Convert TTL (0-5V square wave) to DC 5V

Thread Starter

rahulrox1991

Joined Oct 31, 2011
16
Can i convert TTL square wave to DC voltage in order to drive a 5V relay switch? My project requires me not to use any external power supply. So the this is perhaps the only way to derive power from the input signal itself. I think a RC circuit should work. Please help me with a circuit diagram. assume frequency to be anything (say 5 khz).
 

#12

Joined Nov 30, 2010
18,224
More likely a DC circuit...diode/capacitor.
You're in the 20 microsecond or less time zone. A 1N4001 might work, or not, but they are very common. Try one if you have it.

(Input) square wave, diode in series, capacitor to ground.
 

steveb

Joined Jul 3, 2008
2,436
Can i convert TTL square wave to DC voltage in order to drive a 5V relay switch? My project requires me not to use any external power supply. So the this is perhaps the only way to derive power from the input signal itself. I think a RC circuit should work. Please help me with a circuit diagram. assume frequency to be anything (say 5 khz).
The first question is whether the signal source is capable of driving sufficient power to activate the relay without getting loaded down.

Then you need to understand your data format. Is it possible that a bunch of zero's or ones may come through the data stream and cut off your AC power source? Perhaps a Manchester coding (or similar return to zero format) is needed?

If you work all that out, remember that the average signal of TTL will be 2.5 V, so you need to more than double the voltage with a transformer or boost converter.
 

thatoneguy

Joined Feb 19, 2009
6,359
What are you switching with the relay?

What I'm getting at is relay coils take a lot of current, if you are switching single pole DC on the ground side, a MOSFET wouldn't need much current at all to do the task.
 

crutschow

Joined Mar 14, 2008
34,280
.........................
If you work all that out, remember that the average signal of TTL will be 2.5 V, so you need to more than double the voltage with a transformer or boost converter.
You don't average the signal, you use a simple diode peak detection rectifier circuit with a capacitor filter, the same as you would use with a sine-wave to DC power supply. That will give a voltage equal to the peak, less the diode drop. A Schottky rectifier will minimize the drop.
 

Thread Starter

rahulrox1991

Joined Oct 31, 2011
16
My source of the TTL would be a std. function generator. Also as far the average voltage is concerned, I will be using a 80-90% duty cycle waveform.

The first question is whether the signal source is capable of driving sufficient power to activate the relay without getting loaded down.

Then you need to understand your data format. Is it possible that a bunch of zero's or ones may come through the data stream and cut off your AC power source? Perhaps a Manchester coding (or similar return to zero format) is needed?

If you work all that out, remember that the average signal of TTL will be 2.5 V, so you need to more than double the voltage with a transformer or boost converter.
 

Thread Starter

rahulrox1991

Joined Oct 31, 2011
16
You don't average the signal, you use a simple diode peak detection rectifier circuit with a capacitor filter, the same as you would use with a sine-wave to DC power supply. That will give a voltage equal to the peak, less the diode drop. A Schottky rectifier will minimize the drop.
Could you please provide me with a suitable circuit diagram. I have been trying simulating the same but somehow not getting it. Thanks in advance.
 

Thread Starter

rahulrox1991

Joined Oct 31, 2011
16
What are you switching with the relay?

What I'm getting at is relay coils take a lot of current, if you are switching single pole DC on the ground side, a MOSFET wouldn't need much current at all to do the task.
I need to implement a laptop charging controller. So what i will be switching is either the laptop charger or even the mains (220v AC). But that is only the later part of the project. What I am interested in at this stage is to test my circuit in lab environment where the control bits will be in TTL from function generator (and not the laptop) and what i will be switching would be anything
 

Thread Starter

rahulrox1991

Joined Oct 31, 2011
16
The first question is whether the signal source is capable of driving sufficient power to activate the relay without getting loaded down.

Then you need to understand your data format. Is it possible that a bunch of zero's or ones may come through the data stream and cut off your AC power source? Perhaps a Manchester coding (or similar return to zero format) is needed?

If you work all that out, remember that the average signal of TTL will be 2.5 V, so you need to more than double the voltage with a transformer or boost converter.
My source of the TTL would be a std. function generator. Also as far the average voltage is concerned, I will be using a 80-90% duty cycle waveform.
 

steveb

Joined Jul 3, 2008
2,436
You don't average the signal, you use a simple diode peak detection rectifier circuit with a capacitor filter, the same as you would use with a sine-wave to DC power supply. That will give a voltage equal to the peak, less the diode drop. A Schottky rectifier will minimize the drop.
Well, he mentioned using an RC circuit (not a peak detector), which lead me to believe he just wanted to average the signal, which can be very effective (provided that the voltage obtained is adequate) and is similar to the way a buck converter works.

The peak detector would have been questionable depending on the source resistance and the load resistance. My concern would have been high ripple content, diode drop and loading drops, resulting in voltage dipping below acceptable limits in the off time. But, now that we know the duty cycle is >80%, that approach might work out well, depending on the details.
 

crutschow

Joined Mar 14, 2008
34,280
Could you please provide me with a suitable circuit diagram. I have been trying simulating the same but somehow not getting it. Thanks in advance.
You use a diode in series with the generator output and a large capacitor (>100μF) to ground at the diode output. You need to include the generator output impedance (50Ω?) in series with the output, into the simulation.
 

steveb

Joined Jul 3, 2008
2,436
Can i convert TTL square wave to DC voltage in order to drive a 5V relay switch?
So, I'd like to verify something here. Your title says you have a 0 to 5 V square wave, but you also say that it's a TTL signal. However, in general TTL might be well below 5 V in amplitude.

Also, you say you have a 5 V relay, but you haven't said what the actual acceptable voltage range is. Will it still activate with 4.5 VDC, or 4 VDC?

You should be very careful about the specifications in your system. If you build something in the lab using a 5 VDC square wave from a signal generator, can you be sure that the real application (if there is one) will provide the source amplitude and source impedance under all conditions.

A safer approach would be to use a small transformer to boost the voltage, then use an LC low pass filter to get a good reliable unregulated voltage, and then use a low-drop-out voltage regulator to generate a good regulated 5 VDC.

This approach would be much more robust, and also provides isolation on the power, minimizing the chance of issues with ground loops.
 
Top