Here you will find sample device scripts for connecting an Intel® Arduino/Genuino 101 and IoT Dev Kit to the TechBubble Technologies IoT JumpWay using the Python MQTT Serial Library.
This tutorial helps you to set up an Arduino/Genuino 101 that allows control of an LED, and also an application that can control the LED via the IoT JumpWay.
This project uses three applications:
- A device application (Arduino) which communicates via serial with a Python Serial/MQTT application.
- The Python Serial/MQTT application which communicates with the Arduino/Genuio 101 and the IoT JumpWay.
- A Python MQTT application that sends commands to Arduino/Genuino 101 via the IoT JumpWay and the Python Serial/MQTT application.
- 2.7
- Arduino/Genuino IDE
- ArduinoJson
- Intel® Arduino/Genuino 101.
- Grove starter kit for Intel® Arduino/Genuino/Genuino 101.
- 1 x LED.
If this is the first time you have used the TechBubble IoT JumpWay in your IoT projects, you will require a developer account and some basics to be set up before you can start creating your IoT devices. Visit the following link and check out the guides that take you through registration and setting up your Location Space, Zones, Devices and Applications (About 5 minutes).
TechBubble Technologies IoT JumpWay Developer Program (BETA) Docs
Adding The Arduino/Genuino Board To Arduino IDE- Tools -> Boards -> Boards Manager
- Search for Curie, or Intel Curie
- Right click on the right of the Curie section and install the latest version
- For the Python Serial/MQTT application we will need the TechBubble IoT JumpWay Python MQTT Serial Library installed on our PC/laptop/Mac. To Install the library, issue the following command on your chosen device:
$ pip install iot_jumpway_mqtt_serial
- Install the ArduinoJson library in the Arduino IDE:
Sketch -> Include Library -> Manage Libraries
Search for ArduinoJson
Right click on the right of the ArduinoJson section and click install
First of all you need to connect up an LED to your Intel® Arduino/Genuino 101. To connect the LED you will need a Grove starter kit for Intel® Arduino/Genuino 101.
- Connect the Grove Starter Kit to your Intel® Arduino/Genuino 101.
- Connect the LED to pin D5 of your Grove Starter Kit.
- Follow the TechBubble Technologies IoT JumpWay Developer Program (BETA) Location Device Doc (About 1 minute) to set up your device, and the TechBubble Technologies IoT JumpWay Developer Program (BETA) Location Application Doc (About 1 minute) to set up your MQTT application, you will need the MQTT application to communicate with your serial application further on in the tutorial.
- Download the TechBubble IoT JumpWay Python MQTT Serial Library Application and the TechBubble IoT JumpWay Python MQTT Serial Library Config File, retrieve your connection credentials by following the link above, and update the config.json file with your new connection credentials and actuator (LED) setting.
"IoTJumpWaySettings": {
"SystemLocation": 0,
"SystemZone": 0,
"SystemDeviceID": 0,
"SystemDeviceName" : "Your Device Name",
"SystemDeviceCom" : "Your Device Com Port"
},
"IoTJumpWayMQTTSettings": {
"MQTTUsername": "Your Device MQTT Username",
"MQTTPassword": "Your Device MQTT PASSWORD"
}
Open up the Arduino/Genuino 101 Dev Kit LED Example and update the following line with your LED actuator ID retrieved from the steps above, then upload the sketch to your device:
const int actuator1JumpWayID = 0;
Execute The Python ProgramAs you have already uploaded your sketch, the program will now be running on your Arduino/Genuino 101. All that is left is to start the Python program with the following line:
$ python NameOfYourSerialApplication.py
Control Your Device With Your MQTT ApplicationNow it is time to set up your MQTT application mentioned in the steps above.
For this application you can use the application and config file from the IoT JumpWay Intel® Edison Dev Kit LED Example.
Use the application information you received from the steps above to fill out the details below:
"IoTJumpWaySettings": {
"SystemLocation": 0,
"SystemZone": 0,
"SystemDeviceID": 0,
"SystemDeviceName" : "Your Device Name",
"SystemApplicationID": 0,
"SystemApplicationName" : "Your Application Name"
}
"IoTJumpWayMQTTSettings": {
"username": "Your Device MQTT Username",
"password": "Your Device MQTT Password",
"applicationUsername": "Your Application MQTT Username",
"applicationPassword": "Your Application MQTT Password"
}
Execute The Python ProgramNow all you have to do is execute your MQTT application. This application sends a device command to turn on your LED through the IoT JumpWay to your serial application, which in turn, sends the command via serial to the relevant actuator on your Arduino/Genuino 101, in this case, your LED:
$ python/python3 NameOfYourMQTTApplication.py
Viewing Your DataEach command sent to the device is stored in the TechBubble IoT JumpWay. You will be able to access the data in the TechBubble IoT JumpWay Developers Area. Once you have logged into the Developers Area, visit the TechBubble IoT JumpWay Location Devices Page, find your device and then visit the Command Data page to view the data sent from your application.
Please feel free to create issues for bugs and general issues you come across whilst using the IoT JumpWay Intel® Arduino/Genuino 101 Examples. You may also use the issues area to ask for general help whilst using the IoT JumpWay Intel® Arduino/Genuino 101 Examples in your IoT projects.
IoT JumpWay Intel® Arduino/Genuino 101 Examples Contributors
Comments