Author Topic: Simplified square wave generator  (Read 456 times)

0 Members and 1 Guest are viewing this topic.

Offline Zafar JamalTopic starter

  • Newbie
  • Posts: 2
  • Country: pk
Simplified square wave generator
« on: February 26, 2024, 10:07:27 am »
Hello all,

I'm relatively new to electronics. Currently I m using Siglent Arbitrary Waveform Generators but want to build a basic function generator optimized for electrochemical reactions, primarily for passing current through solutions. Here are some specific requirements:

  • Square wave output only
    Adjustable output range of ±5V with 0.1V resolution
    Capability to sink and source current of at least 100mA
    Independent adjustment of both positive and negative voltage to produce asymmetrical waveforms
    Frequency adjustable up to 1kHz
    Cost-effectiveness: I require at least 5 independently adjustable outputs
I've explored a few options but would appreciate guidance:

A. Using the AD9833 to generate square waves and utilizing op-amps for voltage and offset adjustments. As shown here https://www.instructables.com/DIY-FunctionWaveform-Generator/ However, I'm concerned about the practicality of using multiple potentiometers for voltage adjustment.

B. Employing an H-bridge configuration to switch between two preset voltages. I'm uncertain about the feasibility and how to precisely set the voltages required for this setup.

Any insights or alternative suggestions would be immensely helpful. My goal is to strike a balance between functionality and affordability.

Thank you in advance for your assistance!"

 

Offline Terry Bites

  • Super Contributor
  • ***
  • Posts: 2397
  • Country: gb
  • Recovering Electrical Engineer
Re: Simplified square wave generator
« Reply #1 on: February 26, 2024, 04:37:33 pm »
OK. Really cheap Lets say $10 in parts + An arduino... Build up the channels on strip board.

The Arduino (or other micro) can be used to set both the amplitude and frequency.
Some simple code will be needed.

PWM outputs can be used to accurately set the squarewave amplitude. Low pass filtering converts the pwm duty cycle into a stable reference voltage.
(You might read back the voltage at the filter output with the analog input ports to give you some feedback control).
Any GPIO can clock the output at the frequency you set by simply grounding the input of the BTL amplifier. Use a CD4066 quad analog switch or a low theshold mosfet, say a 2N7002.
For the rest of the circuit LM324 opamps will do. There' a spare opamp that can be used in a later modification. If offset voltages are a big problem chuck in a more precise opamp. Off the top of my head I doubt the offset will exceed 15mV.

To get a symetrical swing use a "bridge tied load" amplifier.
This configuration doubles the voltage swing seen across the load. For an input amplitude of 2.5V the load sees double this, 5vpp.
The output amp in the schematic has a gain of 2*(R2/R1). Omit R1 and set R2=0 for minimum gain.
You can easily make a simple current boosted opamp with a few cheap transistors.
The boosted opamp circuit can be made short circuit proof with a little more complexity and a few cents in parts.
±200mA with 3.6 ohm sense resistors. The final output amp design is in figure 3. Fig 5 is an alternate design using a MOSFET, some additonal details are included.
This circuit will manage 0.1V resolution with ease limited by the resoultion (8 bit) and voltage stabilty of the pwm and the precsion of the opamps and resistors.

Some minor tinkering will be needed I expect. The filter has been set to suit a 500Hz PWM, for higher frequencies adjust the component values for acceptable ripple. Note that output ripple will be greatly attenuated by the electrolytic cell's intrinsic capacitance.

Lots of interuptions today, you may have noticed......!

« Last Edit: February 26, 2024, 08:47:45 pm by Terry Bites »
 
The following users thanked this post: RJSV, Zafar Jamal

Offline Zafar JamalTopic starter

  • Newbie
  • Posts: 2
  • Country: pk
Re: Simplified square wave generator
« Reply #2 on: February 29, 2024, 04:38:52 am »
Thanks for kind reply.
 
I'll order required parts and will start tinkering with it in next week.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf