• 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.

AC to MCU

Status
Not open for further replies.

TucsonDon

Member
I have a valve that operates on 24VAC with limit switchs. I want to use this on a MCU as an input, what is the best wat to do that? Can I use a transistor?
 

TucsonDon

Member
using the NO contacts on the limit switch to indicate valve position (open-shut). the limit switch is a SPDT and NC contacts are used to control the actuator so when the switch shift I have a 24VAC signal that I want to use as an input (5VDC) on a MCU
 

Pommie

Well-Known Member
Most Helpful Member
You can use a voltage divider to feed the pin but be aware that your signal will be a 50/60Hz square wave. On pic μC you can feed the pin via a high value resistor as they have protection diodes built in.

Mike.
 

JonSea

Well-Known Member
Most Helpful Member
One way would be to use a series diode and an optocoupler (plus a current limiting resistor of course). You could add a capacitor across the LED to keep it illuminated during the negative half of the cycle or deal with the pulsating LED in code.
 

TucsonDon

Member
One way would be to use a series diode and an optocoupler (plus a current limiting resistor of course). You could add a capacitor across the LED to keep it illuminated during the negative half of the cycle or deal with the pulsating LED in code.
The series diode-any particular one I should use? How big of a cap?
 

JonSea

Well-Known Member
Most Helpful Member
The diode is absolutely non-critical. It has to handle a peak voltage of √2 ×24 ≈39 v, and at least 20mA. A plain old 1N4148 is up to the task, as is any of the 1N400x series.

As far as the cap, you don't even need one if your code will tolerate a square wave. On for half a cycle, off for half a cycle, on for half a cycle....the first time it's off for more than a cycle means the pump is off.

If you use a cap, you want the capactitance to keep the LED on through the half cycle and not much longer. I'd do some experimenting. The cap should be across the LED and series resistor.
 

be80be

Well-Known Member
All you need is a resistor 1 mho good with 120 volt 5oo k works fine if you use a 6 to 24 volt transformer

The red led is blinking at each cross.
 

JonSea

Well-Known Member
Most Helpful Member
I am using "AC" photocouples like this one.
View attachment 112040
Darn it Ron. I just spent 2 hours drawing a schematic that takes either a contact closure or voltage input, but because one of the contact closure sensors requires bias voltage to operate, the connection polarity is reversed depending on the mode used. THESE will solve that! I wonder if they come in a quad version?
 

JonSea

Well-Known Member
Most Helpful Member
Already found what I needed and my schematic is revised. This simplifies connections substantially and even eliminates some parts.

I never even thought that AC optocouplers existed.

Thanks,

Jon
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top