Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

A to D converter interface

Status
Not open for further replies.

cubdh23

New Member
Is it hard to interface an ATD converter to a microcontroller? My one has a built in 8 bit ATD but i want to use a 10 or 12 bit one so i have to interface it. Since i have no idea what all is involved in doing this. Id just like to know if its doable and if its too hard or what all is involved.
thanks
 
Interfacing a standard chip like that is standard fare in microcontroller programming. You should just learn to do it simply by looking at the datasheet.
Anyway, if you need a fast AD, I'd recommend change a microcontroller to one with a built-in one. Interfacing an external one will be very much slower, considering that microcontrollers are already relatively slow themselves.
 
Many of the cheap FLASH PIC's include 10 bit A2D, including the 8 pin 12F675. Interfacing an external one is generally quite simple to do, just a matter of clocking data bits in and out - but it obviously varies from chip to chip.

An external A2D though is probably going to cost more than a PIC with 10 bit built in.
 
Hey so if my current controller is about 8Mhz E clock.
How fast do u think i could get samples per sec if i use an external one?
do u think i could get 500Hz easily using external atd? I actually need about 500 per sec and not 50 per sec as i stated in an earlier post. If not ill just use the built in ATD. I know the guy that made my board said with my built in one i could get like 125kHz samples so using external one i probably could get 500 Hz easily right? 500 -> 1000 per sec with 12 bits would be perfect.
Question #2
When i look on the internet for ATD i see them for like 2 dollars or 3 dollars. am i looking at the right stuff? Isnt that a bit too cheap? can someone give me a link with 10 or 12 bit atd's? I looked at maxim website and many of them say 10 bit 100 ksps and only cost $3.00 .
I think thats too cheap and im wondering if im looking at the wrong thing.

**broken link removed**

Also. I dont want something like 40 pins or 30 pins. The smaller amount of pins the better of course. Wow why would it need 40+ pins?
 
Hi thanks for all the help, the last link that u gave me, was very helpful.
I believe it is called the MCP3021. I was wondering does it come with a sample and hold built in capability and also how much does it cost? Where can i find the pricing information on it? thanks for all the help.
 
why is everybody assuming he is using a pic? He never staded what he is using so it could be anything...

You can also sample the 3021 from microchip. So you'll get 3 of 'em for free. But mind the fact that the 3021 is SOT23 (very small SMD device).
If you can't handle small smd's then you should look for a similar device in a PDIP package
here's microchip serial selection guide
https://www.microchip.com/ParamChartSearch/chart.aspx?branchID=11021&mid=10&lang=en&pageId=79

but there are others, national, philips, analog devices, do some research before buying
 
Exo said:
why is everybody assuming he is using a pic? He never staded what he is using so it could be anything...

We've all being hoping he might mention what he's using?, but as PIC's are by far the most popular hobbiest micro-controller it's the best one to suggest.

But the answers apply to other controllers as well, many of which are available with in-built 10 bit (or more) A2D.
 
Hi, im using motorola 6812 IT has built in 8 bit a2d. Im not buying the upgrade microcontroller in the 6812 family because it is 130 dollars and it has 10 bits a2d. Thats why i wanted to inteface one.
I had another question. Lets say we want really fast data transfer but we dont want to save the data in a buffer. Just get the reading and send with the sci. Since i have not done the a2d programming yet. I was wondering if by doing this i could get about 100 readings per sec? by just reading atd sending sci and read again. Theoretically using 9600 bits per sec, i should be able to, but practically will this work? or do i need to save it to a buffer. Does buffer mean just external Ram?
 
Oh one more thing. My controller does have SPI port but im not sure what you mean by tri state. why would i need tri state and what does that mean? Hi low and ???? whats the significance of needing tri state.
 
Tristate or 3-state means that the pin can be high, low or both drivers disconnected. The third state lets another device on the same line detirnine the state of the pin.

One way to get more resolution is to over sample. Since you only need 500S/s it shouldn't be a problem. You can gain resolution by sampling much faster than you need and averaging the samples together. There is a formula for how many samples you have to average together to get another bit of resolution (you'll have to check on google for it though I can't remember it). This would let you use your 8 bit converter to get 10 or 12 bit resolution - depending on how fast you can sample.

You should be able to send your data without a buffer. But you might as well use a couple bytes as a buffer - you can just use built in ram. A buffer is just a temporary place to store data it can be any sort of memory.

Brent
 
Hello, that is the first time i have heard of that over sampling thing.
To sample much faster than needed then getting the average thus producing more bits resolution. I see how this works and understand but i dont think this will be accurate. unless the digital levels are moving fast. I believe at my sampling rate i should be able to get every sampling interval if i use 8 bits. 256 posibilities. In my experiment i will be moving through this range in 1/2 sec. If i sample at 500 Hz, that would be 250 sample values out of a possible 256. I believe nyquist theorem states u need to sample 2 times faster than the anolog. Which means i probably need more accuracy. Not to mention i wont be able to use the full 256 range. Probably only 200 of it.
I think oversampling would work if my analog input had a faster frequency. But at 2 Hz, with a period of a good 2.5 feet I need more bits
each bit will cover about 4 mm of length. Hmm comming to think of it
thats pretty precise. 10 bits would cover 1 mm of space though.

I think 8 bits is enough.
thanks for all the help, I never really thought this thing through before.

Im still going to buy the 10 bit add on for the heck of it. Assuming its not hard to interface. thanks and bye.
 
It's not like we don't ask this every time, but just what do you want to do? It will often change the recommendation. Do you want to digitize audio, a thermistor, barometric pressure, or what???

The PIC's 10 bit ADC is easy to use, but "fast" is the last thing I'd use to describe it. Lots of acq time. Also can't handle impedances over 2.5k without losing accuracy. But it's convenient and often a great option.

Oversampling doesn't work in all circumstances. You have to have a certain amount of noise in the signal or reference voltage, otherwise you look at the distribution of values and they will be seen to bunch up around the original 10 bit values.
 
Oznog said:
The PIC's 10 bit ADC is easy to use, but "fast" is the last thing I'd use to describe it. Lots of acq time. Also can't handle impedances over 2.5k without losing accuracy.

That's rather misleading! - there's no loss of accuracy in a correctly designed system, but if you design it poorly you can lose speed or accuracy while waiting for the sample and hold capacitor charging. This is likely to apply to any system that uses a sample and hold, and should always be kept in mind.

The obvious simple answer is to feed it via a buffer amplifier to keep the source impedance low.

But it's certainly something you need to be aware of if you're looking for high speed conversions - which in this case you're not.
 
Hey Nigel, What do you mean by i need to keep in consideration high impedances. Do you mean the load connected to the input of the microcontroller? That needs to be low impedance? To overcome the hold and sample thing should i just put a small delay btw sampling? maybe like a millisecond or something. Can you please explain the significance of the impedance thing to me? this is the first iv heard of it being a factor. I am using a distance to voltage transducer. also im using an indicator for force. when i sample the atd inputs with nothing connected i get random values when i do slow sample. When i do fast sample, i get random in the begging then it just sticks to the maximum which in my case is 255. 8 bits. This is when my input is floating. I havent connected it to the transducer as yet because i dont have it yet.
can u explain why this happens.
 
cubdh23 said:
Hey Nigel, What do you mean by i need to keep in consideration high impedances. Do you mean the load connected to the input of the microcontroller? That needs to be low impedance? To overcome the hold and sample thing should i just put a small delay btw sampling? maybe like a millisecond or something. Can you please explain the significance of the impedance thing to me? this is the first iv heard of it being a factor. I am using a distance to voltage transducer. also im using an indicator for force. when i sample the atd inputs with nothing connected i get random values when i do slow sample. When i do fast sample, i get random in the begging then it just sticks to the maximum which in my case is 255. 8 bits. This is when my input is floating. I havent connected it to the transducer as yet because i dont have it yet.
can u explain why this happens.

If you have a read of my analogue tutorial you might find it helpful.

But basically the sample and hold in the PIC consists of a capacitor, the voltage level on this capacitor rise and falls depending on the input voltage. It's vitally important that the voltage doesn't change as you take a reading, so before the PIC actually takes the reading it disconnects the input from the capacitor. It then measures the voltage on the capacitor.

This capacitor, along with the input source resistance, forms an RC circuit, with the capacitor being charged via the resistor. This takes time, and the larger the resistor value, the longer it will take.

Even worse is when you switch channels, the capacitor then appears to be charged from zero - so it takes even longer. Keeping to the same channel means it only has to charge (or discharge) from the old voltage to the new voltage.

If your input is floating, it might go to any voltage - try fitting a resistor from the input pin down to ground - 100K or something like that.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top