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.

Choice of ADC for raspberry pi

Status
Not open for further replies.

VerifEng

New Member
Hello,
I have a circuit that produces a square wave (can be varying duty cycle) with a maximum frequency of 1 KHz. I wanted to measure the signal through a ADC and feed it back to a raspberry pi to plot the data ( monitoring feature).

what should be the frequency sample I need to try and reproduce the signal properly with enough data points, and How does that have to do with my clock speeds for my SPI interface (would like a adc with a spi interface but can learn i2C).

my signal can vary between 0-8 V, so I’m planning on doing is feeding it through a voltage follower, then a voltage divider then another voltage follower to scale it for the adc.

thank you
 
What resolution do you need? 8 bit=256 levels, 10 bit =1024 levels, 16 bit =64thsound levels. (16 bit is slow)

How much load can the 0-8V handle? Can it drive a 10k voltage divider? With out the voltage follower.

"1khz" = 500uS high/500uS low I do not know how good you must sample but I was thinking that you should sample 3 times in the 500uS. Sampling at 6khz or higher gives you some information.
 
Hey ronsimpson

Again I’m very new to all this so I don’t know too much. 8-12 bits is good. Maybe 12 is best. The signal will be going through a 1-30 ohm load.

And I just want to accurately recreate the graph on python after reading the data. So I don’t know what band of sampling frequencies I should look at.
 
If the 0-8V signal can drove a 1-30 ohm load then you do not need voltage buffers.
I should of asked how many voltages you need to measure.
python Here is an example with software.
example There are many little ADC0832 boards that connect to the Pi.

ADC0832. Two inputs. 8 bit so the data fits in a word. Can sample 200x faster than you signal. Low cost. Most people connect "Vref" to the supply so the 256 levels are from 0V to 5V. You will need to divide the 0-8V down. Using two 1k resistors will add a 2k load on your signal which is nothing compared to the 30 ohm load. The resistors will make the 0-8V look like 0-4V.

I googled "Raspberry Pi ADC" and many of the hits were for the ADC0832. With it being popular, and many examples, you should think about using it. There are many other options but .... do what is easy and where you can copy someone's work.
1581008182593.png
 
If the signal is a square wave then why do you need an ADC? To recreate the waveform you need to measure the on/off times of the signal.

Mike.
 
and what about the voltage levels?
What Pommie is saying is to divide down the 0-8V to 0-3V. Send the information in on a I/O pin and read the pin. Now all you know if 0 or 1, low or high.

If you use the ADC then you will get readings like 0.1V for low and 7.65V for high.

You can choose how much information you want.
 
So use the pin to get the wave, and the ADC to get the voltage? Wouldn't the way to just read everything through the ADC be more accurate and just plot all the data points?

Also, I might need more than 8 bit precision. Let's say my VREF is 3.3V, at 8 bit my step is 12.89 mV which is too big of step size. At lower ends, I can have voltage reading near the 10 mV range for 1 ohm resistor so I wouldn't be able to read anything properly or accurately then.
 
It's not clear what you are trying to measure. You say it's a square wave of varying duty cycle. Are you trying to measure the amplitude and the duty cycle? How quickly do they vary?

Mike.
 
Pommie I'm trying to recreate the graph on a plot in python. That's why I need to collect enough data points to do so. The duty cycle can vary (but let's say worse case is 20%) and the maximum frequency of my signal is 1khz. The voltage can get pretty small though, which is why a 8 bit at 3.3V would be not precise enough
 
The voltage can get pretty small though
plot in python
What is the resolution of the Python plot. If the graph/window is only 250 pixels high then 8 bit. Other wise there are many 10 and 12 bit ADC that are fast.
There must 100s of 12 bit 100khz-1mhz SPI ADCs.
First one I can think of: ADC121S021 Single-Channel, 50- to 200-ksps, 12-Bit A/D Converter.

LTC2365/LTC2366 1Msps/3Msps, 12-Bit Serial Sampling ADC. Python will have to work hard to sample 1-3msps. (you can run it slow)
 
ronsimpson I'll give them a go. I had purchased and used the ads7883 but there's not much documentation on it (beginner). I was able to read it but I would always be off by 40-50 mV and it would not consistently read the same data which is why I'm now looking for a better option.

I also found https://www.digikey.ca/product-detail/en/maxim-integrated/MAX1204BCPP/MAX1204BCPP-ND/1427854 which seems like an overkill, but I just want something that works well and consistently.

Thank you for all the suggestions
 
ads7883 .............. I was able to read it but I would always be off by 40-50 mV
What does "off" mean? Is the 0V reading off or is the full scale reading? Is it not linear? or is it random?
The ADS7883 uses your power supply as a reference. It can only be as good as your power. If you have long wires going back to the Pi, those wires will add a voltage drop that will effect your readings.
The data sheet: most reading are real good but some parts may have a offset of +/-3 ls-bits. Linear is probably very good but could be as bad as +/-2.
Most likely your ground and power wires adds noise.
How are you connected to the 0-8V signal. Noise of 50mV could easy be injected on your wire.
The Pi is a noisy environment.
 
To test the ADC before integrating it in my circuit, I used the 5V power from the pi, fed it through a buffer, through a voltage divider (the resistance used have .1% tolerance) and then through another buffer into the ADC. The power supply is the output of a 12 V to 3.3 V LDO which means is should be very clean. However I am using long wires all over the place. That might contribute, I didn’t think of that
 
LDO regulators are not a clean as non-LDO. Capacitors are important. The regulator might be +/-2.5% so 0.1% resistors will not help.
The ADC wants a low impedance signal (<200 ohms).
 
I see. The input is buffered twice, which means the input impedance should be minimal. Should the power supply input also be buffered?
 
Should the power supply input also be buffered?
The data sheet shows 3 options.
Add caps and use the supply from the computer. In software you can calibrate. Done that.
Add a reference power supply. It only powers the ADC and is very accurate. Done that.
Add a op-amp buffer. Have not done that. I think it will remove noise from the computers power supply.
 
Okay thanks. I’ll look at all this. Right now the DAC is fed by a dedicated LDO, but how is that different then a dedicated voltage reference? The power supply is also coupled with capacitors as the data sheet proproses
 
I’ll try adding an op amp, and shortening the wires and see what happens. I’ve also bought another adc incase it gives better results
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top