Is there a recommended external DAC that works well with the prop?
turbosupra
Posts: 1,088
Preferably that has an object in the obex that goes with it?
I'd like to have at least 9 bits of resolution, and it be a 0-5v DAC, with a working object.
It doesn't have to be 10uS fast but the ability to change every 10mS would be nice, I am wanting to read an analog voltage value that comes in through an ADC and then modifying it slightly and send it back out through the DAC.
I'd like to have at least 9 bits of resolution, and it be a 0-5v DAC, with a working object.
It doesn't have to be 10uS fast but the ability to change every 10mS would be nice, I am wanting to read an analog voltage value that comes in through an ADC and then modifying it slightly and send it back out through the DAC.
Comments
-Phil
http://forums.parallax.com/showthread.php?139655-Looking-for-I2C-based-DAC-recommenations
Thanks for the reply, this interests me since the mouser DAC's are $15+ a piece, wow! Do you have any example code for this?
The "duty DAC" is more than enough for low bandwidth digital to analog conversion.
I have been using duty DAC for audio on the prop on numerous projects and I can assure you that it outperforms any 10 bit DAC I have tested for <20 kHz bandwidth signals.
I'm guessing that it will due with a RC filter with a very low cutoff frequency for what you want to do. The performance will be even better than an RC filter made for audio signals.
/Johannes
One detail to watch if looking for precision, is the way the DUTY mode works, is it is really Pulse Density Modulation.
The gotcha hiding in PDM, is the tplh and tphl times matter, and any skew will give a change in voltage, especially at large changes in pulse density.
I believe the scope shot in Fig 11 of AN001, is showing such an effect : notice the step at 50%
This is somewhat aggravated by the Prop's high speed. With a 12.5ns pulse, a 100ps skew, will be 7 bits of precision.
If the OP wants 9 bits, they need to balance times to within 24ps 12 bits needs 3ps.
More conventional Pulse width modulation, always has two edges per PWM period, so time skews do not spawn changes along the ramp.
A good method of catching non-linearities in Digital DACS is to AC couple a (very) slow RAMP into an Oscilloscope.
You can now zoom to the Step size.
-Phil
I'm glad you replied. I actually looked through the obex earlier for something that I had hoped you had done, because your mcp3208 object was so great and easy to use.
Do you have an object in the obex for this? Also were you able to use this with a breadboard, maybe there is an adapter I can buy? It looks like it is about 3mm x 3mm.
Do you have any more information on this? I'm willing to give this a shot if I can get my head wrapped around it. It looks like prop pin --> RC Filter --> 74HCT ? How about the code, this is going to be in spin and so I'm wondering what the code might look like to get this to working using the prop as the DAC. I did something like this a while ago with StephanL38's help, but the voltage only had to go to 3 different values, so it wasn't nearly as complicated as receiving an analog voltage, modifying the value and then transmitting it out.
-Phil
Not quite, the choices are
(Prop Pin ->filter->op-amp) - single ended is simplest, but has no skew fix.
I see PDM has a Dual pin mode, so I would test a (Prop Pins(2) ->Dual filter->Differential op-amp), as then you reduce the error to a Pin-Match one.
Another approach expanding on the (Prop->74HCT->filter) is to use (Prop->74LVC1T45->filter), which is a Dual Supply Translator, and now you have a VccA pin you can try varying, to adjust and balance the tplh/tphl
No; I don't tend to post much of my work in ObEx. I've attached the object file but you're on your own with it (it won't be hard once you've browsed the data sheet). As I said, that chip is tiny but you can get an eval board from Mouser to get a handle on it (this is what I did).
http://www.mouser.com/ProductDetail/Microchip-Technology/MCP4728EV/?qs=50finrta9rBRTWjUK1SdwIVUkHefShPS
-Phil
I have also found this, a $4 msop 10 to dip 10 adapter so that I can use the MCP4728 in my breadboard, what do you think Jon? I watched a video on using the eval board from MicrochipTechnology and pickit and I'm hoping I'll be able to test it with my breadboard without that equipment.
I think I will try the mcp4728 and the Prop Pin ->filter->op-amp and find out which one I am most comfortable with.
Is there a mathematical formula for figuring out how what the filter voltage will average out to with the prop sending a square wave signal to it? I remember when I did something like this with the RC filter, 50% duty did not equal 1.65vDc and I had to play with it, with the multimeter to get the values I wanted. The voltage level in that circuit was much more forgiving then this one will be, so that's why I ask about the formula.
http://www.proto-advantage.com/store/product_info.php?products_id=2200031
Remember that most Meters have an input impedance - one simple test you can do to check both Skew contribution, and to bridge-out the Meter loading, is to set a prop up to generate three waveforms, and filter then measure between them with a Meter.
* Set DUTY mode to 50.00% and generate A and !A outputs.
* Set NCO mode to a integer division, with 1/50~1/100 the edges, (400-800KHz)
* add a DC R/R splitter for 50%, and swap the R's to measure twice. This removes the resistor ratio error.
% ripple is Period/(4*R*C), as you are driving 1/2 Vcc difference (max) and for Period/2 times.
10K / 100nF will be < 0.1% ripple.
In a perfect chip, with no skew, all 3 voltages will be Vcc/2.0000 and equal to the R/R divider.
The greater number of edges on the PDM pin, means it will have more skew contribution, and you will be able to measure that.
With such a bridge setup, and a reasonably good meter, you should be able to resolve to better than 15 bits, (ie ~ 1.65005V) and any Meter load does not add an offset now, it just slightly reduces the offset amplitude. ( 10M meter from 10K filter, will show 99.9% of true offset).
What this tells me is that there may, indeed, be some skew in the Propeller's DUTY mode output. Also, without correcting for skew, linearity to 9 bits of precision is about the best you can hope for. Interestingly, the worst effect was not noticed at $8000_0000 where the output frequency is highest, but at a lower value. Both the presence of the apparent skew and the location of its worst effects came as a surprise.
-Phil
-Phil
http://www.rohm.com/products/databook/op_com/pdf/op_now-e.pdf
Seems the offset in the banana may be more than one effect ?
What Filter values did you use ? I'm wondering if a few mV of high frequency ripple on the LM358, is not 'averaged away', but may be somewhat peak detected, that varies with shape ? ( it is like RF to a LM358 )
One way to check that would be a two stage filter, one cap back to the Prop GND, and the second RC cap to LM358 Gnd such that any ripple is << 100uV ?
I would love to see diagrams for different cog and pin combinations!
It's a known fact that some combinations gives more distortion for audio signals.
I've tried different RC values that gives the same cutoff frequency; The results yields that the lower the current limiter resistor gets, the more distortion will be heard.(And that's very logical)
The question that needs to be answered is: What is the best combination of cog + pin + filter + buffer to achieve the best result?
/Johannes
What value did you use for the first resistor in this circuit? (The one coming right off of the prop pin)
I used Spin and hand-coded the frqa values.
For the filter, I used 2.2K and 0.1 uF. I didn't bother calculating the roll-off frequency. I just grabbed what was close at hand from my messy bench. Since it's buffered, however, there's no reason not to use a larger input resistor, which could well produce less skew, as Ahle2 points out; so I'll try that first before tearing down the circuit for the other op-amp.
-Phil
I think with the old circuit that Stefan helped me build, I used a 10k/.1uF combination. What would happen if you raised Vcc to 14v? I can't tell from the data sheet if it will amplify the output voltage range or not. Time to read up on frqa!
Yes, they are tiny alas. Another in that series, MCP4725 has an interesting feature, namely it can save the current sample value in an internal EEPROM so that the output value can be retained automatically across power-down.
For high accuracy there is the LTC2602, 16 bit dual DAC with rail-to-rail high current output and fast SPI interface, not cheap and still a tiny package.
Somewhere in my collection I also have the MCP4822, dual 12 bit but SPI instead of I2C.
All these are 3.3 and 5.0V compatible, I assume they 'work well' with any microcontroller(!)
Here is a side-by side comparison of the LM358 (powered from +9V) with the 10K / 0.1uF RC and the LTC1152 (powered from +5V) with the same filter:
Clearly, increasing the input R decreases skew. The lower offset voltage of the LTC1152 has had a beneficial effect, too. Moreover, the fact that it produces rail-to-rail output from a single +5V supply is another aspect in its favor.
-Phil
Jonathan
You've anticipated my next experiment!
-Phil
Here are the results:
That's less than one bit in 12 of maximum error.
Here's what the step response (0 -> 4.95V and 4.95V -> 0) looks like:
-Phil