RoboGeeks

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

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

Paste this into your page. The frame holds the player and the transcript; the link below it says where the transcript comes from.

Debate

Elige un nombre en el siguiente paso. ¿Ya eres miembro? Inicia sesión.

Un correo cuando alguien comente. No hace falta cuenta.

El boletín

Recibe nuestro boletín gratuito con nuevos robots, precios y noticias de robótica.