RoadTest: Raspberry Pi Pico
Author: meera_hussien
Creation date:
Evaluation Type: Development Boards & Tools
Did you receive all parts the manufacturer stated would be included in the package?: True
What other parts do you consider comparable to this product?: The other boards which are comparable to this product are the STM32 microcontroller board
What were the biggest problems encountered?: There is no biggest problem which I encountered except to the small problems which I usually encounter while exploring new development board.
Detailed Review:
By Hussien
Pi Pico is the latest board released by the Raspberry Pi Foundation. Raspberry Pi Pico is designed for physical The Pico comes with many of the capabilities which a similar to Arduino boards including analogue-to-digital conversion (12-bit ADC), UART, SPI, I2C and PWM among others. The specification of the board is shown in the table below.
That is is a very brief introduction of the Pi Pico. Now let's do the unboxing of the board which I received.
Below is the video of the unboxing
To get started on the Pi Pico, there are a lot of sites offering tutorials and how-to guides. Here I would like to share the one from the official site. Here is the link for the site https://www.raspberrypi.org/documentation/rp2040/getting-started/#getting-started-with-micropython. In this site, it is illustrated how to set up the Pi Pico for the Micro Python environment. Here are some of the screenshots.
By following these steps, the Pi Pico is ready for use.
There is much software that can be used to program the Pi Pico, such as Thonny and many others. I have chosen to use Visual studio code as the software for this project. Below is illustrated the steps to get the visual studio code set up for Pi Pico and micro python. In order to program the Pi Pico using the visual studio code first, we need to install the python. In my case, I have installed it earlier. Next is to install the extension in visual studio code.
The installation process is straightforward. Once the extension is installed the visual studio code is ready to use. I noticed that the Pico-Go has useful features such as the pinout view(as shown in the figure below). This function comes in very handy when programming.
Once all are ready we can run the first program, which is the blynk led. The code and the output is shown in the figure below
You don't have permission to edit metadata of this video.
|
That's about setting up the software. Below is the link to download the software which is used
2. Python
In this simple project, I have decided to make an obstacle avoidance robot. Basically, I have used the Pi Pico, Cytron motor driver, ultrasonic HC-SR04 sensor, and a power bank to power up the robot. The robot is constructed using a simple chassis and a breadboard for the wiring purpose. Below is a picture of the constructed robot.
Header 1 | Header 3 |
---|---|
This is the simple code for robot
from machine import Pin,PWM #importing PIN and PWM import time #importing time import utime # Defining motor pins motor1=Pin(15,Pin.OUT) motor2=Pin(14,Pin.OUT) motor3=Pin(17,Pin.OUT) motor4=Pin(16,Pin.OUT) # Defining Trigger and Echo pins trigger = Pin(27, Pin.OUT) echo = Pin(26, Pin.IN) # Forward def move_forward(): motor1.low() motor2.high() motor3.low() motor4.high() # Backward def move_backward(): motor1.high() motor2.low() motor3.high() motor4.low() #Turn Right def turn_right(): motor1.low() motor2.high() motor3.high() motor4.low() #Turn Left def turn_left(): motor1.high() motor2.low() motor3.low() motor4.high() #Stop def stop(): motor1.low() motor2.low() motor3.low() motor4.low() # Defining function to get distance from ultrasonic sensor def get_distance(): trigger.low() utime.sleep_us(2) trigger.high() utime.sleep_us(5) trigger.low() while echo.value() == 0: signaloff = utime.ticks_us() while echo.value() == 1: signalon = utime.ticks_us() timepassed = signalon - signaloff dist = (timepassed * 0.0343) / 2 return dist while True: distance=get_distance() #Getting distance in cm #Defining direction based on conditions if distance < 15: stop() move_backward() time.sleep(2) stop() time.sleep(0.5) time.sleep(1) turn_right() right_distance=get_distance() time.sleep(0.5) left_distance=get_distance() time.sleep(0.5) if right_distance > 16: turn_right() time.sleep(2) stop() else: turn_left() time.sleep(2) stop() else: move_forward() time.sleep(0.5)
Below is the video of the robot in action
In the nutshell, I feel the Pi Pico is a very useful device as it can be easily integrated into any project without any issue in comparison to its predecessor. This device stands in line with the Arduino Nano family and also STM32. This device will be very useful for the makers and also students who want to build a project based on raspberry pi.
Top Comments
Interesting Pico - bot. Just curious, the code imported the PWM library, but never used it.
Maybe next step is to slow down Pico-bot if Ping sensor says the Pico-bot is less than 15 , but more than 5,…
Thanks for the response. I'm new to the whole pico thing. I have two still in a package and haven't got the courage to dive in yet. Other stuff on the go.