Jose Pino's projects & tidbits
"Great stuff from someone with an inquisitive mind"

ADC without ADC.

Here is a example how to read analog values without an Analog-to-Digital converter. Any Microchip PIC microcontroller without ADC can be used. (10/1/2006)


Source: http://www.josepino.com/?adc_wout_adc   Tags: microcontroller electronics howto

Digital electronics and Analog electronics doesn't mix easily. A Microcontroller can't get analog values unless an Analog-to-Digital converter is used, however, you may find a little complicated the use of an ADC and it need lots of Input/Output ports.

Some Microcontrollers, like the small 8-pin Microchip PIC 12F675, do have an ADC integrated, but it is expensier than a PIC without ADC. A simple solution is to use a RC circuit to measure the resistance or capacitance.
Taken from http://www.josepino.com
Basically, a RC circuit is just a capacitor and a resistor. The circuit labeled A shows the most common RC circuit used. I like to use the B circuit, I get better results.

RC circuit

You can replace the resistor and use a thermistor to measure temperature (PTC or NTC), also a photoresistor can be used to measure light. Any kind of resistive sensor can replace the resistor. If you are using a capacitive sensor, just replace the capacitor instead of the resistor.

How it works:

Just connect the RC circuit directly to an I/O pin of the microcontroller. You can use a 33pf capacitor and 1k resistor.

  • First, make the I/O pin as OUTPUT.
  • Second, make the pin POSITIVE (+) for one milisecond. (Using a PIC at 4mhz, a 255-cycles loop will be enough).
  • Third, Make the I/O pin as INPUT and measure how long stays as POSITIVE (+).

    An good application of this technique is my "One wire keypad":

    one wire keypad

    The PIC will measure the RC value of the I/O pin. If the time measured is too long, that means; there is no key pressed. Precision resistors and Mylar capacitor is required to get exact values.

    You can see my " Security Keypad " uses a similar technique.

    Instead of using a single I/O pin, I used an I/O pin for each row.

    Note: Measuring capacitance or resistance usign this technique is affected by the voltage.


    < AC LEDs.   Home   Air Display.>

    Share your comments and experience:
    Keep it short, Comments with bad words, spam and non-related will be deleted.

    Name:   Location:
    Captcha:   <-- This is the Captcha
    Your Comments:

  • Bookmark or Bookmark and Share Suscribe to RSS Feeds

    10 most viewed pages:

    - How To Make a Speaker
    - Hi-fidelity Homemade Loudspeaker.
    - Tachometer/RPM II.
    - Homemade WiFi Lid Antenna.
    - Super Simple Sun Tracker.
    - Led Clock
    - USB LED Light.
    - How To Repair Sony PSP
    - Knowing Everything.
    - Matrix Led Display.

    Articles related:

    - 7-Segment ASCII character Set
    - Getting Started with PICs.
    - ADC without ADC.
    - Air Display.
    - Charlieplexing 7-segment LED display.
    - Four Digit Counter
    - Hacking the LEGO NXT
    - Hitachi LCD Displays
    - How To Control Multiple Leds
    - How To Repair Sony PSP
    - How to get 1 Second with Microcontrollers.
    - How To Repair Dell E172Fbp Display
    - INSIDER V1.0
    - "Lens Error" on Kodak cameras.
    - Matrix Led Display.
    - ON/OFF with Microcontrollers.
    - Reset a frozen iPod.
    - Resistors

    All categories:

    - about
    - advertisement
    - audio
    - automobile
    - bad_ones
    - best
    - circuits
    - computer
    - discover
    - diy
    - electronics
    - fail
    - food
    - from_readers
    - funny
    - furniture
    - hacks
    - homemade
    - how_it_works
    - howto
    - humor
    - interesting
    - lego
    - light
    - microcontroller
    - mysql
    - opinion
    - php
    - projects
    - readings
    - realmeal
    - religion
    - robots
    - science
    - scripts
    - trips
    - videos
    - websites
    - woodworking


    Mr. Counter says: 1369 views.

    Search Article

    Additional Links:

    - Mary's Creations.
    - Publicidad Gráfica.
    - Todito Yucatán
    - Lucina Castillo's Art
    - Conoce Amigos en Dalnet
    - Narciso González' Alebrijes

    Need to contact me?
    e-mail address
    Please get a good reason before sending me an e-mail.

    IE, Firefox, SeaMonkey & Opera tested OK, Some features may not work with Google Chrome. © 2006 - 2009 José Pino - JPC-PHP V5.0
    If any information, data, picture or design infringes a copyright material, please send me an e-mail asking to remove it along with the supporting data.