libelium
  • rss
  • flickr
  • twitter
  • facebook
  • youtube

Documentation: SquidBee and SquidBee Gateway Tutorial

Libelium has launched a new sensor device: Waspmote. It is ready for research and market applications. You can discover the differences between both platforms in the document: Waspmote vs SquidBee.

Contents:

Introduction

Ingredients:

Difficulty: Easy -easy

Preparation Time: 30 minutes

squidbee_gateway
 

Steps Index

Steps Index:

  1. The SquidBee and SquidBee gateway.
  2. Connecting SquidBee gateway to the PC.
  3. Getting data.
  4. The code in SquidBee.

Step 1: The SquidBee and SquidBee gateway:

SquidBee is an Open Hardware and Source wireless sensor device. The goal of SquidBee is getting an "open mote" to create Wireless Sensor Networks.

The main concepts behind SquidBee are:

  • Self-powered
  • Wireless Comunications

How does SquidBee work?

  • Acquires values from environment parameters: temperature, humidity, lightness, presence, pressure or (almost!) whatever you can sense.
  • Operates with these values, when required.
  • Transmits these values using a low power consumption wireless technology (ZigBee).
squidbee_gateway

Step 2: Connecting SquidBee gateway to the PC:

Installing drivers:

Drivers can be downloaded here http://www.ftdichip.com/Drivers/VCP.htm

Communicating with XBee for getting data from the other SquidBees:

Just connect SquidBee Gateway to the computer and open a serial port terminal.

Serial port settings: 9600 baudrate, 8 bits, no parity, 1 stop bit.

Step 3: Getting data:

When both SquidBee Gateway and SquidBee are ready you can start to receive in the PC sensor data from SquidBee. Just power ON the SquidBee mote and you'll get data like in this picture.

squidbee_gateway

Maths to get the values from sensors:

Value (in volts) from an analog input is => V (volts) = analogRead(0) * 5 / 1024

Values from sensors:

  • Humidity
    • Humidity (%) is => H (%) = 32.25 V - 25.81
    • H(%) = (analogRead(0) * 5 / 1024.0) * 32.25 - 25.81
    • that matches:
    • 0.8V => 0%
    • 3.9V => 100% (see picture)
  • squidbee_gateway
  • Temperature
    • MCP9700A Temperature sensor provides 10 mV/ºC
    • Temp (ºC) = V (volts) / 0.01
    • Temp (ºC) = (analogRead(0) * 5 / 1024.0) / 0.01
  • Light
    • Light sensor is a LDR (Light dependent resistor) connected with a pull-up resistor
  • squidbee_gateway

For this sensor we have to calibrate with 100% light (approx.) and dark, I got the next values from analogRead

  • dark => 0
  • 100 % light (down an UV lamp) => 950
  • So I can estimate Light (%) = (100 / 950) * analogRead()

Step 4: The code in SquidBee:

The program in the SquidBee can be changed easily using Arduino IDE, just take out the Arduino from the box, unplug the XBee shield, plug the USB cable and you can upload a new program.

Here is the arduino program that is running in your SquidBee:

Arduino code:

   /*
* Copyright (C) 2007 Libelium Comunicaciones Distribuidas S.L.
* http://www.libelium.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SquidBee code
* Version 0.1
* Author: Marcos Yarza
*/



// variables declaration
//sensors
int sens0 = 0; // Light sensor
int sens1 = 1; // Humidity sensor
int sens2 = 2; // Temperature sensor

//aux var
int val0 = 0;
int val1 = 0;
int val2 = 0;

int count = 0;

void setup(){
Serial.begin(19200); // starts the serial port
}

// function to send data

void sendData(int id,int num, int data0,int data1,int data2){

Serial.print("@");
Serial.print(id);
Serial.print("|");

Serial.print(num);

Serial.print("|data0-");
Serial.print(data0);

Serial.print("|data1-");
Serial.print(data1);

Serial.print("|data2-");
Serial.print(data2);

Serial.println("#\r"); // end of message
}

void loop(){
while (count <= 10000){
val0 = analogRead(sens0);
val1 = analogRead(sens1);
val2 = analogRead(sens2);

sendData(1,count, val0,val1,val2);

delay(5000);
count++;
}

count = 0;

}

Links and Documentation

Links and Documentation: