Difference between revisions of "AlphaBot"

From Waveshare Wiki
Jump to: navigation, search
(Created page with "{{Infobox item|colorscheme=blue |name=AlphaBot |name2=AlphaBot-Ar-Basic |name3=AlphaBot-Ar-Bluetooth |name4=AlphaBot-Pi Acce Pack |name5=AlphaBot-Pi |brief=AlphaBot |brief2=Al...")
 
(18 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
<div class="tabber">
 
{{Infobox item|colorscheme=blue
 
{{Infobox item|colorscheme=blue
 
|name=AlphaBot
 
|name=AlphaBot
Line 5: Line 6:
 
|name4=AlphaBot-Pi Acce Pack
 
|name4=AlphaBot-Pi Acce Pack
 
|name5=AlphaBot-Pi
 
|name5=AlphaBot-Pi
|brief=AlphaBot
+
|brief=Mobile robot development platform
|brief2=AlphaBot-Ar-Basic
+
|brief2=Basic robot building kit for Arduino
|brief3=AlphaBot-Ar-Bluetooth
+
|brief3=Bluetooth robot building kit for Arduino
|brief4=AlphaBot-Pi Acce Pack
+
|brief4=Raspberry Pi robot building kit (no Pi)
|brief5=AlphaBot-Pi
+
|brief5=Raspberry Pi robot building kit
|img=[[File:AlphaBot.jpg|300px|link=http://www.waveshare.com/alphabot.htm]]
+
|img=[[File:AlphaBot.jpg|300px|link=http://www.waveshare.com/alphabot-robot.htm]]
 
|img2=[[File:AlphaBot-Ar-Basic.jpg|300px|link=http://www.waveshare.com/alphabot-ar-basic.htm]]
 
|img2=[[File:AlphaBot-Ar-Basic.jpg|300px|link=http://www.waveshare.com/alphabot-ar-basic.htm]]
 
|img3=[[File:AlphaBot-Ar-Bluetooth.jpg|300px|link=http://www.waveshare.com/alphabot-ar-bluetooth.htm]]
 
|img3=[[File:AlphaBot-Ar-Bluetooth.jpg|300px|link=http://www.waveshare.com/alphabot-ar-bluetooth.htm]]
Line 16: Line 17:
 
|img5=[[File:AlphaBot-Pi.jpg|300px|link=http://www.waveshare.com/alphabot-pi.htm]]
 
|img5=[[File:AlphaBot-Pi.jpg|300px|link=http://www.waveshare.com/alphabot-pi.htm]]
 
|caption=Mobile robot development platform, compatible with Raspberry Pi/Arduino
 
|caption=Mobile robot development platform, compatible with Raspberry Pi/Arduino
 +
|caption2=Basic robot building kit for Arduino: UNO PLUS + AlphaBot + Ultrasonic Sensor
 +
|caption3=Bluetooth robot building kit for Arduino: UNO PLUS + AlphaBot + Ultrasonic Sensor + Bluetooth + Versatile Accessory Shield
 +
|caption4=Raspberry Pi robot building kit: AlphaBot + Camera
 +
|caption5=Raspberry Pi robot building kit: Raspberry Pi 3B + AlphaBot + Camera
 
|category=[[:Category:AlphaBot|AlphaBot]]
 
|category=[[:Category:AlphaBot|AlphaBot]]
 
|brand=Waveshare
 
|brand=Waveshare
Line 28: Line 33:
 
* [[Tracker Sensor]]
 
* [[Tracker Sensor]]
 
}}
 
}}
 +
 +
<div class="tabbertab" title="Instruction">
 
== Introduction ==
 
== Introduction ==
 
Mobile robot development platform, compatible with Raspberry Pi/Arduino
 
Mobile robot development platform, compatible with Raspberry Pi/Arduino
Line 33: Line 40:
 
{{Amazon|{{#urlget:amazon|default}}=display
 
{{Amazon|{{#urlget:amazon|default}}=display
 
|More = [http://www.waveshare.com/catalogsearch/result/?q=AlphaBot More]}}
 
|More = [http://www.waveshare.com/catalogsearch/result/?q=AlphaBot More]}}
 +
{{AlphaBot User Manual}}
  
 +
 +
</div>
 +
 +
<div class="tabbertab" title="Resources">
 
== Resources ==
 
== Resources ==
* [[:File:Tracker-Sensor-Schematic.pdf|Schematic]]
+
=== Documentation ===
* [[:File:Tracker_Sensor_Demo.7z|Demo code]]
+
* [[:File:AlphaBot-User-Manual.pdf|User Manual]]
 +
* [[:File:AlphaBot_Schematic.pdf|Schematic]]
 +
* [[:File:AlphaBot-Assembly-Diagram.pdf|AlphaBot Assembly Diagram]]
 +
 
 +
=== Demo ===
 +
* [[:File:AlphaBot_Demo.7z|Demo code]]
 +
=== Software ===
 
* [http://www.waveshare.com/w/upload/5/56/Putty.zip PuTTY for serial debugging]
 
* [http://www.waveshare.com/w/upload/5/56/Putty.zip PuTTY for serial debugging]
 +
* [http://www.waveshare.com/w/upload/b/b7/SecureCRT.7z SecureCRT for serial debugging]
 +
* Bluetooth Apps: [https://itunes.apple.com/us/app/ws-ble/id1163606757?mt-8= iOS], [https://fir.im/hysk Android]
 +
* [[:File:AlphaBot_Qt.7z|Windows Qt client]]
 +
* [https://fir.im/mex4 WiFi video console for Android]
 +
 +
== Related Product ==
 +
* [[Dual-mode Bluetooth]]
 +
 +
 +
</div>
 +
<div class="tabbertab" title="FAQ"><br />
 +
{{FAQ|1、Alphabot系列智能车配什么电池?|
 +
配18650型电池,即直接为18mm,长度为65mm.单节标的电压一般为3.7V,充满电电压一般为4.2V,最低电压不能低于3V或2.75V,否则电池会永久损坏。|||}}
 +
{{FAQ|2、运行程序小车电机不动?|
 +
需要更加用户手册更改一下跳线帽的位置。|||}}
 +
{{FAQ|3、红外避障程序不正常?|
 +
首先检查一下红外避障模块是否正常,正常情况下绿色的LED灯是不亮的,有障碍物时LED灯亮。如果绿色LED灯一直亮或者一直不亮可以调节模块上面的电位器,使得绿色的LED灯刚好熄灭。另外再检查一下跳线是否正确。|||}}
 +
{{FAQ|4、小车能否循迹T字路口或者十字路口?|
 +
不能识别,小车只能沿着线循迹,要识别T字或者十字最好采用摄像头循迹。|||}}
 +
 +
</div>
 +
<div class="tabbertab" title="Supports"><br />
 
==Support==
 
==Support==
 
{{Service00}}
 
{{Service00}}
 +
</div>
 +
</div>
 +
 +
[[Category:Robotics]]
 +
 +
[[Category:AlphaBot|AlphaBot]]

Revision as of 07:30, 9 September 2020

AlphaBot
Mobile robot development platform
AlphaBot.jpg

Mobile robot development platform, compatible with Raspberry Pi/Arduino
AlphaBot-Ar-Basic
Basic robot building kit for Arduino
AlphaBot-Ar-Basic.jpg

Basic robot building kit for Arduino: UNO PLUS + AlphaBot + Ultrasonic Sensor
AlphaBot-Ar-Bluetooth
Bluetooth robot building kit for Arduino
AlphaBot-Ar-Bluetooth.jpg

Bluetooth robot building kit for Arduino: UNO PLUS + AlphaBot + Ultrasonic Sensor + Bluetooth + Versatile Accessory Shield
AlphaBot-Pi Acce Pack
Raspberry Pi robot building kit (no Pi)
AlphaBot-Pi-Acce-Pack.jpg

Raspberry Pi robot building kit: AlphaBot + Camera
AlphaBot-Pi
Raspberry Pi robot building kit
AlphaBot-Pi.jpg

Raspberry Pi robot building kit: Raspberry Pi 3B + AlphaBot + Camera

Introduction

Mobile robot development platform, compatible with Raspberry Pi/Arduino

More

Functions

As Arduino and Raspberry Pi are the popular development board recently, intelligent robot cars are also a favorite project of many electronics enthusiasts, and AlphaBot is a good choice.
Just connecting a controller board, Raspberry Pi or Arduino, and combined with our open-source example code, AlphaBot is ready to start exploration: line tracking, obstacle avoidance, video monitoring, WiFi/Bluetooth/ZigBee/Infrared remote control, etc.
AlphaBot can perceive its environment and perform relative responses. It involves the following technologies: Tracking line, obstacle avoidance, mobile phone/PC video monitoring, WIFI/Bluetooth/ZigBee/infrared remote control, and the likes.
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.

Features

  • Raspberry Pi/Arduino interfaces, work with either one separately, or both.
  • Arduino extended header, supports Arduino shields.
  • Modular design, plug-and-play modules like line tracking, obstacle avoidance, speed measuring, etc. eliminating the trouble of connecting mess wires.
  • L298P motor driver with diode protection circuit, more safety.
  • LM2596 voltage regular provides stable 5V power to the Raspberry Pi/Arduino.
  • TLC1543 AD acquisition chip, allows the Pi to use analog sensors.

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 be helpful for understanding 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 roboteful 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 in using this product, please follow the steps described in the document.

Selection Guide

Note: Accessories may be different in different product package. This manual describes all the compatible accessories but perhaps the product you bought doesn’t contain some of them. The figure below shows most the compatible accessories:
Alphabot Selection.png

Onboard Resources

AlphaBot-intro.jpg

  1. Raspberry Pi interface: for connecting Raspberry Pi
  2. Arduino interface: for connecting Arduino
  3. Motor interface
  4. Ultrasonic module interface
  5. Servo module interface
  6. Obstacle avoidance module interface
  7. Speed measuring interface
  8. Battery holder: supports 18650 batteries
  9. Reserved power input (not soldered): for connecting other external power supply
  10. Arduino expansion header: for connecting Arduino shields
  11. UART interface: for connecting Bluetooth module, to control the robot remotely via Bluetooth
  12. SPI interface: for connecting NRF24L01 wireless module
  13. Line tracking module interface
  14. TLC1543: 10-bit AD acquisition chip, allows the Pi to use analog sensors
  15. L298P: dual H bridge motor driver chip, up to 2A current
  16. Anti-reverse diode
  17. Power switch
  18. LM2596: 5V regulator'
  19. Power indicator
  20. UART switch: turn on to enable serial communication between Raspberry Pi and Arduino
  21. IR receiver: control the robot remotely via infrared
  22. Raspberry Pi/Arduino selection: select the Raspberry Pi or Arduino to control the robot peripherals

Main control module

The main control module is the key part of the smart robot. AlphaBot provides Arduino and Raspberry Pi interfaces. Configuration can be one of two options, or both of them work together. By making full use of the hardware and software of both boards, the smart robot can be applied to much more application scenarios.
AlphaBot-detail-1.jpg
You can change the setting of jumpers to change the controller between Arduino and RaspberryPi.

Motor driver module

Moter driver module is one of the most important parts of the smart robot. AlphaBot use the L298P driver chip from ST, which is a high voltage, big current motor driver chip
100
Interface of the driver:

PIN Raspberry Pi Arduino
IN1 P12 A0
IN2 P13 A1
ENA P6 D5
IN3 P20 A2
IN4 P21 A3
ENB P26 D6

IN1 and IN2 is connected to the left motor of AlphaBot, IN3 and IN4 is connected to the right motor of AlphaBot. ENA and ENB is the enable pins, high active. To adjust the speed of Alphabot, you can output PWM signal to IN1, IN2, IN3 and IN4 pins.
Control theory:

IN1 IN2 IN3 IN4 Description
1 0 0 1 Motors co-roatating and Alphabot move forward
0 1 1 0 Motors reversing and Alphabot move backward.
0 0 0 1 Left motor stops, and the right motor co-rotate. Alphabot turn left.
1 0 0 0 Rightmotor stops, and the left motor co-rotate. Alphabot turn Right.
0 0 0 0 Motors stop and Alphabot stop.

Power Supply

The smart robot employs two series 18650 batteries for power supply with input voltage of 7.4V. The input voltage will be deal with the LM2596 regulator and send out to Arduino, Raspberry Pi, and sensors.
100
For using an external power supply, the input voltage should not beyond 12V.

AD Chip

Since the GPIO of Raspberry Pi does not support AD function, AlphaBot smart robot has an on-board 10-bit of 11 channel AD conversion chip for tracking line application.
100

Obstacle avoidance module

100
The obstacle avoidance module consists of an infrared transceiver and a comparator. The infrared transmitter has an infrared LED array as a luminophore. When there is an obstacle (reflector) on the detection direction, the Infrared light will be reflected, and received by the infrared receiver, which is a semiconductor with a PN junction made of special material as its core part. As the intensity of the infrared light enhances, more current can be generated, and the analog signal increases. LM393 comparator receives and handles the analog signal, and then outputs the relative digital signal. At this point, the green LED will light up. The logical level of the DOUT can tell you whether there is an obstacle in front of the sensor, and the output voltage of AOUT can tell you the distance from the obstacle if there is. The detection distance can be adjusted via the potentiometer knob.
100

Speed testing module

100
The speed testing module contains a coded disc and a WYC-H206 photoelectric sensor. WYC-H206 photoelectric sensor has an infrared transmitter and an infrared receiver. When the infrared receiver is obscured, and unable to receive infrared light, the sensor will output a high-level voltage. The high-level voltage passes the inverting Schmitt trigger and becomes a low-level voltage. At this point, the relative indicator lights up. When the coded disc runs, DOUT will output a series of high-level pulses and low-level pulses. By checking the number of pluses in cycle time, you can get the speed of the smart robot. Here, we use the Schmitt trigger because it has a stable output signal and a clear waveform without any jitter.
100

Infrared remote control

100
The smart robot applies the LFN0038K receiver to receive an infrared signal. The infrared remote controller provided with the application kit, complies with the standard NEC encoding protocol. When the infrared receiver receives the infrared signal, it will output the relative pulses to the main control chip. Then, the main control part decodes the signal to the key code, so as to control the corresponding motor.
Infrared NEC protocol encoding is a kind of PWM serial code, in which the binary logical“0” is in the cycle of 1.125ms with the pulse width 0.565ms and the interval 0.56ms, and the binary logical“1” is in the cycle of 2.25ms with the pulse width 0.565ms and the interval 1.685ms.
100
Infrared control protocol: The 32-bit binary code made up of logical “0” and logical“1” should be secondarily modulated with a 38kHz robotrier frequency, in order to enhance the transmitting efficiency and reduce power consumption. The secondary modulated code will be transmitted in the form of infrared light by an infrared transmitter, as the figure shows below
300
|Boot code|User ID|Radix-minus-one complement of user ID|Op code |complement of op code|
Firstly, a 9ms high-level pulse is transmitted, and a 4.5ms low-level pulse is followed. Later coming is an 8bit address code (LSB first) and its radix-minus-one complement (for checking). The last is an 8bit command code (LSB first) and its radix-minus-one complement.
Each command will only be transmitted once, even you keep pressing the key on the controller. But it will send out a duplication code every 110mS until you release the key on the controller. The format of the duplication code is a 9mS of AGC pulse, a 2.25mS of the interval, and a 560uS of the pulse.
100

Ultrasonic distance measurement module

The ultrasonic distance measurement module has 4 pins, they are VCC, GND, TRIG (transmitting pin) and ECHO (receive pin).
100
Control theory:
Here is the principle of ultrasonic distance measurement. When the ultrasonic wave meets an object, it will be reflected back and received by the receiver. You can get the distance of the object from the sensor by measuring the interval from transmitting a signal to receiving the echo.
100
The timing diagram above shows the control principle of ultrasonic distance measurement. When the module is working, it sends out a high-level signal at least for 10us to control the pin TRIG to trigger distance measurement. Then, the module transmits 8 serials of 40kHz square wave automatically, to check whether there is an echo signal. If there is, the module outputs a high-level voltage from the pin ECHO. The time duration of the high-level voltage is the time of ultrasonic from being transmitted to reflected.
According to the sound transmitting speed and time, we can get that:measured distance=(measured time*sound speed)/2. The sound speed is 340m/s in here.

Parameters Remark Min Typ Max Units
Operating voltage 3.0 5.5 V
5V operating current Vcc=5V 2.8 mA
3.3V operating current Vcc=3.3V 2.2 mA
5V ,omo,i, detectopm distance Vcc=5V 2 3 cm
3.3V minimum detection distance Vcc=3.3V 2 3 cm
5V maximum detection distance Vcc=5V 400 450 600 cm
3.3V maximum detection distance Vcc=3.3V 350 400 550 cm
Detection angle 15 °
Detection accuracy 1 %
Resolution 1 %
Output mode GPIO
Working temperature -20 80 °C

Servo

100
Servo is an auto-control system with a DC motor, a reduction gear set, a sensor, and a control circuit. The servo can control the rotation angle of the output axis by transmitting a control signal. It has 3 control lines, the red one is the positive power line (5V), the orange one is the signal line (IO) and the brown one is power ground (GND).
Generally, a 20ms of the time-based pulse is required in controlling the servo. And the high level should be last for at least 0.5ms-2.5ms. Taking the 180 degree angle servo control as an example, the relationship between the pulse and the rotation angle is showed as the table below.

Pulse Rotation angle
0.5ms 0 degree
1ms 45 degree
1.5ms 90 degree
2.0ms 135 degree
2.5ms 180 degree

Tracker module

100
The working principle of the tracker module is similar to the infrared obstacle avoidance module. The tracker module has an ITR20001/T infrared reflection sensor, of which the infrared transmitter can transmit the infrared light all the time. When the infrared light is reflected back by the obstacle, it will be received by the infrared receiver. And the sensor will output the relative analog value. The outputted data are affected by the distance and the color of the detected object.
The tracker module has 5-channels of infrared sensors. By checking the outputs from the 5-channels of the infrared sensor, the module can judge the position of the black line, so as to control the action of the smart robot.
100

NRF24L01+ Wireless control

AlphaBot has an SPI interface that can connect with the NRF24L01 module, a new RF transceiver. The NRF24L01 has a built-in frequency synthesizer, a power amplifier, a crystal oscillator, and a modulator. With enhanced ShockBurst technology integrated, its address, output power, and communication channel can be configured by the program, suitable for multiple machine communication. The NRF24L01 has an ultra-low power consumption; when the transmitting power is within -6dBm, its working current is only 9mA, and the working current of its receiver is only 12.3mA. The NRF24L01 module also provides low power working modes, such as power-down mode and idle mode.
When using the SPI interface to configure the NRF24L01 module, you should set the module to Enhanced ShockBurstTM mode, enabling the module to handle the RF protocol automatically. Finished the configuration, the module is ready to work. The switch between receive mode and transmission mode can be done by changing the lowest byte of the command when the module is running.
The settings of the main parameters: Data width, declares the number of bits occupied by the data in the RF data package, enabling the NRF24L01+ to make a distinction between the data and the CRC code in the data package; Address width, declares the number of bits occupied by the address in the RF data package, enabling the NRF24L01+ to make a distinction between the data and the address; Receive channel, receive the address of data, the address from channel 0 to channel 5; CRC checking, NRF24L01+ can generate CRC code and perform decoding; Working frequency, configurable between 2.4GHz to 2.524GHz with the interval of 1MHz; Transmission power, affects the communication distance and the power consumption of the whole device; Communication rate, selectable of 1Mbps or 2Mbps.
100

Bluetooth control

AlphaBot has a UART interface, which can connect with a Bluetooth module 2.0 directly, or connect with a dual Bluetooth module via the Accessory Shield module. Since the Bluetooth module is controlled via a serial port, users do not need to know much about the Bluetooth protocol. When connected with the Bluetooth module, you can control your smart robot via your mobile phone.
100
In the figure above, we can see the robot uses the dual Bluetooth module via the Accessory Shield board, supporting Bluetooth 2.0 and Bluetooth 4.0. This is the Bluetooth configuration of our application. However, Bluetooth 2.0 for the UART interface is not provided in our application kit.

Zigbee

AlphaBot can connect with the Core2530 (B) module via Accessory Shield, to perform ZigBee control. In this configuration, the PC should be connected to the CC2530 Eval Kit (B) via a USB cable.
100
Here is the PC software for controlling the smart robot.
100

Wifi video monitoring

In AlphaBot application, when Raspberry Pi works as the main control part, you can use your mobile phone or PC to perform wifi video monitoring via website control. The webiopi can help you to perform the remote control, and the mjpg-streamer software can realtime display the image captured by the camera.
python-bottle is a simple but efficient python Web framerate which is based on WSCI. You can control Pi via Web page by using the Bottle.
MJPG-streamer can collect images from a webcam camera, and transmit them to the mobile device with a browser in the form of stream via the IP based network. With the software mjpg-streamer, you can see the image captured by the camera displayed on your browser via the network.
100

Arduino Examples

Copy the library file under the directory of Arduino to the libraries folder under the installation directory of Arduino IDE. Then, reboot Arduino IDE, and click File-> Example to check whether there are the options of AlphaBot, TRSensor, and Servo. If there are, the library has been exported successfully.

Robot testing program

1. Click File-> Example -> AlphaBot -> E01_Run_Test to open the project. Compile and download the program to the Arduino development board.
2. Connect the Jumpers IN1, IN2, ENA, ENB, IN3, and IN4 in the A area to the A0, A1, D5, D6, A2, and A3, respectively.

  • Turn on the power adapter, you can see that the smart robot runs straight forward.

If the wheels of the smart robot are not forward running, you can try to change the wiring of the motor, or modify the pin set in the AlphaBot.c file.

Infrared obstacle avoidance program

1. Click File -> Example -> AlphaBot -> E02_Infrared_Obstacle_Avoidance to open the project. Compile and download the program to the Arduino development board.
2. Install the Infrared Proximity Sensors on the left side and the right side of the smart robot. Connect the jumper of the motor in the A area to the Arduino, and the jumpers DL and DR of the E area to D7 and D8, respectively.

  • Turn on the power adapter, you can see that the smart robot can perform infrared obstacle avoidance.

When the sensor detected the obstacle ahead of the robot, the green LED will light up. The detection distance can be adjusted by a potentiometer. When the left sensor detects the obstacle, the smart robot will turn to the right. When the right sensor detects the obstacle, the smart robot will turn to the left.

Infrared tracking program

1. Click File -> Example -> AlphaBot -> E03_Infrared_Tracking_Objects to open the project. Compile and download the program to the Arduino development board.
2. Install the Tracker Sensor to the smart robot. Connect the jumper of the motor in the A area to the Arduino, and the jumpers DL and DR of the E area to D7 and D8, respectively.

  • Turn on the power adapter, and you can see that the smart robot can perform object tracking.

If there is an object in front of the smart robot, the robot will run forward. If there is nothing in front of the robot, the smart robot will stand. The detection distance can be adjusted by a potentiometer.

Infrared remote control program

1. Click File -> Example -> AlphaBot -> E04 Infrared_Remote_Control to open the project. Compile and download the program to the Arduino development board.
2. Connect the jumper of the motor in the A area to the Arduino and the jumper of the Infrared receiver IR in the G area to the jumper D4 on Arduino.

  • Expectation result:

When pressing the key on the Infrared remote controller, you can control the smart robot. The key 2 is for go forwards, 8 for going backward, 4 for turn left, 6 for turn right, 5 for stop, - for speed down, and + for speed up. (Notes: The key encoding may change with different Infrared remote controllers. You can modify the program as required. )

Ultrasonic distance measurement program

1. Click File-> Example->AlphaBot-> E05_Ultrasonic_Ranging to open the project. Compile and download the program to the Arduino development board.
2. Install the servo and Ultrasonic module to the smart robot. Connect the jumpers TRIG, ECHO of the Ultrasonic unit in the D area to the pins D11 and D12 on the Arduino. (The tracking line function will use these pins as well, so please remove the corresponding jumpers, avoiding interruption).

  • Turn on the power adapter, the screen will show the distance measured by the Ultrasonic unit currently.

Ultrasonic obstacle avoidance program (without servo)

1. Click File-> Example -> AlphaBot -> E06_Ultrasonic_Obstacle_Avoidance1 to open the project. Compile and download the program to the Arduino development board.
2. Install the steering gear and Ultrasonic module to the smart robot. Connect the jumpers TRIG, ECHO of Ultrasonic unit in D area to the pins D11 and D12 on the Arduino.

  • Turn on the power adapter, the smart cat can perform ultrasonic obstacle avoidance.

When there is an obstacle in front of the robot, it will move to the side that is far away from the obstacle.

Ultrasonic obstacle avoidance program (with servo)

1. Click File-> Example -> AlphaBot -> E07_Ultrasonic_Obstacle_Avoidance2 to open the project. Compile and download the program to the Arduino development board.
2. Install the servo and Ultrasonic module to the smart robot. Connect the jumpers TRIG, ECHO of the Ultrasonic unit in the D area to the pins D11 and D12 on the Arduino. Connect the jumpers S1 and S2C of the servo in the C area to the pins D9 and D10 on the Arduino. (The tracking line function will use these pins as well, so please remove the corresponding jumpers, avoiding interruption).

  • Turn on the power adapter, the smart cat can perform ultrasonic obstacle avoidance.

When there is an obstacle in front of the robot, the Ultrasonic module will measure the distance from the right side and the left side of the robot to the obstacle, respectively. Then, it will move to the side that is far away from the obstacle

Infrared tracking line program

1. Click File -> Example -> AlphaBot -> E08_Infrared_Line_Tracking to open the project. Compile and download the program to the Arduino development board.
2. Install the Tracker Sensor to the smart robot. Connect the jumper of the motor in the A area to the Arduino, and the jumpers CLK, ADDR, DOUT, and CS of the F area to D13, D12, D11, and D10, respectively. (The servo in the C area and the ultrasonic unit in the D area will use these pins as well, so please remove the corresponding jumpers, avoiding interruption).
3. The tracking line program enables the smart robot to run along the black line with the background color of white. You can choose a black adhesive tape of 15cm in width, and paste it onto a white KT board to create the smart robot tracking line scenario. The dark background color will reduce the capability of the smart robot on the tracking line.
4. Turn on the power adapter, and hold the robot in the middle of the black line and close to the ground, then swing the robot from side to side. The smart robot goes into the calibration mode, identifying the max. and min. threshed of each sensor. Calibration can have a direct influence to the tracking line capability of the smart robot. When the wheels of the robot begin to move, you can release the robot and it will run along with the black line.
For more detailed information about the control theory and the algorithm, please refer to the Tracker Sensor User Manual.

Bluetooth remote control program

1. Click File-> Example -> AlphaBot -> E09_Bluetooth_Control to open the project. Compile and download the program to the Arduino development board.
2. Install the Accessory Shield module to the smart robot via the Arduino interface and the Bluetooth module to the Accessory Shield module via the XBee interface.

  • Turn on the power adapter, and download and install the Bluetooth control software to your mobile phone. :

Run the software and connect with Bluetooth, then you can control the motion of the smart robot with the direction keys. OLED can display the command string that you sent.

ZigBee remote control program

1. Click File -> Example -> AlphaBot -> E10_Zigbee_Control to open the project. Compile and download the program to the Arduino development board.
2. Install the Accessory Shield module to the smart robot via the Arduino interface and the ZigBee module Core2530 (B) to the Accessory Shield module via the XBee interface. Connect the CC2530 Eval Kit5 development kit to your PC with a USB cable.

  • Turn on the power adapter, and open the AlphaBot.exe on your PC, select the corresponding serial port number.

Then you can control the motion of a smart robot with the direction keys. OLED can display the command string that you sent.

  • Here is the PC software for controlling the smart robot.

100

Raspberry Pi example program

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.

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

Execute the following command to enter the Raspberry Pi configuration:

sudo raspi-config

Choose Interfacing Options -> Serial -> No -> Yes:
You need to disable the login shell and enable the srial port hardware:

L76X GPS Module rpi serial.png

Reboot Raspberry Pi:

sudo reboot

Open the /boot/config.txt file and find the following configuration statement to enable the serial port, if not, add it at the end of the file:

enable_uart=1

Reboot to take effect.

Libraries Install

Install Library

If you use the bookworm system, you can only use lgpio library, bcm2835 and wiringPi can't be installed and used.

BCM2835

#Open the Raspberry Pi terminal and run the following command
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.71.tar.gz
tar zxvf bcm2835-1.71.tar.gz 
cd bcm2835-1.71/
sudo ./configure && sudo make && sudo make check && sudo make install
# For more, you can refer to the official website at: http://www.airspayce.com/mikem/bcm2835/

WiringPi

#Open the Raspberry Pi terminal and run the following command
cd
sudo apt-get install wiringpi
#For Raspberry Pi systems after May 2019 (earlier than that can be executed without), an upgrade may be required:
wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb
gpio -v
# Run gpio -v and version 2.52 will appear, if it doesn't it means there was an installation error

# Bullseye branch system using the following command:
git clone https://github.com/WiringPi/WiringPi
cd WiringPi
. /build
gpio -v
# Run gpio -v and version 2.70 will appear, if it doesn't it means there was an installation error

lgpio

#Open the Raspberry Pi terminal and run the following command
wget https://github.com/joan2937/lg/archive/master.zip
unzip master.zip
cd lg-master
sudo make install

# You can refer to the official website for more: https://github.com/gpiozero/lg
  • python
sudo apt-get updata
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

Download Examples

Open a terminal and run the following commands:

sudo apt-get install p7zip
wget https://files.waveshare.com/upload/2/20/AlphaBot_Demo.7z
7zr x AlphaBot_Demo.7z -r -o./AlphaBot_Demo
sudo chmod 777 -R AlphaBot_Demo
cd AlphaBot_Demo/AlphaBot_Demo/RaspberryPi/AlphaBot/

Infrared obstacle program

1. Install the Infrared Proximity Sensors on the left side and the right side of the smart robot.
2. Connect the jumpers IN1, IN2, ENA, ENB, IN3, and IN4 of the motor in the A area to the pins P12, P13, P6, P26, P20, and P21 of the Raspberry Pi, respectively.
3. And connect the jumpers DL and DR of the infrared unit in the E area to the pins P19 and P16.

  • Enter the Linux terminal, and input the following lines:
cd python 
sudo python Infrared_Obstacle_Avoidance.py
  • Expectation result:

When the left sensor detects the obstacle, the smart robot will turn to the right. When the right sensor detects the obstacle, the smart robot will turn to the left.

Infrared tracking program

1. Install the Infrared Proximity Sensors on the left side and the right side of the smart robot.
2. Connect the jumpers IN1, IN2, ENA, ENB, IN3, and IN4 of the motor in the A area to the pins P12, P13, P6, P26, P20, and P21 of the Raspberry Pi, respectively.
3. Connect the jumpers DL and DR of the infrared unit in the E area to the pins P19 and P16.

  • Enter the Linux terminal, and input the following lines:
cd python 
sudo python Infrared_Tracking_Objects.py
  • Expectation result:

If there is an object in front of the smart robot, the robot will run forward. If there is nothing in front of the robot, the smart robot will stand. The detection distance can be adjusted by a potentiometer

Infrared remote control program

1. Connect the jumper of the motor in the A area to the Raspberry Pi and the jumper of the Infrared receiver IR in the G area to the pin P18.

  • Enter the Linux terminal, and input the following lines:
cd python 
sudo python Infrared_Remote_Control.py
  • Expectation result:

When pressing the key on the Infrared remote controller, you can control the smart robot. The key 2 is for go forwards, 8 for going backward, 4 for turn left, 6 for turn right, 5 for stop, - for speed down, and + for speed up. (Notes: The key encoding may change with different Infrared remote controllers. You can modify the program as required. )

Infrared tracking line program

1. Connect the jumpers of the motor in the A area to the Raspberry Pi,
2. Set the pins CLK, ADDR, DOUT, and CS of the tracking line function in the F area to the pins P25, P24, P23, and P5.

  • Enter the Linux terminal, and input the following lines:
cd python 
sudo python Infrared_Line_Tracking.py
  • Expectation result:

Turn on the power adapter, the smart cat can perform ultrasonic obstacle avoidance. When there is an obstacle in front of the robot, the Ultrasonic module will measure the distance from the right side and the left side of the robot to the obstacle, respectively. Then, it will move to the side that is far away from the obstacle.

Ultrasonic Ranging program

1. Install the steering gear and Ultrasonic module to the smart robot.
2. Connect the jumpers TRIG, ECHO of Ultrasonic unit in D area to the pins P17 and P5 on the Raspberry Pi.

  • Enter the Linux terminal, and input the following lines:
cd python 
sudo python Ultrasonic_Ranging.py
  • Expectation result:

The screen will show the distance measured by the Ultrasonic unit currently.

Ultrasonic obstacle program

1. Install the servo and Ultrasonic module to the smart robot.
2. Connect the jumpers TRIG, ECHO of Ultrasonic unit in D area to the pins P17 and P5 on the Raspberry Pi. Connect the jumpers S1 and S2C of the servo in the C area to the pins D9 and D10 on the Arduino. (The tracking line function will use these pins as well, so please remove the corresponding jumpers, avoiding interruption).

  • Enter the Linux terminal, and input the following lines:
cd python 
sudo python Ultrasonic_Obstacle_Avoidance.py
  • Expectation result:

The smart cat can perform ultrasonic obstacle avoidance. When there is an obstacle in front of the robot, the Ultrasonic module will measure the distance from the right side and the left side of the robot to the obstacle, respectively. Then, it will move to the side that is far away from the obstacle.

Mjpg-streamer tool for monitoring

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

  • To use camera, you need to first enable the camera
sudo raspi-config
  • Choose Interface Options -> Camera -> Yes
Rpi Enable Camera.png
  • CSI camera is not be listed as video device in Raspberry Pi by default, you need to modify the 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.

  • Run the following commands:
sudo apt-get update
sudo apt-get install libjpeg8-dev cmake
cd AlphaBot_Demo/AlphaBot_Demo/RaspberryPi/AlphaBot/mjpg-streamer/mjpg-streamer-experimental
sudo chmod +x ./start.sh mjpg_streamer mjpg_streamer.c  mjpg_streamer.h
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

Open a terminal and run the following command

sudo apt-get install python-bottle
cd AlphaBot_Demo/AlphaBot_Demo/RaspberryPi/AlphaBot/Web-Control
sudo python main.py

Open a 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 autostart, you can modify /etc/rc.local file and add the following lines
sudo vi /etc/rc.local

Add:

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

As we know, the IP address of Raspberry Pi is dynamic and change 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 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.

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 requirement listed below.

  • The product employs two series 18650 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 power supply and product performance.
  • The disassembly chassis should be placed on the 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 expose 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 make sure reliability service under 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 electrostatic discharge



 Answer:
配18650型电池,即直接为18mm,长度为65mm.单节标的电压一般为3.7V,充满电电压一般为4.2V,最低电压不能低于3V或2.75V,否则电池会永久损坏。


 Answer:
需要更加用户手册更改一下跳线帽的位置。


 Answer:
首先检查一下红外避障模块是否正常,正常情况下绿色的LED灯是不亮的,有障碍物时LED灯亮。如果绿色LED灯一直亮或者一直不亮可以调节模块上面的电位器,使得绿色的LED灯刚好熄灭。另外再检查一下跳线是否正确。


 Answer:
不能识别,小车只能沿着线循迹,要识别T字或者十字最好采用摄像头循迹。



Support

Support

If you require technical support, please go to the Support page and open a ticket.