TUTORIAL: How to Measure / Read Voltages Into Arduino - (Part 3/3 Voltage Dividers - Analogue)

Поделиться
HTML-код
  • Опубликовано: 20 авг 2024
  • A tutorial in which I talk about reading voltage into Arduino. There are two main paths to take; Less than 5v and greater than 5v. I talk about how to handle both scenarios.
    This video is about voltage dividers in practise - This video is a demonstration with wireup and code for a specific example.
    For those who wish to support the channel, my Patreon account is here: / antony131186

Комментарии • 40

  • @kenadams4246
    @kenadams4246 3 месяца назад

    Nice video Antony. Love your laid back style in teaching your information. You are awesome! Please keep videos like this one coming!👍👍

  • @petermccool9396
    @petermccool9396 2 года назад

    Next step, '555' timer 🤭
    I'm in the process of building a gps speedometer for my Virago XV400.
    Going to add a 'battery voltage /charge indicator using a Ws2812b led.
    Some comments / inputs from your previous videos on this.
    1. I'd use an external Vref for the arduino, say 3.3V from voltage regulator. This would avoid any Vsupply issues. Note, I found setting vref to INTERNAL was' iffy', DEFAULT worked better. Of course, EXTERNAL if you go that way.
    2. To protect the A input, I'd try a zener diode maybe 4V7 on the input if using 3V3 ref.
    3. For me, the top end voltage I'll use 20V as could get that high if the voltage regulator goes North.
    4. Someone commented when using an LED segment display it's too fast around the loop(). Try using the Watchdog Timer, say set @ 500mS and update the display within the ISR.
    I might do some experiments this week see what's a good combination.
    I've seen on some MPPT solutions, an R/10V zener used as voltage divider. I haven't got my head around that one, yet!

  • @onlyiwilknow
    @onlyiwilknow 4 года назад +1

    Anthony, Thanks for your vid. It did cover everything really well and easy to follow.
    I now have this issue and need some help.
    I followed your instructions to the letter:
    Used four NodeMCU ESP8266 and build this voltage measure unit to constantly test my solar backup batteries.
    I used two 10kOhm and a 4.75kOhm resistors.
    After setting it up on a breadboard I connected all four to the same Laptop Power supply. 15Volt and 4Amp to finetune the formulas so all would be giving the exact same reading.
    They were connected for about 10 days and I also connected to a battery charger that acts as a battery providing 13.4 volts.
    So far I had no issues, just twigging the formula.
    Today I decided to swop over to the batteries I want to monitor. It is Gel batteries 12 Volt each 200 Ah batteries.
    After connecting I double-checked the + and - and hook op the power supply to the USB cable. At the time I think I heard a soft pop sound, but continue connecting.
    After I connected three I thought I should first check if the readings are published to my MQTT server as expected.
    No readings:- So I tested the power supply that was feeding the NodeMCU's and all seemed fine.
    When I connected the last one I heard an audible thump sound and a small flash inside the protective box.
    When I opened it, I noticed that two connectors from the micro USB that are soldered to the PCB were burned and caused the flash.
    I am really baffled as I did follow your instructions, tested the set for about 10 days and the ONLY thing that changed, was the AMPS.
    from 4 Amp to 200 Amp
    Any ideas?

    • @GaryMarkowski
      @GaryMarkowski 7 месяцев назад

      @5:10 in the video, he mentions you could use a resistor here as well, but does not share why. I think you answered that question as to why you may need to also insert a resistor, which is to reduce the amps being fed into the analog input. The max current being fed into an Arduino analog pin is 40 mA (0.040 Amps). Also, with 200 Amp, you may need to use resistors that are designed to handle higher watts. So it is not just resistance, such as 10K. The resistors may need to be thicker to handle the 200 amps, and you may need to take into account how many amps you can send to the analog input.

    • @AntonyCartwright
      @AntonyCartwright  7 месяцев назад

      It sounds like a miswire.

    • @AntonyCartwright
      @AntonyCartwright  7 месяцев назад

      So, even 1 X 10k resistor is enough to protect the microcontroller from 12v, because 12v / 10,000 = 1ma. There's so much resistance that only 1ma can get through regardless of the CCA of the battery.

  • @31MikeR
    @31MikeR 6 месяцев назад

    This was a great explanation. Very clear. THANK YOU.

  • @Dorff_Meister
    @Dorff_Meister 2 года назад

    Thanks! I'm powering an ESP32 circuit with a pair of 18650 cells (in series), using an
    LM2596 to step down the voltage. I want to keep an eye on the voltage. Dividing the voltage by three with three 100K Ohm resistors gave me the expected one third voltage. I'm reading it with an ADS1115 as I've heard the analog input on the ESP32 is sub-par and I already had the ADS1115 in my project, so this wasn't really a problem. Seems to be working great. Adding the additional battery voltage sensor (and a second sensor with battery in percentage) within ESPHome was a snap.

  • @ggrizzisabear6912
    @ggrizzisabear6912 4 года назад +1

    This vdo save my life THANK YOU SO MUCH!

  • @stuffoflardohfortheloveof
    @stuffoflardohfortheloveof 2 года назад

    Very well explained. I now understand. Thanks 👍🙂

  • @hoofheartedicemelted296
    @hoofheartedicemelted296 Год назад

    Thanks Mr Cartwright.

  • @onlyiwilknow
    @onlyiwilknow 4 года назад +1

    Thank you so much for your excellent vid:-
    I want to monitor my four PV system batteries and the voltages have to be spot on.
    (I want to use that info via my MQTT server and with Node-RED trigger, contactors to protect batteries)
    So with a constant supply of 13.4 Volt, I added a 19.72 K Ohm and 4.94 K Ohm resistors.
    I then measured with a digital multimeter:-
    Battery input 13.4V
    Input AO and Gnd 2.66 Volt
    Node MCU ESP8266EX 3.22 Volt.
    My calculations then are:
    MVPC: 2.66 / 1024 * 1000 = 3.14453125
    Multiplier: 13.44 / 2.66 = 5.03759398
    I then get a reading of 14.21 Volts
    (With an analog count of 897)
    What am I doing wrong?
    - It is .81 Volt off, and for Deep cycle batts it is a lot
    Regards
    Frits

  • @mdabusayed5710
    @mdabusayed5710 4 года назад

    complete explanation ...Thank U @Sir

  • @LoiNguyen-um7de
    @LoiNguyen-um7de 4 года назад +2

    what is MVPC, anyone can explain it to me ?

  • @sasankasulakshana1329
    @sasankasulakshana1329 3 года назад +1

    I am planning to measure high voltage like 300v-500v DC from this method. It is possible right?
    thank you

  • @BasilHerb
    @BasilHerb 4 года назад

    Hi!
    I realise this is an older Tutorial, but I stumbled across this to figure out how to make sure my LiPos don't get below a certain Voltage, to protect them.
    After watching all three of these Tutorials, I'Ve come to wonder if this method works with Lipos without problem... I have a 1s and a 2s LiPo that I need to Monitor this way.
    Thank you very much for your time and thank you for these great Tutorials!

    • @AntonyCartwright
      @AntonyCartwright  4 года назад

      It works with everything. For 1s, it's really simple. For 2s, you'll need a divider as 8.4v is too much voltage for Arduino.

    • @BasilHerb
      @BasilHerb 4 года назад +1

      @@AntonyCartwright
      Thank you very much for the reply. I've managed to make it work perfectly.
      Probably the best Tutorial out there for this. You have no idea how long I've tried to search for something like this, and all I'd get is the usual LiPo Voltage Buzzer/Meter.

    • @AntonyCartwright
      @AntonyCartwright  4 года назад

      @@BasilHerb It's true. Many other RUclipsrs don't seem focus their videos correctly. The most common thing I see is that most of them fail to address the issues which viewers are interested in, namely, the bare minimum amount of info in order to get the thing to work.

  • @quickfixengineeringltd8035
    @quickfixengineeringltd8035 3 года назад

    Do a video on reading frequency

  • @korishan
    @korishan 6 лет назад +2

    Now go back and do a revisit on code updates to make the ADC more accurate by implementing the code to check for internal chip voltage 😎 jk
    Good work on your presentations.
    One thing I didn't notice you say (which, you may have and I just missed it) is that the higher the voltage you are dividing, the worse the resolution becomes. Also, the more dividers that are used, the worse the resolution. This can be an important factor when needing to measure high voltage (like mains for example) and you can only get 0.1V resolution. Kinda skews kWh usage after awhile.

    • @AntonyCartwright
      @AntonyCartwright  6 лет назад

      Hey Mr Korishan, I suppose I should do really. ;-) I never mentioned anything about that other stuff either. Sometimes its so hard to draw the line on what is excessive and what isn't.

    • @korishan
      @korishan 6 лет назад

      It's only excessive when the content that's being adding doesn't have any real meaning to the overall theme or direction of the project. So if you went off and started talking about how the birds pooped all over your solar panels while you were discussing the mppt controller, that'd be excessive 😜

    • @AntonyCartwright
      @AntonyCartwright  6 лет назад

      Korishan it's hard to explain though, but sometimes, there is a massive amount of relevant material. Lol. For example, in this video, I could have talked about ADCs, etc. It would have given viewers better understanding, but I thought it was too much.

    • @yashwantkumar3233
      @yashwantkumar3233 4 года назад

      @@AntonyCartwright hello,
      I want to measure voltage for common power source, how to do that ?
      I mean to say that, can i measure the voltage of same battery, which is powering up the Arduino ?
      If yes, then how to do that ?

  • @juliussarmiento7708
    @juliussarmiento7708 3 года назад

    Perfect

  • @blakerhoades6356
    @blakerhoades6356 3 года назад

    What resistors would I need to make it draw less current and handle a max of 17 volts just to be safe cuz my charger charges at 16 volts?

  • @kashifshad3265
    @kashifshad3265 4 года назад +1

    I had a question. Basis on the voltage detected by the arduino can I program it in such a way that it says the arduino should turn on only if voltage exceeds 13 volts?

  • @shehriyarbinak3776
    @shehriyarbinak3776 4 года назад

    can you help me out with RMS voltage measurement with mains supply for three-phase I have tried Emonlib it works well but not working for individual voltage sensors.

  • @pettypavlow8330
    @pettypavlow8330 2 года назад

    Can we measure current with this process? Or is there any easier way with Arduino.

  • @joseespinosa6923
    @joseespinosa6923 5 лет назад

    what if i had a source made only with a full bridge rectifier, a 47u capacitor and a 100k resistance in paralel, ....i want to measure that voltaje with arduino in the way you do....but there is a problem, the arduino ground always may have the same reference that the source, but the dc voltage of this source is compound of (for example) +50v and -50v, and arduino would measure 100v....what hapend if i conect -50 to the arduino ground? a shortcircuit?.....i ask you that beacause i did that, i made a voltage divisor,and sometimes i had a -50v conected to the arduino ground and the arduino measured that 100v without problems almost 20 times but then arduino died :( ....i dont know exactly why at the begining it didnt crash, and then it did,....im confused

  • @zawirzahid6506
    @zawirzahid6506 6 лет назад

    sir you did not mention that where did you get the value of mvpc=4.55?. and what it indicates for?.

    • @AntonyCartwright
      @AntonyCartwright  6 лет назад +1

      Hi, that should be described in part two. 4.55 is the amount of millivolts per ADC count. It's VCC / 1024 * 1000.

    • @zawirzahid6506
      @zawirzahid6506 6 лет назад

      ok thanks for the quick reply sir

    • @zawirzahid6506
      @zawirzahid6506 6 лет назад

      sir vcc indicate my power supply value or from 5v arduino?. I means if i used 12v power supply.. my vcc is 12v right?.

    • @AntonyCartwright
      @AntonyCartwright  6 лет назад

      Zawir Zahid Arduino vcc should be near 5v.

    • @zawirzahid6506
      @zawirzahid6506 6 лет назад

      Antony Cartwright ok sir i understand now.. The value mvpc from the arduino itself.. Sir if i use resistor 680k and 100k.. And use supply 12v.. The value for the volt divider. Is 1.53v.. And i wanna know about the float multiplier that u used. I used only 2 resistor as i mention above.. And the value from supply that i used is 12v but the serial monitor only display 9.5 volt.. Why this happen?