PDA

View Full Version : AC to PIC read hi or low



Normnet
- 22nd July 2007, 23:00
Require a read of high or low of 34 22v AC leads.

I thought Melanie had posted one for high voltage AC including a LED but can't find other than this: AC Signal... (http://www.picbasic.co.uk/forum/showthread.php?t=2033&highlight=Signal)

Norm

mackrackit
- 22nd July 2007, 23:44
Here are two threads that might be of help.
http://www.picbasic.co.uk/forum/showthread.php?t=6413&highlight=voltage
http://www.picbasic.co.uk/forum/showthread.php?t=4187&highlight=voltage

But... if all you are wanting to do is see if the signal is HIGH or LOW-- ON or OFF--and the voltage IS only 22 VAC. A rectifier to change to DC and a voltage divider to bring it down to 5 volts should do the trick.

If the high voltage was greater than 32 to 48 volts I would recommend a transformer for the voltage drop along with a page full of safety precautions.

Normnet
- 23rd July 2007, 02:06
A rectifier to change to DC and a voltage divider to bring it down to 5 volts should do the trick.

A problem can occur when power to PIC is off, the 5 volts from the divider can power the PIC.

Perhaps a simple transistor (http://www.fairchildsemi.com/ds/2N/2N3904.pdf), 22vAC to 10k resistor to gate, collector pulls PIC input pin low?


Is this acceptable configuration?

Norm

dhouston
- 23rd July 2007, 02:32
If the PIC you are using has clamping diodes on the inputs, all you need is a current limiting resistor in each circuit. There is a Microchip app note that covers this.

Normnet
- 23rd July 2007, 02:51
If the PIC you are using has clamping diodes on the inputs, all you need is a current limiting resistor in each circuit. There is a Microchip app note that covers this.

This App? Interfacing to AC Power Lines (http://ww1.microchip.com/downloads/en/AppNotes/00521c.pdf)

Norm

mackrackit
- 23rd July 2007, 03:53
A problem can occur when power to PIC is off, the 5 volts from the divider can power the PIC.

You are correct. But you did not say that the PIC was going to be turned on and off. The voltage monitors that I have made are never shut off and equipped with backup power just incase.

Now that you know two ways to solve your first question and one way for the second. (this is a productive thread:) ) The most, I think, reliable way to isolate the PIC is an opto isolator. Nothing fancy, LED and a photo diode with a piece of heat shrink between them.

dhouston
- 23rd July 2007, 04:46
This App? Interfacing to AC Power Lines (http://ww1.microchip.com/downloads/en/AppNotes/00521c.pdf)
That's the one. It works with voltages from about 5.5VAC to ???VAC.