PicoGo Mobile Robot, Based on Raspberry Pi Pico
The PicoGo smart robot is always the favourite project of electronic enthusiasts. There have been several robots based on Raspberry Pi Zero W, 3B+, 4B in Waveshare’s product line. Now, here comes the Pico version: PicoGo!
The PicoGo is a smart mobile robot based on Raspberry Pi Pico. It includes an ultrasonic module, LCD module, Bluetooth module, line following module, and obstacle avoidance module. You can easily achieving the following:
- IR obstacle avoidance
- Auto line following
- Bluetooth/IR remote control
- and more.
PicoGo smart mobile robot features:
- Standard Raspberry Pi Pico header, supports Raspberry Pi Pico series
- Recharge/Discharge circuit, allows programming/debugging concurrently while recharging
- 5-ch infra-red sensor, analog output, combined with PID algorithm, stable line tracking
- Onboard multiple smart robot sensors like line tracking, obstacle avoidance, no more messy wiring
- 1.14inch IPS colorful LCD display, 240 x135 pixels, 65K colors
- Integrates Bluetooth module, allows teleoperations like robot movement, RGB LED display color, buzzer, etc. by using mobile phone APP
- N20 micro gearmotors, with metal gears, low noise, high accuracy
- Colorful RGB LED, pretty cool!
Pico & 14500 Batteries not included
What’s in the box ?
- PicoGo base board x1
- PicoGo acrylic panel x1
- 1.14inch LCD Module x1
- Ultrasonic sensor x1
- IR remote controller x1
- USB-A to micro-B cable 1.2m x1
- PH2.0 8Pin cable 5cm opposite side headers x1
- Mini cross wrench sleeve x1
- Screwdriver x1
- Screws and standoffs pack x1
Resources: For any additional information/example code/Guides and Support please visit the Wiki.
Tips
- You need to connect the power to Picogo to activate the batteries when you change batteries. Otherwise, the Picogo cannot be powered normally.
- The warning light will light up when the batteries are connected reversely, and it needs to be replaced immediately. If the batteries are reversed, the self-recovery fuse will heat up severely. It can be used normally after correction.
- Connect USB power to the Picogo or turn on the power switch. The power indicator, and battery indicator will always be on. After disconnecting the USB cable and turning off the switch, the power indicator (red light) will turn off, and the battery indicator (yellow-green light) will go out after a while. Press the key, the battery indicator will be on for a while and then go out
- Infrared obstacle avoidance sensor, RGB LED and motor all need 5V power supply. If you don’t turn on the power switch and only connect to USB power supply, these functions will not work properly. .
- The yellow-green LED light is the power indicator. When only one LED light flashes, it indicates that the battery is low and needs to be charged.
- Some programs will call other program modules. The sample program must be saved to Raspberry Pi Pico before running the program. Otherwise the running program may provide that the corresponding module cannot be found.
- After Pico is started, it will automatically run the main.py program. If you need the car to start the corresponding program, you need to save the program as a main.py file.
Software Setup
- Download the MicroPython firmware
- Press and hold the Reset button of the Pico board, connect it to the Host PC by USB cable and then release.
- Drag or copy the downloaded UF2 file to the removable RPI-RP2 disk (Pico board)
- The Pico board will auto-restart and it is ready to flash Micropython examples.
- For more information about how to use the Pico board, please refer to the Pico Python SDK
Hardware Setup
Please follow the video to assemble the Picogo.
Note: If you are the first time using the PicoGo, please first flash the Micropython firmware to the Pico board before assembling.
Download example
Open a terminal and run the following command to download the examples and unzip them.
wget https://www.waveshare.com/w/upload/0/00/PicoGo_Code.zip
unzip PicoGo_Code.zip
Test Motors
- Open the motor.py in Thonny IDE, and run it
- The PicoGo will move forward, then backward, turn left and turn right after running the codes.
Note: You need to turn the power switch to ON, and make sure that the PicoGo has enough place to move.
- Codes:
...
M = PicoGo() #Instantiate the PicoGo class, which has defined the functions of motions (forward, backward, left, right stop and the intialiation.
M.forward(50) #Move the motor forward in half speed (0- 100)
utime.sleep(0.5) #Set sleep time to let the Picogo keep moving for 0.5s
M.backward(50) #Move the motor backward in half speed (0- 100)
utime.sleep(0.5)
M.left(30) #Let the motor turn left in speed 30 (0-100)
utime.sleep(0.5)
M.right(30) #Let the motor turn right in speed 30 (0-100)
utime.sleep(0.5)
M.stop() #Stop the motor
Infrared Remote Control
- Open the IRremote.py in ThonnyIDE and run it.
- Press the Infrared controller to control the PicoGo
- 2,8,4,6,5 are used for forwarding, backward, turn left, turn right and stop. You can press the – or + keys to adjust the speed and press EQ to restore the setting.
- Different infrared remote controllers may have different key codes, if you use other controllers, you may need to modify the codes.
Note: If you need to make the PicoGo run without cable, you need to rename the IRremote.py as main.py and save it to Raspberry Pi Pico. The codes also need to call the Motor.py, you need to save it to Raspberry Pi Pico as well.
- Codes:
...
while True:
key = getkey() #use the getkey function to read the singal of Infrated controller.
if(key != None):
n = 0
if key == 0x18:
M.forward(speed) #If the value of controlled is 0x18, move the motor forward
print("forward")
if key == 0x08:
M.left(20) #If the value of controlled is 0x08, turn the Picogo toward left
print("left")
if key == 0x1c:
M.stop() #If the value of controlled is 0x1C, stop the motor
print("stop")
if key == 0x5a:
M.right(20) #If the value of controlled is 0x5a, turn the Picogo toward right
print("right")
if key == 0x52:
M.backward(speed) #If the value of controlled is 0x52, move the motor backward
print("backward")
if key == 0x09:
speed = 50 #If the value of controlled is 0x09, set the speed to 50
print(speed)
if key == 0x15:
if(speed + 10 < 101):
speed += 10 #If the value of controlled is 0x15, speed up the motor in 10, max is 100
print(speed)
if key == 0x07:
if(speed - 10 > -1):
speed -= 10 #If the value of controlled is 0x07, slow down the motor in 10, min is 0
print(speed)
else:
n += 1
if n > 800:
n = 0
M.stop() #If the controller doesn't be operated for a certain time, stop the motors.
Infrared Obstacle Avoidance
- Open the Infrared-Obstacle-Avoidance.py in Thonny IDE, rename it as main.py, and save it to Pico. Disconnect the USB cable and run it.
- When there is no obstacle in front of the car, the green LED light in front of the car will be off. When the car meets an obstacle, the green LED light in front will be on.
- If the LED light is not bright or keeps brightening, you can adjust two potentiometers on the bottom of the PicoGo, so that the LED is just out of state. The detection distance is the farthest.
- Procedure phenomenon is no obstacle when the car straight, encountered obstacles when the car to turn right.
- Code:
...
while True:
DR_status = DSR.value() # Read the value of the right Infrared sensor
DL_status = DSL.value() # Read the value of the left Infrared sensor
if((DL_status == 0) and (DR_status == 0)): #If the value of both the sensor are 0, there is obstace in the front, turn left
M.left(10)
elif((DL_status == 0) and (DR_status == 1)): #If the DL value is 0 and the DR value is 1, there is obstace in the left side, turn right
M.right(10)
elif((DL_status == 1) and (DR_status == 0)): #If the DL value is 1 and the DR value is 0, there is obstace in the right side, turn left.
M.left(10)
else:
M.forward(20) #else, there is no obstace, keep moving forward.
utime.sleep_ms(10)
Ultrasonic Ranging
- Open the Ultrasionc_Ranging.py in Thonny IDE, the detected distance will be shown on the shell.
- Because the ultrasonic wave will be reflected, the front side of the obstacle plane is not in front of the ultrasonic wave but with the ultrasonic wave formed an Angle of the measured distance may be inaccurate.
- Codes:
...
def dist(): #Function to read the sensor data and caculate the distance
Trig.value(1)
utime.sleep_us(10)
Trig.value(0)
while(Echo.value() == 0):
pass
ts=utime.ticks_us()
while(Echo.value() == 1):
pass
te=utime.ticks_us()
distance=((te-ts)*0.034)/2
return distance
while True:
print("Distance:%6.2f cm" % dist()) # Print the Distance data to the console.
utime.sleep(1)
Ultrasonic Obstacle Avoidance
- Open the Ultrasionc-Obstacle-Avoidance.py in Thonny IDE, rename it as main.py, and save it to Raspberry Pi Pico.
- Run the program after disconnecting the USB cable. Go straight when there is no obstacle, and turn right when there is an obstacle.
- Codes;
...
def dist(): #Function for reading data of Ultrasonic sensor and calculate the distance
Trig.value(1)
utime.sleep_us(10)
Trig.value(0)
while(Echo.value() == 0):
pass
ts=utime.ticks_us()
while(Echo.value() == 1):
pass
te=utime.ticks_us()
distance=((te-ts)*0.034)/2
return distance
while True:
D = dist() #read the distance data
if(D <= 20): #Turn right if there the distance of obstace is shorteer than 20
M.right(20)
#Ab.left()
else: #else keep moving forward
M.forward(20)
utime.sleep_ms(20)