I want to sense the On/Off state of an electrical appliance (e.g. light bulb 100W) using a microcontroller ATmega16L. How do i go about doing this? My mains supply specs are 230V, 50Hz
You're telling us too little. What's the "device", for instance?
Like Cybergibbons says, you don't need an ADC for detecting a logic level, because that's what you'll have: a high when it's switched on, a low when off (or vice versa).
I'll suppose it's a mains operated appliance. You can't connect directly with the device's power supply: this would make that all of your circuit is connected to the mains, and it would be no longer touch-safe. Touching any part of it could be lethal.
Use an optocoupler to isolate your circuit from the mains:
If there's enough voltage across the LEDs the transistor will be on, and the output pulled low. Only during the zero-crossing of the mains sine you'll get a positive peak. You can connect that to any GPIO pin of your microcontroller.
This will indicate that there's 230V AC on your appliance. If it has an on/off switch it won't tell you if it's on. In that case use a current transformer in series with the appliance, and terminate it with a resistor. The appliance's current will cause a voltage across the resistor, the resistor's value determines the voltage level.
Easier to use, but more expensive is the i-Snail_V. It's also based on a current transformer, but it gives a DC voltage out proportional to the measured current. The i-Snail-V-10 for instance gives 5V DC out at 10A. Since the voltage in this case is analog you would connect it to the ADC. You won't only know if the appliance is switched on, but also its current consumption. (That's a first indication for its power, but not precise.) Use a clamping zener diode on the output in case the voltage would rise higher than 5V.
|show 5 more comments|