View Full Version : ADC advice needed
Josh Siegel
10-10-2006, 18:10
Hi all,
I'm building a sensor unit with 11 analog inputs and 1 PWM device.
At a minimum, I would like to get the 11 analog sensors hooked up to a single RS232 line. Their specs are as follows:
0-2.54V, 10mV incriments (meaning 8-bit on a 0-2.54V sensor, or 10-bit on a 0-5v).
I would like to sample them at least 10 times per second.
Are there any (inexpensive/sampleable) ADC's that I can wire the sensors to, and get an RS232 output that I can plug into the computer? I'd love to somehow get a string like this:
A055B155C254
and so on - so that I do not have to have a serial out line to ask for specific data.
Also, is there any way to make an ADC take PWM data? If not, I will be integrating several RS232 lines, so I can capture that in my microcontroller.
Thanks!
Rickertsen2
10-10-2006, 20:14
Hi all,
I'm building a sensor unit with 11 analog inputs and 1 PWM device.
At a minimum, I would like to get the 11 analog sensors hooked up to a single RS232 line. Their specs are as follows:
0-2.54V, 10mV incriments (meaning 8-bit on a 0-2.54V sensor, or 10-bit on a 0-5v).
I would like to sample them at least 10 times per second.
Are there any (inexpensive/sampleable) ADC's that I can wire the sensors to, and get an RS232 output that I can plug into the computer? I'd love to somehow get a string like this:
A055B155C254
and so on - so that I do not have to have a serial out line to ask for specific data.
Also, is there any way to make an ADC take PWM data? If not, I will be integrating several RS232 lines, so I can capture that in my microcontroller.
Thanks!
To make things simple you could use a microcontroller with integrated ADC. Microchip has many PICs with the amount of analog inputs you need, UARTs for rs232 and a thing called a CCP module which can be used to capture the PWM pulsetrain.
the 18F4220 (http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1335&dDocName=en010286) is just an example
Josh Siegel
11-10-2006, 19:00
The only problem with that is that I don't have a programmer for it. I could build one, but if there's an ADC that already does (nearly) what I want, why would I need the extra features?
I was planning on using a Parallax SX48 at first, anyway, but my board arrived dead so I have been unable to get any of the code for my project tested.
Other options? Easy programmers? I can code, but would rather the focus be on using the data once it is collected, not collecting it in the first place..
ZZII 527
11-10-2006, 21:47
You probably won't be able to find a single chip that does all that. You could look for a data aquisition board, which will be more pricey.
For a similar project, I did exactly as Rickertsen2 described with a PIC 16F877. I got a kit with breadboard/programmer from www.machinescience.org (now an official FIRST supplier), which has a good web-based compiler. It took me some time to learn all the microcontroller specifics, but with the analog inputs, a multiplexer, and capture modules, you can read in all your signals and then send out bytes via the same RS-232 programmer that comes with the kit. The advantage over a DAQ board is that you have complete control over the processing and data format.
Josh Siegel
11-10-2006, 23:06
I have a few consumer level DA boards like Phidgets, but they don't have the speed or inputs I need.
I was looking at the 2004 Edubot - it has up to 16 analog inputs. The resolution isn't wonderful, but could this work? It seems like I could get all 11 sensors onboard, and use a DO to control the timing. I could capture the PWM from the PWM in portion.
The nice thing about this is the easy debug command, and I could put the filtering on the external board...
My only question left, then, is if I could somehow manage to tie a GPS into the TTL line? Is there sufficient sample code, that I could somehow capture and parse the data, to spit out from the program/debug port? This would enable me to put every sensor device on one line, and take some of the processing load off the computer.
yongkimleng
12-10-2006, 01:47
I have a few consumer level DA boards like Phidgets, but they don't have the speed or inputs I need.
I was looking at the 2004 Edubot - it has up to 16 analog inputs. The resolution isn't wonderful, but could this work? It seems like I could get all 11 sensors onboard, and use a DO to control the timing. I could capture the PWM from the PWM in portion.
The nice thing about this is the easy debug command, and I could put the filtering on the external board...
My only question left, then, is if I could somehow manage to tie a GPS into the TTL line? Is there sufficient sample code, that I could somehow capture and parse the data, to spit out from the program/debug port? This would enable me to put every sensor device on one line, and take some of the processing load off the computer.
the 2004 edubot is a very stable platform for your work imho, but the price... :eek: not sure you are comfortable with it. it has all you need! Yes the TTL serial is accesible. there are sample codes online to assist you with using it. Code written in MCC with C18 for C code support.
oh but beware it can only run off 5v to 9v supply. Anything more you'll probably spoils omething, anything less it'll shut down. Its made for 7.2v nominal battery packs.
Josh Siegel
17-10-2006, 17:27
I am using the 2004 controller now and having some luck, I just need to write a filtering algorithm to help clean up the data some. My question, though, is on the interfacing of my PWM sensor.
I know this is meant only for a true radio system, but shouldn't there be some other way to measure pulse width? My sensor is wired properly, with the 5V to the 5V, that tied to the I2C lines according to the documentation, GND to GND, and PWM to the signal wire. I am using a CMPS03 sensor, and the pulse widths relate as follows:
1mS to 36.99mS, or 1uS/degree with a 1mS offset. The signal goes low for 65mS between pulses.
Is there any way to make this work? I'm getting a radio data error, and the values show up as 127 regardless of how the sensor faces.
yongkimleng
18-10-2006, 00:02
I am using the 2004 controller now and having some luck, I just need to write a filtering algorithm to help clean up the data some. My question, though, is on the interfacing of my PWM sensor.
I know this is meant only for a true radio system, but shouldn't there be some other way to measure pulse width? My sensor is wired properly, with the 5V to the 5V, that tied to the I2C lines according to the documentation, GND to GND, and PWM to the signal wire. I am using a CMPS03 sensor, and the pulse widths relate as follows:
1mS to 36.99mS, or 1uS/degree with a 1mS offset. The signal goes low for 65mS between pulses.
Is there any way to make this work? I'm getting a radio data error, and the values show up as 127 regardless of how the sensor faces.
I dont know about CMPS03, but did you say I2C ? EDU RC has no I2C port, unless you write the interfacing code via an IO pin yourself.
If i'm not wrong you'll have to: 1) custom code the CCP on the microprocessor to process your custom-pwm signal, or 2) tie the pwm source to an interrupt pin, have a 16bit running timer in the background, have the interrupt trigger on both rising and falling edges, and write code to capture the timer's values per interrupt trigger. The difference between the captured values should be proportional to the pulse width.
hope this helps, but I'm abut skeptical on method 2 unless you have a way to pull the whole 16bit value in 1 command instead of 2 seperate 8 bit reads to ensure accuracy. :]
Josh Siegel
18-10-2006, 15:22
Thank you, but my question is more about PWM sensors -
The compass has an I2C output, but it also has PWM output capability. I think the issue is that it isn't a standard radio protocol; is there some way to make it work?
yongkimleng
18-10-2006, 23:39
Thank you, but my question is more about PWM sensors -
The compass has an I2C output, but it also has PWM output capability. I think the issue is that it isn't a standard radio protocol; is there some way to make it work?
yes, if it isn't a standard radio protocol, you have to measure the pulse width urself either using the microcontroller's CCP function or interrupt function. Read my previous post's points 1 and 2.. you may want to check out the datasheet's info on CCP too. The CCP and timers can be configured to measure ANY pulse width.. the problem is finding out which pin the CCP goes to :yikes:
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.