Skip to content
raymondxie edited this page Oct 2, 2017 · 34 revisions

IoT Workshop Wiki Page

Internet of Things (IoT) has gained some traction and expected to grow significantly in the coming years. At Oracle Code 2017 events, this IoT Workshop provides an opportunity for you to get a hands-on experience on the topic, and hope it opens the door for you to this wonderful IoT world. Have fun!

We assume the audience of this workshop are software developers with no prior experience in electronic dev board, so we will start with preparing your environment to work with electronic dev board, as explained in the Part 1 below. It is highly recommended that you have tried the steps in Part 1, before you attend the workshop.

If you have played with Arduino board before, please still go over Part 1 quickly to ensure you have everything needed for this Workshop.

When you attend the workshop, you will receive an IoT packet containing these parts: IoT board and parts

Note: the IoT packet also contains a USB thumb drive which has various documentation and source code. Since there are some changes after we prepared the USB thumb drive, some information may be outdated. Please use all example source code referenced by links below instead of the copy on the USB thumb drive. Everything referenced by this page has the latest version of content.

During the workshop, you will upload different sketch code onto the board, and test light, button, play a tune, and send a message into Oracle IoT Cloud Service. This is the diagram on how the things (or Internet of Things) in this workshop are connected together. IoTWorkshop Flow Diagram

Part 1 - Environment Setup

We will use Arduino IDE for writing and uploading code to dev board. Please follow the steps to prepare your development environment:

  1. On the USB thumbdrive, it has Arduino IDE software. Please choose the correct platform for your computer. You may also find IDE Arduino IDE software from original website: https://www.arduino.cc/en/Main/Software.

  2. install Arduino IDE on your computer, based on platform: Windows, Mac OSX, or Linux.

  3. enable NodeMCU board support in Arduino IDE, see details. Over conference WiFi, sometimes it takes long time to install this board library due to unreliable WiFi, please use the network cable at the desk and disable the WiFi for this step.

  4. download and install driver for NodeMCU for Windows, Mac OSX, Linux 3.x or Linux 2.6.x. This step is to let your computer recognize the board, and open a port for uploading code to the board.

  5. Download PubSubClient library Experiment 2 and 3 utilize MQTT (Messaging Queue Telemetry Transport), so we need install MQTT library into Arduino IDE, so our sample code can work with MQTT. Go to MQTT Library page, and download as a .zip file, extract it to Arduino User Library directory, which is usually ~/Documents/Arduino/libraries/ on Mac OSX, and My Documents\Arduino\libraries\ on Windows, and on a Linux machine, it is usually /home/USERNAME/sketchbook/libraries. Make sure the library name is a valid directory name for your computer, and change the name to a valid directory path if necessary. After that, restart Arduino IDE.

Part 2 - IoT in Action

Now that you have development environment properly setup with the hardware board on hands, let's start!

Experiment 1 - Blink test

This is equivalent to the "Hello World" program when you are learning a new language. Refer this link for source code, and more details.

Experiment 2 - Play a tune

Demonstrate that IoT device NodeMCU interacts with services on the Internet. Refer wiring diagram for how to hook up the device and parts.

You can get the source code here. Please note, you need to modify the code by supplying necessary connection parameters for WiFi network and MQTT broker. Check the parameter values with your instructor.

The example let you press a button, the event is sent to MQTT broker in the Cloud, and NodeMCU board is also listening to that channel for input, essentially the information just come right back to the board. Based on the button press count (even / odd count), the board plays a different tune for you.

Have fun playing the tunes!

Bonus Point: Try to understand the source code and how the tune is composed, then modify it to make your own tune.

Experiment 3 - Send to IoTCS

Send a message into Oracle IoT Cloud Service (IoTCS) by press of a button. Refer wiring diagram for how to hook up the device and parts.

You can get the source code here. Please note, you need modify the code by supplying necessary connection parameters for WiFi network and MQTT broker. Check the parameter values with your instructor. Also put into your name to indicate it is your message.

This sample let you press a button, and a message along with your name is sent to MQTT broker. There is a Raspberry Pi listening to inputs to that particular MQTT channel. The Raspberry Pi acts as a gateway to IoTCS, and relays the message to it. You can then verify your message with your name in the IoTCS Web Console.