This repository contains the quickstart and registered device sample, and contains samples for connecting Arduino Uno devices to the IBM Internet of Things Cloud
The events that are emitted in this sample are:
- Internal sensor temperature
-
Connect Ethernet / Wifi shield to Arduino Uno
-
Connect Ethernet cable to the Ethernet / Wifi shield
-
Install sketch on desktop / laptop
-
Download Paho mqtt library, for Ardunio, from this link (https://www.eclipse.org/downloads/download.php?file=/paho/arduino.zip) in the sketch
a) To load it into the Arduino IDE, the zip file should be downloaded intact, without unzipping.
b) Then in the IDE: Select Sketch -> Import Library -> Add Library and select the zip file -
Connect the USB cable to the Arduino Uno and other end to desktop / laptop which has the sketch installed on it
-
The samples folder of this repository (https://github.com/ibm-messaging/iot-arduino) contains 2 folders, each containining 1 flow - a) Quickstart flow b) Registered flow
-
Compile the 2 skectch codes (corresponding to the flows)
-
Depending upon the requirement, push one of the flows to the Arduino device
-
Reset the Ethernet / Wifi shield
-
Wait for about 10 seconds and the flow starts working
- Modify the clientId, in the sketch code, by providing the values in the following format "d:quickstart:iotsample-arduino:aabbccde02", by replacing "aabbccde02" with the MAC Address of the device
- Open the quickstart dashboard (http://quickstart.internetofthings.ibmcloud.com/#/)
- Provide the MAC Address (in case of the example, its aabbccde02) in the textbox "Ready to View data?"
This has 2 flows
- Registered Flow from device
- Registered Flow to device
- Modify the organization, authToken, deviceId in the sketch code
- Modify the registeredMQTTDNS, in the sketch code, by providing the values in the following format "w8wx0.messaging.internetofthings.ibmcloud.com", by replacing "w8wx0" with the organization
- Modify the clientId, in the sketch code, by providing the values in the following format "d:w8wx0:ArduinoUno:00aabbccde03", by replacing "aabbccde03" with the MAC Address and "w8wx0" with the organization
- Use mqttpublisher / mqttsubscriber to publish and subscribe the commands / events sent to / received from the Arduino Uno
- The code contains comments, which explains how to modify the parameters
- In case of registered flow, you will have to connect to https://internetofthings.ibmcloud.com/dashboard/#/ and create the following
- Organization
- Device
- Auth tokens