Thursday, September 29, 2011

Purchase experience with Probot

I have recently posted my purchase experience with Simple Labs. This post is the continuation of that. That same day I ordered these components from www.probots.co.in


The 4 port relay board will turn on/off any lights and fans connected to them. And the on/off state of these relays is controlled from the transmitter. The transmitter and receiver talk over a 433 MHz frequency in their own protocol.

The transmitter controls the relays by the way of 4 physical buttons or by a micro controller like the arduino board. There are 5 pins on the transmitter (one for each of the relays and one ground) which should be connected to the arduino board. When a relay pin is connected to ground, the relay on the receiver turns on. When the relay pin is open, the relay is off.

The relay requires a 12V DC supply and the transmitter requires a 5V DC supply, which also I purchased. Make sure the power supply connectors have a positive potential in the center pin. The transmitter and receiver are supposed to work over a 50 m range when they are not in line of sight. That is more than my requirement.


The purchase experience on probots.co.in is not bad, but it was not as easy as Simple Labs. After checking out my shopping cart, I had to do a fund transfer for the cost of components + shipping and then send the confirmation number, along with screenshot of my fund transfer transaction to probots email. I found this a bit cumbersome. The shipping was also not done the same day. Instead it took 4 business days for me to receive the package as opposed to 1 days for a purchase from Simple Labs. Overall I rate the purchase experience as average.

Wednesday, September 28, 2011

InduinoX: Interfacing with LCD

After my quick Hello World app, I became a bit more adventurous and decided to interface with the LCD screen that was part of the basic kit from Simple Labs (see this post for more details). Fortunately, arduino has a library called LiquidCrystal to interface with LCD displays that are driven by Hitachi HD44780 compatible drivers. All you have to do is add a #include <LiquidCrystal.h> in your code to start using the library.

But before going into the coding part, I had to first make the proper connections from the LCD display to the arduino board. I looked up the datasheet for my LCD display, but found a much simpler connection diagram over at http://www.arduino.cc/en/Tutorial/LiquidCrystal. I did not make the exact connections like in the diagram. This is what I did

LCD                            Arduino
PIN 1 (GND)                    GND
PIN 2 (Vcc)                    +5V
PIN 3 (Contrast adjustment)    Voltage divider (see below)
PIN 4 (Register select)        Digital PIN 13
PIN 5 (R/W signal)             GND
PIN 6 (Enable signal)          Digital PIN 12
PIN 7 (Data bus line)
PIN 8 (Data bus line)
PIN 9 (Data bus line)
PIN 10 (Data bus line)
PIN 11 (Data bus line)         Digital PIN 11
PIN 12 (Data bus line)         Digital PIN 10
PIN 13 (Data bus line)         Digital PIN 9
PIN 14 (Data bus line)         Digital PIN 8
PIN 15
PIN 16

Pins 7, 8, 9, 10, 15 and 16 are not connected to the arduino board. Pin 3 was supposed to be connected to a 10K pot, but since I did not have a pot, I had to do a voltage divider circuit. I tried out 1K, 10K divider circuit, with output of the 1K ohm resistor connected to pin 3. This gave me the correct contrast! Although the LCD display has 8 data lines it can be driven with only 4 lines with a lower refresh rate and the arduino library can communicate over the 4 lines. Now that the connections are done, back to programming.  Here is the code

#include <LiquidCrystal.h>

LiquidCrystal lcd(13, 12, 11, 10, 9, 8);

void setup() {


  // Setup LCD's number of columns and rows
  lcd.begin(16, 2);
  
  // Print a message to LCD
  lcd.print("hello");
}

// a function which executes again and again
void loop() {
}

Very simple app that displays "hello" on the LCD screen.


If you want the backlight of the LCD screen to turn on, connect pin 15 to +5V with a limiting resistor and pin 16 to ground.

Sunday, September 25, 2011

InduinoX: Blinking LEDs

Having received my arduino and basic components kit earlier last week, I sat out to write my first arduino program. A hello world of sorts. I started out by installing the arduino package in Kubuntu. What you get from the package is a simple IDE which can compile and upload the code to the arduino board. For installing the IDE on other flavors of linux, head on over to the arduino site.

I connected the InduinoX board to my laptop using a USB cable. Selected the correct board type in the IDE using Tools --> Board --> Arduino Deceimila, Duemilanove, or Nano W/ ATmega 168. Next select the correct USB to use from Tools --> Serial Port. And finally wrote these first lines of arduino code :)

void setup() {
  pinMode(11, OUTPUT);  // Prepare red LED for output
  pinMode(12, OUTPUT);  // Prepare blue LED for output
  pinMode(13, OUTPUT);  // Prepare white LED for output
}

// a function which executes again and again
void loop() {
  redLight(HIGH);    // Turn on red LED
  delay(100);        // Wait a few moments

  redLight(LOW);     // Turn off red LED
  blueLight(HIGH);   // Turn on blue LED
  delay(100);        // Wait a few moments
  
  blueLight(LOW);    // Turn off blue LED
  whiteLight(HIGH);  // Turn on white LED
  delay(100);        // Wait a few moments
  
  whiteLight(LOW);   // Turn off white LED
}

void redLight(int status) {
  digitalWrite(11, status);
}

void blueLight(int status) {
  digitalWrite(12, status);
}

void whiteLight(int status) {
  digitalWrite(13, status);
}

A successful compile and upload later, the LEDs on the InduinoX board started blinking. Yay!!! To know which LED is connected to which pin, take a look at this page. Make sure the jumpers above the LEDs are in the right position.



More updates in my next post.

Friday, September 23, 2011

Purchase experience with Simple Labs

I have been having this itch to work on a home automation project for a long time. And finally the day has come to scratch the itch. I have been putting off this idea for a while and it is high time I did something about it. So as a first step I at least wanted to get the basic electronic components. Perhaps staring them long enough would finally motivate me to do the project. I wanted to start off on a very simple setup.

Basically, get a proximity sensor to detect if there are people in the room, talk to a light sensor and see if we need to turn on the lights, talk to a temperature sensor to see if we need to turn on the fan and do the necessary based on the sensors' response. To interface with these sensors I wanted to use an arduino board, which I have been wanting for a while now. The list comes down to
  1. Arduino board
  2. Proximity, light and temperature sensors
  3. Relays to turn on/off lights and fans
I searched for the stuff online and found these 2 online stores (in India) that met my requirements.
I would have preferred to use Simple Labs for all my components because of the simpler purchase flow, but unfortunately I could not find any relays on Simple Labs. Anyway long story short, I ordered an Indian version of the arduino board called InduinoX and a quick start kit. I ordered it on Wednesday afternoon, the whole process was simple. I got an email in a couple hours that the package was dispatched through courier. I got the package the very next day! I really loved my shopping experience on Simple Labs. Recommend it strongly. Here are the contents of the package for reference.


I also ordered the relays from Probots the same day, but did not receive the package yet. So more about that purchase experience in my next blog.