Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Protection circuit for microcontroller

Status
Not open for further replies.

Parth86

Member
Is it possible to read 230 v AC signal using microcontroller without use of transformer. microontroller work only with 5V DC . If we give voltage more than 5V to the input of microcontroller, it will get damage permanently.

Is it possible to read 230 v AC using any microcontr? How to read 230 AC signal without transformer ?
 
You can feed it into many μC pins via very high value resistors - typically 10MΩ. The pin needs protection diodes which are incorporated in pic pins but can be added if not incorporated. The signal on the pin is a 50/60Hz square wave that goes fron -0.7 to 5.7V.

Mike.
Google Pic zero crossing app note for more info.
Edit, https://ww1.microchip.com/downloads/en/AppNotes/00521c.pdf
 
You can feed it into many μC pins via very high value resistors - typically 10MΩ. The pin needs protection diodes which are incorporated in pic pins but can be added if not incorporated. The signal on the pin is a 50/60Hz square wave that goes fron -0.7 to 5.7V.
Thanks Pommie We use resistor for voltage drop. Are you sure that this will work because working with AC is vary dangerous. Will the controller be safe
 
You can feed it into many µC pins via very high value resistors - typically 10M
In general, that can be a bad idea.

For some of the reasons why check out microchip TB3009 **broken link removed**
and TB3013 https://ww1.microchip.com/downloads/en/AppNotes/93013a.pdf

Note: Passing current through the ESD protection diodes of the device is outside
of the operating conditions of the device causing potentially shortened device life span
and incorrect functionality

Note: Passing currents through the ESD protection diodes is outside of the operating
conditions of the part and the device may not function as expected
 
Microchip also have many application notes suggesting exactly this technique
That doesn't make it a good idea.

From microchip TB3013...
Microchip application note, AN521 "Interfacing to AC Power Lines",
provides a number of guidelines for implementing low-cost, zero cross circuits
by relying upon the parasitic ESD diodes in the I/O pins. These guidelines have
been used successfully for many years, but, with the increase in analog functionality
on the microcontrollers, the simple world in AN521 is now much more complex.
Many recent devices are pin-compatible with older devices and can be inserted
into an older socket, but the application can now exhibit strange behaviors unless
the interaction with the new analog features are understood and avoided

Personally, I like to avoid the 'potential VERY, VERY unlikely' problems. You're free to do as you wish.
 
I simply answered the question and even supplied an application note about it.

Mike.
 
You can use the same method with an optocoupler between the clamp and mcu if youre worried. Only works for zero crossing though. Not if youre trying to measure the value with an adc through a resistive divider because you know...optocoupler.

I ALWAYS add on external clamp diodes and never rely on the internal ESD diodes for anything. Instead of a clamp diode to the positive rail and another to the negative rail, I like to use two antiparallel diodes to ground so the voltage is clamped at +/-0.7V in both directions and feeding it to a comparator. That keeps the input far from the rails. Seems safer to me than clamping it to just above above the rail but doing that lets you not need a comparator. And of course add a digital isolator like an opto if you're paranoid...which I am, so I do
 
Last edited:
It's not going to kill nothing the clamping diode are good enough to handle curent. It's so low it's not even a mill amp.
I do it even one better I feed it to a npn that get's you a nice cross.

Here a video where I first tested with a transformer I then set it up to do the same thing with line voltage.
It worked great.
 
This kind of shows you that a 10 m Ohm would be more then good LOl
This kind of like them you tube there telling peolpe how bad something is when there is a lack of understanding you tie the ground and read to the high side of the AC and its 240 volts.
I seen one show they said 240 volts was on the usb It's not It was at 5 volts .

The only way you have a problem is if you could plug it in backward But that can be fixed with the right plugs. you want grounds on the ground side.

Back to this the diodes will clamp it at 5 volts to the uC rail so with a uC you'll not get 3 mA
The meter was hooked to the hot side of the AC and reading taken to the ground of a 5 volt supply
VDD and GND


Just be careful Parth if you try this out make sure you hook it all up right before you power up.
 
Last edited:
Some excerpts from Microchip TB3013. Do with this what you will.
Undervoltage
Voltages below VSS are a special case. These voltages cause negative currents in the die substrate.
When the die substrate is negatively biased, the silicon structures change from field-effect devices to bipolar devices.
All diodes on the die become transistors and shunt currents into the substrate.
.....
Even if latch-up does not occur, the negative current can cause oscillator shifts, or POR Resets.
.....
One word of caution with repeated undervoltage: undervoltage conditions cause degrading damage to the oxide layers
on the die. Problems may not appear until the product has been in the field a long time.
 
Its each his own really
Buddy setups kind of like reading the battery with Adc pin it be the same no mater what voltage the battery is at.

Got have a voltage reference
 
Last edited:
Here I played with it a bit more the first video is 120 I'm toggling a led with it.
The second one I'm delaying it for 100mS after carossing .

 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top