This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
proiecte:sparrowv3-devicehub [2015/10/06 00:41] alex.marin [Real time monitoring with Devicehub] |
proiecte:sparrowv3-devicehub [2015/10/08 01:01] (current) alex.marin [SHT21 library] |
||
---|---|---|---|
Line 18: | Line 18: | ||
< | < | ||
- | ==== Using Zigduino support in Arduino IDE ==== | + | ==== Adding the Sparrow Board to the Arduino IDE ==== |
- | Zigduino is an Arduino | + | - Download [[https:// |
+ | - Download and unzip the {{: | ||
+ | - Locate | ||
+ | - Copy in **Arduino\hardware\arduino\cores** | ||
+ | - Replace the file **Arduino\hardware\arduino\boards.txt** with **sparrow_patch\Arduino\hardware\arduino\boards.txt** | ||
+ | - Copy in **Arduino\hardware\arduino\variants** the folder named **sparrow** from **sparrow_patch\Arduino\hardware\arduino\variants** | ||
+ | - Restart the Arduino IDE | ||
- | One should | + | After a successful patch, you should |
+ | {{ :arduino.png? | ||
+ | You're all set up! | ||
- | 1. Install Arduino IDE: http:// | + | === Optional Step: If Your Nodes Don't Come With a Preinstalled Bootloader === |
- | 2. Download Zigduino-1.0 archive: https://github.com/ | + | The binary will be installed on flash memory through a bootloader. Most probably Sparrow v3 will come with the bootloader already installed, but in case it won't or in case it somehow gets erased, one will need to install it. You can download the bootloader from {{::atmegaboot_168_atmega128rfa1.zip|here}}. |
- | 3. Replace folder // | ||
- | |||
- | 4. Copy in // | ||
- | |||
- | 5. Replace file // | ||
- | |||
- | 6. Copy in // | ||
- | |||
- | Now you should see two new entries for Zigduino in // | ||
- | |||
- | NOTE: If Arduino IDE was already started, a restart will be needed. | ||
- | |||
- | The binary will be installed on flash memory through a bootloader. Most probably Sparrow v3 will come with the bootloader already installed, but in case it won't or in case it somehow gets erased, one will need to install it. We used the bootloader described by the following address: // | ||
In order to install the bootloader, a flash programmer will be needed (we used AVRISP mkII). We then installed AtmelStudio and used its built in Flash Programmer utility (// | In order to install the bootloader, a flash programmer will be needed (we used AVRISP mkII). We then installed AtmelStudio and used its built in Flash Programmer utility (// | ||
+ | Fusebits: EXT 0XFE, HI 0xD0, LO 0xF7 | ||
===== Simple test program ===== | ===== Simple test program ===== | ||
Line 51: | Line 47: | ||
2. In // | 2. In // | ||
- | 3. In // | + | 3. In // |
4. From // | 4. From // | ||
Line 88: | Line 84: | ||
===== SHT21 library ===== | ===== SHT21 library ===== | ||
- | There is one more thing that we must take care of before we can start playing with our WSN monitoring project. We'll need a library for reading values from SHT21, our relative humidity and temperature sensor, connected to the micro controller through an I2C interface. You'll need to use the attached | + | There is one more thing that we must take care of before we can start playing with our WSN monitoring project. We'll need a library for reading values from SHT21, our relative humidity and temperature sensor, connected to the micro controller through an I2C interface. You'll need to use the files stored in this {{: |
1. In folder // | 1. In folder // | ||
- | 2. Copy the attached | + | 2. Copy the files from the attached archive |
After this it will be possible to import sht21.h header into a project, as you'll see below. | After this it will be possible to import sht21.h header into a project, as you'll see below. | ||
Line 106: | Line 102: | ||
All non-gateway nodes are duty-cycling, | All non-gateway nodes are duty-cycling, | ||
+ | |||
+ | You can see below a representation of the topology we've used, followed by our source code. Multiple nodes are sending the data they' | ||
+ | |||
+ | < | ||
<code C> | <code C> | ||
Line 377: | Line 377: | ||
===== Real time monitoring with Devicehub ===== | ===== Real time monitoring with Devicehub ===== | ||
+ | |||
+ | Below you can see the Devicehub API we've used to monitor the parameters read by our Wireless Sensor Nodes. For simplicity, the code below is an example for only one monitoring node. If you'll use multiple nodes you'll need to add sensors / devices on Devicehub for each of them, then add code in the script for each of them. Of course, you'll also need to add your own PROJECT_ID, DEVICE_UUID and API_KEY as shown in the script below. | ||
+ | |||
+ | One thing which should be mentioned is that we've empirically saw that the voltage ADC reported value is directly proportional in terms of volts with 1/71, hence we are dividing the ADC value to 71. | ||
<code python> | <code python> | ||
Line 427: | Line 431: | ||
device.send() | device.send() | ||
</ | </ | ||
+ | |||
+ | You can see below some snapshots from Devicehub.net for one of our nodes. | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < |