WEBVTT

NOTE
Tutorial for Adeept Robot HAT | RaspTank, RaspClaws, DarkPaw | Expansion Board for Raspberry Pi
Transcript by RoboGeeks: https://robogeeks.org/videos/5RbkFuivSJM

1
00:00:10.220 --> 00:00:16.200
A deeped robot hat is designed for Raspberry Pi. It brings out a variety of commonly used

2
00:00:16.200 --> 00:00:21.720
expansion ports from the Raspberry Pi's 40-pin header to drive different sensors and electronic

3
00:00:21.720 --> 00:00:30.160
modules. It is compatible with Raspberry Pi 3B, 3B+, 4B, 5 and other models, allowing you to

4
00:00:30.160 --> 00:00:48.080
build your custom Raspberry Pi robot projects. Install the Raspberry Pi OS. Prepare a Raspberry

5
00:00:48.080 --> 00:00:55.960
Pi board, a micro SD card, minimum 16GB, a card reader, the A deeped robot hat and a computer.

6
00:00:57.100 --> 00:01:06.850
Connect the SD card to your computer via the card reader. Go to the official Raspberry Pi website to

7
00:01:06.850 --> 00:01:13.650
download and install Raspberry Pi Imager. Select the version matching your computer OS. The following

8
00:01:13.650 --> 00:01:59.620
steps take Windows as an example. Launch Imager to prepare flashing the Raspberry Pi OS image.

9
00:01:59.620 --> 00:02:09.840
Select your Raspberry Pi model. Raspberry Pi 3B is used in this example. Choose the operating system,

10
00:02:10.220 --> 00:02:21.460
pick the latest 64-bit OS version. Select your storage device. Set the hostname. Please note it down,

11
00:02:21.700 --> 00:02:41.180
as you will need it to check the Raspberry Pi IP address later. Select your time zone. Set the

12
00:02:41.180 --> 00:02:47.520
username and password and keep them safe. These credentials will be used for SSH login afterwards.

13
00:02:48.020 --> 00:03:19.630
Configure Wi-Fi detail so the Raspberry Pi can connect to this network on boot. Enable SSH and select

14
00:03:19.630 --> 00:03:30.780
password authentication, which allows remote access to the Raspberry Pi. Leave Raspberry Pi connect as

15
00:03:30.780 --> 00:03:42.120
default. Review all settings. Once confirmed, start writing the OS image and wait for the process to

16
00:03:42.120 --> 00:04:13.520
finish. Insert the flashed SD card into the Raspberry Pi. Attach the expansion hat to the Raspberry Pi,

17
00:04:13.520 --> 00:04:29.850
connect the power supply and wait for the board to boot up. This may take several minutes. Log into your

18
00:04:29.850 --> 00:04:52.200
router to find and record the Raspberry Pi's IP address. The example IP is 192.168.3.135. Open a terminal and log

19
00:04:52.200 --> 00:04:59.640
into the Raspberry Pi over SSH. Replace the username and IP with your actual values, then enter your password

20
00:04:59.640 --> 00:05:25.520
when prompted. Clone the sample code repository from GitHub, then run the installation script to set up

21
00:05:25.520 --> 00:05:51.940
dependencies. The installation script may take some time. Please wait patiently. This script configures the

22
00:05:51.940 --> 00:05:59.140
Wi-Fi management service and enables I2C, SPI, and other interfaces. You can check the status with

23
00:05:59.140 --> 00:06:30.440
relevant commands. Now we will demonstrate usage examples for the various expansion functions of the

24
00:06:30.440 --> 00:06:44.500
Adept Robot Hat. Onboard LED. The Adept Robot Hat integrates three single color LEDs and provides

25
00:06:44.500 --> 00:06:54.260
expansion pins for external LEDs. They are connected to Raspberry Pi GPIO-16, GPIO-25, and GPIO-26

26
00:06:54.260 --> 00:07:06.000
respectively. For version version 3.4 and earlier, the pin assignment is GPIO-9, GPIO-25, GPIO-11. Run the sample

27
00:07:06.000 --> 00:07:14.040
program. If you are using version 3.4 or an older version, execute the Python script with the version 3.4

28
00:07:14.040 --> 00:07:36.030
suffix. After starting the program, you will see the three LEDs on the Adept Robot Hat turn on and off

29
00:07:36.030 --> 00:07:56.400
one by one. The LED status information will also be printed on the console. This program uses PiA0 to

30
00:07:56.400 --> 00:08:05.620
control the three onboard LEDs on GPIO-16, 25, and 26. The LEDs light up sequentially with intervals,

31
00:08:06.040 --> 00:08:12.240
turn off all at once after all are lit, and repeat the cycle. Lighting status is output to the console.

32
00:08:12.240 --> 00:08:24.300
Onboard buzzer. The Adept Robot Hat comes with an integrated passive buzzer wired to Raspberry Pi

33
00:08:24.300 --> 00:08:37.320
GPIO-18. Run the sample program. Once the program starts, you will hear the buzzer play the tune

34
00:08:37.320 --> 00:08:58.940
Happy Birthday. Each note will be printed to the console in real time. This program uses PiA0 to

35
00:08:58.940 --> 00:09:05.820
control the passive buzzer on GPIO-18. It iterates through a predefined list of notes and durations

36
00:09:05.820 --> 00:09:20.320
for Happy Birthday and prints each note to the console during playback. Servo. The Adept Robot

37
00:09:20.320 --> 00:09:28.340
Hat integrates the PCA9685 chip, which supports control of up to 16 servos. Please note that the

38
00:09:28.340 --> 00:09:43.040
I2C address of this board is 0x5f, instead of the default 0x40. Connect the servos to the hat.

39
00:09:43.620 --> 00:09:49.560
Match the wire colors with the port pinout and avoid reverse connection. When multiple servos are

40
00:09:49.560 --> 00:09:55.320
connected, use battery power to prevent poor performance caused by insufficient power supply.

41
00:09:58.660 --> 00:10:15.490
Before running the sample program, confirm that I2C is enabled. Run the command to enable I2C.

42
00:10:15.490 --> 00:10:41.450
Ensure there are no errors and verify that the device at address 0x5f is detected. Run the sample

43
00:10:41.450 --> 00:10:49.830
program. After launching the program, all servos will rotate repeatedly between 0 degrees and 180 degrees.

44
00:10:51.210 --> 00:11:01.330
This program controls the PCA9685 over I2C via SMBUS. It converts target angles into PWM signals and

45
00:11:01.330 --> 00:11:07.810
drives all 16 servos to swing back and forth from 0 degrees to 180 degrees in a loop.

46
00:11:11.830 --> 00:11:27.020
Motor. The Adept Robot Hat provides four motor ports. Motors are driven by the PCA9685 and DRV8833 chips,

47
00:11:27.460 --> 00:11:45.700
occupying PCA9685 channels 8 to 15 respectively. Connect the DC motors to the hat. Run the command to

48
00:11:45.700 --> 00:11:52.580
enable I2C. Ensure there are no errors and verify that the device at address 0x5f is detected.

49
00:12:08.670 --> 00:12:13.550
After the program starts, the motors will rotate forward and backward alternately,

50
00:12:13.910 --> 00:12:43.060
with status messages printed to the console. This program drives the PCA9685 over I2C via SMBUS to

51
00:12:43.060 --> 00:12:51.040
generate PWM signals. It controls four DC motors with HBridge slow decay mode for cyclic forward slash

52
00:12:51.040 --> 00:13:03.450
reverse rotation, and the speed can be set by percentage. Onboard WS2812. The Adept Robot Hat

53
00:13:03.450 --> 00:13:12.290
integrates two WS2812 LEDs and exposes one expansion port. They are connected to Raspberry Pi GPIO10 and

54
00:13:12.290 --> 00:13:39.060
controlled via SPI. Before running the program, confirm that SPI is enabled. Run the command to

55
00:13:39.060 --> 00:14:03.080
enable SPI and check for no errors. Run the sample program. Once the program starts, the WS2812 LEDs will

56
00:14:03.080 --> 00:14:17.260
cycle through different colors. This program uses SpyDev to emulate the WS2812 one-wire timing over SPI.

57
00:14:17.260 --> 00:14:24.300
It renders lighting effects asynchronously in a daemon thread. It supports configurable LED count,

58
00:14:24.580 --> 00:14:29.260
brightness and color order, and allows individual color setting for each pixel.

59
00:14:35.860 --> 00:14:46.130
Ultrasonic. The Adept Robot Hat has an ultrasonic port for connecting the HCSR04 ultrasonic sensor.

60
00:14:46.690 --> 00:14:54.370
It enables functions such as obstacle avoidance for robots. The sensor is wired to Raspberry Pi GPIO23

61
00:14:54.370 --> 00:15:23.130
and GPIO24. Connect the ultrasonic module to port X9 on the hat. Run the sample program.

62
00:15:24.170 --> 00:15:30.130
After the program runs successfully, the ultrasonic sensor measures the distance to obstacles in real

63
00:15:30.130 --> 00:15:36.310
time, and readings are printed to the console. Move your hand back and forth in front of the sensor and

64
00:15:36.310 --> 00:15:52.300
watch the console output. This program uses PiA0's distance sensor to drive the ultrasonic module.

65
00:15:52.300 --> 00:16:00.660
The trigger pin is GPIO23 and the echo pin is GPIO24, with the maximum measuring distance set to

66
00:16:00.660 --> 00:16:07.420
2 meters. It calculates distance based on the round-trip time of ultrasonic echoes and prints the result.

67
00:16:08.140 --> 00:16:16.980
Line tracking. The Adept Robot Hat is equipped with a line tracking port for connecting a three-channel

68
00:16:16.980 --> 00:16:21.900
line tracking module, which lays the foundation for the robot's line tracking function.

69
00:16:21.900 --> 00:16:29.820
The module is connected to Raspberry Pi GPIO22, GPIO27, and GPIO17.

70
00:16:40.730 --> 00:17:04.430
Connect the line tracking module to the X8 port on the expansion board. Run the example program.

71
00:17:05.370 --> 00:17:11.570
After the program starts successfully, the detection values of the left, middle, and right channels will

72
00:17:11.570 --> 00:17:16.870
be printed on the console. You can block the probe of the line tracking module with your hand.

73
00:17:16.870 --> 00:17:22.910
The indicator light of the corresponding channel on the module will turn on, and the detection result

74
00:17:22.910 --> 00:17:30.190
will be output on the console. The program uses PiA0.input device to read the three-channel line

75
00:17:30.190 --> 00:17:39.330
tracking sensors wired to GPIO22, 27, and 17. The sensor outputs high or low level when a black line is

76
00:17:39.330 --> 00:17:46.150
detected. The program continuously reads the pin level and prints the status to identify the position of the

77
00:17:46.150 --> 00:17:59.180
black line. Light tracking. The Adept Robot Hat integrates the ADS7830, an 8-bit ADC chip with the

78
00:17:59.180 --> 00:18:13.440
I2C address 0x48. Channel A1 is used for the light tracking module. Connect the light tracking module to

79
00:18:13.440 --> 00:18:38.180
port X3 on the expansion board. Run the command to enable I2C. Ensure there are no errors and confirm the

80
00:18:38.180 --> 00:19:03.540
device 0x48 is detected. Run the sample program. After the program starts, the console will print

81
00:19:03.540 --> 00:19:10.880
light tracking readings. Cover LDR1 or LDR2 with your hand, and the light value will change in real time

82
00:19:10.880 --> 00:19:31.620
within the range of 0 to 255. This code reads raw ADC values from the ADS7830 over I2C using SMBUS.

83
00:19:31.620 --> 00:19:37.760
It continuously samples channel 1 and outputs photoresistor readings at regular intervals.

84
00:19:38.500 --> 00:19:49.910
OLED. The Adept Robot Hat provides two I2C ports for connecting external I2C devices.

85
00:19:50.690 --> 00:20:07.920
In this example, we connect an OLED module with the I2C address of 0x3c. Connect the OLED module to

86
00:20:07.920 --> 00:20:15.840
port X1 or X2 on the expansion board. Run the command to enable I2C. Ensure there are no errors and

87
00:20:15.840 --> 00:20:40.680
confirm the device at 0x3c is detected. Run the sample program. Once the program starts, the OLED will

88
00:20:40.680 --> 00:20:54.160
display the date and time. This program uses the Luma library to drive the 128x64 SSD 1306 OLED display

89
00:20:54.160 --> 00:21:01.600
over I2C. It creates a monochrome canvas with PIL, reads the system time in a loop, and draws the date

90
00:21:01.600 --> 00:21:20.860
and time onto the canvas. MPU6050. The Adept Robot Hat has a dedicated port for the MPU6050 module.

91
00:21:21.460 --> 00:21:37.380
It enables attitude control for the robot, and its I2C address is 0x68. Connect the MPU6050 module to the

92
00:21:37.380 --> 00:21:47.770
expansion board. Pay attention to the orientation and avoid reverse connection. Run the command to

93
00:21:47.770 --> 00:22:09.440
enable I2C. Ensure there are no errors and confirm the device at 0x68 is detected. Run the sample

94
00:22:09.440 --> 00:22:16.910
program. After launching the program, roll and pitch angles will be printed on the console.

95
00:22:17.530 --> 00:22:23.170
Tilt the MPU6050, and the console will output the current angle values in real time.

96
00:22:23.910 --> 00:22:30.590
YAH cannot be calculated only with the MPU6050, a magnetometer is required. Therefore,

97
00:22:30.590 --> 00:22:41.250
YAH is fixed to 0 here. This program uses the MPU6050 library over I2C to read the three-axis

98
00:22:41.250 --> 00:22:49.570
accelerometer data from the MPU6050. It calculates roll and pitch angles from acceleration values using

99
00:22:49.570 --> 00:22:56.030
arctangent formulas, applies averaging filtering on samples, and outputs attitude angles in a loop.

100
00:22:56.030 --> 00:23:08.590
RGB LED. The ADEPT robot hat has two RGB LED ports. One is connected to Raspberry Pi GPIO 13,

101
00:23:09.090 --> 00:23:25.020
GPIO 19, and GPIO 0, while the other is connected to GPIO 1, GPIO 5, and GPIO 6. Connect the two RGB

102
00:23:25.020 --> 00:23:45.380
LEDs to ports X4 and X5 on the expansion board. Run the sample program. Once the program starts,

103
00:23:45.380 --> 00:23:55.540
the two RGB LEDs will light up and cycle through different colors. This program uses Pi Zero PWM

104
00:23:55.540 --> 00:24:03.960
devices to drive two sets of common cathode RGB LEDs on six GPIO pins. It inverts the duty cycle to

105
00:24:03.960 --> 00:24:11.400
adapt to common cathode wiring and cycles through different colors. Onboard Infrared Receiver.

106
00:24:11.400 --> 00:24:27.780
The ADEPT robot hat integrates an infrared receiver, model IRM-H638-T, which is connected to Raspberry

107
00:24:27.780 --> 00:24:56.310
Pi GPIO 12. It allows the robot to be controlled by an infrared remote controller. Run the sample

108
00:24:56.310 --> 00:25:03.530
program. After the program starts, point the remote control at the infrared receiver and press any key.

109
00:25:03.530 --> 00:25:16.570
The decoded key value will be printed on the console. Please note that different remote controls may use

110
00:25:16.570 --> 00:25:22.270
different protocols. You may need to modify the code to decode the infrared signals correctly.

111
00:25:23.230 --> 00:25:29.730
This program captures level changes from the infrared receiver using Pi Zero. It decodes pulses

112
00:25:29.730 --> 00:25:37.090
following the NEC protocol, validates 32-bit data, identifies remote key codes and prints key names.

113
00:25:37.090 --> 00:25:42.130
It keeps receiving signals until exit and releases the GPIO pin.

114
00:25:46.440 --> 00:25:59.020
LED Matrix. The ADEPT robot hat provides two I2C ports for connecting external I2C devices.

115
00:25:59.800 --> 00:26:05.880
In this example, we connect an LED matrix module with the I2C address of 0x70.

116
00:26:12.550 --> 00:26:26.080
Connect the LED matrix module to port X1 or X2 on the expansion board. Run the command to enable I2C.

117
00:26:26.080 --> 00:26:51.740
Ensure there are no errors and confirm the device at 0x70 is detected. Run the sample program.

118
00:26:52.340 --> 00:26:57.920
After the program runs successfully, the LED matrix will display a SMILEY pattern.

119
00:27:00.210 --> 00:27:07.370
This program uses SMBUS2 to drive the HT16K33 LED matrix controller over I2C.

120
00:27:08.030 --> 00:27:13.510
It sends predefined SMILEY bitmap data to the chip to display the SMILEY graphic repeatedly.

121
00:27:13.510 --> 00:27:26.180
Battery Level Detection. The ADEPT robot hat integrates the ADS7830, an 8-bit ADC chip with

122
00:27:26.180 --> 00:27:38.670
the I2C address 0x48. Channel A0 is used for battery voltage monitoring. Connect the battery

123
00:27:38.670 --> 00:27:47.150
holder to the expansion board and turn on the power switch. Run the command to enable I2C.

124
00:27:47.150 --> 00:27:54.450
Ensure there are no errors and confirm the device at 0x48 is detected. Run the sample program.

125
00:27:54.950 --> 00:28:01.510
For version 3.4 and older hat versions, run the script with the version 3.4 suffix.

126
00:28:02.190 --> 00:28:08.410
The voltage divider resistor ratios differ between version 3.4 and version 3.5,

127
00:28:08.650 --> 00:28:15.230
so the calculation formulas are not the same. After the program starts, the console prints the raw

128
00:28:15.230 --> 00:28:24.700
ADC reading, current battery voltage and battery level in real time. Small deviations between

129
00:28:24.700 --> 00:28:30.720
calculated voltage and the actual battery voltage are normal, caused by tolerances of the voltage

130
00:28:30.720 --> 00:28:48.020
divider resistors and reference voltage. Battery Charging. For normal operation, the expansion board is

131
00:28:48.020 --> 00:28:58.460
powered by two 3.7V nominal 18,650 power batteries, with a full charge voltage of 8.4V. The ADEPT robot

132
00:28:58.460 --> 00:29:05.800
hat integrates a charging chip. You can charge the batteries via the USB-C port on the hat. The red CR

133
00:29:05.800 --> 00:29:12.280
indicator lights up when charging is in progress. When the red CR indicator turns off and the green OK

134
00:29:12.280 --> 00:29:18.620
indicator lights up, charging is complete. The four green indicators near the power switch show the

135
00:29:18.620 --> 00:29:24.640
remaining battery level. It is recommended to turn off the power switch during charging and place the

136
00:29:24.640 --> 00:29:30.980
board in a safe location. We have now covered all functions of this expansion board. Based on these

137
00:29:30.980 --> 00:29:36.120
examples, you can design and develop your own robot projects with the ADEPT robot hat.
