Shop OBEX P1 Docs P2 Docs Learn Events
MCP3202 ADC readings jumpy — Parallax Forums

MCP3202 ADC readings jumpy

Don MDon M Posts: 1,652
edited 2013-03-11 08:44 in Propeller 1
I am using Ken's object from the OBEX http://obex.parallax.com/objects/515/. I have the chip connected as per the diagram with the demo with the exception I am using 5VDC as the Vref. I have a 3.3K between the Prop and the DI/DO pins. I am trying to read a LiPo battery and my meter indicates a nice steady voltage but the ADC values are all over the place. I'm using a Quickstart and am just wondering how persnickety these chips are? I don't have any bypass caps on the Vref other than what is on the Quickstart (using the proto board that plugs into it) and am wondering it that is my trouble.

I'm only reading the value every 2 1/2 seconds. I have it set to average (using one of the methods) 100 times.

What has been other peoples experience with these chips?

Comments

  • kwinnkwinn Posts: 8,697
    edited 2013-03-10 17:38
    Are you running the MCP3202 from the 5V supply as well as the reference? If so it will not work and may have damaged the MCP3202.
  • Don MDon M Posts: 1,652
    edited 2013-03-10 19:43
    kwinn wrote: »
    Are you running the MCP3202 from the 5V supply as well as the reference? If so it will not work and may have damaged the MCP3202.

    Please explain. Pin 8 is VDD / Vref. The IC is rated to operate from 2.7 - 5.5VDC. As I understand the spec sheet if I operate the IC from 5VDC then I can input a voltage from 0 - 5VDC to measure. If I operate the IC on 3.3VDC then my input range is 0 - 3.3 VDC.It shares a common ground between the IC and the voltage input.

    So what I tried next was to operate the 3202 from 3.3VDC and added a .1uF cap across the VDD / Vss pins. It seems to have settled down but the reading sometimes works sometimes doesn't. I can put the input to ground and it will show "0". If I put the input to pin 8 (3.3VDC) I get 4095 which I would expect. Then I go back to ground but the display sits at 4095. Or it might jump to 0. It isn't predictable. I even quit using the average sampling setting to see if that helps. Not much difference.

    I have it reading in a repeat loop every 1/2 second. Also tried reading every second and 2 seconds. No different.

    Also tried another 3202. No different....

    Confused with this at the moment...
  • frank freedmanfrank freedman Posts: 1,983
    edited 2013-03-10 19:55
    What does the circuit do if you tape acouple of aa batteries in series with a pot? Wondering also what the 3.3v mode will do if you wire out the resistor in the DIO/DO pin. I wonder if at five volts the chip is seeing the correct logic levels when being set up.
  • Don MDon M Posts: 1,652
    edited 2013-03-10 20:10
    It seems like it will read for the first few seconds after a reset or powerup then it seems like it locks up. Becomes unresponsive.

    Is there supposed to be any pullup on the DO/DI pin? Seems like a driver problem to me.
  • kwinnkwinn Posts: 8,697
    edited 2013-03-10 21:20
    Don M wrote: »
    Please explain. Pin 8 is VDD / Vref. The IC is rated to operate from 2.7 - 5.5VDC. As I understand the spec sheet if I operate the IC from 5VDC then I can input a voltage from 0 - 5VDC to measure. If I operate the IC on 3.3VDC then my input range is 0 - 3.3 VDC.It shares a common ground between the IC and the voltage input.

    So what I tried next was to operate the 3202 from 3.3VDC and added a .1uF cap across the VDD / Vss pins. It seems to have settled down but the reading sometimes works sometimes doesn't. I can put the input to ground and it will show "0". If I put the input to pin 8 (3.3VDC) I get 4095 which I would expect. Then I go back to ground but the display sits at 4095. Or it might jump to 0. It isn't predictable. I even quit using the average sampling setting to see if that helps. Not much difference.

    I have it reading in a repeat loop every 1/2 second. Also tried reading every second and 2 seconds. No different.

    Also tried another 3202. No different....

    Confused with this at the moment...

    Sorry, my misunderstanding. I thought it had separate Vdd and REF inputs like the MCP3208 I use.
  • frank freedmanfrank freedman Posts: 1,983
    edited 2013-03-10 22:38
    Have you put a scope on the csel clk and data pins to see what may be going on with these? My avatar is from the 3201 with CSEL, CLK and data out pins on 3 of 4 channels on a TEK2247A scope. The exact will be different, but should be similar for most of the time, and continuous unless the code does one or two passes and then clobbers something; in which case, the select and clock pins may be out of wack depending on what got stomped on.
  • ElkinElkin Posts: 58
    edited 2013-03-11 02:35
    I have used these chips quite a bit (with Johnny Mac's object for the prop) and from my experience putting a capacitor on the input will make your "jumpyness" go away. if the signal that you are measuring is a battery which should give stable values I would recommend using a 1 µF cap first and if you want to reduce this then you can lower the capacitance as you see fit. I have done this with the analog output on several devices and it works quite well. I assume you are measuring this battery as a meter of how full it is so 1 µF would be more than fine for that purpose... it wont change that fast.
  • ElkinElkin Posts: 58
    edited 2013-03-11 02:41
    Also, this shouldnt be hard to connect... follow what is in the object, it is pretty straight forward. You can use either 3.3 V or 5V to power the device. connect the ground and the CS, SCLK, and DIO (with resistor) to the stamp? and the demo with that code should work fine. If you are familiar with spin and you have a prop you may want to consider looking at Johnny macs code here: http://obex.parallax.com/objects/625/. at the vey least you will be able to see how this thing should be wired up and from that you can just add a cap to whatever channel you want to measure on.
  • Don MDon M Posts: 1,652
    edited 2013-03-11 06:51
    Ok I got it working satisfactorily. It turned out to be the driver object. Don't know what the problem exactly is with the object I was using (listed at the first post) but using Jon's object cured it. As the name implies- ez. Just what I was looking for.

    The original object would only work for a few seconds then it seemed to "lock up" and become unresponsive. I didn't put my logic analyzer on it to see what was happening. And I was using it as-is with it's demo.

    So my final configuration is- VDD / Vref connected to 3.3VDC with .1uF cap. Battery voltage in goes through resistor divider- IN >> 180K >> AD0 In >> 330K >> Ground. Allows me to measure up to 5.1 VDC scaled to 3.3 VDC.

    Edit: Thanks Elkin!!
  • ElkinElkin Posts: 58
    edited 2013-03-11 08:44
    Don M wrote: »
    Edit: Thanks Elkin!!

    Glad to finally be able to give someone on here some useful information for once!
Sign In or Register to comment.