WEBVTT

NOTE
Tutorial 09 - Battery Level Detection - ADA031-V5.0
Transcript by RoboGeeks: https://robogeeks.org/videos/jYELXGhSLu0

1
00:00:04.400 --> 00:00:08.100
This lesson introduces the battery level detection function.

2
00:00:08.500 --> 00:00:14.200
It demonstrates the principle of battery voltage and battery level sampling with an example program.

3
00:00:15.900 --> 00:00:23.020
Required components, robotic arm control board, USB cable, OLED screen, battery.

4
00:00:24.300 --> 00:00:29.300
We use the Arduino ADC function to read the analog signal from pin A7,

5
00:00:29.300 --> 00:00:35.400
then calculate the current battery voltage according to the reference voltage and voltage divider principle.

6
00:00:36.100 --> 00:00:43.220
This experiment only demonstrates the basic principle of battery level detection, and some measurement errors may exist.

7
00:00:44.160 --> 00:00:45.960
Let's start the demonstration.

8
00:00:48.160 --> 00:00:55.440
First, plug the OLED into the controller board, then connect the controller board to your computer with a USB cable.

9
00:00:56.220 --> 00:00:58.620
Connect the battery and turn on the power switch.

10
00:00:58.620 --> 00:01:05.420
Next, open the example code.

11
00:01:12.710 --> 00:01:17.630
Select the board type and serial port, then upload the program to the control board.

12
00:01:27.770 --> 00:01:37.470
After successful upload, the OLED screen continuously refreshes the sampled ADC value, calculated battery voltage and battery percentage.

13
00:01:38.230 --> 00:01:42.610
Code principle, initialize and configure pin A7 as input mode.

14
00:01:43.170 --> 00:01:47.170
Read the analog value of pin A7 in real time inside the loop.

15
00:01:47.170 --> 00:01:54.930
And calculate the current battery voltage and battery percentage based on the reference voltage and voltage divider ratio.

16
00:01:55.630 --> 00:01:58.770
Once you understand the principle of battery voltage detection,

17
00:01:59.250 --> 00:02:05.470
you can build your own low battery warning system by combining what you learned in the buzzer and OLED lessons.
