Це відео не доступне.
Перепрошуємо.

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

Поділитися
Вставка
  • Опубліковано 16 сер 2024
  • Patreon ➤ / jacobsorber
    Courses ➤ jacobsorber.th...
    Website ➤ www.jacobsorbe...
    ---
    ***
    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.jacobsorbe...
    people.cs.clem...
    persist.cs.clem...
    To Support the Channel:
    + like, subscribe, spread the word
    + contribute via Patreon --- [ / jacobsorber ]
    Source code is also available to Patreon supporters. --- [jsorber-youtub...]

КОМЕНТАРІ • 35

  • @filips7158
    @filips7158 Рік тому +8

    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 Рік тому +6

    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 Рік тому +7

    AFAIK, ATMega has a separate pin for ADC reference voltage. Why not to use it, maybe, with a resistor and zener/LED?

    • @edgarbonet1
      @edgarbonet1 Рік тому +3

      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 Рік тому +5

    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?

  • @portblock
    @portblock Рік тому +1

    simple way, use an precision reference voltage for the ADC
    LM4040 or similar

  • @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 Рік тому +1

    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!

  • @tobias4lyph
    @tobias4lyph Рік тому +5

    Cardboard and tape craft science is what I do best ;)

  • @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).

  • @RespectEdits
    @RespectEdits Рік тому +1

    Could adding a capacitor to the power supply fix the issue?

  • @gdotone1
    @gdotone1 Рік тому +1

    more on resistor dividers

  • @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.

  • @rexjuggler19
    @rexjuggler19 Рік тому

    Good one.

  • @CC-tb6tj
    @CC-tb6tj Рік тому

    Can you pls do a video on resistor dividers

  • @omargamal665
    @omargamal665 11 місяців тому

    very useful thank you

  • @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.

  • @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.

  • @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

  • @berk473
    @berk473 Рік тому

    Great knowledge👌🏽!

  • @hasanalattar9561
    @hasanalattar9561 Рік тому

    I thought you will talk about digital filters instead of caps and beads

  • @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? ;)

  • @thevitruvianman9781
    @thevitruvianman9781 Рік тому

    Why not an stm32 example but thanks

  • @OmidAtaollahi
    @OmidAtaollahi 10 місяців тому

    tnx. great.

  • @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. 😁

  • @gdotone1
    @gdotone1 Місяць тому

    more more embedded

  • @sathirasilva4958
    @sathirasilva4958 Рік тому

    How about using galvanic isolation, though? (instead of using multiple power rails)

  • @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 Рік тому +2

    No code at all video.