Hi, I'm trying to figure out a way, using 2 9V batteries, to generate a voltage sweep from -9V to +9V on an output. I would like a picaxe to sweep the voltage over about ~.5 seconds or so. Any thoughts?
-9v to +9v is nothing more than 0v to 18v with a differnt reference point, so as stated by Jeremy, depends on what you want it for.
Is it just a signal voltage or does it need to drive a heavy load?
Does the PICAXE need to supply any other signals that require reference to the "0v" associated with the "+/-9v"?
You could do this with an op amp configured as a differential amplifer with gain of 18/5. Picaxe outputs 0-5V via pwm, low pass filter then differential amp. I could post a schematic but what is the application as there might be another solution.
An op amp configured with a voltage gain to match the output of the picaxe D/A then offset is the choice as Dr Acula suggests. "Rail to rail" op amps, ones that will actually output up to and including their supply voltages are a figment of vender's imaginations - they can do it, but with so many current restrictions that for all practical purposes you're better off to allow for ~1V close to the supply rails (9-0-9 supply will yield 8-0-8 output).
This isn't a particularly efficient way to do what you want so if your idea was to drive motors the H-bridge and pwm is easier on batteries.
The circuit uses an input of 3-0 and inverts and amplifies it by a factor of six (ratio of input and feedback resistors 4.7 K and 28.2 K) Ratio of resistors means the voltage on the output has to be six times higher than the input to reach equilibrium at the inverting pin of the amp. A +1.5 volt source to the non-inverting input sets the zero point for the amp - as the input signal crosses +1.5 volts the output of the amp is at zero volts.
The output power can be whatever you want with a pair of transistors on the output to boost the current (include them in the feedback loop to preserve the gain control) - "whatever you want" within the limits of your battery.
Thank you all for all of the quick replies! This is actually to supply a voltage bias to a Langmuir probe (for calculating plasma density and electron temperature - we're testing a Magnetoplasmadynamic thruster) ). The load will be virtually nothing (~1-2 mA max). The pwm + resistor and capacitor + H-bridge looks like it would be the simplest. Anyone know a good DIP h-bridge chip?
Don't know what a H bridge is, but i have been intrigued by this article in Silicon chip, so much so that i looked up the datasheet for the Texas Instruments TL499a, found and ordered a few.
As BB says, +_ 9 is 18V from another reference point. According to the TL499a data sheet you should be able to get the 18V and few milliamps you want from 2 or 3 x AA batteries. Amazing. This chip also has a linear regulator for higher voltage input, so the batteries can be used as a battery backup. Should be just perfect for powering a picaxe at 5V.
I found the chip at futurelec.com, and they are only $1. An inductor, a few capacitors and resistors and you can get about 40mA.
I have a metal detector that takes 3x 9v batteries, so i'm hoping to use this chip and run the thing off three x AA batteries.
Good luck with your magnetoplasmastic drive. Didn't they have one of those in The Hunt for Red October?