BorisPlaysToo
Posts: 2
Joined: Tue Apr 23, 2013 3:26 pm

Controlling ADC Vref using DAC Vout

Tue Apr 23, 2013 3:38 pm

I'm absolutely new to this and still making my way through an electronics for bloody beginners book. So please excuse any misconceptions and or stupid questions.

My first RPi sensing project involves a TMP36 temperature sensor and a LDR. I take samples of their measurements through a MCP3008 in my RPi using the code snippets on the Adafruit tutorial pages. The TMP36 has a way different output voltage than the LDR under normal living room conditions. I'm using the GPIOs 3.3V as Vref for the MCP3008. While even "halving the voltage" of the GPIO to scale the MCP3008 Vref seems a major electronics operation (yes, earlier today I still assumed it was as simple as adding a resistor somewhere along the way), I just thought it would be nice to have Vref adjustable and a DAC came to mind. Now here's the thing: Adafruit have another nice tutorial on how to run a MCP4725 DAC via I2C from the GPIO.

I'm almost too embarrassed to ask: Is it feasible to control the MCP3008s Vref by the MCP4725's Vout? Or are there better ways to do it? Also, can one use the I2C pins of the GPIO and still use the other pins for other operations that don't follow that protocol? Any hints much appreciated!

User avatar
Burngate
Posts: 6313
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: Controlling ADC Vref using DAC Vout

Tue Apr 23, 2013 4:17 pm

I don't see why not. And might be a good idea.

The down-side is that the D-A uses the supply rail as its reference, and so any variation there will get transfered to the A-D. But that wouldn't be a problem for purely resistive measurements such as you are doing, as long as you use the same supply rail throughout

EDIT: I see the D-A has non-volatile ram built in, and in your usage you can just set it once and leave it be. So you could use the I2C to set it up, then disconnect it, reboot your Pi and you can use those pins for other things. Wonderful!

Return to “Automation, sensing and robotics”