Shop OBEX P1 Docs P2 Docs Learn Events
ADC0831 analog-to-digital converter question — Parallax Forums

ADC0831 analog-to-digital converter question

Robert SchwartzRobert Schwartz Posts: 141
edited 2005-02-17 16:32 in General Discussion
In the StampWorks article about using ADC's, there is a variable resister attached to pin 2 (Vin +). I was wondering what this is used for, and how I know if it set to the right level of resistance. Thanks.

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-02-16 15:33
    That's the voltage being measured. In the StampWorks experiment the Vref is set to 5 volts, giving each bit a value of 19.6 millivolts. If you want to change that, add a second potentiometer and connect its wiper to Vref. For an example of using a variable Vref on the ADC0831 have a look at this article:

    http://www.parallax.com/dl/docs/cols/nv/vol5/col/nv114.pdf

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • Robert SchwartzRobert Schwartz Posts: 141
    edited 2005-02-16 16:43
    So I just turn up/down the resistance until it it outpus 2.55V?
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-02-16 18:15
    I'm not sure what you want to do, so let's get back to basics: (in single-ended mode) the ADC0831 measures the voltage on the Vin+ pin (2). The output will be a binary value between 0 and 255. The voltage per bit (of the output value) is dependent on the voltage level on the Vref pin (5). You need to make sure that your Vref input is equal to or greater than what you expect to measure on Vin+.

    In the article I suggested, the output from the sensor is always less than 2.55 volts. By setting the Vref voltage to 2.55 volts, this makes each bit of the output worth 10 millivolts; hence makes the program math easier to deal with.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • Robert SchwartzRobert Schwartz Posts: 141
    edited 2005-02-16 21:17
    Sorry. I plan on using the adc to interface a gp2d12 (Sharp IR) sensor.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-02-16 23:31
    Then you'll want to use a threshold voltage of 2.55 volts as in my article. There are other ways of calculating the distance, the key is getting a good voltage measurement and by using a 2.55 Vref it's very easy.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • Robert SchwartzRobert Schwartz Posts: 141
    edited 2005-02-17 01:46
    Thanks Jon. So all I would need to do is ensure that Vref is 2.55 volts and then each digital step will be equivalent to .01 volts. But won't the voltage fluctuate depending on the load? If there is more current flowing, at equal resitance, wont the voltage spike (based on ohms law)? And the same for less current flowing?

    Post Edited (Robert Schwartz) : 2/17/2005 3:25:06 AM GMT
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-02-17 04:40
    If you're using a regulated supply for your Vref pot, there won't be any problems. The output from the sensor will vary with distance to target.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • Robert SchwartzRobert Schwartz Posts: 141
    edited 2005-02-17 16:32
    OK, so Ill resgulate the signal then trim it down to 2.55 volts with a potentionmeter. Thanks Jon.
Sign In or Register to comment.