Skip to main content

Posts

Showing posts from October, 2011

InduinoX and wireless relays: Part I

It has been a while since I received my wireless relay and I finally got some time this weekend to put them to good use. The connections were really simple. I connected a 5V DC power supply (check polarity, the center pin should be positive) to the wireless transmitter and a 12V DC power supply to the relay board (which also has the receiver). To control the relays using InduinoX, I connected the wireless transmitter board ground to the InduinoX board's ground. Connected the relay 0 pin on the board to digital pin 7 on InduinoX. Finally connecte the light bulb to mains neutral, the live from mains to the common pin on the relay and "normally closed" (NC) pin on the relay to the light bulb. Generally you would connect the "Normally open" (NO) pin to the light bulb instead of NC, but I will explain in a minute why I had to connect NC. Now to the coding part. The specification for the relay tells us that when the relay pin is open (high impedance),

Scopes and electronics

An oscilloscope is very important for any electronic enthusiast. Recently I have been trying to send IR remote codes from an arduino board to my TV. I was having some trouble with timings and my TV would not respond properly. Without the oscilloscope this would not have been easy to debug. I have been looking for some not very expensive, simple to use oscilloscope that can be connected to my computer, so I can save data. I came upon PicoScope . They have a wide variety of products, but the one that caught my eye is the PicoScope 2205  which came in my budget and good enough for my projects. However it is not available in India. Lucky for me my sister and brother-in-law are in UK! I asked them for the PicoScope 2205 and 2 probes (x1 and x10). Thanks to them I now have an oscilloscope. Contents of PicoScope 2205 and Probes So when I had to find the IR signal coming from my TV remote, I connected the probe to the IR receiver data out pin on the arduino board and started rec

InduinoX: IR Emitter

In my last post , I promised an arduino board based remote control. This is the post you have been waiting for. Now the InduinoX comes with an IR emitter too (don't you just love this board?)! The IR emitter is connected to analog pin 0. So you can start transmitting the remote signal you previously discovered. Before we go too far, make sure you have read the primer on IR remotes . My TV remote sends out the signal in the sony protocol as observed from my gnuplots and oscilloscope. You know now that according to Sony protocol, a 1 is represented by 1200ms of high and 600ms of low, while a 0 is represented by 600ms of high and 600ms of low. Also the signal is to be prefixed with a header, which is 2400ms high signal followed by a 600ms of low. So lets write some code to send the header, 0 and 1 first. #define HEADER_ON    2400 #define HEADER_OFF   600 #define BIT_1_ON     1200 #define BIT_1_OFF    600 #define BIT_0_ON     600 #define BIT_0_OFF    600 void sendHeader()

InduinoX: IR receiver

From my previous post , you probably understood how IR remotes work in general. Now lets take a look at how we can read the signals coming from various remotes that you might have. Fortunately for us the InduinoX board comes with an IR receiver. And the good news is that  some one already wrote the code  to read IR signal from arduino! Just copy the code from  http://www.arduino.cc/playground/Code/InfraredReceivers , replace the value of IRpin from 2 to A1, because on InduinoX, the IR receiver is connected to analog pin 1. Compile and upload the code to InduinoX. The code basically sets up the serial port to 115200 baud rate, then sets up timers (read this excellent tutorial on PWMs on arduino), finally the code waits on the IR receive pin for the signal to change (the signal changes when a button on a remote is pressed pointing to the IR receiver). Then the code keeps track of the time it takes for the signal to change from high to low and low to high. At the end of the signal t

IR remotes

As part of my  home automation project , I also wanted to control my home entertainment system. The controller can be a web interface or an app on android phone, or even a universal remote. Which means, I have to be able to send IR signals from the arduino board that my TV, amplifier and set-top box can understand. For this I will first have to read the signal coming from the remotes, store the various signals and replay them from the arduino board depending on my needs. Before going too far into the details of receiving and sending IR signals, it would help to understand how a remote control actually works. There is already a lot of material on the internet on how remotes work. So I will try to keep it short and simple. The IR transmission from remote to your device works on a really simple protocol. The transmitter which is just an LED that emits light in the infrared spectrum, pulses the light in a quick succession and the receiver which is a phototransistor, converts the light

InduinoX: Interfacing with the LDR

Now that I got my LCD display to work with the arduino board , I wanted to use it to show something useful. Since I needed to detect the ambient light for my home automation project , I decided to display the amount of light coming into a room using the light dependent resistor (LDR) that comes with the InduinoX board. Later I will use the LDR reading to determine whether I have to turn on the lights in the room or not. Typical LDR (Source: http://www.induino.com/wiki/index.php?title=File:LDR.jpg) The LDR's output is connected to analog pin 3. The voltage as read from pin 3 is inversely proportional to the light incident on it. The analog input is connected to a 10 bit analog to digital converter (ADC). Hence the values range from 0 (at 0V) to 1023 (at 5V). The analog pins can be referenced in the code using A0 (for analog input 0) to A5. For more information on analog inputs, check out  http://www.arduino.cc/en/Tutorial/AnalogInputPins . Now to get to the coding part #