Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

220 AC input to microcontroller

Status
Not open for further replies.

qpasatio

Newbie level 5
Joined
Nov 8, 2003
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
97
hello
Does anyone know a good and cheap solution to sense the 220V AC from a pic microcontroller?
An Optocoupler would be a good solution, but it is very expensive. I´ve read a appnote from microchip and they sense the line direct with a 20M resistance. Do you think is a good idea?
Thanks
 

You need to comply with safety regulations. I would use a transformer or the opto isolator method. Avoid all direct connections to the mains. You also have to guard against lightning strikes to the mains conductors getting into your circuit.
 

How do you power your PIC? Directly from AC line or through powersupply with transformer?

If it´s direct AC line then you can go with a 10/20M resistor and add external protection diodes to VCC/GND to input pin. There must be some app-notes for dimmer applications here at edaboard...

If your powering from transfor supply why don´t you feed AC signal from there?

If none of them is true then go with optocoupler...and please #define EXPENSIVE (o; When it comes to safety nothing is expensive...
 

I build an controller with a 12f675. In my aplication i use 40M to the zero cross detectorf of the 220v (Argentina). It is safe cos Pic has two diode to protect the input, so Voltage never is going to be grater than 5V a less than 0V (-0.7). The 40M resistor prevents thath this diodes melt down. :D

Apart from that im not using transformer. I use two capacitors, two diodes, a zenner and a resistor.

To avoid the hight voltages i use a varistor at 450 volts peak.
 

Trust me: this is only 3Mohm resistor to pic input. No 20Meg. and no diodes neded. because they are built in PIC.
I used this method to zero sensing in phase control circuit. (thermal regulated heater project)
 

Thank you for your replies
But.... I need 1 or 0. The resistante is a good method if you activate an interrupt to detect the zero cross. In order to detect Fase oder Neutral, I think that it is necessary to add diodes... condensators... and so on.
 

What you mean by "detect phase or neutral" ????

Do you wanna detect only polarity?
It already does it (o;
 

Sorry, Possibly I didn't use the correct terms. I feed a sensor with 220vac (relay inside). The relay returns 220 oder N.
 

Sorry...now I don´t really see what you want to achieve with this (o;

Always output same polarity regardless of input?
 

Sorry, Possibly I didn't use the correct terms. I feed a sensor with 220vac (relay inside). The relay returns 220 oder N.
 

Usually engineers make difficult the most easy thing. :)
It´s very easy. I have a presence sensor with 3 terminals. These terminals are the tree connections of relay.
I use this connection:
NC (normally closed) -> N
NO (normally open) -> F
C (common) - > to the microcontroller Input (signal)
If the sensor detects presence, the signal is 220, otherwise, N.
I don´t know if my english is precise, if you don´t understand me I can send you one scheme.
 

Let´s say your english is "understandable" and a schematic would have been much better from the beginning (o;

qpasatio said:
It´s very easy. I have a presence sensor with 3 terminals. These terminals are the tree connections of relay.
I use this connection:
NC (normally closed) -> N
NO (normally open) -> F
C (common) - > to the microcontroller Input (signal)

I think you mean with "F" phase?

If the sensor detects presence, the signal is 220, otherwise, N.
I don´t know if my english is precise, if you don´t understand me I can send you one scheme.

Now you´re talking more strange...what "presence"? What "sensor"?

The sensor should switch the relay between "N" and "P" when 220V is present and feed it to the PIC?


Please draw a block diagram (o;
 

qpasatio said:
Thank you for your replies
But.... I need 1 or 0. The resistante is a good method if you activate an interrupt to detect the zero cross. In order to detect Fase oder Neutral, I think that it is necessary to add diodes... condensators... and so on.

for pbp. to sync. to mains:

if pin= 1 then
while pin=1: wend
else
while pin=0: wend
endif
...
pause 1ms
trig. triac etc
 

Let´s try it now.
The opto is very expensive and I had some problems, maybe a good selected capacitor with the 680K resistance could improve the circuit.
thanks
 

I'm also curious about this too. How about coupling with some capacitance?
 

qpasatio said:
Let´s try it now.
The opto is very expensive and I had some problems, maybe a good selected capacitor with the 680K resistance could improve the circuit.
thanks

insteed of simple opto why not you used MOC3020 or MOC3040 the 3040
come with built in zero cross and suitable for interfacing and controlling 220vac direct from Uc i have built temp controller by using moc 3040

if you need more help i will guide you more
 

ref some cheap battery charger circuit
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top