Very Simple Raspberry Pi Pico Robot

by BobbyBalsa in Circuits > Microcontrollers

2473 Views, 2 Favorites, 0 Comments

Very Simple Raspberry Pi Pico Robot

DSCN0651.JPG

This obstacle avoiding robot is easy to build and program . It uses a Pi Pico board running Micropython . No servo is used for obstacle scanning . It runs forward until an obstacle is met . Then it looks left , scans , returns , looks right and scans again . The distance is recorded for the left and right scans . It picks the largest distance and moves in that direction until a new obstacle is seen .

Why the Pi Pico instead of the ESP8266 or ESP32 running micropython ? The Pi Pico has the same price-tag as the ESP's if you're living in Europe ( extra taxes on parts ordered from Banggood , Ali etc ...) .And flashing MicroPython is a piece of cake , just drag-and drop instead of ESPtool.py . If you're a beginner , the Pico is your key to success !

Supplies

DSCN0644.JPG

Raspberry Pi Pico with Micropython loaded

Headers , male for the Pico , female for the pcb

Arduino-like robot chassis with 2 motors and tailwheel

L298 motor driver module like this one :

Ultrasonic detection module like this one :

prototype board like this one :

2 transistors NPN like BC547 or equivalent

2 blue Leds ( headlights )

2 red Leds ( brake lights )

2 resistors , 20kOhm

resistor , 180 Ohms (blue headlights)

resistor , 330 Ohms (red brake-lights)

resistor , 1000 Ohms (1k , level shifter)

resistor , 2000 Ohms(2k , level shifter)

2S Lipo , 800 or 1000mAh

Power switch , optional .

Connector XT60 ( or other , see your LiPo cell )

mounting hardware ( screws , standoffs , bolts and nuts )

1 driver ( I used a Minion )

Prepare Your Pi Pico

DSCN0658.JPG
DSCN0648.JPG

If you are new to Micropython and the Raspberry Pi Pico I recommend the book by Dogan Ibrahim , everything you might need is in there .

First of all load the latest Micropython to your board as explained here :

Make sure Micropython was properly installed ( check the REPL ) .

Prepare and Test L298 Driver Board

5V_jumper.jpg
Enable_jumper.jpg

Remove the 2 jumpers from the ENA and ENB pins , the Pico will control the Enable-inputs . Make sure the 5V-enable jumper is in place , we need the 5V supplied by the L298board to power our Pico .

Connect the Lipo or a power supply ( 8V ) to the +12V and GND terminals of the L298board , WATCH POLARITY !!!

Measure the voltage at the 5V and GND terminals , make sure the 5V is within tolerances (we power our Pico via VBUS so tolerance is +-10%). If OK : Next step !

Build the Mechanics

DSCN0653.JPG

Very easy if you are using a kit . Fix the motors and tailwheel to the chassis using nuts and bolts . Normally the circuit boards can be fixed using nuts , bolts and insulated standoffs because the chassis has plenty pre-made 3mm holes .

Build the Electronics

DSCN0654.JPG
headlights_Driver.jpg
US_detail.jpg
brake_lights.jpg
Level_shifter.jpg

If your Pico came without headers solder male headers .

I used a mainboard containing the Pico and the brakelight circuit , a smaller board with the US-transducer , the level shifter resistors and the headlight electronics and 2 small boards with only the brakelight Leds on it . The connections to the L298cca are female Dupont wires , soldered at the main board side . Refer to the schematic diagram for more info .

Check and double-check your work , especially the power connections . Do not install the Pico yet , it has only Micropython installed . A power switch can be installed between the +side of the LipO and the electronics if desired .

Load the Main.py File Into Your Pico

Load the main.py file into your Pico , the easiest way is using Thonny IDE . If OK install the Pico on the mainboard .

Make sure all connections are OK before applying power .

Downloads

Install Your Driver

DSCN0651.JPG

The Minion on my robot is not only a decoration , he's keeping the tailwheel dowm during brake or reverse maneuvres .

I did not use PWM so the motors are always at full power , much more fun ! But if you like a slower robot it's easily done by applying PWM-signals to the Enable-terminals of the L298-board .

Have Fun !

Raspberry Pi Pico robot no servo for scan

If you're absolutely sure about all connections it's time to connect the battery and have lots of fun ! Normally all hard and software has been tested so the robot should work without any problems . If not , drop me a line and we will work it out !