Why are my ADC readings messed up? (Arduino example)

  Рет қаралды 6,506

Jacob Sorber

Jacob Sorber

Күн бұрын

Пікірлер: 35
@filips7158
@filips7158 2 жыл бұрын
Put a cap parallel to the divide output and add an emitter follower or an op amp follower. You get very low impedance output and you can sample it very fast.
@jonathangainsford6811
@jonathangainsford6811 2 жыл бұрын
Hi Jacob, would appreciate if you could add more content of embedded systems coding, best practices and tops and tricks I am self taught and always scanning for learning and improving my skills. Thank you for the great channel I appreciate your time, J
@andreidaniacovache
@andreidaniacovache 2 жыл бұрын
Doesn't the arduino have an internal voltage reference that you can use? Most microcontrollers I've used have that. Googled it and it seems it does have an internal 1.1V reference, that you can use, of course you'd also change the resistor divider to bring the signal to that level. Wouldn't that be a better quick fix that the battery?
@m0Ray79
@m0Ray79 2 жыл бұрын
AFAIK, ATMega has a separate pin for ADC reference voltage. Why not to use it, maybe, with a resistor and zener/LED?
@edgarbonet1
@edgarbonet1 2 жыл бұрын
Right. There is also an internal band-gap reference that should be quite immune to power-supply fluctuations. Its is somewhat low voltage though (1.35 V IIRC).
@katiagalkina4607
@katiagalkina4607 2 жыл бұрын
@@edgarbonet1 that is still full of white noise both from power supply and wires. the most clean output of uno adc in my experiments is just to feed the supply voltage to external reference pin. in this case as mentioned, the surge current of motor upon action and sampling rate of adc causes the problem.
@berk473
@berk473 2 жыл бұрын
Great knowledge👌🏽!
@datawolk
@datawolk 2 жыл бұрын
I think in this case its the sample and hold circuit of the adc. Since the aref of the Uno is on the 5v supply rail. So it should be proportional to the voltage drop.
@johntoe6127
@johntoe6127 2 жыл бұрын
I try to put all inductive loads on their own power supply. I use input from a 12v or 9v wall cube. Then split that between two inexpensive buck converters that drop the voltage. One buck converter powers all the inductive loads (motor/solenoid/relay/servo) The second buck converter powers only the microcontroller. The MCU then has it's own power supply with nothing to cause surges. The 12v Vin can usually easily handle varying loads from either buck converter.
@brandontay2053
@brandontay2053 Жыл бұрын
This is usually what I do too! It has worked pretty well so far!
@RespectEdits
@RespectEdits 2 жыл бұрын
Could adding a capacitor to the power supply fix the issue?
@portblock
@portblock 2 жыл бұрын
simple way, use an precision reference voltage for the ADC LM4040 or similar
@gdotone1
@gdotone1 2 жыл бұрын
more on resistor dividers
@tobias4lyph
@tobias4lyph 2 жыл бұрын
Cardboard and tape craft science is what I do best ;)
@CC-tb6tj
@CC-tb6tj Жыл бұрын
Can you pls do a video on resistor dividers
@omargamal665
@omargamal665 Жыл бұрын
very useful thank you
@Error_00101
@Error_00101 2 жыл бұрын
Ugh i remember when we learned about this in school. There is a whole field about providing clean power to all components (with lowpass filtering, shielding, dividing power correctly,...) there are all sorts of things you can do with hardware to prevent these things. When we measured with our µControler and had (more or less) the same problem to solve only we HAD to use the power provided via the controller (part of the exercise).
@rexjuggler19
@rexjuggler19 2 жыл бұрын
Good one.
@fluiditynz
@fluiditynz 2 жыл бұрын
There's another common issue I've dealt with in the past which is charge couples input voltage sharing between channels. Especially with high impedence inputs and rapid channel switching (which I used to have back in the old days using assembler. If you're running python it's kind of slow so might not be an issue but otherwise you might need to do some dummy reads or extend your input sample time depending on your hardware and how much into the nuts and bolts you're having to dive to extract the readings. i.e. for Arduino, it's already hiding most of the work of doing an analogue reading behind the calls you make.
@KangJangkrik
@KangJangkrik 2 жыл бұрын
Hobbyist-grade sensor often either biased or a bit noisy, need to be calibrated and filtered in Arduino program. This is why industry-grade sensor like Siemens and Omron are bloody expensive because calibration is hard to do and they did the job very well
@zyghom
@zyghom 2 жыл бұрын
Thank you - I realised similar issues some time ago, and since then, all my MCU based sensors have: LDO and bunch of capacitors, to make sure the Vin is as stable as possible. Vref in MCU crap ;-) (because it is probably not referenced to the Vin but Vref, however if Vin is unstable then Vref as well) EDIT: btw, this issue you are showing is typical: "LAB only problem" because in the real life application you were describing there was... no motor, right? ;)
@PinakiGupta82Appu
@PinakiGupta82Appu 2 жыл бұрын
Please make a video on the Adafruit TinyUSB library and its implementations in CDC and HID (both host and device) modes. It would be better if you can use something which incorporates an RP2040 controller. Raspberry Pi Pico is cheaper. The codes should perform simple tasks without making things difficult to understand.
@OmidAtaollahi
@OmidAtaollahi Жыл бұрын
tnx. great.
@thevitruvianman9781
@thevitruvianman9781 Жыл бұрын
Why not an stm32 example but thanks
@hasanalattar9561
@hasanalattar9561 2 жыл бұрын
I thought you will talk about digital filters instead of caps and beads
@brianczuhai8909
@brianczuhai8909 2 жыл бұрын
You are measuring an independent absolute voltage source with an A/D. Your input is not ratiometric with the Vref. To measure absolute A/D voltages, you need to also feed in a stepped down Vref and a precision voltage reference into 2 other A/Ds. Then you can derive what the voltage of Vref is. A/Ds read a count value relative a full count value representing Vref. It is wrong to assume your A/Ds read absolute voltages. You need a discussion on ratiometric A/D configurations and one on what’s needed to read absolute voltages on A/Ds. The easy way out of this problem is to use a weight and pendelum or connect the arduino to a clean power separate from the motor power. Vref ~= 5V and be fairly stable.
@katiagalkina4607
@katiagalkina4607 2 жыл бұрын
thanks a lot, it was certainly interesting. 👍 but if had to do it in a more precise and reliable way I wouldn't use an Uno! Instead I'd go for a military/aerospace/life support ADC chip and a bridge to my pc with proper filtering and shielding. 😁
@sathirasilva4958
@sathirasilva4958 2 жыл бұрын
How about using galvanic isolation, though? (instead of using multiple power rails)
@gdotone1
@gdotone1 6 ай бұрын
more more embedded
@brianczuhai8909
@brianczuhai8909 2 жыл бұрын
I cringe when I hear people are reading voltage levels when using their A/Ds. They need to get out of this fantasy land in assuming Vref = 5V. Ratiometric configurations address much of this. Just think of A/Ds as being a count value relative to Vref and not an absolute voltage reading.
@sameerplaynicals8790
@sameerplaynicals8790 2 жыл бұрын
you are my father
@unperrier5998
@unperrier5998 2 жыл бұрын
No code at all video.
@vectoralphaSec
@vectoralphaSec 2 жыл бұрын
yes it's great
@unperrier5998
@unperrier5998 2 жыл бұрын
@@vectoralphaSec not my point.
How to use an ADC (embedded example in C)
14:56
Jacob Sorber
Рет қаралды 31 М.
Pulling Back the Curtain on the Heap
21:38
Jacob Sorber
Рет қаралды 37 М.
IL'HAN - Qalqam | Official Music Video
03:17
Ilhan Ihsanov
Рет қаралды 700 М.
Try this prank with your friends 😂 @karina-kola
00:18
Andrey Grechka
Рет қаралды 9 МЛН
Правильный подход к детям
00:18
Beatrise
Рет қаралды 11 МЛН
Revisiting print debugging. Is it that bad?
9:25
Jacob Sorber
Рет қаралды 10 М.
Debugging with Core Dumps
9:16
Jacob Sorber
Рет қаралды 66 М.
Tips on Improving ADC Measurement Accuracy and Resolution Part 1
24:21
What Actually is Embedded C/C++? Is it different from C/C++?
11:05
Jacob Sorber
Рет қаралды 157 М.
How do I access a single bit?
11:07
Jacob Sorber
Рет қаралды 23 М.
Utilizing the Arduino ADC Internal Reference
17:04
ForceTronics
Рет қаралды 27 М.
Can I write to NULL (0x0000000000) without seg faulting?
6:59
Jacob Sorber
Рет қаралды 29 М.
The Multiple Paths through Embedded Systems
29:04
Jacob Sorber
Рет қаралды 10 М.
How to Get Started Learning Embedded Systems
11:08
Jacob Sorber
Рет қаралды 290 М.
IL'HAN - Qalqam | Official Music Video
03:17
Ilhan Ihsanov
Рет қаралды 700 М.