Arduino Tutorial 10: Understanding How To Read Analog Voltage using analogRead Command

Arduino Tutorial 10: Understanding How To Read Analog Voltage using analogRead Command

Paul McWhorter

5 лет назад

461,497 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@clems6989
@clems6989 - 24.07.2024 22:30

I'm back on the Arduino training, I have to refresh my brain... Thanks Again !!

Ответить
@cinibar
@cinibar - 26.07.2024 08:23

Great videos thanks! Hope you can find the time to answer this for me. I'm playing with the HC12 transceiver modules and would like to transmit the battery voltage of a remote system. By your, (and others), I get how to read a voltage into the microP and display it on a lcd, but I don't know how to deal with transmitting the data. Is the data automatically available on the TX pin which would connect to the RX pin on the hc12? Of course there has to be a reciprocal setup on the receive hc12 to then transfer it to a display. I guess this would make a great video all by itself! Thanks so much for our thoughts and time! Cheers!

Ответить
@mhandelll6040
@mhandelll6040 - 12.08.2024 07:46

Hello Paul, thanks for your lecture. I have a question: I use 2 resistors with values ​​of 220 ohms and 1000 ohms, I have measured the voltage value V1 corresponding to the 1000 ohms resistor but cannot measure the voltage value V2 corresponding to the 220 ohms resistor. Can you solve this?

Ответить
@knunn552
@knunn552 - 14.08.2024 02:52

Paul, all beverage jokes aside, it was a tad unclear WHY the ADC went from 0-1023. Based on some research, it appears this is just an arbitrary number the makers of the Arduino Uno chose to allow for the flexibility when working with volts. If they wanted to, this number could've been 2046, 512, or any other number. 1023 seems to be a good compromise for the price we pay for the Arduino. Could be wrong

Ответить
@HVAC_Tips_Tricks_Calcs
@HVAC_Tips_Tricks_Calcs - 21.08.2024 21:36

Having fun, great stuff. But I have a problem. When I put the A3 wire before the first resistor, I get a value of 5. After first resistor, value of 4. After second resistor, value of 0. Tried different wires, tried rebooting.
Same thing happens when I use my VOM to check voltages and ohms. Both resistors ohm out correctly. Any thoughts? Thanks.

Ответить
@annaiweighingscales2325
@annaiweighingscales2325 - 27.08.2024 14:29

how to find voltage across R1 using single ground

Ответить
@jackoneill707
@jackoneill707 - 05.09.2024 17:31

Excellent material

Ответить
@jackoneill707
@jackoneill707 - 05.09.2024 17:31

Excellent material

Ответить
@Ching-sx2nc
@Ching-sx2nc - 07.09.2024 13:56

Why dont u use the command called map to convert the scale from 0-1023 to 0-255. Also, how can you give output from Arduino with no output command??

Ответить
@TwilightZone13
@TwilightZone13 - 09.09.2024 22:49

How would I read the voltage going across the first resistor? Or how can I read 3.84 volts that was calculated for the 330 ohm resistor?

Ответить
@seanselk6450
@seanselk6450 - 10.09.2024 16:21

how did you fix the .35V problem at the end of the video? I can't fix it?

Ответить
@navnitpatil421
@navnitpatil421 - 12.09.2024 16:04

Why do we need to put V2=0 in the said program ?

Ответить
@casuci
@casuci - 13.09.2024 00:39

Could you also use the map function to get V2?

Ответить
@SionElfed
@SionElfed - 15.09.2024 19:13

How do you get syntax highlighting? I have it but it only highlightes words like int, numbers, and any word with () after it, even if that word is completly misspelled. How do i get it to work?

Ответить
@ReDoG129
@ReDoG129 - 26.09.2024 17:59

I'm getting 1023 when I hook it above R1, but when I attach it above R2, I'm getting 236 instead of 292.

Ответить
@johannamit4388
@johannamit4388 - 28.09.2024 15:20

Thanks Paul. I'm here mainly to learn how to program the Arduino. In the early 80's I used to write programs for the Intel 8748/49 microcontroller in machine language for test jigs at work and also my personal projects. It was great fun and very challenging. I came across the Arduino kit while shopping in Amazon and thought it would be nice to get back into it again and keep myself busy in my retirement. Circuits aren't a problem as I have designed and built lots but I'm here for the programming. You are an excellent teacher and thanks for the time and effort you've put into making these videos.

Ответить
@samoryleyankee
@samoryleyankee - 08.10.2024 22:50

Hello, Paul I'm NOT getting the results that your getting on the analog monitor (I am on MacBook) I get this box underneath ny code withdow.

Output Serial Monitor x
Message ( Enter to send message to 'Arduino Uno' on '/dev/cu.Bluetooth-incoming-Port' - Drop down box - Drop down box (9600 baud)
Where did I go wrong?

Ответить
@0124akash
@0124akash - 10.10.2024 17:47

Sir, Arduino can read negative voltage?
Example is:
+5V Input to A0
255 output from PWM pin
But I want to
+5V = 255
0V = 127
-5V = 0
This is possible sir ?

Ответить
@stephengray8007
@stephengray8007 - 19.10.2024 10:28

thank you Mr MacWhorter. Probably too late to be adding comments, but I appreciate your videos very much

Ответить
@MortazaHussainZada
@MortazaHussainZada - 20.10.2024 02:32

I don't know why I am still getting a 5.0V even after I used the 100k resistor

Ответить
@prosonnonaskar7648
@prosonnonaskar7648 - 29.10.2024 13:14

Understood Everything!
and assignment done!
I did with 100 ohms and 1k ohms resistors

Ответить
@richardloss4207
@richardloss4207 - 18.11.2024 05:35

thank you!!!! I'm really enjoying these tutorials. they are helping a lot.

Ответить
@TheFastGXC
@TheFastGXC - 28.11.2024 04:29

What am I missing. This has been giving me problems. I am using a Chromebook and the Cloud app, but that should not make a difference. I have a jumper going from 5V to A2 on the Serial log I get 16 even when plugged in the 3.3V gives me 16

int readPin=A2;
int V2=0;
int delayTime = 500;

void setup() {
pinMode(readPin,INPUT);
Serial.begin(9600);
}

void loop() {
V2=(analogRead,readPin) ;
Serial.println(V2);
delay(delayTime);

}

Ответить
@brandonly27
@brandonly27 - 28.11.2024 06:10

You can also use the Arduino "Map" function to scale your input. I use it often.

Ответить
@sespach
@sespach - 02.12.2024 04:59

I’m digging it and I’m a non math person.

Ответить
@chadyonfire7878
@chadyonfire7878 - 05.12.2024 04:29

Legend man

Ответить
@taghyper5312
@taghyper5312 - 12.12.2024 18:08

almost 2025, still on here, I'm loving your videos Paul. I watched the first series when I was around 12 to learn coding. Now i'm 17 wanting to relearn arduino and your videos are incredible!!

Ответить
@AslamKalungi
@AslamKalungi - 13.12.2024 10:00

this was great but i have kind of not understood what you did for sure please could you elaborate even more

Ответить
@AslamKalungi
@AslamKalungi - 13.12.2024 10:06

i have watched it again but really this is confusing

Ответить
@don8919-t2n
@don8919-t2n - 14.12.2024 10:00

May be your oldest student or at least close to it, but you're presentations are great. Up to this point the home work has been just one evening of study, this one might take all weekend but going to do my best...Don

Ответить
@ehsanbahrani8936
@ehsanbahrani8936 - 20.12.2024 22:54

Thanks a lot ❤

Ответить
@RussellCambell
@RussellCambell - 25.12.2024 02:59

I made a variable called float power = 5.0 😊. In fact i made all varable float it seemed to work fine. The only constant i had in the loop code was the 1023

Ответить
@scottwindham9824
@scottwindham9824 - 03.01.2025 20:35

Digging this format! I have a strong background in hardware controls but very light on the programming side. I'm a bit confused as to why when declaring the variable readVal (int readVal) it is not set to a value. I get int V2=0, but not sure I understand readVal not being set to a value (int readVal=something). I am learning so much, this lesson seemed to speed up a bit for me. Thanks again for the most excellent content.

Ответить
@andremercante8451
@andremercante8451 - 04.01.2025 23:44

What if you want to read the other resistor? As far as I understand, and tested myself, you only have three places to read voltages: Near the source, that reads 5V, near the ground, that reads 0V, and in the middle, that reads 1.16V, is there a way to place A3 in order to read R1's voltage? Thanks a lot for the tutorial, I'm loving it!

Ответить
@raziiier
@raziiier - 06.01.2025 22:45

Just took a course at DTU Denmark. My teacher used all your videos. Huge + to you. A bit unprofessional of my teacher but huge work from you. keep up the good work.

Ответить
@ethanwells2712
@ethanwells2712 - 06.01.2025 23:25

The price of that kit has doubled since this video was posted. It has only been five years!!!

Ответить
@slowtism4523
@slowtism4523 - 09.01.2025 23:19

hvala djedo!

Ответить
@ngguideline
@ngguideline - 13.01.2025 22:29

Hi Paul, help please. I have set up the Arduino and circuit but for some reason the Serial Monitor reads 0 continuously but if I remove the A2 or gnd leads the SM shows various readings. This happens with a separate Arduino.

Ответить
@imetr8r
@imetr8r - 20.01.2025 14:09

I think you should divide by 1024 not 1023. i.e. 2.5v * 1024/5 = 512 whereas 2.5v * 1023/5 = 511.5.

Ответить
@indiedavecomix3882
@indiedavecomix3882 - 21.01.2025 08:38

What I've learned from this lesson was always have a voltmeter handy. 😁

Ответить
@CircleFly
@CircleFly - 01.02.2025 19:48

I'm getting it now. I tried a 2000 and a 10 ohm resistor. First I calculated on pen and paper the voltage drop, getting 0.02. Then I ran the code and got the correct value, 0.02.

Ответить
@garethedwards3379
@garethedwards3379 - 07.02.2025 09:10

The first lesson I’ve found tough! Maths was never my strong suit. I did feel this was a bit quick paced for me. I’ll watch it in full again and and again until it sinks in properly as it’s clearly got tangible benefits. I’m hoping to use some of these projects in my own job and having a clear voltage indicator available on some of the equipment at work would be hugely beneficial. Thanks again for all your time and effort to make these videos!

Ответить
@nightvoltv1714
@nightvoltv1714 - 22.02.2025 20:37

Hi Paul, I dont understand why V2=0 :(

Ответить
@MartinMantey-l8j
@MartinMantey-l8j - 23.02.2025 02:59

I really like your tutorials, however, your math on the ADC on Tutorial 10 is slightly off. A 10-bit ADC stores the voltage being read in memory, with 10-bits that 1024 possible values. So, you need to divide by 1024 like it states in the ATMEGA328P datasheet. ADC = Vinx1024/Vref. I know the error is minimal 1/1024; however, fundamentally it is incorrect. You must think of 0 as a range from 0 to the approximately 5 mV until it becomes a 1. At the other end the 5 V is 4.995 V to 5.0 V, with 5 V as the default reference.

Ответить
@RenierVanMaastricht
@RenierVanMaastricht - 23.02.2025 11:16

These tutorials help me so much not only with Arduino, but just in general testing of electrical circuits and finally understanding how to do measurements in a simple effective way....
PAUL is a legend, thank you for the time and work you put in to making our lives simpler... Thanks mate

Ответить
@hartyguyton3800
@hartyguyton3800 - 08.03.2025 01:03

V2 = (readVal/1023.)*5. ; only to rearrange it in a correct way. thank you for your videos and for your efforts you put in.
I came here because ChatGPT recommended you!

Ответить
@ederdeet1
@ederdeet1 - 10.03.2025 22:51

I am a retired dental tech and I really wanted to have a hobby that didn't require a bunch of large equipment. I have always been interested in electronics. I started building HealthKits at the ripe age of nine. Now I have the time to play with it. Your videos are amazing! I have learned so much in the past few weeks. I have the Arduino mega and with your instructions I am really enjoying my retirement. Thank you for taking the time to do your lessons for us.

Ответить
@khoabui1392
@khoabui1392 - 11.03.2025 06:47

This guy is an actual legend. Top-quality stuff being free like this is a blessing. I have always had so many difficulties grasping these concepts, like PWM or how the analogRead shows a weird value. This guy just demolished them all. THANK YOU, SIR. Your Arduino tutorials are top-notch.

Ответить
@cosmicthanos
@cosmicthanos - 13.03.2025 22:40

does anyone know why i got 2.49 as a reading?

Ответить