super nice educational video, I still however did not get WHY we would go for register vs built in functions but ok ;-) Great point about ref voltage btw 1k/4.7k resistors - it makes sense to measure them first or apply some reference voltmeter when the project is finished - and let me tell you from my experience: breadboard vs. soldered final project is huge difference. On Raspberry Pico ADC minimum value never goes below 450 but max goes to 64k - strange
"I still however did not get WHY we would go for register vs built in functions but ok ;-)" Two reasons I suppose. 1. It's good to understand what is happening on the chip, this is somewhat hidden from you if you are using the built in functions. 2. Depending on your use case, direct register code is going to run faster/significantly faster than using the built in functions.
@@deadly_dave yeap, in general it would be true but in this case probably not much. When I read ADC I usually make few measurements and then get AVG ;-)
I really enjoy watching detailed videos like this. It fills gaps in my knowledge and makes me more confident I can do these things myself. And you have such a great way of explaining things. Thank you!
Great Video, very well explained! However, you missed one important trick ;) One source of the ADC Mux is the internal 1.1V bandgap reference. This allows you to measure the 1.1V internal reference against Vcc as reference and thus determining Vcc without the need of a voltage divider or additional wiring!
You don't need a voltage divider. It is more accurate to use the supply as reference and then to read the internal bandgap reference. Reverse the equation to find out what reference is needed to yield 1.1V... that is your calibrated battery voltage.
Hi brother, I have a question, can we sample higher frequency periodic signals with low sampling ADCs by taking samples not from a single cycle but from multiple cycles, lets say we want a 360° waveform, so if we sample it from 360 cycle by teiggering the conversation at right time while the wave is at that phase. Then we can merge the samples from different cycles to re create the shape of the wave. This will be helpful to make a high bandwidth scope using slow Arduino. Please reply with your opinion. Thanks
@@ELECTRONOOBS Thank you for your reply, I am fan of you Following since PID Vedio Ping pong ball Amazingly explained Best ever explanation of pid concept, After watching that vedio no one can have confusion on pid Thank you so much for putting great effort
Didn't knew that the atmega328p chip had an internal temperature sensor...thanks for this informative video... Just wanted to that is it possible for the atmega to get hot while operating at the highest clock speeds?
Good tutorial. Maybe you missed to comment that in order to make accurate measurements using the internal reference, you need to measure it. The datasheet says 1.1V, but the exact value can vary from chip to chip, so in order to make precise measurements, one has to measure it and include the value in the code. There are many videos about the topic on YT (the guy with the swiss accent has one).
Thanks for explaining this. So using a prescaler increases the sampling rate of the analog pins making it possible to create an audio amplifier using a nano and a dual h-bridge motor driver.
In other cases, you've noted that the use of registers can be faster than the Arduino functions -- is there a performance benefit in their use for ADCs?
There is a seemingly better way to read VCC - Without a voltage divider, that drains the battery and without using pins. you can Read the Voltage Reference against VCC, and calculate VCC from there somewhat backwards: long readVcc() { long result; // Read 1.1V reference against AVcc ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1); delay(2); // Wait for Vref to settle ADCSRA |= _BV(ADSC); // Convert while (bit_is_set(ADCSRA, ADSC)); result = ADCL; result |= ADCH
Very useful, thanks. Can you talk about external reference standards that you can buy from ebay such as the AD584KH precision voltage reference modules? Do they improve on the accuracy of the internal reference provided by the Arduino?
I love this series and I really wanted to learn about the internal voltage reference, it will be extremely useful for some of my data logging applications. However, does anyone know how stable this voltage reference is compared to the 5V VCC e.g. when the arduino is powered with 12V (always the same supply adapter)? Is there a significant improvement in the stability?
Im not understanding the sampling rate. You said that the sample rate is 16MHz divided by a division factor (one option being 2), but the max rate is 200KHz? what happens when the division factor is 2 and why does the ADC not sample at 8MHz in this situation?
Thanks for this! The inaccuracy of analog voltage measurement has been bugging me for a long time. I see that using the default Vcc as the voltage reference is garbage due to your well-explained points. So the only way to get an accurate voltage reading is to: 1 - Use the 1.1V reference 2 - Prescale your maximum expected input voltage down to a maximum of 1.1V with a resistor divider. This leads me to see that you have to use extremely high precision resistors in your voltage divider, or you're forced to do a calibration process on every unit you build. Otherwise the single fixed scaling factor you use in the software will be inaccurate in each unit due to tolerances in the resistors. How do people normally handle this? 1%? 0.1%? What is the cost differential for these vs. default 5% resistors? I've tried to use an external 4.096V reference chip so I don't lose a bunch of resolution bringing my 80V battery pack max target voltage down to under 1.1V. Am I gaining anything with that chip or should I just massively scale down the input voltage and use the 1.1V reference? Also, how does using the Bandgap reference come into this? Does every microcontroller have the same Bandgap reference and if so, what value is it and how accurate is it? Thanks!
I have seen many old boards where the manufacturer places a potentiometer on the board to manually calibrate. Another option to calibrate each board without a potentiometer is through software. Have an accurate 5v supply on your bench and run a routine to record the digital value on the board's nonvolatile memory. Your program can use that as the max value and scale accordingly.
Hello sir, I have made the portable soldering iron V3 . But the buttons are not working properly .May be because there was no interrupts for the push buttons. If you fix the problem that would be great...
Hey man, could you build a peak detector in software using this. I have a few 328pu chips. Great video series btw. I'll be back on your patreon in a few weeks
But Internal 1.1ref bound me to measure Maximum 1.1 v drop Is it applicable for 3 3.7 v series connection Fully charged 4.2*3 12.6 Discharged 3.0*3 9v 12.6 - 9 3.6 Min 3 volt drops detection required
super nice educational video, I still however did not get WHY we would go for register vs built in functions but ok ;-)
Great point about ref voltage
btw 1k/4.7k resistors - it makes sense to measure them first or apply some reference voltmeter when the project is finished - and let me tell you from my experience: breadboard vs. soldered final project is huge difference.
On Raspberry Pico ADC minimum value never goes below 450 but max goes to 64k - strange
"I still however did not get WHY we would go for register vs built in functions but ok ;-)"
Two reasons I suppose.
1. It's good to understand what is happening on the chip, this is somewhat hidden from you if you are using the built in functions.
2. Depending on your use case, direct register code is going to run faster/significantly faster than using the built in functions.
@@deadly_dave yeap, in general it would be true but in this case probably not much. When I read ADC I usually make few measurements and then get AVG ;-)
@@zyghom
In that case refer to reason 1 💪🧠
There is also the third reason that I follow sometimes, just because you can. 😎
@@deadly_dave we are together ;-) That is why I said: "super nice educational video" ;-)
@@zyghom That's fair :)
Very interesting, the "quality" times "deep info" from your channel is unique!
Arduino Course (Spanish): bit.ly/3ldW6kO
Follow me on FACEBOOK for more: facebook.com/Electronoobs
Help me on Patreon: www.patreon.com/ELECTRONOOBS
Your series regarding registers has truly helped me better understand how things work . Thank you
I have watched it in full quality 1080p. Now I realized it is worth to do so. Nice tutorial
I really enjoy watching detailed videos like this. It fills gaps in my knowledge and makes me more confident I can do these things myself. And you have such a great way of explaining things. Thank you!
This is cool. With a PIC micro I was once able to send the DAC output to the ADC input and get the battery voltage without using any external pins.
Great Video, very well explained! However, you missed one important trick ;) One source of the ADC Mux is the internal 1.1V bandgap reference. This allows you to measure the 1.1V internal reference against Vcc as reference and thus determining Vcc without the need of a voltage divider or additional wiring!
Very good! As an undergrad, I know that it is not easy to explain this in such a short amount of time!👍👍👍
Interested in this type of content for ESP32
Me too 🙌
Advanced Arduino = BIG LIKE!
excellent presentation and sequence of information, man you are a good teacher
I was waiting for this episode.
I finally able to learn what to use with ADC.. thanx again.. pls give more videos on analog 101 series
You don't need a voltage divider. It is more accurate to use the supply as reference and then to read the internal bandgap reference. Reverse the equation to find out what reference is needed to yield 1.1V... that is your calibrated battery voltage.
This is what I was searching for whole day and Thanks for making this video.
Hi brother, I have a question, can we sample higher frequency periodic signals with low sampling ADCs by taking samples not from a single cycle but from multiple cycles, lets say we want a 360° waveform, so if we sample it from 360 cycle by teiggering the conversation at right time while the wave is at that phase. Then we can merge the samples from different cycles to re create the shape of the wave. This will be helpful to make a high bandwidth scope using slow Arduino. Please reply with your opinion.
Thanks
Very good tutorial, very good and simple way explain how to program arduino and others microcontrollers on low level. I like it !
Please do more on microcontroller
U r explaining is best
Skills
Thank you so much! I'll do more!
@@ELECTRONOOBS
Thank you for your reply,
I am fan of you
Following since PID Vedio
Ping pong ball
Amazingly explained
Best ever explanation of pid concept,
After watching that vedio no one can have confusion on pid
Thank you so much for putting great effort
I love your videos. Your uploads make my day!
Very helpful and excellent video
regards from india
Really nice vid mate. You inspire me to learn more and I started a UA-cam channel too.
Informative and clear. Super!
Didn't knew that the atmega328p chip had an internal temperature sensor...thanks for this informative video...
Just wanted to that is it possible for the atmega to get hot while operating at the highest clock speeds?
That is some really quality stuff. Brilliant 🙌
You are Genius. I want learn but to old for learning
Excellent series ..!!! Thank You for sharing ... Cheers :)
Good tutorial. Maybe you missed to comment that in order to make accurate measurements using the internal reference, you need to measure it. The datasheet says 1.1V, but the exact value can vary from chip to chip, so in order to make precise measurements, one has to measure it and include the value in the code. There are many videos about the topic on YT (the guy with the swiss accent has one).
Very helpful video
Thanks for explaining this. So using a prescaler increases the sampling rate of the analog pins making it possible to create an audio amplifier using a nano and a dual h-bridge motor driver.
Interesting video ... Especially the part of the temperature sensor
Saludos! 😍
Espero y puedas hacer un video sobre el ESP32
Excellent video as usual. 👍🏻
More register videos would be great!
In other cases, you've noted that the use of registers can be faster than the Arduino functions -- is there a performance benefit in their use for ADCs?
As always, incredible man 👌👌👌👌
Need similar knowledge about Esp32. Great video thanks.
I love 101 tutorial . thanks noobs !
Thank you a lot. Very nice explanation.
Awesome sir🔥🔥
Very nice and instructive video; thank you
Excellent video, thank you.
I love this seriessss.....
Thank you for explaining this so clearly. :)
Great content as always
Hi Bro you are doing great work.
Next video should be be on generating pwm on multiple pins at same time with register
This is amazing! more please :)
hi thanx for the video but please can you tell us witch software you use for the teaching animation ???
Thx for the fully explained video👏🏻 upload more video like this😃 this really helped me🫡
Hope you will make this type of video for esp32
What's up my friend 😊👍
There is a seemingly better way to read VCC - Without a voltage divider, that drains the battery and without using pins. you can Read the Voltage Reference against VCC, and calculate VCC from there somewhat backwards:
long readVcc() {
long result;
// Read 1.1V reference against AVcc
ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
delay(2); // Wait for Vref to settle
ADCSRA |= _BV(ADSC); // Convert
while (bit_is_set(ADCSRA, ADSC));
result = ADCL;
result |= ADCH
Very useful, thanks. Can you talk about external reference standards that you can buy from ebay such as the AD584KH precision voltage reference modules? Do they improve on the accuracy of the internal reference provided by the Arduino?
Nice video, very usefull !
So .. if we .. set .. reference to 1.1v can we used it measure.. thermocouple .. ?
I love this series and I really wanted to learn about the internal voltage reference, it will be extremely useful for some of my data logging applications. However, does anyone know how stable this voltage reference is compared to the 5V VCC e.g. when the arduino is powered with 12V (always the same supply adapter)? Is there a significant improvement in the stability?
Next: Communication Protocols😁... I'm waiting....
Very nice tutorial! There is just one issue with your code, this line is incorrect:
int value = ADCL | (ADCH
Just for summary:
So of i create external voltage reference 0.1 v (100mv) and measure 75mv
I get 75/100*1023 reading?
Tq for reply
Im not understanding the sampling rate. You said that the sample rate is 16MHz divided by a division factor (one option being 2), but the max rate is 200KHz? what happens when the division factor is 2 and why does the ADC not sample at 8MHz in this situation?
Can you please make driver drowsiness detector using raspberry pi and usb camera
thank you. nice video friend!
very well explained....
Great video, Thanks
Thanks for this! The inaccuracy of analog voltage measurement has been bugging me for a long time. I see that using the default Vcc as the voltage reference is garbage due to your well-explained points.
So the only way to get an accurate voltage reading is to:
1 - Use the 1.1V reference
2 - Prescale your maximum expected input voltage down to a maximum of 1.1V with a resistor divider.
This leads me to see that you have to use extremely high precision resistors in your voltage divider, or you're forced to do a calibration process on every unit you build. Otherwise the single fixed scaling factor you use in the software will be inaccurate in each unit due to tolerances in the resistors. How do people normally handle this? 1%? 0.1%? What is the cost differential for these vs. default 5% resistors?
I've tried to use an external 4.096V reference chip so I don't lose a bunch of resolution bringing my 80V battery pack max target voltage down to under 1.1V. Am I gaining anything with that chip or should I just massively scale down the input voltage and use the 1.1V reference?
Also, how does using the Bandgap reference come into this? Does every microcontroller have the same Bandgap reference and if so, what value is it and how accurate is it? Thanks!
I have seen many old boards where the manufacturer places a potentiometer on the board to manually calibrate. Another option to calibrate each board without a potentiometer is through software. Have an accurate 5v supply on your bench and run a routine to record the digital value on the board's nonvolatile memory. Your program can use that as the max value and scale accordingly.
Hello sir, I have made the portable soldering iron V3 . But the buttons are not working properly .May be because there was no interrupts for the push buttons. If you fix the problem that would be great...
nice tutorial thank you
excellent video
That's what I queries (why veref or vcc is not internally shorted in chip)
So we could avoid shorting in vref and vcc in battery powered project.....
Расскажите пожалуйста если можно как в регистрах настроить 12 битный ацп
Please tell how to use interupt
Hardware and software
Amazing ! Thank you
what if it's a microphone??? should i first get rid of the negative signal?
Hey man, could you build a peak detector in software using this. I have a few 328pu chips. Great video series btw. I'll be back on your patreon in a few weeks
where can i print the page you have?
Please how can i use register for more than one channel??
I need reply
Thank you very much!!
CAN YOU SUPPLY A WEIGHING SCALE PROJECT INCLUDING SOURCE CODES?
good job
Hi sir I want instrument for underground water detection special software and program can you make for me thanks
But Internal 1.1ref bound me to measure
Maximum 1.1 v drop
Is it applicable for 3 3.7 v series connection
Fully charged 4.2*3 12.6
Discharged 3.0*3 9v
12.6 - 9 3.6
Min 3 volt drops detection required
Is it safe to connect Arduino 3.3 v pin to ref
May this resolve it
Nice!
amazing video, I hope you keep doing more videos like this.
Muito bom!!!
👍👍
+/- 10 difference in temperature is a night and day difference 🥲
Next UART
That keysight multimeter is really sexy
👌👌👌👌
Sir i want to know your source of earning.
a video without a banana it´s not a video...
In the most cases the "5V" on my arduinos is somewhere between 4.2 and 4.8V XD
💫🤟🏼💞
👍
#GlobalElectroTech
Для чего писать по русски когда видео на английском ?
Thanks for nice works