Archive

Posts Tagged ‘Arduino’

Arduino and MMA7361 (acceleration sensor)

July 11, 2011 23 comments

Needed components:

  • 1 Arduino board (Duemilanove, in this case)
  • 1 acceleration sensor MMA7361
  • some wires.

Pins connections:

  • ST (Self Test): Arduino pin 2
  • GSEL (g-Select): Arduino pin 3
  • 0GD (0g-Detect): Arduino pin 4
  • SLP (#Sleep#): Arduino pin Power (3.3V)
  • XOUT: Arduino pin A0
  • YOUT: Arduino pin A1
  • ZOUT: Arduino pin A2
  • GND: Arduino pin Ground
  • VCC: Arduino pin Power (3.3V)

The firmware application created for the Arduino board read the analog inputs (A0, A1, A2) and send the resulted information to the computer. On the computer a software application read the information which comes on the serial port and display it into a user friendly interface.

For each axis the acceleration value is displayed in [m/s^2] measurement unit and graphically using different progress bars (one for the positive values and another for negative values).

The analog inputs present some variation even the sensor is not moved, which make me think that it is not the best solution when it is necessary to have a high precision. Maybe I do something wrong but I could not see what could be. The single option to improve the analog readings was to make the reading of the same input multiple times (100 – 1000 x) and calculate an average value. If you have another better ideas please tell me :D.

At the beginning I want to use this type of sensor for monitoring the vibrations from a building structure (ex. walls), but now I’m not very sure that it is a very good idea. I will have to find another type of sensor, more precise.

Advertisements

Create the future – Design Contest 2011 – A building as a living body


This post contains the concept idea subscribed at the contest Create the future – Design Contest 2011 (http://contest.techbriefs.com/sustainable-technologies-2011/1690-a-building-as-a-living-body ) .

A building as a living body

An intelligent building is a building which is able to monitor and control its own functionalities, according to the building structure, indoor and outdoor environment. The functionalities and their characteristics are directly related to building scope (the activities accomplished by the occupants), but usually are the same. The most part of the necessary functionalities have been already determined, and they are mainly for ensuring the minimum energy consumption and the occupants comfort. Not to forget that the occupants’ productivity is dependent on their comfort. Since a building is related to its occupants, all the functionalities of the building could be determined from the occupants’ needs and abilities. This is the reason why it come the idea to view a building as a living body (e.g. human body). It is a new approach of considering an intelligent building.

The human body is full of sensors, most of them on the skin and inside different body’s organs, and actuators which receive and execute commands, and make possible the interaction between different parts of the body. So, a building should have: a lot of sensor and actuators integrated into its structure. Since the sensors are not cheap, to diminish the total cost of the monitoring and control system, the optimum number of sensors and their location has to be determined. Even the buildings structures are different they are organized in similar ways.

The next connections could be established between a human body and a building:

  • brain (the center of coordinating and monitoring all body activities) – BMS (Building Management System). A BMS monitors the existent conditions from the entire building and take actions for ensuring the required conditions.
  •  eyes – video surveillance system and lighting;
  • smell – monitoring air quality (temperature, humidity, carbon monoxide, carbon dioxide, hydrogen sulfide, ozone, particles) and react when the air quality is not proper for living (ventilation);
  •  taste – monitoring the energy quality and quantity  (e.g. current, voltage, active energy, active power, water, gas);
  • feel the inside/outside temperature – temperature sensors;
  •  feel the humidity – relative humidity sensors;
  •  feel vibrations or force – vibrations/force sensors;
  • ensure body temperature (e.g. perspiration) – ensure indoor temperature (heating, air conditioning);
  • protection against diseases – security systems.

All the psychic feelings represent input information, measurable by sensors. Analyzing the input information could be sent commands for ensuring the working plan of the entire building. As a human body have a working plan, same a building.

For implementing the idea, a solution based on using a wireless sensor network (WSN) is proposed (formed by coordinator, routers and end nodes). Only end nodes could have attached sensors and actuators. Such a network could be easily deployed in any building space, even if the building is already constructed. Each node’s base hardware could be easily implemented using a board as Arduino and a XBee radio communication module (at a cost of about 45$). And according to its destination the node could be completed with sensors and/or actuators.

Indoor environment parameters on Pachube

June 20, 2011 4 comments

The Pachube website has become famous since it permits to software applications (developed with different kind of languages – Java, C, Processing, etc.) to connect to an online storage and presentation system. Using specific procedures a software application is able to save essential information, at each half a minute (or longer time interval). In fact, the website is dedicated to monitoring systems, which measure the same parameters  values at defined periods of time, and need to save the information somewhere or transmit it for other applications input.

Our example is based on using the Seduino SHT11 sensor, connected to an Arduino Duemilanove board. The development board read the information from the sensor (temperature, relative humidity and dew point; the last parameter is calculated based on the first 2 parameters values) and transmit it to Pachube website. The architecture of the system and the connections between the components is presented into the figure below.

On Pachube website, charts with the evolution of the parameters values could be displayed and the status of the device is visible (if it is still transmiting information or not). All neccessary documentation for interacting with the website environment is presented with easy  understandable examples.

The Arduino application is:

#include “Sensirion.h”
#define VERSION “1.0”

//INSIDE SHT11 SENSOR
int sht11DataPin = 8;
int sht11ClockPin = 9;
float officeTemperature = 0;
float officeHumidity = 0;
float officeDewPoint = 0;

Sensirion sht11Sensor = Sensirion(sht11DataPin, sht11ClockPin);

void setup()
{
Serial.begin(9600);
}

void loop()
{
//****************************
// INSIDE SHT11 SENSOR
//****************************
sht11Sensor.measure(&officeTemperature, &officeHumidity, &officeDewPoint);

Serial.print(‘a’);
Serial.print((int)(officeTemperature * 100), DEC);

//the delay should be at least 0.5 minutes
for(int i = 0; i < 30; i++)
delay(1000);

Serial.print(‘b’);
Serial.print((int)(officeHumidity * 100), DEC);

//the delay should be at least 0.5 minutes
for(int i = 0; i < 30; i++)
delay(1000);

Serial.print(‘c’);
Serial.print((int)(officeDewPoint * 100), DEC);

//the delay should be at least 0.5 minutes
for(int i = 0; i < 30; i++)
delay(1000);

Serial.print(‘d’); //end of telegram
}

For sending the values from Arduino board, through serial communication, to Processing environment the next telegram format have been used:

‘a’ temperature value ‘b’ relative humidity value ‘c’ dew point value ‘d’

where all values are represented on 4 bytes. On Processing each serial written character is read as the coresponding ASCII code, and a transformation to the real value had to be done.

 

… and Processing application:

/*
* Office Temperature, Relative Humidity and Dew Point monitoring
* and post the measured information on Patcube website

import eeml.*;
import processing.serial.*;

Serial serialPort;  // Create object from Serial class
int serialValue = 0;
byte parameterType = 0; // 0 – no parameter; 1 – temperature; 2 – relative humidity; 3 – dew point
int parameterValue = 0;

String mySerialPort = “your_COM_name“;
String apiKey = “your_api_key;
String feedURL = “your_feed_url“;
DataOut pachubeDataOut;

float officeTemperature = 0;
float officeHumidity = 0;
float officeDewPoint = 0;

void setup()
{
size(200, 200);
smooth();
frameRate(10);

// Open the port that the board is connected to and use the same speed (9600 bps)
serialPort = new Serial(this, mySerialPort, 9600);

// set up DataOut object; requires URL of the EEML you are updating, and your Pachube API key
pachubeDataOut = new DataOut(this, feedURL, apiKey);

//and add and tag a datastream
//pachubeDataOut.addData(0,”temperature, relative humidity, dew point”);
pachubeDataOut.addData(0, “temperature”, 0, 50);
pachubeDataOut.addData(1, “relative humidity”, 0, 100);
pachubeDataOut.addData(2, “dew point”, 0, 50);

pachubeDataOut.setUnits(0, “Celsius”, “C”, “basicSI”);
pachubeDataOut.setUnits(1, “Percent”, “%”, “basicSI”);
pachubeDataOut.setUnits(2, “Celsius”, “C”, “basicSI”);
}

void draw()
{

if (serialPort.available() > 0)
{
serialValue = serialPort.read();

//verify if it one identifier (‘a’, ‘b’, ‘c’ or ‘d’)
if(serialValue == 97) //’a’
{
SetParameterValue(parameterType, parameterValue);

parameterType = 1;
parameterValue = 0;
}
else
{
if(serialValue == 98) //’b’
{
SetParameterValue(parameterType, parameterValue);

parameterType = 2;
parameterValue = 0;
}
else
{
if(serialValue == 99) //’c’
{
SetParameterValue(parameterType, parameterValue);

parameterType = 3;
parameterValue = 0;
}
else
{
if(serialValue == 100) //’d’
{
SetParameterValue(parameterType, parameterValue);

parameterType = 0;
parameterValue = 0;
}
else
{
if(parameterType != 0)
parameterValue = parameterValue * 10 + (serialValue – 48);
}
}
}
}

}
}

void SetParameterValue(byte parameterType, int parameterValue)
{
if(parameterType == 1)
{
officeTemperature = (float)parameterValue / 100;
println(“temperature = ” + officeTemperature);

postDataOnPachube(parameterType);
}

if(parameterType == 2)
{
officeHumidity = (float)parameterValue / 100;
println(“relative humidity = ” + officeHumidity);

postDataOnPachube(parameterType);
}

if(parameterType == 3)
{
officeDewPoint = (float)parameterValue / 100;
println(“dew point = ” + officeDewPoint);

postDataOnPachube(parameterType);
}
}

void postDataOnPachube(byte parameterType)
{
println(“ready to POST: “);

if(parameterType == 1)
pachubeDataOut.update(0, officeTemperature);

if(parameterType == 2)
pachubeDataOut.update(1, officeHumidity);

if(parameterType == 3)
pachubeDataOut.update(2, officeDewPoint);

int response = pachubeDataOut.updatePachube(); // updatePachube() updates by an authenticated PUT HTTP request
println(“response from Pachube: ” + response); // should be 200 if successful; 401 if unauthorized; 404 if feed doesn’t exist
}

For using the Pachube services you need to have an account created on their website. The bolded code should be replaced with your data (serial port name, api key and feed provided using your Pachube account).

The Sensirion class, created by Markus Schatzl, have been used for communicate with the sensor.

Arduino, Seeeduino and XBee


Three weeks ago I have started to make a more deeply research on electronic platforms dedicated for Wireless Sensor Networks. I take into consideration 2 main aspects: cost (very important when the budget is low and the solution should be possible to be implemented even in not rich people houses) and characteristics (functionalities offered by the platform and how they could be extended more coresponding to our needs).

After many found solutions (iSense, Libelium Waspnode, MeshBean, Particle Computer, MicroStrain, Dust network, Econotag, Redbee, Tyndall, Mica2, etc.), I get to the conclusion that they are quite expensive :-s. If I had to continue the development from the scratch it will take me years. But I didn’t give up, I search more and more until … found it – something that really like… I found first Seeeduino Stalker v2.0, then Arduino and XBee. I knew XBees and before but I didn’t considered them suited for my project until now.

The Seeduino Stalker is a base platform for Wireless Sensor Network, and at a price of 39$, I considered much cheaper like other similar products. Also, it have enough functionalities for what we need. I ordered 2 pieces and hope to have them next week to start testing. Also, I ordered 2 XBee 2 Series with chip antenna for using with the Stalker. The full list of functionalities of the Stalker are presented in the second image bellow.

Maybe many people are used with Arduino but for me is something new. From Seeeduino, I found Arduino and bought one hardware board Duemilanove. I tested it a lot the last day and I was really happy what was able to implement. The programming of the microcontroller, using the Arduino IDE, is quite simple.

The XBee modules could test since I don’t have them but from reviews I uderstand that they could be very easily configured and used with Arduino board and Seeeduino Stalker.