16 bit adc to serial project

Go To Last Post
16 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Im new to the forum and to this, I used to program c at college but have not done anything for 10 years.
I want to make a project to capture 4 14 bit or 16 bit adc channels along with two NMEA strings from two ports at no faster than 80 times a second
(I can manage with 10 times a second) and sends it a 115200 baud RS422 port over 200m of cable.

Does anyone have any thoughts on this?

I was looking at an ATmega 2561 as it has 4 RS232 ports. Maybe a 128 but with a software rx only uart added.
SPI/I2C ADC?

program in win GCC in AVR studio?

Its not supidly fast like many people want to do so in reality Im looking at 100 bits 10 times a second or up to 80( I may want to average the 80 so each channel is an average of 20 samples 10 times a second to get a better result I dont need to send the data.
Any thoughts? ADCs, interefacing, best place to start?
I was going to break it into chnuks an dstart with USARTS then ADC then cobble together.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The AVR a/d converters are 10 bits. Something like an arduino mega2560 and a BBB electronics 232 to 422 converter dongle would let you try it all out real fast. You could add an external a/d converter chip if you decided you really needed the extra res.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What are your input voltage requirements for the ADC ?

* Positive voltages only, or Plus and Minus rails ?
* Input voltage levels ?

You are going to have to use an external ADC. There are a large number of serial interface ADCs that would work. At only 80 times per second, speed is not going to be a big issue.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

mega2561 have two usarts, its 640/1280/2560 that have four. But they are 100 pin devices and that may be overkill. If you're not afraid of X:es than maybe a device from the XMega32A4(U) families with an external ADC? They are 44 pin devices with plenty of communication peripherals. The downside may be (or not) that they don't have 5V tolerant pins.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all thankyou for your responses its good to get some ideas and help.
I can feed anything as Im not unfamiliar with electronics and op amps but it is single ended 0-5v analogue and ttl rs232 levels. I already have a 422 converter.

Does anyone have any ideas on which ADC and example interfacing?
I seem to see that most 16 bit adcs with 4 inputs I have seen are differential inputs or single adcs.

i cant use parallel as I dont really have enough pins.
Im also not good at this really starting again after years so Im trying to find examples and keep it simple in blocks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My crystal ball tells me you want to get your a/d and nmea reading project working quickly and cheaply without having to learn a schematic drawing progfram and a pcboard layout program as well as another programming language. One factor the Systems Engineers among us will want to consider is: is this a one-off hobby gizmo, or a prototype for a commercial product where component cost becomes more important than programmer time cost. You have already decided thru some line of reasoning that 14 bits is needed, 16 bits is better. I'd love to see the numbers that led you to this decision. There is always a range/resolution tradeoff. Is the nmea sentence coming in from a gps at 4800 baud? Once per second? Is this an AHRS for a UAV? Have you looked at sparkfun?

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,
Its a project to read some sensor voltages on a remote submersible.i wrote the control stuff with a friend for a colledge project years ago and I now want to mount some sensors on it for bearing (nmea) sonar altitude (NMEA)and some depth, magnetic sensor, other sonar sensors.
bits were chosen to be able to navigate to within cm of an object in bad vis and to detect metal objects from analoigue out of a detector to a certain range and size. Its to do with an archaeological survey project.
Bits were just calculated from the number of divisions of volts needed to be sensed giving the number of bits per milivolt or microvolt and thus resolution of depth, range to all sides and magnetic tesla. I have tried with 8 bits and the sensitivity is very poor.
I have a working system on USB but I cant run that to 80m/100m.

Laying out the PCB is easy Im good at that and well versed at it. schematic is easy, Its the code Im not as good at. Yes time is running out this autumn to try it before sea conditions worsen.
I wanted to make a sonar capture system too.
2 16 bit adcs sampling after a trigger pulse for a specific time and at a specific selectable rate.
bits here defines dynamic range as above and while I can shife the foltages around I cant it then saturates and you dont know anythign other than you have a reading.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK, Bob. It Sounds To Me like you have done some numbers. I'd recommend publishing a 'spec' for your program and I betcha you'd get a half dozen submissions from AVRfreaks of various skills and backgrounds. Some editing to use the cleverest algorithms of those provided might be a good path to pursue. There are lots of 5V SPI 16 bit a/ds at LinearTech, Maxim, TI. Use the parametric selector guides.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks BobGardner, your help is much appreciated.

OK A spec for all interested.

*Im looking to use an Atmel Mega 128 wth a software UART or a larger processor with 4 UARTS.
*Id like to interface a MAX11060GUU+ 16 bit 4 wire spi instantaneous sampling ADC to it.
*Ill design the hardware so nothing needed. I have a kanda STK 20 and 300 to start development with a 422 converter on it.

Operation flow will be

On reception of a start command STAR ascii from UART 1
?read a $dbbt from UART 2 and a $ bearing string from UART 3(I only need bearing in degrees and depth in meters)
Read 4 16 bit samples from adc and add to the above commands in one string - my own mabe $test, Analog 1, Analogue 2 , Analogue 3, Analogue 4, Bearing, Depth
Stream up UART 1 to PC.

Do this 10 or 20 times a second.
Eevntually Id like to sample say 10 samples for each one and average them to improve my accuracy.

How is that for a basic spec?
Thanks again. Im using this as a learning exercise thats useful for projects but trying to get some data while th eweather on this site allows.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Here's my initial whack at it. It compiles for a mega1280 with the imagecraft iccv7avr compiler. I guess I should use the iccv8avr version, but I just edited up a program I had sitting around.

Attachment(s): 

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Wow I didnt expect that and so soon. Thanks. Ill see what you have done, Understanding it will be the hardest bit but most of it is simple c.
The SPI adc was the bit I was unsure of and how to get adc data from it.
The UART is standard which I understand the case structures I assume are for a state machine.
Your good... I am indeed so rusty Im needing more than a refresher.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That example uses the internal 10 bit a/d. Only a superman could have provided a custom solution for a particular external device he has never used... Worse that could happen is its just not sensitive enough.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks BobGardner, I read all your code an dput my own together using what I learned from it.
I dont have a menu but I have got ports working etc.

Im strugglin gto get a display project working now but after checking all th ehardware there isnt much otehr than the difference between the 128 it was tested on and the 1280 that could cause problems.
Im talking to it in memory mapped mode and th ecode works ton the STK 300 dev kit just not my board. The LCD interface was copied to prove things work.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh I got my maxim adc working too with a friends help and a lot of debugging.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Show us a picture

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Take a look at the Texas Instruments ADS8321

They also have multi channel devices in the same family

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user