Pages: [1]   Go Down
Author Topic: How to generate square wave pulses >5V?  (Read 2536 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm trying to use an arduino Uno to replace an older piece of equipment--a Grass SS88 square pulse generator.  I don't need to reproduce the broad range of function, just a particular set.  Specifically, I need to generate square wave pulses in a range of 1-10V, duration from 0.1-10 ms, and at a frequency up to 200 Hz.

I'm not experienced with electronics, but I've found a few ideas to start from.  Particularly, using a relay to open/close a circuit at the desired voltage; however, I'm not sure of the relay's response time.  I've also seen TRIACs mentioned, though I'm not clear how to use them.

In addition to controlling the open/closed state of the circuit, I'm looking for a way to reliably control the voltage on a 0.1-10ms time frame.  I've seen diagrams that combine a capacitor and resistor to produce a low-pass filter that, combined with PWM duty time, can serve as a sort of analog control for voltage but the ramp up time is relatively long compared with the ideal pulse duration.  Currently I'm set up with a 12V wall mart adapter plugged into a voltage regulator to bring the voltage down to 9V.  If fine-tune control over the voltage from 1-10V is complicated, I could instead use a fixed voltage of 7V (the range of 1-10V is merely to extend the flexibility of the device to projects which haven't been thought of yet and not a necessity).

Thanks for your time.  Let me know if there are any bits of information missing, I'm afraid I'm too new to the electronics side of this to know if I've left anything out.
Logged

Montreal
Offline Offline
Faraday Member
**
Karma: 29
Posts: 2590
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Start from the theory: http://www.electronics-tutorials.ws/transistor/tran_4.html
To generate different freq. with 50% duty cycle you can use Tone: http://arduino.cc/en/Reference/HomePage
To generate pulses, with variable duration, same freq. use analogWrite on PWM pin,
and to mix both , freq. and duty cycles, look into library with TIMER's: http://arduino.cc/en/Reference/Libraries
Logged

0
Online Online
Shannon Member
****
Karma: 206
Posts: 12097
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are the pulses to be positive only (0V to 10V range) or do you want bipolar pulses (-5V..+5V)?  How much output current does it need to supply?

I'd suggest an opamp-circuit to amplify the Arduino logic output using a potentiometer to vary the gain.
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks  for the reading. I'm working my way through it.

The voltage needs to be positive +0 to +10.  The current I'm not sure of, but probably in the 100 milliamperes range. I'll do some reading about op-amps. I saw one in a diagram for a square pulse generator so I think you're on to something.

Thanks
Logged

Greater Boston, MA, USA
Offline Offline
Newbie
*
Karma: 1
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm trying to use an arduino Uno to replace an older piece of equipment--a Grass SS88 square pulse generator.  I don't need to reproduce the broad range of function, just a particular set.  Specifically, I need to generate square wave pulses in a range of 1-10V, duration from 0.1-10 ms, and at a frequency up to 200 Hz.

I'm not experienced with electronics, but I've found a few ideas to start from.  Particularly, using a relay to open/close a circuit at the desired voltage; however, I'm not sure of the relay's response time.  I've also seen TRIACs mentioned, though I'm not clear how to use them.

In addition to controlling the open/closed state of the circuit, I'm looking for a way to reliably control the voltage on a 0.1-10ms time frame.  I've seen diagrams that combine a capacitor and resistor to produce a low-pass filter that, combined with PWM duty time, can serve as a sort of analog control for voltage but the ramp up time is relatively long compared with the ideal pulse duration.  Currently I'm set up with a 12V wall mart adapter plugged into a voltage regulator to bring the voltage down to 9V.  If fine-tune control over the voltage from 1-10V is complicated, I could instead use a fixed voltage of 7V (the range of 1-10V is merely to extend the flexibility of the device to projects which haven't been thought of yet and not a necessity).

Thanks for your time.  Let me know if there are any bits of information missing, I'm afraid I'm too new to the electronics side of this to know if I've left anything out.

@Cloverleaf,

If what you need is just digital pulses, it's pretty simple.  If I recall correctly, most Grass devices give you a modest (tens of mA) "courtesy power supply (? +12V or so) that you can tap off from.  Simple open-collector drives (ULN2803) is available in a through-hole package (perfect for protoboarding) and would probably do fine, up to tens of mA.  But a TIP121, with an input resistor and (for safety) a diode to protect from reverse-voltage transients from any inductance lurking can really sink some serious current (Amps, if properly heat sunk.  For analog (variable) voltages, an OpAmp is your friend, and can source or sink at least 5 mA without letting the magic smoke out; add a push-pull pair after the OpAmp if you need more current.  If you don't need to control 120 VAC, you can  get away without the hassle of Triacs.

Hope this helps!

Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 534
Posts: 26970
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If you just need the one output, than an arduino output pin driving an NPN transistor such as 2N2222A with 1K pullup to 10V on the collector is all you need.
If you need several outputs, than ULN2003 or ULN2803 is really convenient for bundling several transistors into one package.


* simple_inverter.jpg (27.81 KB, 960x720 - viewed 105 times.)
« Last Edit: July 16, 2012, 12:27:41 am by CrossRoads » Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The 2N2222A with 1K pullup on the collector seems to reproduce what I need on the oscilloscope; however, the output is in the is only in the 5V.  I assume that is because I have the collector attached to the 5V source on the arduino.  If I change this to a 12V source from a wall mart style 12V DC plug I assume I'll have access to a range up about 12V, which I'll adjust manually using a potentiostat.  I think this is my solution.  Thanks for the help!
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 534
Posts: 26970
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

"I assume that is because I have the collector attached to the 5V source on the arduino. "
What?
No, you should have the collector connected to one end of the pullup resistor, and the other end connected to the voltage you are pulling up to, such as 12V.
You can replace the pullup resistor with a pot, or with 2 fixed resistors, to make a 10V reference.

Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Pages: [1]   Go Up
Jump to: