# Digital Voltmeter

This is an instructable for beginners to teach you how to use an analog to digital converter

This will let you measure a ratio between a higher reference voltage and an input voltage. You need to calculate the actual voltage yourself because the basic stamp cannot calculate numbers below 1 (such as a percent)
Both the binary data and the decimal value will be displayed in the basic stamp debug window

This is done on a basic stamp 2 because it is the only microcontroller I have right now.
(I'll be making a programmer and cool toys for the PIC16F877A and PIC16F628A very soon.)

You will also need a 5v voltage regulator and a 3v voltage regulator (it's not really needed)
5v for the higher reference voltage, and the 3v for the test reading voltage (it's not really needed)
Your development board should already have a 5v supply though

And a MCP3001 analog to digital converter from Microchip at http://microchip.com/ , another converter can be used if it uses the same method to transmit the measurement result, and you may need to modify the code

datasheet:
http://ww1.microchip.com/downloads/en/devicedoc/21293b.pdf
Remove these ads by Signing Up

## Step 1: Understanding Resolution

The resolution of a A/D converter means the accuracy, and it ranges from 8 bit and higher, the more bits, the more accurate results you can get

8 bit resolution has a maximum decimal value of 255, which means you can measure 255 different voltages ranging from 0 to whatever reference voltage you are using

16 bits has a maximum decimal value of 65535, big difference in accuracy, but only twice the storage needed

Say, if you wanted to make a voice recorder, and you needed the top sound quality, you need to get better resolution because it will make the sound so much more accurate, but the file size will be bigger
dolphin425 years ago
Oh - and the >4000 V - means "At least 400V static discharge from the "human body model simulator" a very specific network of resistors anc caps that simulates a charged up person.  there is a secondary number, generally less than 1000V for "machine discharge" (the machine, being metal - discharges much more rapidly into the chip) - this refers to things like assembly robots (most electronics are assembled robotically now)

so it does NOT mean the chip can handle a bazillion volts. - not by any means,

treat CMOS parts (that's most everything now) with care.
dolphin425 years ago
the reason that most modern CMOS ICs need protection is because of how the transistors work. the key to the amazing low current draw is the thin layer of glass that is between the input (gate) of the MOSFETs used and the switched current (the rest of the device) - this thin layer of glass is so thin that it breaks down at about 25V (this can be as low as 6V or much higher, but it is a low voltage relatively speaking) - when you walk around with a static charge on you and you touch an unprotected gate - you'll blast right through the glass layer and destroy the MOSFET (or merely cripple it so the device 'sort of' works.)  - the protection networks route any voltage higher than the +power terminal or lower than the -power terminal onto the power buss of the part, effectivly distributing the static over all the terminals of the part. Most of the time this will protect the part from the static. BUT NOT ALWAYS! this is why you need to handle the parts with care, and don't run pins directly to the outside world unless it's through a high vlaue resistor (to limit the actual current of a static event to levels the protection networks can handle safely.) If you don't have an antistatic mat, you can use an unfolded newspaper to work on. (newspaper is anti static, if not as good as a proper antistatic work surface).
LasVegas7 years ago
ESD protection is 4000V and above, not below. > 4kV
frank26080115 (author)  LasVegas7 years ago
oh, so... if it's 7 volts to 4000 volts, it's fried if it's 4000 volts and over, it'll be alright? thx
5 years ago
ESD is for a very short time. That's why the protection works. It is the current * time that damages (FRIES) the chip. Even low over voltage would kill the chip if sustained for a longer period of time.
7 years ago
Actually, if you feed 120v into the pins, I assure you that you have no chip left, but that's not the point. ESD Protection is protection from "ElectroStatic Discharge." This is the static buildup that occurs if you're wearing wool socks with rubber soles or any other combination of dissimilar materials. It could be enough that it makes you jump when you touch a friend or so small that you never knew it was there. Either way, many components would be instantly destroyed because you touched it and discharged through the device. This device, with the protection, shouldn't suffer that fate.
7 years ago
i think he was jsut being humorous
5 years ago
Are you serious ? I'm not sure but if you are, do you think it would resist a 1 million volt discharge ? >4kV means that the device has a protection better than 4kV, without knowing what level exactly. So you should take 4kV as a maximum. Also, this is a protection for human contact, calculated for the human body model (100pF in series with 1500ohm). You won't get this protection if you connect it with something else, the mains, a battery, a lightning rod, etc ... Something else : if you wish to record a 20kHz signal, you need to sample at least at 40kHz. That's the Nyquist theorem. That's why CDs or high quality digital audio in general has a sampling rate of 44.1kHz or above.
frank26080115 (author) 7 years ago
I just used a ds1620 on my bs2 and made a working computerized thermometer, the code is found here http://www.parallax.com/dl/docs/prod/appkit/ds1620thermometer.pdf , and connecting it is simple