Generating square wave AC signal

Hi,

I have a device that I need to feed with +/-5V square wave AC signal (no DC offset, and about equal cycles in both -5V and +5V) of somewhere around 100-1000Hz and I was wondering what would be the best way to implement this? Basically I need an MCU to switch the AC signal on/off (on=+/-5V, off=0V) for this device and the frequency of this signal can be fixed (i.e. MCU doesn't need to be able to control the frequency). My MCU is able to output only 0/+3.3V from its pins. I was thinking of having a step-up converter and H-bridge, but does anyone have a better idea? Maybe an IC package which does something like this?

Thanks, Jarkko

Feed your 3V into MAX232 or MAX3232, it has internal charge control pump and will output +/-5V signal.
http://datasheets.maximintegrated.com/en/ds/MAX3222-MAX3241.pdf
http://www.dipmicro.com/store/MAX3232

A couple of consierations:

You refer to an "AC signal", but at what level must it be when it is "switched off"? Does it matter whether it is HIGH or LOW or should it be halfway? What in fact are the voltage levels you need for each state? Do you mean positive 5 V and negative 5 V? Does the last state before it is switched off, matter?

How important is symmetry? If symmetry is important, a good way is to generate pulses at twice the frequency and feed them into a toggling Flip-flop.

If you use an op amp dual supply (+/- 5V) comparator , you can drive it with an arduino output and bias the Vref at 2.5 V so the output changes polarity at a predicable point ( 0V and 5V would not be predicable enough due to slight variations in the voltage). You can get a 5V USB ac adaptor and connect it reverse polarity to obtain the -5V . (connect the POSITIVE OUTPUT to the arduino GND and use the NEGATIVE OUTPUT as the -5V))

Comparators have open collector outputs.

All (modern) op-amps are "dual supply" - but can operate on a single supply. The tricky criterion is "rail to rail".

Comparators have open collector outputs.

I never said anything about using comparators (like the LM339).
What I said was:

If you use an op amp dual supply (+/- 5V) comparator

(an op amp in a comparator configuration)

meaning (I assumed it was obvious)

If you use an op amp dual supply (+/- 5V) (AS A ) comparator

Contrary to popular belief "rail to rail " is not really necessary because the arduino has no problem distinguishing TTL signals in the 3.5V range. I have not seen a post yet where rail to rail was really necessary. I use the LT1215 because it was specifically designed for 5V operation but is capable of +/- 36V split supply.

I meant "rail to rail" because we suspect the shy OP might want the full ±5 V signal.

I meant "rail to rail" because we suspect the shy OP might want the full ±5 V signal.

If that's true then this might be a legitimate application for a RTR op amp. ( I don't know any)

CrossRoads:
Feed your 3V into MAX232 or MAX3232, it has internal charge control pump and will output +/-5V signal.

Thanks CrossRoads!
I was checking the datasheet trying to figure out how to use MAX232. I take that I should simply pass PWM signal with proper frequency & duty cycle from the MCU to T_IN and then connect the load between T_OUT and GND? I guess then if I want to turn the AC signal off (0V), I would switch VCC to GND and that would take T_OUT to GND level?

Unfortunately they don't sell MAX3232 (that operates on 3.3V) in my local electronics surplus store (www.creatroninc.com) but they got MAX232 which seems to require 4.5-5.5V in VCC, so I guess I would need 5V step-up converter for that as well, or is there better options?

Thanks, Jarkko

Step up converter would work.
Many places carry them, some examples:

Doesn't sound like you need a lot of current.