5v SPI ADC interface
Basil
Posts: 380
Hi All,
Im trying to interface the prop with the MCP3208, SPI interface·ADC.
I will be using 5v for Vdd and VRef.
Vref must be 5v for my circuit, and Vdd can't be less than Vref from what I see.
I have read the interfacing 5v sticky and understand I could use a 1k-10k resistor on each of the data lines to interface to the prop.
This is ok for Vout, CS and CLK as they are all coming from the·ADC to the prop and need the reduction in voltage.
Is a resistor required·for the Din data line from the·Prop to the ADC?
The ADC 'High' voltage for Din is (0.7 * Vdd), so 3.5V in my case, and low is (0.3 * Vdd), so 1.5V.
3.5V for Vhi is above what the prop can output, so im not sure if it will work anyway (can someone confirm this?) and wouldn't adding a resistor lessen its chance even more?
Thanks for the help on this one! My brain is·melting...
Alec
·
Im trying to interface the prop with the MCP3208, SPI interface·ADC.
I will be using 5v for Vdd and VRef.
Vref must be 5v for my circuit, and Vdd can't be less than Vref from what I see.
I have read the interfacing 5v sticky and understand I could use a 1k-10k resistor on each of the data lines to interface to the prop.
This is ok for Vout, CS and CLK as they are all coming from the·ADC to the prop and need the reduction in voltage.
Is a resistor required·for the Din data line from the·Prop to the ADC?
The ADC 'High' voltage for Din is (0.7 * Vdd), so 3.5V in my case, and low is (0.3 * Vdd), so 1.5V.
3.5V for Vhi is above what the prop can output, so im not sure if it will work anyway (can someone confirm this?) and wouldn't adding a resistor lessen its chance even more?
Thanks for the help on this one! My brain is·melting...
Alec
·
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Thanks Paul. The Prop will be operating at 3.3V I may look at a CMOS buffer, though ive never heard of one :P
Any you would recommend?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
What about a weak pullup to 5V? say 10k? And maybe protect the propeller's pin with a 3k3 resistor - something like this:
+5V
|
Z 10k
|
5V INPUT PIN
3k3
PROP 3.3V OUT PIN
When prop outputs a high, it gets pulled up to +5V
When prop outpus a low, it pulls down the 5V input below its H treshold, while limiting the current thru the propeller to 1ma
Mind you, my analog is weak, but I think this should work...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com - a new blog about microcontrollers
Yeah, I saw something like that on the sticky.
Considering my board space, it may be the way to go.
On the input pin, I need to drop from 5v to 3v, would 3k3 do the trick here also?
Also, I have a situation where a high input to the prop ranges from 2.09v to 4.28v.
I would like to put a 3k3 resistor in series with this one too, but am affraid it will drop the 2.09v below the Prop's Vil threshold (which from what I see is 0.6*Vdd=0.6*3.3=1.98V)
I power the MCP3208 at 3V3 with a 3V3 reference and fed the analogs in through a resistor divider to set the range. The resistors on the input are part of the transient protection in any case. Also, by doing it this way I've got the option of having different input scaling by using different resistors.
1x 0 -> 5V Accelerometer (its really 0.25-4.75V but anyway)
1x 0 -> 5V Barometer
3x OPamps to measure voltage drop across an electric match. They have a 9V source and am still learning how to use op-amps so the range is not yet defined.
This suggestion may give me more fliexibility with the op-amp circuit...hmmmm
Would you use the same 3K3 & 10K resistors on the input side?
1) If any nasties get that far, then it becomes the next piece of sacrificial componentry,
2) You need to watch·the source impedence for the MCP3208, and the buffer·makes sure that it's always going to be good.
·
I don't need the full 0-5v range for these inputs. Their function is to test continuity across the terminals and also, depending on voltage drop, can tell me if there is carbon build up on the terminals themselves.
The Accelerometer and Barometer inputs are happy the way they are [noparse]:)[/noparse]
I think in that case I will go with the 3K3/10K divider on the MCU side of the ADC [noparse]:)[/noparse]
Thanks for the input though, this is all very interesting!
EDIT: Attached the file...
Post Edited (Basil) : 4/15/2007 11:28:30 PM GMT
Ok so from what you guys have told me, the attached interfaces should do the trick?
I need to drop from 5V interface to 3V interface for the output on the ADC
Also, 3.3V up to 5V for the 3 inputs to the ADC.
I hope I got the resistor values correct!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Will 1K in series be enough to drop the 4.1V 'high' from the ADC to a safe High voltage for the prop?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com - a new blog about microcontrollers
Cheers, Ian
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ian Mitchell
www.research.utas.edu.au
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
So in the input, I would just have a 1K5 series resistor.
In the output, just a 10K to 5V pull-up resistor, keep the prop pin as an input and inverse the 1's and 0's to those 3 pins when communicating?
Would this work with SPI communication at around 2MHz?
I haven't had a good look at the object yet (if there is one) so can't think if how to modify/create it.
The data from the ADC is quite critical, will this have any effect on the incoming data? (Noise etc)
The only issue is how long your line is and it's associated capacitance because the 10kΩ resistor and the parasitic capacitance forms an RC circuit which takes some amount of time to pull the line to high. Depending on the speed of the serial communication and the length of your line connecting the ADC to the propeller this may or may not be an issue. If it is, you can lower the value of the 10kΩ resistor to speed up the charge rate.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
The track to the ADC is, at most, about the width of the prop (LQFP package) away and is 12mil, 1oz.
Does it matter that the track is running right beside the crystal? It doesn't run underneath it, just near one of its pins.
EDIT: Forgot to mention, the quickest rise/fall time in the data sheet shows 50ns...
Post Edited (Basil) : 4/16/2007 9:39:37 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Thats a simple fix and saves alot of board space!
I noticed that you have a separate circuit for the DIN and DOUT pins on the MCP3208.
If you look at the code to support this chip, it requires that a single propeller pin (dpin) be connected to BOTH DIN and DOUT on the MCP3208. The code switches back and forth between input and output on dpin to service both lines.
Therefore, I would guess that a single 10K pull-up would be all that is required.
Let me know what you think.
Jim
With 5V VRef, DIN is coming from the Prop @ 3.3V to the ADC @ 5V and so needs to be pulled up to 5V, whereas DOUT is visa versa (5V down to 3.3V and so needs a limiting resistor, so i cant really join them.
It seems like you can set VDD and Vref to 3.3V. Then power your sensors with 5V as needed and use a simple voltage divider on the ADC inputs to convert from 0-5V range to the 0-3.3V range needed by the MCP3208.
With this you can use the existing code, tie DIN and DOUT together and get the results you want.
Am I missing something?
Jim
I forgot about that.
I don't really understand all that stuff about the unity gain buffer, but if a simple voltage divider on the input side will work then I may chose to go down that path [noparse]:)[/noparse]
EDIT: Sorry, had to run so here's the rest of this post
COuld I do what mirror suggested and NOT use the untiy gain buffer bit? Just the voltage divider from 5V sensors to 3.3V?
The pull up resistors are nasty to route on the PCB, and changing the code is a pain
Overall, I think mirror's suggestion would be the easiest ot do.
Post Edited (Basil) : 5/6/2007 1:31:02 AM GMT
With the voltage divider, using 1K3 and 3K resistors, 5V drops to 3.030 volts for open circuit.
WOuld the ADC be considered an open circuit?
Since you're only measuring voltage, you can probably go to higher resistance values.
Maybe try 33K and 18K.
I should have my 3208 by Tuesday, so I'll try it on my Propeller Proto board.
Have fun.
The voltage I am measuring needs to be very accurate since I am using it to calculate altitude, speed and acceleration in a rocket.
With those values, the output voltage range ends at 3.235v. This would reduce the accuracy of the ADC would it not?