EEVblog Electronics Community Forum

Electronics => Beginners => Topic started by: Zafar Jamal on February 26, 2024, 10:07:27 am

Title: Simplified square wave generator
Post by: Zafar Jamal 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:

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/ (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!"

Title: Re: Simplified square wave generator
Post by: Terry Bites 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......!

Title: Re: Simplified square wave generator
Post by: Zafar Jamal 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.