background image

AlphaBot 2 User Manual 

 

 

10 

 

share awesome hardware

Quick start 

We have provided the control programs for Arduino and Raspberry Pi, which can 

implement many functions, such as tracking, obstacle avoidance, remote control, 

video monitoring and so on.   

You can get the example programs described in the following sections from the 

website of Waveshare Wiki. To apply these examples to your application, you need 

to  copy  the  file  libraries  under  the  directory  of  Arduino  into  the  folder  libraries 

under the installation directory of Arduino IDE. Then, restart the Ariduino IDE, and 

click  File->  Example  to  see  if  there  is  an  option  TRSensors.  If  yes,  it  means  the 

libraries are imported successfully. When using the Raspberry Pi, you should extract 

the  example  programs  and  place  them  in  the  directory  of  /home/pi  under  the 

operation system of Raspbian. 

Arduino examples 

Motor testing 

Compile and download the program  Run-Test. Normally, the smart robot moves 

forward when the program runs and drives the motor to rotate. In case that the 

direction of motion is wrong, you may need to modify the motor wring or change 

the pin settings in your program. We recommend the latter one. If left wheels of the 

robot run in a wrong direction, you should exchange the settings of AIN1 and AIN2. 

For right wheels, exchange the settings of BIN1 and BIN2. 

In the event that all the wheels run in a wrong  direction, you should modify the 

Summary of Contents for AlphaBot 2

Page 1: ...AlphaBot 2 User Manual 1 share awesome hardware AlphaBot 2 User Manual August 2017 V1 3...

Page 2: ...UNO PLUS Enhanced Arduino compatible board Dual mode Bluetooth Dual mode Bluetooth module Ultrasonic sensor Ultrasonic obstacle avoiding ranging IR remote controller remotely control the robot RPi Cam...

Page 3: ...ractical experience of smart robot development Raspberry Pi tutorial http www waveshare com wiki Raspberry_Pi_Tutorial_Series Due to the electrical characteristic limitation user should be more carefu...

Page 4: ...n Guide 2 Recommendation 3 Get details 3 Contents 4 What s on board 5 Introduction 5 AlphaBot2 Base 6 AlphaBot2 Ar 7 AlphaBot2 Pi 8 AlphaBot2 PiZero 9 Quick start 10 Arduino examples 10 Raspberry Pi e...

Page 5: ...h common robot functions including line tracking obstacle avoiding Bluetooth infrared WiFi remote control video monitoring etc Thanks to the highly integrated modular design it is fairly easy to assem...

Page 6: ...frared photoelectric sensor for obstacle avoiding 6 ITR20001 T reflective infrared photoelectric sensor for line tracking 7 Potentiometer for adjusting obstacle avoiding range 8 TB6612FNG dual H bridg...

Page 7: ...duino shields 3 Arduino interface for connecting Arduino compatible controller 4 Xbee connector for connecting dual mode Bluetooth module remotely control the robot via Bluetooth 5 IR receiver 6 PC857...

Page 8: ...or connecting Raspberry Pi 3 Model B 3 Servo interface 4 USB TO UART easy for controlling the Pi via UART 5 LM2596 5V voltage regulator 6 TLC1543 10 bit AD acquisition chip allows the Pi to use analog...

Page 9: ...receiver 5 Buzzer 6 FE1 1S USB HUB chip 7 12M crystal 8 USB TO UART easy for controlling the Pi via UART 9 USB HUB interface extends the USB port of Raspberry Pi Zero Zero W 10 CP2102 USB TO UART con...

Page 10: ...here is an option TRSensors If yes it means the libraries are imported successfully When using the Raspberry Pi you should extract the example programs and place them in the directory of home pi under...

Page 11: ...directions Up Down Left Right and Center Enter Open the serial monitor and set the baud rate to 115200 Then the monitor displays the current key press When there is a key pressed down the buzzer sound...

Page 12: ...bot and EQ can restore the default setting of the speed The key encoding may change with different Infrared remote controller You can modify the program as required Infrared obstacle avoidance Compile...

Page 13: ...e baud rate to 115200 Then the monitor displays the current measured distance Ultrasonic obstacle avoidance Compile and download the program Ultrasonic Obstacle Avoidance In this example the robot goe...

Page 14: ...ne in the background color of white You can choose a black adhesive tape with 15cm width and paste it to a white KT board to create the smart robot tracking line scenario The dark background color wil...

Page 15: ...of the robot and 4000 means the black line is on the rightmost side of the robot When this program runs well the line tracking sensor works properly Or else the sensor cannot perform line tracking In...

Page 16: ...haracter display and drawing operation including drawing line cycle rectangle box and the likes To run this program you should import the corresponding library to Arduino IDE Comprehensive program Com...

Page 17: ...ee the OLED display the characters AlphaBot2 Then place the robot on the black line and press down the key Now the smart robot goes into the calibration mode moving to left and then right And the RGB...

Page 18: ...ll slow down and detects if there is a corner once again As the difference at motor and operation voltage in used the smart robot may be unable to identify the corner In this case you can modify the s...

Page 19: ...AlphaBot 2 User Manual 19 share awesome hardware...

Page 20: ...remove the Bluetooth module from the smart robot before downloading or else the program cannot be loaded When finished you should insert the Bluetooth module to the smart robot again Then scan the QR...

Page 21: ...artup the APP and click the option Scan Note Turn on the Bluetooth on your mobile phone Then insert the Bluetooth module to the smart robot After a few second you can find the corresponding Bluetooth...

Page 22: ...e and click the option Settings to configure the commands according to the program When there is key pressed down it will trigger corresponding command And when the key is released and bound up it wil...

Page 23: ...Bluetooth Bluetooth control smart robot JSON formatted command Remove the Bluetooth module then compile and download the program Bluetooth json Next startup the APP and insert the Bluetooth module to...

Page 24: ...tion For the freshmen of Raspberry Pi please refer to the Raspberry Pi Tutuiral You can optionally read the following content Raspberry Pi Tutuiral 2 Raspberry Pi burning image Raspberry Pi Tutuiral 3...

Page 25: ...2 python sudo python Joystick py Expectation result This Joystick has 5 control directions Up Down Left Right and Center Enter Open the serial monitor and set the baud rate to 115200 Then the monitor...

Page 26: ...stacle_Avoidance py When there is no obstacle ahead of the robot the green LED on the robot is off When the obstacle is detected the green LED will light up In case that the LED is always off or alway...

Page 27: ...dance py Expectation result The robot goes straight when there is no obstacle detected by the sensor on the left and turns right when obstacle is detected RGB LED Copy the file rpi_ws281x master zip i...

Page 28: ...Enter the following commands under the terminal cd AlphaBot2 python sudo python ws2812 py Expectation result The four RGB LEDs on the bottom of the smart robot will be in red green blue and yellow res...

Page 29: ...tracking Enter the Linux terminal and input the following commands cd AlphaBot2 python sudo python LineFollow py Expectation result While the program is running the smart robot goes into the calibrat...

Page 30: ...I interface the system may be unable to find out the device under the directory of dev video0 In this case you should add a line bcm2835 v4l2 into the file etc modules sudo nano etc modules Add the li...

Page 31: ...treamer cd AlphaBot2 lib mjpg streamer sudo start sh Then open the browser and enter the IP address of RPi and the port number 8080 into the address bar Notices the port number here is 8080 other than...

Page 32: ...erminal pressing the keys Ctrl C can end the program However we recommend you to keep the program running since we still need it in the following operations Remote control via webiopi Webiopi is a web...

Page 33: ...support Raspberry Pi 3B To install the webiopi you should open a new terminal and keep the route described above running cd AlphaBot2 lib WebIOPi 0 7 1 raspi2 sudo setuo sh Check if the library is in...

Page 34: ...be changeable according to your actual condition To login the website you should enter your account and password The default account name is webiopi and the original password is raspberry When finish...

Page 35: ...ano index html Find out the link http 192 168 10 235 8080 action stream In here 192 168 10 235 is the IP address of RPi and it can be changeable according to your actual condition The port number shou...

Page 36: ...hrome browser or the Firefox browser Furthermore please make sure the current directory of Raspberry Pi is AlphaBot2 mjpg AlphaBot mjpg AlphaBot since there is a file index html under this directory A...

Page 37: ...with WSGI By Bottle you can fast and easily implement Web control 1 Install the library sudo apt get install python bottle 2 Perform web control RGB LED via Bottle cd AlphaBot2 Web RGB sudo python ma...

Page 38: ...out the line below and change the IP address to the actual RPI address and set the port to the stream port img width 320 height 240 src http 192 168 10 235 8080 action stream Then run the following c...

Page 39: ...et the program to be started up on boot Open the file etc rc local with your editor and add the following line into it sudo vi etc rc local Add the commands following the comments Please make sure the...

Page 40: ...h the 24 should not be removed Remote control via software To implement video control the smart robot via the software on your mobile phone or PC you should modify the IP address in the program firstl...

Page 41: ...Then click the button Cmd Connect to connect to the smart robot sever You will see the button turn to green if the connection is successful Now you can control the action of the smart robot by pressin...

Page 42: ...to blue Now you can control the actions of the smart robot and the steer by pressing down the corresponding keys By dragging the slider you can change the speed of the robot Open the file etc rc loca...

Page 43: ...ote control via RPi Bluetooth 1 Upgrade the relative packages of the Bluetooth and install the depended upon software sudo apt get update sudo apt get upgrade y sudo apt get dist upgrade y sudo apt ge...

Page 44: ...device hci0 displayed on the screen When the Bluetooth does not work no Bluetooth device can be identified Note If the line dtoverlay pi3 miniuart bt exists in the file boot config txt it should be c...

Page 45: ...interface agent on default agent Following the scan on you can see the physical address of the scanned Bluetooth device similar to XX XX XX XX XX XX For Bluetooth pairing use the following command In...

Page 46: ...XX XX XX XX XX XX Next connect to the device connect XX XX XX XX XX XX At last enter the command quit to exit the interface After the settings above as the Bluetooth device is turned on the Raspberry...

Page 47: ...hardware enter the graphic interface to make the connection Click the Bluetooth icon and add new device Select the corresponding Bluetooth device Please make sure the Bluetooth on the mobile phone sh...

Page 48: ...rdware On the RPi select the option OK for pairing And at the same time on the mobile phone click the option Pair Then you may see the prompt saying that Paired successfully but this device has no ser...

Page 49: ...AlphaBot 2 User Manual 49 share awesome hardware...

Page 50: ...hone and download the relative APP This is the software for controlling the Dual mode Bluetooth module If you has installed this software in your Arduino mobile phone you can skip this step Start the...

Page 51: ...AlphaBot 2 User Manual 51 share awesome hardware If the Bluetooth of the Raspberry PI can not be searched you can run the following lines to enable the Bluetooth and set it to discoverable...

Page 52: ...keys buzzer RBG LED USB converter and the likes AlphaBot2 Ar adapter board adds OLED and AlphaBot2 PiZero adapter board adds usb Hub PCA9685 steer control chip able to avoid jittering when using Rasp...

Page 53: ...LEDs on the robot are off When the obstacle is detected the green LEDs will light up In case that the LEDs are always off or always on you can try to adjusted the potentiometers on the bottom of the r...

Page 54: ...come unable to connect you should charge the battery When the battery voltage is low you should stop using the battery or else it may be permanently damaged and cannot be applied any more Question 7 C...

Page 55: ...y has to obey to 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 pro...

Page 56: ...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 ed...

Reviews: