Automating/reading sensorbin status using JeeNode/Arduino


I’m currently playing around with Jeenode boards. The JeeNode is a small wireless board with an 8-bit Atmel RISC microprocessor. JeeNodes are compatible with the Arduino platform and can be programmed under Windows, Mac OS X, or Linux using sketches created with the Arduino IDE. As a first test of it’s capabilities, I wanted to read out the state of the cover of my recycle bin.

I have one of these recycle bins:
http://www.easybin.nl/Easybin_2009-2010/assortiment.html
(deluxe 50)

The cover automatically opens when it detects motion over it.. this is nice and hygienic.

I decided to open up my bin. Once opened I quickly notices the most interesting part of the bin.. the motion sensor and the LED that flashes when the bin is in the open state.

The LED has the following states:

  • Short red flashes when the device is alive;
  • constantly green lid when the cover is open;
  • constant red lid when the cover is closing.

This led is a so called bi-color LED. It has 3 pins, one pin supplies power for the green color.. the other pin supplies power for the red color. The middle pin is the neutral/GND pin.
Using a multimeter I measured the voltages on the pins.. turns out there was 2 volt on it. Great! This could be connected to the analog ports of the JeeNode.

I soldered some leads on the existing sensorbin board:
sesnsorbin1

Image 1: the sensorbin board with additional wires connected.

The orange wire is the green led color, the middle wire is the ground and the blue wire is the red color.
Now that I connected the leads to the exisiting board I connected the orange wire to analog port 1 of the jeenode. The middle wire to ground port 1. And the blue wire to analog port 2.

I was now ready to go ahead and upload a ‘sketch’ (this is a program that runs on the microprocessor) to my JeeNode.
This is what I came up with:

#include <Ports.h>
#include <RF12.h>

Port input (1);

/* is the bin open? */
byte isopen = 0;

void setup () {
 // initialize the serial port and the RF12 driver
 Serial.begin(57600);
 Serial.print("\n[SensorBin]");
 rf12_config();
 // set up easy transmissions at maximum rate
 rf12_easyInit(0);
}

void loop () {
 int state = input.anaRead();

 if (state > 600 && isopen == 0) {
 Serial.print("Cover is opened!");
 Serial.println();
 isopen = 1;
 } else if (state < 600 && isopen == 1) {
 Serial.print("Cover is closed again..");
 Serial.println();
 isopen = 0;
 }

 delay(1000);
}

And here is the test result:

sensorbin2

Image 2: output log from Arduino serial port monitor

Excellent! So, I can now read the status of my recycle bin.. is this life saving? No.. not really but atleast it gave me some insight on the JeeNode and Arduino platform.
I want to extend this concept with the following:

  • Sending the status of RF;
  • reading out the battery status (percentage left) of the recycle bin (this is handy to get e-mail notifications from home automation software);
  • putting in a light sensor so I can read the light status of the room the recycle bin is placed in;
  • putting in a motion sensor so I can get the motion status of the room the recycle bin is placed in;
  • etc.

Oh btw.. just for for fun.. this is my test setup (JeeNode connected to USB-BUB in front, sensorbin hardware board in the back):

sensorbin3

Image 3: test setup in action 🙂

Maarten

Hi, I am Maarten and I am the owner of this weblog. I post on various IT subjects that matter in my life as an IT professional.

Recent Posts