Voltage to serial data

This is the place for any magazine-related discussions that don't fit in any of the column discussion boards below.
metroid
Posts: 12
Joined: Mon Feb 25, 2008 9:29 am
Location: NY
Contact:

Voltage to serial data

Post by metroid » Mon Feb 25, 2008 9:40 am

does anoybody know of a circuit that would act as a Voltage to serail data converter. for example I have it hooked up to a batetry and it take the volteg of the battery and outputs the voltage as serial data. Ex a 9v battery that has a charge of 5.7 volts left so when it is hooked up to it it would output "voltage 5.7 volts"

User avatar
philba
Posts: 2050
Joined: Tue Nov 30, 2004 1:01 am
Location: Seattle
Contact:

Post by philba » Mon Feb 25, 2008 10:48 am

using a uC would be fairly straight forward. use one with an ADC and serial controller. PIC16F88 springs to mind but there are lots of them. If you have no uC background then it's going to be a steep learning curve.

If you are willing to pay a bit more, maybe a basic stamp could be used.

You might be able to hook up an ADC to a UART and use one of the control lines to capture a conversion into the uart and send it to the PC. there may be circuit designs you can adapt.

User avatar
haklesup
Posts: 2948
Joined: Thu Aug 01, 2002 1:01 am
Location: San Jose CA
Contact:

Post by haklesup » Mon Feb 25, 2008 12:08 pm

There are all sorts single IC chip A/D converters with serial output on the market. Analog Devices, Maxim-IC, TI all make chips. You can get any resolution and a variety of other features to suit your power supply and load. But all of them will just output the data not something formatted along with ASCII characters spelling out "Voltage 5.6V". For that you would need to add the extra power of a uController.

Fortunately there are plenty of single IC chip uControllers with multiple A/D or D to A inputs and outputs. The circuits are usually simple and generally published in the datasheet for the device. so your task boils down to component selection moreso than circuit design.

Start with DigiKey's (or Mouser) part search or a manufacturer like Maxim. Look at uControllers, PICs and serial A to D categories. It will take a few minutes to sort out the options that are meaningful to you but thats how it is done. You can also Google the same search terms and look for app notes and example circuits to guide you further.

Engineer1138
Posts: 458
Joined: Thu Feb 05, 2004 1:01 am
Location: Minneapolis, MN
Contact:

Post by Engineer1138 » Mon Feb 25, 2008 2:43 pm

Number of ways to accomplish this.

- What OS is the computer running? Windows? DOS? Linux?
- Do you already have software to read the serial data or are you planning on writing it yourself?
- What is the voltage range and resolution (e.g., read to 1 millivolt, 0.1V, 1.0V?)

The solution ranges from a 25 cent chip to a system level package costing a few $100 depending on your answers.

User avatar
philba
Posts: 2050
Joined: Tue Nov 30, 2004 1:01 am
Location: Seattle
Contact:

Post by philba » Mon Feb 25, 2008 6:55 pm

I was under the impression that serial ADCs are not typically async but rather some sort of clocked serial interface (i.e not NRZ). At least the ones that I've looked at are.

User avatar
kheston
Posts: 348
Joined: Wed Dec 03, 2003 1:01 am
Location: CA
Contact:

Post by kheston » Mon Feb 25, 2008 7:53 pm

This article may get you started:

http://www.edn.com/article/CA159691.html

I'm looking to do something similar to read a 0-20vdc range. I'd be curious to see what you come up with.
Kurt - SF Bay

metroid
Posts: 12
Joined: Mon Feb 25, 2008 9:29 am
Location: NY
Contact:

re

Post by metroid » Tue Feb 26, 2008 6:42 am

I was thinking of having a chip hocked up to a pic or something like that. not just have one chip. Has anybody done this with a A/d converter

dyarker
Posts: 1712
Joined: Fri Aug 22, 2003 1:01 am
Location: Izmir, Turkiye; from Rochester, NY
Contact:

Post by dyarker » Tue Feb 26, 2008 8:37 am

Many PICs (and other uControlers) contain an ADC and a UART, so it can be done with one IC.
Dale Y

User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Post by MrAl » Tue Feb 26, 2008 9:00 am

Hi there,


I offer a chip that has 4 channels of AD and connects to the serial
port and comes with software that has built in alarms and various
settings, and also does averaging and catches highs and lows.
It also can read cheap thermistors and do all the conversion
to either F or C degrees.
I use mine for testing batteries of various types, charging and
discharging, and that was the original purpose. It worked out so
well that i started selling the chips to other people and they built
their own circuits. I also build one for a friend.
It all started because various people i know were getting cells that
didnt seem to last very long (recharge type cells like NiMH) and so
i set out to make a tester that would test them and provide a
capacity readout, and make it very affordable to anyone who wanted
to do this and could build their own circuits. The whole thing
(including chip) can be made for under 10 dollars or so, and i give
the software with the chip for free (via internet email so nobody
has to pay for a CD or anything) and that gives you four channels
with one serial port or one serial to USB adapter.
The software is also set up to handle external resistors connected
to boost the input range up to just about anything, by simply entering
the value of the resistors...it does all the calculations to be able to
provide a readout like 5.00 volts or 50.00 volts or whatever.
It also does the math for thermistors, which have a characteristic
curve with temperature and provides a readout like 35 degrees C
or 80 degrees F depending on what you set it for (F or C).
If you are interested PM me and i'll provide more details.

I was thinking of making more chips too, like with more channels
and/or external control like turning chargers on and off. I could
use some ideas here too.
LEDs vs Bulbs, LEDs are winning.

dyarker
Posts: 1712
Joined: Fri Aug 22, 2003 1:01 am
Location: Izmir, Turkiye; from Rochester, NY
Contact:

Post by dyarker » Tue Feb 26, 2008 9:41 am

I deleted most of my previous post because I thought I made a serious mistake. Thinking some about it, it was a minor mistake. So I'll do it again (with correction) :grin:

To make the ADC calculations easier pick a power of 2 larger than the voltage to be measured. For 9V that would be 16. Minus 1 is 15, which is binary 1111. This makes the top 4 four bits of ADC whole volts; and the lower bits 1/2, 1/4, 1/8, etc.

For a 10 bit ADC the highest output (1111111111b) would represent 8 + 4 + 2 + 1 + 0.5 + 0.25 + 0.125 + 0.0625 + 0.03125 + 0.015625 = 15.984375V.

If ADC reference is 5V, then 15.984375V / 5V = 3.196875; a 3.2 to 1 voltage divider from voltage to be measured to ADC input is needed.

Convert top 4 bits from binary to decimal to ASCII characters, send to UART, send decimal point (ASCII period) to UART, convert binary fraction to decimal, round to nearest tenth or fifty hundreths, to ASCII and send to UART. Job done!

For kheston's 20V range, I'd start with 32, giving 5 whole volt bits and 5 fraction of volt bits. Add up the weights of bits, and divide by reference to get voltage divider.

Cheers,

Added- Or get a chip from Mr Al who was typing at same time I was :D
Dale Y

Engineer1138
Posts: 458
Joined: Thu Feb 05, 2004 1:01 am
Location: Minneapolis, MN
Contact:

Post by Engineer1138 » Wed Feb 27, 2008 11:27 am

That's right (although ISTR that Intersil made one that was NRZ 8-bit serial data), but the reason I asked if he was going to write his own code is that you can use the serial control lines and a level shifter to clock the data out of a serial ADC and read it with a standard RS232 port. I haven't done it, but having used the flow control lines to turn relays, etc on and off I know it's certainly possible.

One of these days when I actually have time for a new project I should try it.

philba wrote:I was under the impression that serial ADCs are not typically async but rather some sort of clocked serial interface (i.e not NRZ). At least the ones that I've looked at are.

muntron
Posts: 13
Joined: Tue Feb 12, 2008 9:02 am
Location: Colorado, USA
Contact:

Post by muntron » Tue Mar 04, 2008 3:54 pm

dyarker wrote:Many PICs (and other uControlers) contain an ADC and a UART, so it can be done with one IC.
Yes, but RS232 needs conversion so another chip is needed, for example max232.

User avatar
Bob Scott
Posts: 1192
Joined: Wed Nov 20, 2002 1:01 am
Location: Vancouver, BC
Contact:

Post by Bob Scott » Tue Mar 04, 2008 6:15 pm

Mr Al: I was thinking of making more chips too"

You make ASICS? How do you manufacture on such a small scale? :shock:

Bob

dyarker
Posts: 1712
Joined: Fri Aug 22, 2003 1:01 am
Location: Izmir, Turkiye; from Rochester, NY
Contact:

Post by dyarker » Tue Mar 04, 2008 7:30 pm

Did you want RS-232? (where logic 0 is +voltage, and logic 0 is -voltage)

Serial to/from uController UART is logic 0 is 0V, and logic 1 is Vcc; not RS-232.

If you don't want RS-232, then no other IC is needed.

Cheers,
Dale Y

User avatar
philba
Posts: 2050
Joined: Tue Nov 30, 2004 1:01 am
Location: Seattle
Contact:

Post by philba » Wed Mar 05, 2008 8:27 am

Bob Scott wrote:Mr Al: I was thinking of making more chips too"

You make ASICS? How do you manufacture on such a small scale? :shock:

Bob
I presumed it was a preprogrammed uC of some sort.

By the way, one of the above links shows using serial I/O (actually async via RS232 to be precise) control lines to transmit the digital bit stream from an ADC. Kind of cute but requires writing some sort of code on the PC to assemble the bit stream into usable data. I had assumed the OP was asking for something that just plugs in and gets the data via something like hyperterm.

Not exactly what was requested but there is a fairly cheap solution for this - the USB Bit Whacker. $25 from sparkfun. http://www.sparkfun.com/commerce/produc ... cts_id=762
it takes a little setup via hyperterm but it's pretty close to the OP's request. There is even a kit form that is a bit cheaper.

Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests