***WARNING***: This tutorial is based on the Contiki Repository created in 2016 by a 3rd party developer. The materials within this tutorial cannot be ensured by Ubidots Support Team. If issues present during your use of the Contiki Repository, please reach out directly to the firmware developers at https://github.com/Zolertia/contiki/.
Re-Mote is a powerful development board to build real IoT projects and solutions. Re-Mote IoT hardware board was developed by Zolertia.io with universities and industrial partners from different countries in the context of a European Project to create powerful IoT hardware for Smart cities, logistics, lighting and industrial project. Fully compatible with main IoT operating systems.
In the following tutorial, Ubidots will demonstrate how to setup and program the Zolertia RE-Mote to display your data in efficiently using the Ubidots IoT Application Development Platform.
Requirements
To complete this tutorial, you’ll need:
At least one Zolertia RE-Mote.
An Orion Router.
Step-by-Step
System Router Setup
Hardware Setup
Sending (PUBLISH) data to Ubidots
Summary
1. System Router Setup
1. Clone Zolertia pack repository if you don’t have it already Zolertia contiki. To clone the repository, run the command below your computers terminal:
git clone https://github.com/Zolertia/contiki.git
With the repository already cloned, you need to update the repository by running the command below:
git submodule update --init
Then, change to branch Zolertia-Packs
:
git checkout Zolertia-packs
2. Program the binary files on Orion Router for connectivity to the internet over 6lbr and create a 6LoWPAN network. To program a device use the cetic_6lbr_router_eth_gw.bin image which can be found in the repository previously downloaded.
First, you need to enter to the proper folder which is mqtt-node
. To enter folders, run the command below into your computers terminal:
cd /contiki/examples/zolertia/tutorial/99-apps/mqtt-node
Now that you are located in the right folder download the image by running the command below:
$ python ../../../../../tools/cc2538-bsl/cc2538-bsl.py -e -w -v -a 0x200000 Binaries/router cetic_6lbr_router_eth_gw.bin
At this point, you should see something like this:
/contiki/examples/zolertia/tutorial/99-apps/mqtt-node$ python ../../../../../tools/cc2538-bsl/cc2538-bsl.py -e -w -v -a 0x200000 Binaries/router cetic_6lbr_router_eth_gw.bin
Opening port /dev/ttyUSB0, baud 460800
Reading data from Binaries/router/cetic_6lbr_router_eth_gw.bin
Firmware file: Raw Binary
Connecting to target...
CC2538 PG2.0: 512KB Flash, 32KB SRAM, CCFG at 0x0027FFD4
Primary IEEE Address: 00:12:4B:00:06:16:0E:52
Erasing 524288 bytes starting at address 0x00200000
Erase done
Writing 524288 bytes starting at address 0x00200000
Write 16 bytes at 0x0027FFF0F8
Write done
Verifying by comparing CRC32 calculations.
Verified (match: 0x57ee5c91)
3. Plug Ethernet cable and supply by PoE or USB.
4. Notice the Border Router also advertise a local IPv6 address (bbbb::/64
as default), being the default Border Router address the bbbb:100
. We can use this address to also talk to the Border Router using IPv6.
5. Now open a browser and using [bbbb::100]
This is the 6lbr webservice; it shows the Border Router status and configuration options. You can manage and configure both the IPv4/IPv6 and 6LoWPAN networks, and also manage the wireless nodes in the 6LoWPAN network.
6. In Configuration tab you will find all network parameters, both 802.15.4 and Eth network. For this example the security is enabled on 6LoWPAN network and is necessary enable it on router:
Link-layer security : Pre-shared
Link-layer security level: AES-CCM-128
Enable anti-replay workround: on
7. Then click "Submit" which will reset the Orion Router.
2. Hardware Setup
1. The RE-Mote uses a 5 and 3 pins connectors. The relay can be connected on ADC1, soil moisture should be connected on ADC3 because can provide 5V on signal pin.
3. Sending (PUBLISH) Data to Ubidots
1. In the route below you will find a ubidots.h sample code, which is the one in charge of taking the readings of the sensors connected to the board and publish those values to Ubidots.
../contiki/blob/Zolertia-packs/examples/zolertia/tutorial/99-apps/mqtt-node/cloud/ubidots.h
2. Then, assign your Ubidots TOKEN where is indicated in the ubidots.h.
Include the token in the header of the platform ubidots.h.
3. Verify in the Makefile that:
MQTT_PLATFORM ?= ubidots
MQTT_SENSORS ?= ubidots_demo
# Platform options: relayr, thingsio, bluemix, ubidots
MQTT_PLATFORM ?= ubidots
# Sensor options: fridge, coldchain, agriculture, watering, remote, coinbox,flowerpot, smartcities, ubidots_demo
MQTT_SENSORS ?= ubidots_demo
4. Compile the application and program RE-Mote by running the command below:
$ make clean && make TARGET=zoul BOARD=remote-revb mqtt-client.upload
At this point, you should see something like this:
contiki/examples/zolertia/tutorial/99-apps/mqtt-node$ make clean && make TARGET=zoul BOARD=remote-revb mqtt-client.upload
using saved target 'zoul'
rm -f *~ *core core *.srec \
*.lst *.map \
*.cprg *.bin *.data contiki*.a *.firmware core-labels.S *.ihex *.ini \
*.ce *.co
rm -rf *.zoul symbols.c symbols.h *.d *.elf *.hex
rm -rf obj_zoul
mkdir obj_zoul
CC ../../../../../cpu/cc2538/./ieee-addr.c
CC ../../../../../cpu/cc2538/cc2538.lds
CC ../../../../../cpu/cc2538/./startup-gcc.c
CC ../../../../../apps/mqtt/mqtt.c
CC ../../../../../platform/zoul/dev/adc-zoul.c
...
...
...
CC ./internals/mqtt-sensors.c
CC ./internals/mqtt-res.c
CC ./cloud/ubidots.c
CC ./device/ubidots_demo.c
LD mqtt-client.elf
arm-none-eabi-objcopy -O binary --gap-fill 0xff mqtt-client.elf mqtt-client.bin
Flashing /dev/ttyUSB0
Opening port /dev/ttyUSB0, baud 460800
Reading data from mqtt-client.bin
Firmware file: Raw Binary
Connecting to target...
CC2538 PG2.0: 512KB Flash, 32KB SRAM, CCFG at 0x0027FFD4
Primary IEEE Address: 00:12:4B:00:06:0D:B3:3C
Erasing 524288 bytes starting at address 0x00200000
Erase done
Writing 516096 bytes starting at address 0x00202000
Write 8 bytes at 0x0027FFF8F00
Write done
Verifying by comparing CRC32 calculations.
Verified (match: 0x2fe9a913)
rm obj_zoul/ubidots.o obj_zoul/startup-gcc.o mqtt-client.co obj_zoul/ubidots_demo.o
5. When the RE-Mote is connected with Router, you will find it in the Sensor tab of the device list:
6. Once the RE-Mote is connected with the Orion, Ubidots should automatically create the variables inside the device which are identifiable using the Device IDs provided in the sample code:
4. Summary
With this simple tutorial we are able to PUBLISH data to Ubidots with the ease of the Zolertia Products. To learn more about different IoT Platforms to prototype and develop connected devices that can easily convert into a real final product in a short period of time, check the Zolertia Website.
Now its time to create Ubidots Dashboards to visualize and interpret your data to control and monitor your machines and environments, keeping your clients happy and you thrilled to have been the integrator of another successful solution.
Other readers have also found useful...