1
\$\begingroup\$

I am designing a circuit to convert 24VAC signal to 5V DC signal. The 24VAC signal is designed where 24VAC is on and 0VAC is off. The signal needs to be fed to an MCU which is 5V DC.

The circuit designed has to be very cheap so more expensive ICs and full wave rectifiers are not options.

There are two designs that I came up with

The first design outputs a 5V DC signal for high and about 0VDC for LOW. enter image description here

The second design eliminates the capacitor but outputs a 5VDC for low and 5VDC square wave for high which will be accounted for in code. enter image description here

I would like to know if there is an advantage for one over the other considering that the circuit needs to be as cheap and safe as possible since it will be used in an industrial environment and will be heavily affected by dust, debris, and humidity.

\$\endgroup\$
  • 1
    \$\begingroup\$ 24VAC is on and 0VAC is off - how can this work? 24VAC is crossing the zero periodically. Are you going to take some time window to get "on" or "off" state (like an integrator?) I don't see anything like this in your designs \$\endgroup\$ – Eugene Sh. Jan 10 at 19:05
  • \$\begingroup\$ The 24VAC was intended to be driving an AC device with 24VAC turns the device on and 0AC turns the device off. Now a part of this needs to bypassed and some logic needs to be done on an MCU. So in the first design I use a half wave rectifier with a capacitor and NPN transistor to convert the signal to be ON/OFF based the presence of the 24VAC. \$\endgroup\$ – Amr K. Aly Jan 10 at 19:12
  • \$\begingroup\$ Can you afford an optocoupler? \$\endgroup\$ – pipe Jan 10 at 19:13
  • \$\begingroup\$ In the second case it will generate a DC square wave with 60/50 HZ frequency which will be accounted for in code. 5V--> LOW 5V 60HZ Square wave --> High \$\endgroup\$ – Amr K. Aly Jan 10 at 19:13
  • 1
    \$\begingroup\$ Sounds like a 60 Hz detector. How long of a time can you afford to wait for an active HI to arrive once the 60 Hz is present? How long of a time can you afford to wait for an active LO to arrive once the 60 Hz is no longer present? \$\endgroup\$ – jonk Jan 10 at 19:15
1
\$\begingroup\$

enter image description here

Figure 1. R4 is redundant as R1, R3, Q1 and R2 shunt it.

Similarly in the second scheme R1 is redundant.

schematic

simulate this circuit – Schematic created using CircuitLab

Figure 2. Solution with component count of 2.

If you use a bi-directional opto-isolator and series resistor you can cut the component count to two. The opto-isolator output transistor will pull low every half-cycle if you use the MCU internal pull-up resistor. Your software will need a timer to check that AC has been lost for 10 ms or so before determining that AC is off.

I have written more on opto-isolators here.

\$\endgroup\$
  • \$\begingroup\$ This design was considered however since there will be a lot of inputs in the circuit using optocouplers on every single one of them would significantly increase the cost of the board. \$\endgroup\$ – Amr K. Aly Jan 10 at 20:05
  • 1
    \$\begingroup\$ There is no price specification in your question. EL814 series AC opto-isolator is $0.12 on Digikey (but for large quantities). Check around for alternate prices or alternate "AC opto-isolator". \$\endgroup\$ – Transistor Jan 10 at 22:59
0
\$\begingroup\$

Industrial environments can be harsh from an electrical point of view. If the 24VAC isn't close to the input, the signal can pick up noise and transients, also possible differences in ground potentials, all of which which can cause bad readings or even damage the input. For these reasons, galvanic isolation is often used.

Having said that, for lowest cost, look into using a basic resistor divider with a couple of diodes to clamp to +5V and ground. I would add a small capacitor to reduce noise and help out with transients and ESD.

Functionally, there isn't much difference between the two circuits, except that the first would be better at sourcing current, the second better at sinking current. But since there's a 10k resistor in series with the output, this probably isn't a concern

\$\endgroup\$
  • \$\begingroup\$ Could you elaborate more on the last part "By the way, the first design above probably isn't working the way you think it is. Both B-E and B-C junctions are forward biased; you could replace the 3904 with a pair of diodes and get the same operation" \$\endgroup\$ – Amr K. Aly Jan 10 at 20:04
  • \$\begingroup\$ The circuit is intended to put the transistor in saturation region when it detects 24VAC and Cutoff region otherwise. \$\endgroup\$ – Amr K. Aly Jan 10 at 20:15
  • \$\begingroup\$ @AmrK.Aly - Never mind, I should have checked the numbers.. Will edit \$\endgroup\$ – user28910 Jan 10 at 20:15
  • \$\begingroup\$ Thank you! So my question is there an advantage for design over the other ? \$\endgroup\$ – Amr K. Aly Jan 10 at 20:22
  • \$\begingroup\$ @AmrK.Aly - Not much difference between the two, see edit \$\endgroup\$ – user28910 Jan 10 at 21:01
0
\$\begingroup\$

Assuming a \$5\:\text{V}\$ DC supply rail and assuming that a broad approach is satisfactory, then something like this might be okay:

schematic

simulate this circuit – Schematic created using CircuitLab

It's mostly just a AC high pass filter and resistive divider (\$C_1\$, \$R_1\$, and \$R_2\$), followed by \$D_1\$ to protect \$Q_1\$'s base-emitter junction from reverse voltages, followed by a 2-BJT shaper (\$Q_1\$, \$Q_2\$, \$R_3\$, and \$R_4\$), followed by a simple RC lowpass filter/integrator (\$R_5\$ and \$C_2\$), followed by a simple saturated switch that normally is OFF unless there is a sufficient number of low-going pulses at the collector of \$Q_1\$ to pull down the voltage on \$C_2\$. When \$Q_3\$ is active, it pulls the output high. Otherwise, \$R_8\$ pulls the output low.

I've no idea what your source impedance is, but the values of \$R_1\$ and \$C_1\$ can be adjusted per need there.

The design is more "slapped together" than it is carefully crafted, because I have no idea if this achieves any of your goals. If the broad strokes are okay, then fine... more could be done to craft it better. If not, then at least this provides enough for you to clearly say so.

\$\endgroup\$
0
\$\begingroup\$

So, I finally got around to drawing up a simple circuit using a bridge rectifier.

As mentioned in the comments, there are SMD bridge rectifiers for low current available for about the price of a single transistor. I can order a bridge rectifier that costs less than a 2N3904 from the same supplier.

enter image description here

The blue section represents whatever is generating the 24VAC.

The red section represents the microprocessor input, with clamp diode to 5V and 100 kOhm as the input impedance.

The AC-detector is really just the three resistors, the rectifier bridge, and the capacitor.

The three resistors reduce the 24VAC to something that will be a little over 5V when rectified.

They also limit the current that can reach your processor in case you get more than you expected on your 24VAC.

This is the simulation:

enter image description here

You can't see it, but the current through the clamp is less than 1mA (red line across the bottom.) So, probably safe enough to let the clamp diodes on the processor's input handle it. If not, a schottky diode is pretty cheap.

The voltage builds up a little slowly. That's about 75 milliseconds before it hits 5V. Ought to be fast enough, though. The decay when the 24VAC disappears ought to be similar.

That's a cheap, dead simple AC detector that offers at least some protection against over voltage.

Probably as cheap as if not cheaper than the transistor based circuits.

\$\endgroup\$

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.