Now that you've generated code for you gateway and edge devices, you're ready to deploy the code and test out your M2M application. We'll start by running the CoAP gateway, then starting up the gateway and edge device Choreo programs.
1Make sure that you have the latest Temboo image or package for your gateway device - this will ensure that you have the necessary Temboo MQTT gateway libraries on your device. You can find Samsung's ARTIK images here, and for the Arduino Yún you can run:
opkg upgrade temboo
2Next, you'll need to SSH into your board and install version 14 or later of Twisted so that you can run our CoAP gateway. If you're using an Arduino Yún, you'll need to expand your device's memory by using a micro SD card.
3Now, to run the CoAP gateway, navigate to the location of the gateway script and then run the script. With the gateway running, you should see feedback in your terminal window confirming that the CoAP gateway is running as expected.
Samsung ARTIK 10 gateway location
Arduino Yún gateway location
Start CoAP gateway
python TembooCoAPGateway.pyc -s yes -d
Starting the Temboo CoAP gateway
Now's a good time to review the script options that we're using above. We've chosen to use HTTPS to send Choreo requests to Temboo from our gateway, and to turn debug mode on so that we can monitor activity more clearly. You can adjust these options as desired.
-s yes|no|ifavailable, --https=yes|no|ifavailable
Note: The Arduino Yún does not include SSL for Python by default, so you'll need to install that yourself if required. Communication with edge devices is always handled via HTTP.
For instructions on how to get set up with other protools, check out our MQTT and HTTP tutorials.
4The last step is to compile and run your gateway and edge device Choreo programs. If you haven't run Temboo code on a device before and and would like to learn more about the basics, we have simple getting started instructions for all devices. Building the files for Arduino or TI devices follows the standard process via their respective IDEs. Building edge device code for CoAP on the Samsung ARTIK requires running the command below, where
myEdgeDeviceProgram should be replaced with the name of the file containing your edge device code.
g++ -L/opt/iothub/artik/temboo/temboo_artik_library/lib -ltemboocoap -I/opt/iothub/artik/temboo/temboo_artik_library/include/m2m myEdgeDeviceProgram.cpp -o myEdgeDeviceProgram
When the Choreo programs are running successfully, you'll be able to monitor the CoAP messages being sent to the gateway by watching the output on the terminal window that you used to start your gateway.
5That's it! You've built a multi-device M2M application that uses CoAP to communicate with with Temboo via an internet-connected gateway.
Now that you know how to generate code for multiple devices, why not check out the 2000+ Choreos in our Library and start thinking about all the possibilities for your next M2M application?
We're always happy to help. Just email us at email@example.com, and we'll answer your questions.