Maker Pro
Maker Pro

How to generate AC frequency from DC waveform

NomadAU

Jul 21, 2012
14
Joined
Jul 21, 2012
Messages
14
Hi,

I'm looking for some tips on how to generate an AC frequency from a DC one. A brief explanation of what I am trying to achieve might help everyone to better understand my question.

I am trying to build an ultrasonic measuring device (yes, I know I can go and buy a ready made unit, but I kind of enjoy the tinkering involved in building my own!). It consists of 3 parts, an ultrasonic transmitter, an ultrasonic receiver and some logic running in an ATMega168. And the source voltage will be 12Volts (suitably regulated for the CPU).

So, the question is about generating the ultrasound. I have already built a very accurate 40KHz square wave generator based on the ubiquitous 555 chip. On my scope I can see that it is a 40 KHz square wave, with 50% duty cycle, oscillating between 0 and around 7 volts. I'm sending this to a 40 KHz transducer (from Jaycar) which has a spec allowing up to 140v (peak to peak).

My thinking is that if I could increase the peak-to-peak voltage being applied across the transducer, then I would effectively generate a higher 'volume' and therefore have a better chance of detecting it on the receiver.

I'm confident I can amplify the current signal so that it oscillates between 0 and +12v (using a transistor) but was wondering if there was some (simple?) way to have it swing between +12v and -12v with just a single 12 volt power source? That way I would get around 24v peak-to-peak instead of my current 7 volts.

Any ideas?
 

Laplace

Apr 4, 2010
1,252
Joined
Apr 4, 2010
Messages
1,252
A simple way to increase the output voltage might be to wind an output transformer on a toroid ferrite core.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,719
Joined
Nov 17, 2011
Messages
13,719
A transformer is a good choice to step up the signal.

Since your signal is 0 V ... 7 V you can consider it as the sum of a 3.5 V DC signal plus a 3.5 V peak-peak AC signal. The transformer can only transfer the AC component, therefore you should block the DC componnet of the signal by a series capacitor.
Now you have 3.5 V peak-peak at the transformer's primary. To get 140 V peak-peak at the secondary you need a transformer ratio of 140:3.5 = 40:1 (a few windings more to compensate for losses won't hurt).

Harald

You are now dealing with hazardous voltages. You work at your own risk. Take the necessary precautions. I cannot assume any responsibility for damages material or personal.
 

tdia

May 31, 2012
8
Joined
May 31, 2012
Messages
8
yes there is you can use the very simple BJT to do so it wont be exactly +12 -12 but you will get a larger peak to peak amplitude
use a PNP and NPN two BJTs and connect them to the two power lines the NPN to the negative so when the pulse is in high state HS the terminal would have a high negative charge and when the pulse is in Low state LS the PNP is triggered connecting a high positive power
thise oscillation gives alternate positive and negative charge on one terminal make the other terminal for your out put a ground at zero volts level and enjoy ....

but be ware of the calculations BJTs are a bit slow if they distort your wave signal think of mosfets they can do the same with better effeiciency but BJTS are simpler and cheaper

GOOD LUCK ;)
 

NomadAU

Jul 21, 2012
14
Joined
Jul 21, 2012
Messages
14
Thanks for all the tips guys. I like the BJT option from tdia due to its relative simplicity...and safety. I also can now see how to push the peak-to-peak up to the devices max. of 140v (using the xformer) but will only pursue this option if I find the 'volume' being emitted is not sufficient for my receiver circuit.

Again, thanks for all the help - it's appreciated.
 

NomadAU

Jul 21, 2012
14
Joined
Jul 21, 2012
Messages
14
I'm not getting the expected amplification....

yes there is you can use the very simple BJT to do so it wont be exactly +12 -12 but you will get a larger peak to peak amplitude
use a PNP and NPN two BJTs and connect them to the two power lines the NPN to the negative so when the pulse is in high state HS the terminal would have a high negative charge and when the pulse is in Low state LS the PNP is triggered connecting a high positive power
thise oscillation gives alternate positive and negative charge on one terminal make the other terminal for your out put a ground at zero volts level and enjoy ....

but be ware of the calculations BJTs are a bit slow if they distort your wave signal think of mosfets they can do the same with better effeiciency but BJTS are simpler and cheaper

GOOD LUCK ;)


So I have put together what I think tdia has suggested, but it doesn't provide any voltage amplification....quite the opposite in fact :(

I've attached a couple of images, one showing the simple amplification circuit and the other showing the waveforms on my DSO. Hopefully someone will be able to enlighten me as to what is going wrong here. BTW, I have tried various values for R1 and R2 from 220K down to a couple of hundred ohms...changing their values didn't have any apparent effect.

The scope output contains the input signal and the (amplified?) output signal. CH1 is input, CH2 is output.
CH1 Vpp = 13.4v
CH2 Vpp = 12.2v

I was expecting around 24V for CH2.
 

Attachments

  • AmplifierCircuit.jpeg
    AmplifierCircuit.jpeg
    39.1 KB · Views: 366
  • WaveOutput.jpg
    WaveOutput.jpg
    57.9 KB · Views: 372
Last edited:

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,719
Joined
Nov 17, 2011
Messages
13,719
Sorry to say but your "amplifier" is no amplifier at all.
For a 0 V ... +12 V swing:
If you want to turn on the PNP, your input signal would have to rise above +12V.
If you want to turn on the NPN, your input signal would have to go below 0 V.

Why do you want to level-shift the output of the 555 anyway? You can drive the transformer with the 7 V provided by the 555. All you need is a few more windings to arrive at the same high voltage.

This circuit works (at least in the simulation):
attachment.php



Harald
 

Attachments

  • LevelShift.jpg
    LevelShift.jpg
    79.4 KB · Views: 1,550
Last edited:

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,719
Joined
Nov 17, 2011
Messages
13,719
Of course it amplifies. Input is 5V, output is 18 V.
And yes, it is inverting.
 

NomadAU

Jul 21, 2012
14
Joined
Jul 21, 2012
Messages
14
Again, thanks for the replies (and the interesting 'discussion') :)

I should point out that I have tried using a simple signal transformer, driving the primary using the signal from the 555. By varying the voltage of the input signal (by using a pot), I have been able to significantly increase the output signal up to levels reaching the maximum the transducer can take. So, this is a success, and I do have a solution to my original question.

However, what I was (perhaps naively) trying to do as a learning exercise, was to see if there was some way of taking the original waveform (which oscillated 0-7 volts) and turn this into a signal that oscillated between -12 and +12 volts and was driven by a single rail, 12v power supply, using just amplifiers and inverters.

I can see it's quite straightforward to amplify the positive going pulse from 7v to 12 v however, the low (0v) pulse is a bit different. I was thinking there must be some way of turning the 0v into -12 volts using some kind of inverter, or switching the ground reference. If I could achieve this, then I would end up with a signal that is 24v p2p.

Anyhow, it was just an idea, and it seems that like a lot of ideas, this one may not be practicable :D.... and the transformer does work just fine!
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
The circuit is called an H-bridge. It allows you to get 24V p-p from a single 12V supply. Essentially you have 4 transistors in two push-pull arrangels. Two switch from 0 to 12 and the other two switch from 12 to 0 and the same time. So the output is taken between them, at the junctions and it goes from +12 to -12.

Bob
 

NomadAU

Jul 21, 2012
14
Joined
Jul 21, 2012
Messages
14
The circuit is called an H-bridge. It allows you to get 24V p-p from a single 12V supply. Essentially you have 4 transistors in two push-pull arrangels. Two switch from 0 to 12 and the other two switch from 12 to 0 and the same time. So the output is taken between them, at the junctions and it goes from +12 to -12.

Bob

Thanks for pointing this out Bob. Do you have an example circuit that I might use? I did a quick search and found lots of references to H-bridges used for driving motors forwards and in reverse, but not for amplifying signals.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,719
Joined
Nov 17, 2011
Messages
13,719
For just amplifying a signal you don't need an H-bridge. As Bob pointed out, an H-bridge is mainly used for controlling motors in forward and reverse direction.
It can be used for this purpose here, too.
If you use an H-bridge in this application you effectively double the voltage across the load. This way you can reduce the number of windings on your transformer.
But you have to ensure that all transistors are turned off before you turn on the next set of transistors. Otherwise you risk high currents from CVV to GND through the transistors during the (short) time where both transistors in one leg are conducting.
Look it up here: http://en.wikipedia.org/wiki/H_bridge

Harald

P.S.: I use LTSPICE
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
A bridged audio amp is the basically an H-bridge that is driven linearly. It is used to get twice the voltage and hence 4 times the power into a speaker.

Bob
 

NomadAU

Jul 21, 2012
14
Joined
Jul 21, 2012
Messages
14
For just amplifying a signal you don't need an H-bridge. As Bob pointed out, an H-bridge is mainly used for controlling motors in forward and reverse direction.
It can be used for this purpose here, too.
If you use an H-bridge in this application you effectively double the voltage across the load. This way you can reduce the number of windings on your transformer.
But you have to ensure that all transistors are turned off before you turn on the next set of transistors. Otherwise you risk high currents from CVV to GND through the transistors during the (short) time where both transistors in one leg are conducting.
Look it up here: http://en.wikipedia.org/wiki/H_bridge

Harald

P.S.: I use LTSPICE

I've got back to working on this project after a few interruptions, and I'm now using (or trying to use!) a small transformer to step up the voltage as per Haralds original suggestion.

The xformer I'm using is a small 1K ohm Centre Tapped - 8 ohm Output Transformer. I tried wiring the 8ohm inputs across the Gnd and 555 output pin and guess what....there was a popping noise and a dead 555. I guess I had exceeded the power rating for the 555 chip. When I did my sums, I figured that I must have been trying to draw around 1.5A @ 12V, i.e. 18W through the 555, no wonder it complained. Looking at the specs for the 555, it's rated to handle 1180mW max...so that's why it popped! :eek:

So, on to my question, which I hope is really just a confirmation of what I think I already know. Summarising what I have as my current status (with the new 555).

an output waveform of around17V p2p is what I am seeing on the 555 output. I was expecting it to be no more than 12V but I can see a large (momentary) spike on the leading edge of each of the square waves which is probably why the scope sees 17V.
I have a transformer which has 8ohm resistance on the input winding
I need to ensure that the 555 doesn't source/sink more than 200mA (from spec sheet)


So I think I need to put a resistor in series with the 555 output to limit the current draw?
Using Ohms law, and the inputs of 17V and 200mA, I get a resistor value of 85 ohms.

I could (probably should) increase this so that the current draw is not up at the max, so if I set the max current to 100mA, a resistor of 170 ohm should do the trick.

Can anyone confirm if I'm on target here, or is there something significant I might have overlooked? BTW, I'm not sure what voltage I will get from the transformer, but hopefully not more than 140V which is the max my transducer can handle. I just picked the transformer because it happened to be handy at the time :)
 

Laplace

Apr 4, 2010
1,252
Joined
Apr 4, 2010
Messages
1,252
A transformer with a 1000:8 impedance ratio has sqrt(1000/8)=11.2 turns ratio, so a 12V input could produce as much as 134V out. However, since this is a small signal transformer, it may not have been constructed with the wire insulation for this voltage. Just something to watch for. Also, the impedance ratio of 1000:8 does not necessarily mean that the winding has a resistance of 8 ohms. Have you measured the wire resistance? If the core becomes saturated, as might happen if the frequency of the square wave from the 555 is too low, then it is the wire resistance that is the impedance of the winding instead of the reflected impedance from the other winding. What is the frequency of the 555? Since this is likely an audio transformer, it should be good to at least 5 KHz or more.

It would be best to block any DC current flowing in the transformer winding. Instead of using a resistor for current limiting try using a capacitor instead and drive it at the highest frequency practical. What is the resistance you have loading the high voltage winding?
 

NomadAU

Jul 21, 2012
14
Joined
Jul 21, 2012
Messages
14
Thanks for the quick response Laplace.

I'm getting used to things not being quite as simple as one might hope :)

The intention is to drive a transducer at 40KHz...at or around its maximum voltage (which is 140V p2p). So I have my 555 generating a 40KHz square wave and it's nominal voltage p2p is around 17V, but as I said, this is due to an initial spike on the square wave - the 'flat' top part of the wave is at 12V.
The 555 is generating 40 KHz. When I measured the (wire) resistance I found it to be around 8ohms.

I hadn't thought of using a capacitor to block the DC, but this now makes good sense, since what I really want driving into the transformer primary is the AC component. Is it best to go for a large or small capacitance, and would ceramic be preferred over electrolytic?
 
Last edited:
Top