Тёмный

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

Jacob Sorber
Подписаться 161 тыс.
Просмотров 6 тыс.
50% 1

Patreon ➤ / jacobsorber
Courses ➤ jacobsorber.thinkific.com
Website ➤ www.jacobsorber.com
---
***
Welcome! I post videos that help you learn to program and become a more confident software developer. I cover beginner-to-advanced systems topics ranging from network programming, threads, processes, operating systems, embedded systems and others. My goal is to help you get under-the-hood and better understand how computers work and how you can use them to become stronger students and more capable professional developers.
About me: I'm a computer scientist, electrical engineer, researcher, and teacher. I specialize in embedded systems, mobile computing, sensor networks, and the Internet of Things. I teach systems and networking courses at Clemson University, where I also lead the PERSIST research lab.
More about me and what I do:
www.jacobsorber.com
people.cs.clemson.edu/~jsorber/
persist.cs.clemson.edu/
To Support the Channel:
+ like, subscribe, spread the word
+ contribute via Patreon --- [ / jacobsorber ]
Source code is also available to Patreon supporters. --- [jsorber-youtube-source.heroku...]

Опубликовано:

 

30 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 35   
@filips7158
@filips7158 Год назад
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 Год назад
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
@m0Ray79
@m0Ray79 Год назад
AFAIK, ATMega has a separate pin for ADC reference voltage. Why not to use it, maybe, with a resistor and zener/LED?
@edgarbonet1
@edgarbonet1 Год назад
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 Год назад
@@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.
@andreidaniacovache
@andreidaniacovache Год назад
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?
@johntoe6127
@johntoe6127 Год назад
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!
@datawolk
@datawolk Год назад
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.
@tobias4lyph
@tobias4lyph Год назад
Cardboard and tape craft science is what I do best ;)
@portblock
@portblock Год назад
simple way, use an precision reference voltage for the ADC LM4040 or similar
@berk473
@berk473 Год назад
Great knowledge👌🏽!
@OmidAtaollahi
@OmidAtaollahi 10 месяцев назад
tnx. great.
@omargamal665
@omargamal665 11 месяцев назад
very useful thank you
@RespectEdits
@RespectEdits Год назад
Could adding a capacitor to the power supply fix the issue?
@fluiditynz
@fluiditynz Год назад
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.
@Error_00101
@Error_00101 Год назад
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 Год назад
Good one.
@zyghom
@zyghom Год назад
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? ;)
@KangJangkrik
@KangJangkrik Год назад
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
@PinakiGupta82Appu
@PinakiGupta82Appu Год назад
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.
@gdotone1
@gdotone1 Год назад
more on resistor dividers
@CC-tb6tj
@CC-tb6tj 11 месяцев назад
Can you pls do a video on resistor dividers
@brianczuhai8909
@brianczuhai8909 Год назад
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 Год назад
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. 😁
@hasanalattar9561
@hasanalattar9561 Год назад
I thought you will talk about digital filters instead of caps and beads
@thevitruvianman9781
@thevitruvianman9781 Год назад
Why not an stm32 example but thanks
@sathirasilva4958
@sathirasilva4958 Год назад
How about using galvanic isolation, though? (instead of using multiple power rails)
@gdotone1
@gdotone1 Месяц назад
more more embedded
@brianczuhai8909
@brianczuhai8909 Год назад
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 Год назад
you are my father
@unperrier5998
@unperrier5998 Год назад
No code at all video.
@vectoralphaSec
@vectoralphaSec Год назад
yes it's great
@unperrier5998
@unperrier5998 Год назад
@@vectoralphaSec not my point.
Далее
Is memcpy dangerous?
14:08
Просмотров 23 тыс.
The What, How, and Why of Void Pointers in C and C++?
13:12
The Multiple Paths through Embedded Systems
29:04
Просмотров 10 тыс.
Why Function Pointers are Awesome
11:11
Просмотров 5 тыс.
The moment we stopped understanding AI [AlexNet]
17:38
Просмотров 811 тыс.
Detect Corruption with a Checksum
13:06
Просмотров 15 тыс.
How to make memory read-only in your C programs.
12:57
A const int is not a constant.
9:16
Просмотров 66 тыс.
How to Debug a Program when the Output Looks Right
6:02