DC signal generator using the DAC

Status
Not open for further replies.

raflyer

Well-known member
Hi all,
I need to generate a variable DC voltage from -2vdc to +4vdc at less than 5mA. I would like to do this using the DAC output of a TeensyLC. The problem is I'm not sure how to properly do it and protect the Teensy from any possible damage from back feed on the signal wire. This signal is feeding the input of an OPAMP in an instrument. Do I need to feed the DAC output into an opamp to get a dual voltage output?
Thanks
Rob
 
You will need an additional supply to provide the negative level. Since the T.LC's DAC can't go to +4 V, you will need to add an opamp to generate that level.

There are many ways to use this, depending on accuracy etc. Here's one:

Power the opamp from +5 V, and the negative supply (-3 to -5 or more will be OK). Connect the opamp's non-inverting input to The Teensy's AREF pin (1.2 V, on the back of the board), drive the inverting input from the DAC via 10 kohm. Connect 30 kohm from the inverting input to the output (this gives a gain of -3). Now, the opamp's output will be 3*(1.2-VDAC). So, with DAC at 0, you'll get +3.6 V out; with the DAC at +2 V, you'll get 3*(1.2-2.0) = -2.4 V out.
 
One minor issue using Teensy-LC is the lack of a built-in 1.2V reference. That's one of the many awesome things in the more expensive Teensy 3.1 that you lose when stepping down to the lower cost LC.

By default, the DAC will output 0 to 3.3V, where 3.3V is related to the 3.3V power. If the 3.3V power is accurate and stable enough (eg, you don't need really great analog precision), then you can just use it as-is.

If you need a more accurate and stable reference voltage, you might need to add extra circuitry to create the reference and put it onto the AREF pin. Some code will also be needed to get the DAC to use it, instead of 3.3V power as the reference.
 
If you need a more accurate and stable reference voltage, you might need to add extra circuitry to create the reference and put it onto the AREF pin. Some code will also be needed to get the DAC to use it, instead of 3.3V power as the reference.

oh, indeed. so the LC DAC is different in that respect ...

"The DAC reference can be selected to be VDDA or the voltage output of the VREF module (VREF_OUT)" (MK20)

vs

"The DAC reference can be selected to be VDDA or VREFH." (MKL26)
 
Status
Not open for further replies.
Back
Top