A 6LoWPAN/IPv4 router was used to translate the 6LoWPAN/IPv6 data from the wireless network to a remote MQTT broker on the "cloud" in this case Ubidots, the application creates a tree type of events:
- a data event (sensor readings published periodically)
- alarm event (sensor readings over/below a given threshold)
- data from Ubidots (the device reads the value published by the platform)
The tutorials are with linux, there is an image for development that can be used in Windows with VMware
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Flashing RE-Mote
for flash this you need to:
- open terminal
- go to the /examples/zolertia/tutorial/99-apps/mqtt-node
- edit the Makerfile with ubidots and lighting
- copy the token of the ubidots account and paste it in ubidots.h inside the cloud folder
- check the RE_Mote is connected to program
- upload Makefile in the RE-Mote
- the next step is to program and configure the Orion, it is explained in github
Step 2: IT DONE
If successfully uploaded, you will see through the terminal the RE-Mote response that constantly loads the sensor values and periodically publishes them with the address of the device.
On the ubidots platform within devices and on the device that matches the published address you can see all the variables uploaded form the device.
led_toggle is a variable that is not generated, the device does not load it on the platform, but the platform loads it on the device. To control the led we need the variable led_toggle, for that click Add Variable, Default and the name led_toggle.
In dashboard we will create a widget, Control, Slider, Add Variable, click in the address of the device, led_toggle, Max: 100, Min: 0, Add Variable.
If you slide the bar you will see how the led lights up and the values are published in terminal, the value of the bar is between 0 and 100, on the device this value has to be 16 bit which reaches 65535, to control it is multiplied by a factor so 100 * 655 = 65500.
Step 3: EXAMPLE
with the slide of leds_toggle, it controls the brightness of the LED, the gauge and the chart are the published value every 45 seconds of the light sensor.
Step 4: HOW IT WORKS
control a variable from the mqtt, the variable is loaded in arg, in the activate_color_led function it generates a PWM for each color of the RGB LED, the variable arg is multiplied by a factor, the result is loaded in count, in case of the red color, the factor is less than the rest since the red color has more intensity becouse works at difrent voltage. datasheet of LED ASMB-MTB0-0A3A2
the device polling the sensors and publishig every interrupt of etimer, in the funtion of poll_sensors if detected and god configured read the TSL2563 in the channel 0 detects visible and IR radiation (channel 1 only IR radiation), works over I2C.
Step 5: CODE
It is inside of branch Zolertia-paks.
This file is linked and selected in the mikefile, don't flashing