Monday, September 14, 2009

Sensors. Eyes to the Real World!

Touch, the biggest revolution in mobile these days wouldn't have been possible sensors. Infact anything electronic, interpreting real world would have been impossible without sensors. High speed optical fibre communication, Remote controls, touch screens and hundreds and thousands of equipments hungry for real world data would have always remain hungry! But now when have them, interfacing them is the most important thing now.

There are a number of sensors, sensing diffrent type of events around. Sound, Light, Pressure, Flow, displacement and a lot more. And to detect these events we have components which show certain behaviour in presence of above stated events. It is now upto us what property of what substance under given curcumstance, can be best utilised.

Lets take an example of LDR (The very common sensor). It stands for Light Dependent Resistance. When light falls on this sensor, this reduces its resistance. Now measuring change in resistance is an easy task. The good old Ohms law V=IR! if a constant voltage is applied, the current thrrough this sensor will increase with increase in light falling on it.

This is a simple potenstial divider circuit. R is a normal resistance with nearly of the same resistance as of LDR in dark.
Mathematically, V across R will increase with increase in light by equation.
VR=12V*(R/(R+R_LDR))
Or can be simply understood as increase in current will cause the drop across R ro increase as Vr=IR.

Now just tap a wire at this junction, one can interface it with ADC to make this data available digitally. But there is a contraint to it. You can use this circuit to measure the light intesity around you. But please do not use this circuit to measure some distance, by measuring the light of a distant transmitter(source). This output is depend on all the combined light falling on sensor. And a large part is the ambient light, which may vary, any time by any amount.

Well there are many other sensors to talk about. Lets talk about them in coming blogs.



Wednesday, August 19, 2009

PCB! What the heck???


This post is especially for the beginners and hobbists. Its a great pain making huge circuits on bread boards and much more keeping them alive on them. Its good though in the start but when, its a matter of circuit with communication or clocks, u need noise free circuits. I remember trying UART for the first time and communicatig with the PC via RS232. It took us 3 days to figure out what went wrong. Our code was correct, written over many times, but still it didn't worked! And i guess the hardware was correct too.We finally decided to make a PCB. And it worked! But then what was wrong???

I would call it the inherit devil in each circuit. The "Noise". The more you keep your circuits open, they catch more noise. Remember each conductor is intelf an antenna. So when when it was on a PCB, following happened.

  1. No open or loose wires, which means proper connections.
  2. Atleast half of the noise due to wires was suppresses.
  3. It was easier to track down faults.
  4. Probability of working of project increased many folds.
Its not hard to make your own PCB at home. There are a lot of Free tools available to design PCBs. The idea I'm using here holds good only for single-layer PBCs.

Making a PCB is like developing a photograph. Here's what to do

1. Draw your layout using some PCB designing software (PCB EXPRESS (free of cost), EAGLE(Free for small boards), ULTRA ROUTE or anything that’s worth the money and you can lay your hands on.

2. Get its LASER print out on a cheap glossy sheet (my own method of cost effectiveness).

3. Put it upside down on to the copper plate.

4. Iron it for 3-4 minute.

5. Remove the sheet in one go.

Now you'll have a copper plate with black lines on it. Thats your circuit! Dip this in FeCl3 or H2O2

for 15 minutes. These will replace the copper, which comes in contact with the acid. The left over is your PCB. Yes one more problem though. the holes are still required. Well a small drill should do for you. Enjoy!!

Friday, July 31, 2009

Power of Resistance

For years scientists are trying to produce super conductors to transmit electricity without resistance, to avoid losses. But on the other hand a 'resistor' is equally important to make any circuit. I haven't seen any circuit so far that ends up without a resistance.

At college level its hard to decide what value of resistance should come up where. Lets take a simple example of LED circuit. I have seen people who won't even care to put a resistance in series with LED to glow it. When I asked many students the answer is again a question, "Why should we? Its already glowing!". Be it interfacing the LEDs to the Computer's parallel port or microcontrollers or simply driving them from battery no one just cares. But then my question is, "How do you drive LED on an 220v AC source?". And to be frank I get all those weird answers like "We should first step down the voltage". Well the answer is not completely incorrect! If you can do it without much losses(running on low voltage), you could save power you'll waste on resistance.
This simple circuit drives the LED at 5 volts. typically an LED requires 15 to 20 mA of current(actual value to be decided by manufacturers data sheet). I have used a 330 ohm resistance to limit the current to 12.61mA. 330 ohm is a standard value. this value can be tweaked to adjust the brightness.

Well there are other uses too. Lets discus them in points first.

  1. Pull up or Pull down resistance. (also called passive pull up or pull down)
  2. Limiting the current in input signals also for impedance matching in amps.
  3. Filters.
These few points can save a lot of problems in our circuits. Lets discuss the first one first.

Pull up or Pull down resistance
In general, a pull up or pull down is used to provide a reference to the input signal. Consider a circuit where the input is open(In case of switch intercaing with microcontroller), a pull up/down will either pull the voltage to Vcc or pull down to ground, hence avoiding floating voltages at the input of a gate.

Limiting the current in input signals
Limiting the input current is very important if you are playing only with voltage levels. Example, if you are reading some value with an ADC, we don't need much current. A series resistance in this case will help in limiting the current and avoid loading the source.

Filters
As in my previous post about caapcitor, I got a nice comment from one of my friends, talking about the filter. The decoupling capacitor in any circuit, includes the series resistance of the circuit and thus makes a cutoff frequency for a filter to block certainf frequencies. Now if we are aware of what to block, we can easily implemet RC filters to avoid noise.

Thursday, July 30, 2009

Capacitor!


All of us must have studied 'DC coupling and Ac coupling', but most of us neglect the use of a coupling capacitor while designing our circuits. Be it in our old faithful 7805 circuit to power up our applications or on the VCCs of our ICs. And often we face the same problem of project not working specially in front of our Boss or Project Guides. Many a times it would happen that you are upto running a RS232 link between your board and PC, and sometimes it would run and sometimes wont. Interfacing a LCD is a pain if you are a novice. It will eat your head because of its timing conditions and initiallization problems. But many of us would have faced a certain problem many times. You switch on the supply and the LCD shows a lot of garbage data. And after a few struggles of turning on the power slowly you get ur data up and running. Or if you have just interfaced a some good motor on your project and your other peripherals stop working.

All of this could be avoided if we take care of inserting a few capacitors in our projects. It will drain out all the stupid noise and glitches you never ever wanted. But yes please do not forget to check the polarity of an electroltytic capacitor. Or else believe me, you'll have to taste some good electronic cigar!

Well I would like to have your comments on this very first article of mine. This post is also open for further discussions.