Tutorial for Adeept Robot HAT | RaspTank, RaspClaws, DarkPaw | Expansion Board for Raspberry Pi
Adeept · Uploaded · 29:38 · Watch on YouTube
Adeept walks through preparing a Raspberry Pi with the OS, network, and SSH, then installing the sample code for the Robot HAT. It then demonstrates each onboard function, including LEDs, buzzer, servos, motors, ultrasonic and line-tracking sensors, OLED, MPU6050, infrared receiver, and battery monitoring and charging.
Transcript
Captions as a .vtt fileEmbed with the transcript
- 0:10A deeped robot hat is designed for Raspberry Pi. It brings out a variety of commonly used
- 0:16expansion ports from the Raspberry Pi's 40-pin header to drive different sensors and electronic
- 0:21modules. It is compatible with Raspberry Pi 3B, 3B+, 4B, 5 and other models, allowing you to
- 0:30build your custom Raspberry Pi robot projects. Install the Raspberry Pi OS. Prepare a Raspberry
- 0:48Pi board, a micro SD card, minimum 16GB, a card reader, the A deeped robot hat and a computer.
- 0:57Connect the SD card to your computer via the card reader. Go to the official Raspberry Pi website to
- 1:06download and install Raspberry Pi Imager. Select the version matching your computer OS. The following
- 1:13steps take Windows as an example. Launch Imager to prepare flashing the Raspberry Pi OS image.
- 1:59Select your Raspberry Pi model. Raspberry Pi 3B is used in this example. Choose the operating system,
- 2:10pick the latest 64-bit OS version. Select your storage device. Set the hostname. Please note it down,
- 2:21as you will need it to check the Raspberry Pi IP address later. Select your time zone. Set the
- 2:41username and password and keep them safe. These credentials will be used for SSH login afterwards.
- 2:48Configure Wi-Fi detail so the Raspberry Pi can connect to this network on boot. Enable SSH and select
- 3:19password authentication, which allows remote access to the Raspberry Pi. Leave Raspberry Pi connect as
- 3:30default. Review all settings. Once confirmed, start writing the OS image and wait for the process to
- 3:42finish. Insert the flashed SD card into the Raspberry Pi. Attach the expansion hat to the Raspberry Pi,
- 4:13connect the power supply and wait for the board to boot up. This may take several minutes. Log into your
- 4:29router to find and record the Raspberry Pi's IP address. The example IP is 192.168.3.135. Open a terminal and log
- 4:52into the Raspberry Pi over SSH. Replace the username and IP with your actual values, then enter your password
- 4:59when prompted. Clone the sample code repository from GitHub, then run the installation script to set up
- 5:25dependencies. The installation script may take some time. Please wait patiently. This script configures the
- 5:51Wi-Fi management service and enables I2C, SPI, and other interfaces. You can check the status with
- 5:59relevant commands. Now we will demonstrate usage examples for the various expansion functions of the
- 6:30Adept Robot Hat. Onboard LED. The Adept Robot Hat integrates three single color LEDs and provides
- 6:44expansion pins for external LEDs. They are connected to Raspberry Pi GPIO-16, GPIO-25, and GPIO-26
- 6:54respectively. For version version 3.4 and earlier, the pin assignment is GPIO-9, GPIO-25, GPIO-11. Run the sample
- 7:06program. If you are using version 3.4 or an older version, execute the Python script with the version 3.4
- 7:14suffix. After starting the program, you will see the three LEDs on the Adept Robot Hat turn on and off
- 7:36one by one. The LED status information will also be printed on the console. This program uses PiA0 to
- 7:56control the three onboard LEDs on GPIO-16, 25, and 26. The LEDs light up sequentially with intervals,
- 8:06turn off all at once after all are lit, and repeat the cycle. Lighting status is output to the console.
- 8:12Onboard buzzer. The Adept Robot Hat comes with an integrated passive buzzer wired to Raspberry Pi
- 8:24GPIO-18. Run the sample program. Once the program starts, you will hear the buzzer play the tune
- 8:37Happy Birthday. Each note will be printed to the console in real time. This program uses PiA0 to
- 8:58control the passive buzzer on GPIO-18. It iterates through a predefined list of notes and durations
- 9:05for Happy Birthday and prints each note to the console during playback. Servo. The Adept Robot
- 9:20Hat integrates the PCA9685 chip, which supports control of up to 16 servos. Please note that the
- 9:28I2C address of this board is 0x5f, instead of the default 0x40. Connect the servos to the hat.
- 9:43Match the wire colors with the port pinout and avoid reverse connection. When multiple servos are
- 9:49connected, use battery power to prevent poor performance caused by insufficient power supply.
- 9:58Before running the sample program, confirm that I2C is enabled. Run the command to enable I2C.
- 10:15Ensure there are no errors and verify that the device at address 0x5f is detected. Run the sample
- 10:41program. After launching the program, all servos will rotate repeatedly between 0 degrees and 180 degrees.
- 10:51This program controls the PCA9685 over I2C via SMBUS. It converts target angles into PWM signals and
- 11:01drives all 16 servos to swing back and forth from 0 degrees to 180 degrees in a loop.
- 11:11Motor. The Adept Robot Hat provides four motor ports. Motors are driven by the PCA9685 and DRV8833 chips,
- 11:27occupying PCA9685 channels 8 to 15 respectively. Connect the DC motors to the hat. Run the command to
- 11:45enable I2C. Ensure there are no errors and verify that the device at address 0x5f is detected.
- 12:08After the program starts, the motors will rotate forward and backward alternately,
- 12:13with status messages printed to the console. This program drives the PCA9685 over I2C via SMBUS to
- 12:43generate PWM signals. It controls four DC motors with HBridge slow decay mode for cyclic forward slash
- 12:51reverse rotation, and the speed can be set by percentage. Onboard WS2812. The Adept Robot Hat
- 13:03integrates two WS2812 LEDs and exposes one expansion port. They are connected to Raspberry Pi GPIO10 and
- 13:12controlled via SPI. Before running the program, confirm that SPI is enabled. Run the command to
- 13:39enable SPI and check for no errors. Run the sample program. Once the program starts, the WS2812 LEDs will
- 14:03cycle through different colors. This program uses SpyDev to emulate the WS2812 one-wire timing over SPI.
- 14:17It renders lighting effects asynchronously in a daemon thread. It supports configurable LED count,
- 14:24brightness and color order, and allows individual color setting for each pixel.
- 14:35Ultrasonic. The Adept Robot Hat has an ultrasonic port for connecting the HCSR04 ultrasonic sensor.
- 14:46It enables functions such as obstacle avoidance for robots. The sensor is wired to Raspberry Pi GPIO23
- 14:54and GPIO24. Connect the ultrasonic module to port X9 on the hat. Run the sample program.
- 15:24After the program runs successfully, the ultrasonic sensor measures the distance to obstacles in real
- 15:30time, and readings are printed to the console. Move your hand back and forth in front of the sensor and
- 15:36watch the console output. This program uses PiA0's distance sensor to drive the ultrasonic module.
- 15:52The trigger pin is GPIO23 and the echo pin is GPIO24, with the maximum measuring distance set to
- 16:002 meters. It calculates distance based on the round-trip time of ultrasonic echoes and prints the result.
- 16:08Line tracking. The Adept Robot Hat is equipped with a line tracking port for connecting a three-channel
- 16:16line tracking module, which lays the foundation for the robot's line tracking function.
- 16:21The module is connected to Raspberry Pi GPIO22, GPIO27, and GPIO17.
- 16:40Connect the line tracking module to the X8 port on the expansion board. Run the example program.
- 17:05After the program starts successfully, the detection values of the left, middle, and right channels will
- 17:11be printed on the console. You can block the probe of the line tracking module with your hand.
- 17:16The indicator light of the corresponding channel on the module will turn on, and the detection result
- 17:22will be output on the console. The program uses PiA0.input device to read the three-channel line
- 17:30tracking sensors wired to GPIO22, 27, and 17. The sensor outputs high or low level when a black line is
- 17:39detected. The program continuously reads the pin level and prints the status to identify the position of the
- 17:46black line. Light tracking. The Adept Robot Hat integrates the ADS7830, an 8-bit ADC chip with the
- 17:59I2C address 0x48. Channel A1 is used for the light tracking module. Connect the light tracking module to
- 18:13port X3 on the expansion board. Run the command to enable I2C. Ensure there are no errors and confirm the
- 18:38device 0x48 is detected. Run the sample program. After the program starts, the console will print
- 19:03light tracking readings. Cover LDR1 or LDR2 with your hand, and the light value will change in real time
- 19:10within the range of 0 to 255. This code reads raw ADC values from the ADS7830 over I2C using SMBUS.
- 19:31It continuously samples channel 1 and outputs photoresistor readings at regular intervals.
- 19:38OLED. The Adept Robot Hat provides two I2C ports for connecting external I2C devices.
- 19:50In this example, we connect an OLED module with the I2C address of 0x3c. Connect the OLED module to
- 20:07port X1 or X2 on the expansion board. Run the command to enable I2C. Ensure there are no errors and
- 20:15confirm the device at 0x3c is detected. Run the sample program. Once the program starts, the OLED will
- 20:40display the date and time. This program uses the Luma library to drive the 128x64 SSD 1306 OLED display
- 20:54over I2C. It creates a monochrome canvas with PIL, reads the system time in a loop, and draws the date
- 21:01and time onto the canvas. MPU6050. The Adept Robot Hat has a dedicated port for the MPU6050 module.
- 21:21It enables attitude control for the robot, and its I2C address is 0x68. Connect the MPU6050 module to the
- 21:37expansion board. Pay attention to the orientation and avoid reverse connection. Run the command to
- 21:47enable I2C. Ensure there are no errors and confirm the device at 0x68 is detected. Run the sample
- 22:09program. After launching the program, roll and pitch angles will be printed on the console.
- 22:17Tilt the MPU6050, and the console will output the current angle values in real time.
- 22:23YAH cannot be calculated only with the MPU6050, a magnetometer is required. Therefore,
- 22:30YAH is fixed to 0 here. This program uses the MPU6050 library over I2C to read the three-axis
- 22:41accelerometer data from the MPU6050. It calculates roll and pitch angles from acceleration values using
- 22:49arctangent formulas, applies averaging filtering on samples, and outputs attitude angles in a loop.
- 22:56RGB LED. The ADEPT robot hat has two RGB LED ports. One is connected to Raspberry Pi GPIO 13,
- 23:09GPIO 19, and GPIO 0, while the other is connected to GPIO 1, GPIO 5, and GPIO 6. Connect the two RGB
- 23:25LEDs to ports X4 and X5 on the expansion board. Run the sample program. Once the program starts,
- 23:45the two RGB LEDs will light up and cycle through different colors. This program uses Pi Zero PWM
- 23:55devices to drive two sets of common cathode RGB LEDs on six GPIO pins. It inverts the duty cycle to
- 24:03adapt to common cathode wiring and cycles through different colors. Onboard Infrared Receiver.
- 24:11The ADEPT robot hat integrates an infrared receiver, model IRM-H638-T, which is connected to Raspberry
- 24:27Pi GPIO 12. It allows the robot to be controlled by an infrared remote controller. Run the sample
- 24:56program. After the program starts, point the remote control at the infrared receiver and press any key.
- 25:03The decoded key value will be printed on the console. Please note that different remote controls may use
- 25:16different protocols. You may need to modify the code to decode the infrared signals correctly.
- 25:23This program captures level changes from the infrared receiver using Pi Zero. It decodes pulses
- 25:29following the NEC protocol, validates 32-bit data, identifies remote key codes and prints key names.
- 25:37It keeps receiving signals until exit and releases the GPIO pin.
- 25:46LED Matrix. The ADEPT robot hat provides two I2C ports for connecting external I2C devices.
- 25:59In this example, we connect an LED matrix module with the I2C address of 0x70.
- 26:12Connect the LED matrix module to port X1 or X2 on the expansion board. Run the command to enable I2C.
- 26:26Ensure there are no errors and confirm the device at 0x70 is detected. Run the sample program.
- 26:52After the program runs successfully, the LED matrix will display a SMILEY pattern.
- 27:00This program uses SMBUS2 to drive the HT16K33 LED matrix controller over I2C.
- 27:08It sends predefined SMILEY bitmap data to the chip to display the SMILEY graphic repeatedly.
- 27:13Battery Level Detection. The ADEPT robot hat integrates the ADS7830, an 8-bit ADC chip with
- 27:26the I2C address 0x48. Channel A0 is used for battery voltage monitoring. Connect the battery
- 27:38holder to the expansion board and turn on the power switch. Run the command to enable I2C.
- 27:47Ensure there are no errors and confirm the device at 0x48 is detected. Run the sample program.
- 27:54For version 3.4 and older hat versions, run the script with the version 3.4 suffix.
- 28:02The voltage divider resistor ratios differ between version 3.4 and version 3.5,
- 28:08so the calculation formulas are not the same. After the program starts, the console prints the raw
- 28:15ADC reading, current battery voltage and battery level in real time. Small deviations between
- 28:24calculated voltage and the actual battery voltage are normal, caused by tolerances of the voltage
- 28:30divider resistors and reference voltage. Battery Charging. For normal operation, the expansion board is
- 28:48powered by two 3.7V nominal 18,650 power batteries, with a full charge voltage of 8.4V. The ADEPT robot
- 28:58hat integrates a charging chip. You can charge the batteries via the USB-C port on the hat. The red CR
- 29:05indicator lights up when charging is in progress. When the red CR indicator turns off and the green OK
- 29:12indicator lights up, charging is complete. The four green indicators near the power switch show the
- 29:18remaining battery level. It is recommended to turn off the power switch during charging and place the
- 29:24board in a safe location. We have now covered all functions of this expansion board. Based on these
- 29:30examples, you can design and develop your own robot projects with the ADEPT robot hat.
토론
누군가 댓글을 달면 메일로 알려 드려요. 계정은 필요 없어요.
뉴스레터
새 로봇, 가격, 로봇 소식을 담은 무료 뉴스레터를 받아보세요.