Shop OBEX P1 Docs P2 Docs Learn Events
Analog Input — Parallax Forums

Analog Input

eoinsyeoinsy Posts: 8
edited 2004-11-10 16:24 in BASIC Stamp
How can i read an analog voltage coming in on one of the pins on my BS2p. Everytime i look at the pin its either 1 or 0 but i want the actual voltage (·from 0 - 5 v ).·Is this possible does anybody know?

thanks for any help


Post Edited By Moderator (Jon Williams) : 11/10/2004 4:18:13 PM GMT

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-11-10 16:21
    The BS2p does not have any A2D built in. If you're looking for very precise values, an external A2D like the AC083x or the LCT1298 should be used. Or, you can use RCTIME with some circuit modifications to read a voltage, but this takes a bit of work in code and is not as accurate as using an external A2D.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office


    Post Edited (Jon Williams) : 11/10/2004 4:39:38 PM GMT
  • glasoglaso Posts: 38
    edited 2004-11-10 16:24
    You need an ADC (Analog to Digital Converter). This chip reads the analog voltage and sends it to the stamp as a binary value. For example an 8 bit ADC can measure the voltage in 255 steps between upper and lower limits. If I try to measure a voltage between 0 and 10 volts, I will have an a ccuracy level of 10/255 = 0.039 volts.

    Another way to work with analog signals is an RC circuit. It measures trough an Stamp's pin the time wich takes a completely charged capacitor to lower it's charge. This time is proportional to the voltage applied to it. A better description of an RC time circuit and it's applications is in the Stampworks manual, fre available on Parallax site.
Sign In or Register to comment.