AlphaBot2

From Waveshare Wiki
Jump to: navigation, search
AlphaBot2
AlphaBot2 robot building kit
AlphaBot2-Ar-detail 01.jpg

AlphaBot2 robot building kit
AlphaBot2-Ar
AlphaBot2 robot building kit for Arduino
Alphabot2-ar-8.jpg

AlphaBot2 robot building kit for Arduino
AlphaBot2-Pi
AlphaBot2 robot building kit for Pi
Alphabot2-pi-3.jpg

AlphaBot2 robot building kit for Pi
AlphaBot2-PiZero
AlphaBot2 robot building kit for Raspberry Pi Zero/Zero W
Alphabot2-pizero-8.jpg

AlphaBot2 robot building kit for Raspberry Pi Zero/Zero W
{{{name5}}}

{{{name6}}}

Overview

  • Old Version Link
  • AlphaBot, the smart car development kit, includes the AlphaBot basic board and the smart car chassis with the support of Arduin and Raspberry Pi.

Functions

The AlphaBot2 smart car development kit includes a baseboard AlphaBot2-Base and an adapter board (one of AlphaBot2-Ar, AlphaBot2-Pi, and AlphaBot2-PiZero). By choosing different adapter boards, the car can support access to Arduino, Raspberry Pi 3B, and Raspberry Pi Zero W.
With a stable structure and high integration, it does not require complicated assembly and cumbersome wiring. Through different adapter boards, AlphaBot2 can be connected to Raspberry Pi or Arduino control, and with the open-source code and learning tutorials provided by Waveshare, you can quickly understand and explore the learning and development of smart cars.
The technical points involved in this:
Tracking, obstacle avoidance, infrared ranging, mobile phone/PC video surveillance, WIFI/Bluetooth/infrared wireless remote control, etc.
Notes: This document is not for any specific product kits. Some of them may not have the component(s) described in the sections below. For more information about the product kit, please refer to the product page on the Waveshare website.

Target Groups

Many microcontroller enthusiasts have wanted to design a smart car by themselves. However, it is difficult to get started. If you have this kit, you can quickly learn the structure, basic principles, and outer module of the smart car.
This tutorial mainly explains the working principle and production process of the smart car through the Waveshare AlphaBot smart car. Sample programs include tracking, automatic barriers, Bluetooth remote control, WiFi control, etc. This manual revolves around the sample program, and the content is explained in simple language, from the smallest system to the main control design of the entire car, from the simple linear motion of the car to the complex multi-functional composite implementation. It is hoped that beginners of microcontrollers can have a clear understanding of smart cars through this kit.
Due to the limited level of the author, mistakes and deficiencies in the tutorial are inevitable, and readers are welcome to criticize and correct them.

Recommandation

Reading this document can be a challenge for a freshman. We advise that the reader needs to have some knowledge of programming in Raspberry Pi Python or Arduino, which can help understand the programming fundamentals.
Due to space constraints, only a few of the programming fundamentals can be explored here. If you want to have a thorough understanding of them, please check the source code. Here, we will describe more about the practical experience of smart robot development.
Raspberry Pi tutorial: http://www.waveshare.com/wiki/Raspberry_Pi_Tutorial_Series
Due to the electrical characteristic limitation, users should be more robot fun to use this product in a safe and correct matter, to prevent the Raspberry Pi board or Arduino board from irreversible damage by the smart robot chassis. For your first time using this product, please follow the steps described in the document.
Alphabot 2 Spec01.png

Onboard Resource

AlphaBot2-Base

Alphabot 2 Spec02.png

AlphaBot2-Ar

Alphabot 2 Spec03.png

AlphaBot2-Pi

Alphabot 2 Spec04.png

Arduino (AlphaBot-Ar) User Guide

Copy the library files in the Arduino directory to the libraries folder in the Arduino IDE installation directory. Restart Arduino IDE, click File->Example, and check if there is a TRSensors option, if so, it means the library is imported successfully.

Motor Test

  1. Compile and download the Run-Test program. After the program runs, the motor rotates and the car moves forward.
  2. If the direction is wrong, you need to modify the motor wiring accordingly, or modify the pins in the program. The second method is recommended.
  3. If the left wheel rotates in the wrong direction, then swap AIN1, AIN2; if the right wheel rotates in the wrong direction, swap BIN1, BIN2.
  4. If the wheels of this program turn in the wrong direction, all the following programs need to be modified accordingly:

Alphabot 2 Arduino01.png

Five-direction Remote Sensing

  1. Compile and download the Joystick program, Joystick joystick in 5 directions, including up, down, left, right and OK;
  2. Open the serial monitor, and set the baud rate to 115200, the serial monitor will display the key position of the current button, the motor will rotate according to the direction of the button, and the buzzer will sound when the button is pressed;
  3. If the rotation direction of the wheel is different from the direction of the button, you need to modify the pin.

Alphabot 2 Arduino02.png

Infrared Remote Control Car

  1. Compile and download the IR program, press the number keys of the infrared remote control to control the car;
  2. 2, 8, 4, 6, and 5 respectively represent forward, backward, turn left, turn right, and stop. Press – or + to adjust the speed, and press EQ to restore the default value;
  3. Different infrared remote controllers may have different key codes. If they are different, you need to modify the program accordingly.

Infrared Obstacle Avoidance

  1. Compile and download the Infrared-Obstacle-Avoidance program.
  2. When there is no obstacle in front of the car, the green LED light in front will go out, and when the car encounters an obstacle, the green LED light in front will be on;
  3. If the LED light is not on or is always on, you can adjust the two potentiometers on the bottom of the trolley so that the LED is just off.
  4. The program phenomenon is that the car goes straight when there is no obstacle, and turns right when it encounters an obstacle.

Ultrasonic Ranging

  1. Compile and download the Ultrasionc_Ranging program.
  2. Open the serial monitor, set the baud rate to 115200, and the serial monitor will display the current measurement distance.

Alphabot 2 Arduino03.png

Ultrasonic Obstacle Advoidance

  1. Compile and download the Ultrasonic-Obstacle-Avoidance program.
  2. When there is no obstacle, the car goes straight, and when encountering an obstacle, the car turns right.
  3. Due to the reflection of ultrasonic waves, the front obstacle plane is not directly in front of the car, and the distance measured when forming an angle with the car may be inaccurate.

Ultrasonic IR Obstacle Advoidance

  1. Compile and download the Ultrasionc-Infrared-Obstacle-Avoidance program.
  2. When there is no obstacle, the car goes straight, and when it encounters an obstacle, the car turns right.

Tracking Sensor Test

  1. Import the TRSensors library into the libraries under the Arduino IDE installation directory, click File -> Example -> TRSensors -> TRSensorExample to open the project, compile and download it to the Arduino development board.
  2. The tracking sensor can detect the black line, and the background color is white (or the white line is black, and the program needs to be modified). You can use black tape to stick it on the white KT board to make a trolley track. The width of the black track is 15cm. If the background color is too dark, it will affect the tracking.
  3. Open the serial monitor, set the baud rate to 115200, and when the serial port displays "TRSensor example", hold the car with your hand and shake it close to the ground in the black line. This stage is calibration so that the car can set the maximum value of each sensor. and the minimum value. The calibration directly affects the tracking.
  4. After calibration, the minimum and maximum values ​​for each sensor are displayed. Then the serial monitor will display the current measurement value of each sensor, the larger the value, the darker the color. The last column represents the position of the black, 2000 means the black line is in the middle, 0 means the black line is at the far left of the car, and 4000 means the black line is at the far right of the car.
  5. If this procedure is normal, it means that there is no problem with the sensor, otherwise it may not be able to track normally.

Alphabot 2 Arduino04.png

IR Tracking Demo

  1. Compile and download "Infrared-Line-Tracking" program.
  2. Turn on the power and hold the car with your hand and shake it close to the ground in the black line. This stage is calibration so that the car can set the maximum value of each sensor. and the minimum value.
  3. The calibration directly affects the tracking. Until the car is opened when the wheels of the car start to turn, the car will run along the black line.

RGB LED

  1. Compile and download W2812 program.
  2. There are four colorful LEDs on the bottom of the car: Red, Green, Blue, and Yellow.

OLED

  1. Compile and download the OLED program.
  2. The sample program will basically display character and drawing operations, including drawing lines, drawing circles, and rectangles.

Comprehensive Program

  1. Compile and download the Line-Tracking program.
  2. Turn on the power switch, and the OLED will display "Alphabot". At this time, place the car on the black line and press the button, the car will rotate left and right to automatically calibrate, and the RGB LED will display green. The RGB LED lights up blue after calibration is complete.
  3. OLED display below right. "**" indicates the current position of the black line. Move the cart left and right and the symbol will move with it.
  4. Press the button again and the car goes along the black line. RGB LEDs display different colors, the car stops when it encounters an obstacle, and the buzzer sounds at the same time. The car will keep moving after the obstacles are removed.
  5. The car will stop moving after being picked up. It will keep moving after being placed on the black line.

Alphabot 2 Arduino05.png

Smart Car Walks the Maze

1. Compile and download the MazeSolver program.
2. Turn on the power switch, and the OLED will display AlphaBot2. Put the car on the black line, press the key, and the car will automatically calibrate by turning left and right. At the same time, RGB LED will display green and turn blue after calibration.
3. OLED displays "**", which means the position of the black line. If you move the car and this symbol will move too.
4. Press the key again and the car will move along the black line. If there is a right corner, the car will automatically turn around to find the endpoint until it stops at the endpoint.
5. Now you can put the car at the starting point, press the key, and the car will run to the endpoint along the shortest line.

  • The requirements for maze production:

The steering must be at a right angle, and the maze route must not have loops.
About the program: When the car detects a corner, it will decelerate and run for a period of time to check whether there is a corner again. Due to the difference between the motor and the voltage, the trolley may not be able to recognize the corner normally. At this time, the speed and delay time in the program can be modified. In the same way, the corner of the car is also delayed to judge the size of the angle. If the corner is wrong during the actual operation, the speed and delay time of the corner in the program can be modified.
Alphabot 2 Arduino07.png
Alphabot 2 Arduino08.png

Control the Car By Bluetooth

  1. Remove the Bluetooth module before compiling and downloading the Bluetooth program. Note that the Bluetooth module must be removed, otherwise the program will not be downloaded normally.
  2. Scan the QR code below with your mobile phone to download the corresponding APP. Among them, iOS uses Bluetooth BLE to communicate with the module, which requires iphone4S and above. Android uses Bluetooth EDR to communicate with the module.

Alphabot 2 Arduino09.png
Also, you can click here to download.
Start the APP, click "Scan" (Note: the mobile phone needs to turn on the Bluetooth function), plug in the Bluetooth module, and after a few seconds, the corresponding Bluetooth devices will be displayed in the list normally. If using iOS, select "Waveshare_BLE" device, if using Android, select "Waveshare_ERD" device. Go to the next page and select "Remote Mode".
Alphabot 2 Arduino10.png
Note: If the Android phone supports Bluetooth BLE, it will scan two devices. Note that you need to select the device with the MAC address 00:0E:0E.
Alphabot 2 Arduino11.png
Select "Remote Mode", click "Set", set the command according to the program, set the corresponding command when the key is pressed, and set the "Stop" command when the key is up.
Alphabot 2 Arduino12.png
When the speed button changes from gray to black, it means that the program has been linked. Press the button to remote control the car, and the RGB LED will light up in various colors.
For more information on Dual-mode Bluetooth, please refer to the user manual.

Control the Car By Bluetooth

  • Unplug the Bluetooth module, compile, and download the Bluetooth-json.
  • Open the APP, and plug the Bluetooth module. Click "Scan" to connect the Bluetooth, and choose "remote" mode to control the car. Choose "Peripheral Control" to control the buzzer and the color of the RGB LED. (This function is not supported in other mobile robots.)

Raspberry Pi Example Program (AlphaBot-Pi)

Python demo also is provided.

Enable SPI interface

PS: If you are using a system with a Bullseye branch, you need to change "apt-get" to "apt", and the system of the Bullseye branch only supports Python3.
  • Open the terminal, and use the command to enter the configuration page.
sudo raspi-config
Choose Interfacing Options -> SPI -> Yes  to enable the SPI interface

RPI open spi.png
Reboot Raspberry Pi:

sudo reboot

Make sure that the SPI is not occupied by other devices, you can check in the middle of the /boot/config .txt.

  • Check /boot/config.txt, and you can see 'dtparam=spi=on' was written in.

Raspberry Pi Guides for 4.37 e-Paper.jpg

  • To make sure SPI is not occupied, it is recommended to close other drivers' coverage. You can use ls /dev/spi* to check whether SPI is occupied. If the terminal outputs /dev/spidev0.1 and /dev/spidev0.1, SPI is not occupied.

Raspberry Pi Guides for 4.37 e-Paper02.jpg

Enable I2C Interface

Open a terminal and run the following commands:

sudo raspi-config 
Choose Interfacing Options -> I2C -> Yes.

Reboot Raspberry Pi:

sudo reboot

RPI open i2c.png

Enable UART interface

Open the Raspberry Pi terminal and enter the following command to enter the configuration interface

sudo raspi-config
Select Interfacing Options -> Serial, disable shell access, and enable the hardware serial port
L76X GPS Module rpi serial.png

Install Libraries

  • python2
sudo apt-get update
sudo apt-get install ttf-wqy-zenhei
sudo apt-get install python-pip 
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install python-smbus
sudo apt-get install python-serial
sudo pip install rpi_ws281x
  • python3
sudo apt-get update
sudo apt-get install ttf-wqy-zenhei
sudo apt-get install python3-pip 
sudo pip3 install RPi.GPIO
sudo pip3 install spidev
sudo apt-get install python3-smbus
sudo apt-get install python3-serial
sudo pip3 install rpi_ws281x

Download Examples

Open a terminal and run the following commands:

wget https://files.waveshare.com/upload/3/39/AlphaBot2-Demo.zip
unzip AlphaBot2-Demo.zip

Motor Test

Run in the terminal of the Raspberry Pi:

cd /home/pi/AlphaBot2-Demo/RaspberryPi/AlphaBot2/python/
sudo python AlphaBot2.py 
  • Expected result: After the program runs, the motor rotates and the trolley moves forward.
  • If the direction is wrong, you need to modify the motor wiring accordingly or modify the pins in the program. The second method is recommended. If the rotation direction of the left wheel is not correct, then ain1 and ain2 will be used. If the rotation direction of the right wheel is not correct, then switch bin1 and bin2.
def __init__(self,ain1=12,ain2=13,ena=6,bin1=20,bin2=21,enb=26):

Joystick Direction

Run in the terminal of the Raspberry Pi:

cd /home/pi/AlphaBot2-Demo/RaspberryPi/AlphaBot2/python/
sudo python Joystick.py 
  • Expected result: Joystick Joystick in 5 directions, including up, down, left, right, and OK. When the button is pressed, the control port will display the key position of the current button, the motor will rotate according to the direction of the button, and the buzzer will sound.
  • If the rotation direction of the wheel is different from the direction of the button, you need to modify the pin.

Alphabot2 000.png

IR Remote Control Car

Run in the terminal of the Raspberry Pi:

cd /home/pi/AlphaBot2-Demo/RaspberryPi/AlphaBot2/python/
sudo python IRremote.py 
  • Expected result: Press the number keys of the infrared remote control to control the car. 2, 8, 4, 6, and 5 respectively represent forward, backward, turn left, turn right, and stop. Press - or + to adjust the speed. (Note: Different infrared remote controllers may have different key codes, if they are different, you need to modify the corresponding program.)

Infrared Obstacle Avoidance

Run in the terminal of the Raspberry Pi:

cd /home/pi/AlphaBot2-Demo/RaspberryPi/AlphaBot2/python/
sudo python Infrared_Obstacle_Avoidance.py 
  • When there is no obstacle before the car, the front green LED will turn off. When the car encounters an obstacle, the green LED light in front will light up. If the LED is not on or is always on, you can adjust the two potentiometers on the bottom of the trolley so that the LED is just off.
  • Expected result: If the sensor on the left side of the car does not reach an obstacle, the car will go straight and turn left when an obstacle is detected.

Ultrasonic Ranging (the Raspberry Pi 3B package does not include the ultrasonic module)

  • Run in the terminal of the Raspberry Pi:
cd /home/pi/AlphaBot2-Demo/RaspberryPi/AlphaBot2/python/
sudo python Ultrasonic_Ranging.py 
  • Expected results: the terminal will display the current measuring distance.

Alphabot20001.png

Ultrasonic Obstacle Avoidance (Raspberry Pi 3B package does not include ultrasonic module)

Run in the terminal of the Raspberry Pi:

cd /home/pi/AlphaBot2-Demo/RaspberryPi/AlphaBot2/python/
sudo python Ultrasonic_Obstacle_Avoidance.py 
  • Expected result: If the sensor on the left side of the car does not reach an obstacle, the car will go straight and turn right when an obstacle is detected.

RGB Light

Run in the terminal of the Raspberry Pi:

cd /home/pi/AlphaBot2-Demo/RaspberryPi/AlphaBot2/python/
sudo python ws2812.py 
  • Expected result: there are four RGB LEDs on the bottom of the car: Red, Green, Blue, and Yellow.

If the displayed color is wrong, you can add the following statement to the /boot/config.txt file, and then restart to take effect. Since the RGB LEDs are controlled by DMA and the audio output of the Raspberry Pi is a DMA channel, the following statement will disable the headphone port.

hdmi_force_hotplug=1
hdmi_force_edid_audio=1

Tracking Sensor Test

Run in the terminal of the Raspberry Pi:

cd /home/pi/AlphaBot2-Demo/RaspberryPi/AlphaBot2/python/
sudo python TRSensors.py 
  • Expected result: The terminal prints five sets of data, corresponding to five sensors respectively. When the car is placed on the white bottom plate, the value is about eight or nine hundred. The number is about one hundred to three hundred.

IR Tracking Program

Run in the terminal of the Raspberry Pi:

cd /home/pi/AlphaBot2-Demo/RaspberryPi/AlphaBot2/python/
sudo python Line_Follow.py
  • Expected result: When the program is running, it will rotate left and right for automatic calibration. After the calibration is completed, move the Alphabot2 left and right, and the terminal will display the current position of the black line and the values of the five sensors. Straighten the car, and press the button in the middle of the five-way joystick, the car will move along the black line, and the RGB LED at the bottom of the car will display different colors.

Servo

Run in the terminal of the Raspberry Pi:

cd /home/pi/AlphaBot2-Demo/RaspberryPi/AlphaBot2/python/
sudo python PCA9685.py
  • Expected result: the servo will move left and right, and the rotation range is about 180 degrees.

MJPG-streamer Software Real-time Monitoring

"MJPG-streamer", is an open-source project which is used to capture images from the camera, and transmit the video data to a webpage via the network.

  • To use the camera, you need to first enable the camera
sudo raspi-config
*Choose Enable Camera -> Yes
Rpi Enable Camera.png
  • If it is a camera using the CSI interface, the system cannot find the device node of /dev/video0. A line for bcm2835-v4l2 needs to be added to the /etc/modules file:
sudo nano /etc/modules
  • Append the line to the file
bcm2835-v4l2
Pan-tilt hat addmodules.png
  • Reboot and check the device:
sudo reboot
ls /dev/video*

video0 device will be listed as expected.

SIM862E-M2 5G HAT USER GUIDE03.png

Note: After performing the first steps, please confirm that the operation and instructions are correct.

  • Run the following commands:
cd /home/pi/AlphaBot2-Demo/RaspberryPi/AlphaBot2/
sudo apt-get update
sudo apt-get install cmake libjpeg9-dev
git clone https://github.com/jacksonliam/mjpg-streamer
cd mjpg-streamer/mjpg-streamer-experimental/
sudo make clean all
sudo ./start.sh

Open a Chorme, and go to Ip_address:8080, click stream to check the camera.
For more information about the mjpg-streamer:https://github.com/jacksonliam/mjpg-streamer
Pan-tilt hat cam.png

Remotely Control Alphabot By Bottle

"Bottle" is a simple and efficient WSGI-compliant micro python web framework. You can quickly implement web control with Bottle.
Run the following commands in the terminal:
Python2:

sudo apt-get install python-bottle

Python3:

sudo apt-get install python3-bottle
  • Web Control RGB LED via Bottle
cd /home/pi/AlphaBot2-Demo/RaspberryPi/AlphaBot2/Web-RGB
sudo python main.py

Enter the IP address of the Raspberry Pi in the address bar of the mobile phone browser (computer browsers are not supported), the port number is 8002, and the following page will be displayed. By clicking on different positions of the picture, the RGB LED will display different colors. "static", "breath", and "flash" correspond to three display modes respectively.
Alphabot201.jpg

  • Realize web video control the car through Bottle.
cd /home/pi/AlphaBot2-Demo/RaspberryPi/AlphaBot2/Web-Control
sudo python main.py

Open Chrome, and go to Ip_address:8000, click stream to check the camera.
Pan-tilt hat ip.png
You can control it by telephone or PC.
Control it by telephone:
Alphabot rpi web.png

  • To set it to autostart, you can modify /etc/rc. local file and add the following lines
sudo nano /etc/rc.local
#Without the nano editor, enter the following command to download
sudo apt-get install nano

Add:

cd AlphaBot_Demo/AlphaBot_Demo/RaspberryPi/AlphaBot/Web-Control
sudo python main.py &

Finally, edit main.py. This step is very important. If it is not set, the program will not be able to run after booting. This step is to wait for the host to connect to the network and the added delay.

sudo nano /home/pi/AlphaBot2-Demo/RaspberryPi/AlphaBot2/Web-Control/main.py
#Find the 23rd line, delete the # sign in front of time.sleep(12), if your system boots slowly, you can increase the parameters in parentheses

As we know, the IP address of Raspberry Pi is dynamic and changes all the time. You can configure static IP by modifying the /etc/dhcpcd.conf file.

interface wlan0
static ip_address = 192.168.1.114/24
static routers = 192.168.1.1

192.168.1.1 is the IP address of the router and 192.168.1.114 is the static IP set, /24 should be added in the end
Note:
You need to set the jumpers IN1, IN2, ENA, ENB, IN3, and IN4 which are in the A area to P12, P13, P6, P26, P20, and P21 for controlling Alphabot by Pi. The jumpers S1, and S2 of the C areas should be connected to P27 and P22. After rebooting, you can go to ip_address:8000 to enter the control webpage.

Remote Control Alphabot2 With The Software

  • Control the car through the mobile phone or PC software video.
cd /home/pi/AlphaBot2-Demo/RaspberryPi/AlphaBot2/App-Control
sudo python main.py
  • Open another terminal and run mjpg-streamer
cd /home/pi/AlphaBot2-Demo/RaspberryPi/AlphaBot2/mjpg-streamer/mjpg-streamer-experimental
sudo ./start.sh 

Open the AlphaBot.exe program on the computer, enter the IP address, the port number of mjpg-stream, and the port number of the car Soket server.
Click Video Connet to connect the video, the button turns green and the connection is successful, click Cmd Connect to the car server. If the button turns green, the connection is successful. The button on the left controls the movement of the car, and the button on the right controls the rotation of the camera servo.
Alphabot2 888.png
Scan the QR code below with your mobile phone to download the corresponding APP.
Alphabot2 889.png
If it fails, please click here to download [APP https://files.waveshare.com/upload/5/53/Alphabot_app.zip] Enter the actual address of the Raspberry Pi, click the link to see the image captured by the camera, click the connection, after the button changes from green to blue, it indicates the control port connection program, the corresponding button of the motor can control the movement of the car, the rotation of the servo, and pull the slider to Change the trolley speed.
Alphabot2 890.png
Open the /etc/rc.local file with a text editor and add the following command to set the boot to start.

sudo nano /etc/rc.local
#There is no nano editor, enter the following command to download
sudo apt-get install nano

Add the following command between fi and exit 0, then save the file and exit.

cd /home/pi/mjpg-streamer/mjpg-streamer-experimental
sudo ./start.sh &
cd /home/pi/AlphaBot2-Demo/RaspberryPi/AlphaBot2/App-Control
sudo python main.py &

Finally, edit main.py. This step is very important. If it is not set, the program will not be able to run after booting. This step is to wait for the host to connect to the network and the added delay.

sudo nano /home/pi/AlphaBot2-Demo/RaspberryPi/AlphaBot2/APP-Control/main.py
#Find the 15th line, delete the # sign in front of time.sleep(8). If your system boots slowly, you can increase the parameters in the parentheses

Every time the Raspberry Pi starts, it needs to connect to the router. Of course, we can also enable the AP function of the Raspberry Pi wireless network adapter and use the Raspberry Pi as a router. For details, please refer to the Raspberry Pi tutorial, which will not be described in detail here.

Remote Control Car Via Raspberry Pi Bluetooth

  • Upgrade and install Bluetooth-related software packages, and install Bluetooth dependency library.
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
sudo apt-get install pi-bluetooth bluez bluez-firmware blueman
  • Add a Pi user to the Bluetooth group.
sudo usermod -G bluetooth -a pi
  • Reboot the Raspberry Pi.
sudo reboot
  • Start/increase SPP, and turn on Bluetooth device.
sudo vi /etc/systemd/system/dbus-org.bluez.service

Modify these two statements in the file.
Alphabot2900.png
After rebooting the Raspberry Pi, you can enter the command "hciconfig" (similar to "ifconfig" command) to check the Bluetooth service.
Alphabot2901.png
If you can see "hci0" device, the Bluetooth is enabled to work. If not, the Bluetooth device is not identified. Note: If there is dtoverlay=pi3-miniuart-bt in the /boot/config.txt file, this statement needs to be commented out, otherwise the Bluetooth device will not work properly.

  • Connect to the Bluetooth device

Enter the following command to enter the Bluetooth control interface. (input "help" to enter the interface to check the command list.)

sudo bluetoothctl
agent on

After entering the interface: (input "help" to enter the interface to check the command list.)

agent on
default-agent

After "scan on", you can see the physical address of the scanned Bluetooth devices, that is, Addresses like XX:XX:XX:XX:XX:XX.
Alphabot29011.png
Use the following command for pairing (please replace XX:XX:XX:XX:XX:XX with the address of your own device, Android phone can see the Bluetooth address in Settings->About Phone->Status Information.)
Alphabot2902.png
Add the device to the trusted list after pairing.

trust XX:XX:XX:XX:XX:XX

Alphabot2903.png
After connecting the device

connect XX:XX:XX:XX:XX:XX

Alphabot2904.png
Finally, click "quit" to exit. After the Bluetooth device is turned on, the Raspberry Pi will automatically connect.
Note: If the link under the command line is unsuccessful, you can connect under the graphical interface. Alphabot2905.png
Click the Bluetooth icon to add a Bluetooth device.
Alphabot2906.png
Select the corresponding mobile phone Bluetooth device, note that the mobile phone Bluetooth must be turned on to be discoverable.
Alphabot2907.png
On the Raspberry Pi side, select ok for pairing, and on the mobile phone side, select "Pair" for pairing.
Alphabot2908.png
It prompts that the configuration is successful, but there is no service.
Alphabot2909.png
Alphabot2919.png
Connected successfully. Run the following command to start the program:

cd AlphaBot2-Demo/RaspberryPi/AlphaBot2/Bluetooth-Control
sudo rfcomm watch hci0 1 python bluetooth.py

Scan the QR code below with your mobile phone to download the corresponding APP. (This software is Dual-mode Bluetooth module control software. If this software has been installed in the above Arduino operation, it is not necessary to install it again.)
Alphabot2939.png
If it fails, you can click here to download.
Start the APP, and click "Scan" (Note: the mobile phone needs to turn on the Bluetooth function), the corresponding Bluetooth devices will be displayed in the list normally. Select the "raspberrypi" device. Go to the next page and select "Remote Mode" to enter the remote mode.
Alphabot2949.png
If the Raspberry Pi Bluetooth is not found, you can run the following command to enable Bluetooth discovery.
Alphabot2959.png

Safety Precautions

Product name: Smart robot extension development kit, contains AlphaBot baseboard, and smart robot baseboard. Support Arduino and Raspberry Pi development boards.
To prevent AlphaBot, a precision device, from breaking down or being damaged, please follow the requirements listed below.

  • The product employs two series 14500 batteries for power supply with an input voltage of 7.4V. When working with Arduino and Raspberry Pi at the same time, the external power supply should be applied. Any external power supply has to obey the regulations and standards of power supply for your area.
  • The product should be applied under a well-ventilated environment, to guarantee the heat dissipation of the power supply and product performance.
  • The disassembly chassis should be placed on a stable, flat, and non-conducting surface, without touching any conductive materials.
  • The chassis can be connected to either Raspberry Pi or Arduino, or connected to both of them. Arduino and Raspberry Pi should not touch each other, in case of working together.
  • Installing the incompatible device to the chassis may cause damage and void the warranty.
  • The product should not be exposed to water and moisture, or not be placed on a conductive surface, in the course of any operations.
  • AlphaBot should not touch any heat source, to ensure reliable service under a normal room temperature environment.
  • Protect the printed circuit board and the components on it from mechanical or electrical damages, in the course of any operations.
  • Avoid touching the energized printed circuit board in the course of any operations. Touching the edge of the board is allowed, which can reduce the risk of electrostatic discharge.

Resource

Document

AlphaBot2-Base: Schematic
AlphaBot2-Ar: Schematic Assembly diagram
AlphaBot2-Pi: Schematic Assembly diagram
AlphaBot2-PiZero: Schematic Assembly diagram
AlphaBo2 for micro:bit Schematic Assembly diagram

Video

Demo codes

Software

Datasheet

FAQ

 Answer:

AlphaBot2 is smaller in size, highly integrated with various sensors, and more stable in structure. With a high-precision all-metal motor, it boasts low noise and high precision. Compared with L298P, its TB6612FNG motor driver chip is more efficient, smaller, and does not heat up. Also, it added peripherals such as buttons, buzzers, cool lights, USB to a serial port, etc., which is more convenient for you. AlphaBot2-Ar adapter board adds OLED, AlphaBot2-PiZero adapter board adds USB Hub and PCA9685 servo control chip to avoid the jitter phenomenon of Raspberry Pi software PWM control servo. The programs are more abundant, and the Raspberry Pi adds Android App video control and Qt software control on the computer. Also adds onboard Bluetooth remote control for Raspberry Pi.

{{{5}}}


 Answer:

Support a 14500 battery (not included), that is, 14mm directly and 50mm in length. The standard voltage of a single cell is generally 3.7V, the fully charged voltage is generally 4.2V, and the minimum voltage cannot be lower than 3V or 2.75V, otherwise, the battery will be permanently damaged. The shape of this battery is the same as the size of the AA battery, but it cannot be replaced by the AA battery. The 5th battery voltage is not enough.

{{{5}}}


 Answer:
First, check whether the infrared detection module in front of the car is normal. Under normal circumstances, the two green LED lights are not on, and only when there is an object in front of the car is detected. If the LED light is always on or not, you can adjust the potentiometer at the bottom of the trolley so that the LED just goes out when there is no obstacle.

{{{5}}}


 Answer:
When the motor rotates in the wrong direction, it can be corrected by modifying the pin settings in the program, as described in the user manual.

{{{5}}}


 Answer:
The servo can be rotated about 180 degrees and can be rotated 90 degrees left and right under normal circumstances. If the difference between the left and right sides of the rotation is too large, you can reassemble and adjust.

{{{5}}}


 Answer:
The car will slow down when the battery power is too low. Under normal circumstances, when the Raspberry Pi is turned off and cannot be connected, the battery needs to be charged. When the battery voltage is too low, you should not continue to use it, otherwise, the battery will be permanently damaged and cannot be used.

{{{5}}}


 Answer:
Yes, we provide schematic diagrams and dimension drawings, and users can carry out secondary development.

{{{5}}}


 Answer:
If it cannot be recognized, the car can only track along the line. To recognize the T-word or cross, it is best to use the camera to track it.

{{{5}}}


 Answer:
The SG90 is an entry-level servo. The main reason is that the potentiometer inside is inaccurate. It loosens after a period of use, which causes the gear to be inconsistent with the theoretical rotation angle, resulting in noise and heat.

{{{5}}}


 Answer:

Please download and replace the examples with this one for a try.

{{{5}}}


Support



Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)