In this project the Pico is used to control a two motor buggy via a Kitronic robotics board.
The Raspberry Pi Pico is a more sophisticated microcontroller than the micro:bit so it is the processor of choice for more sophisticated computer control systems. The device is coded using the Micropython language via the Thonny IDE.
The sample of code below uses two functions to move the buggy forward and then turn to the left.
It is frequently necessary to use the trial and improvement method to refine the code to make the buggy run strait and turn by exactly 90 degrees.
from machine import Pin
import PicoRobotics
import utime
board = PicoRobotics.KitronikPicoRobotics()
def fwd():
board.motorOn(1, "f", 30)
board.motorOn(2, "f", 30)
def r_turn():
board.motorOn(1, "r", 30)
board.motorOn(2, "f", 30)
# Main program
while True:
fwd()
utime.sleep(5)
The transistor is a semiconductor because it is made of a semiconducting material, typically silicon.
A semiconducting material is one that conducts electricity better than an insulator, but not as well as a conductor.
Note the shape of the transistors and the fact that they have three ‘legs’ to connect them into a circuit.
These connections are known as the collector, base and emitter.
The transistor acts like a switch.
In the open state, no current will flow through the transistor.
If a current is applied to the base of the transistor current can flow through it between the collector and the emitter.
The output from transistors are said to have two possible states:
HIGH - the high voltage state when current has been applied to the Base and so current can flow through the transistor - in this state the output corresponds to 1.
LOW - the low or zero voltage state when no current has been applied to the Base and so the current flow through the transistor is too small to give an output - in this state the output corresponds to 0.
Gate symbol
Gate symbol
The 555 IC is built from a number of gates combined in a particular way.
It is not necessary to understand how the 555 IC actually works to be able to use it in a wide range of micro electronics projects but if you are interested, watch the video below.
The 555 timer is not a microprocessor.
Here's the difference:
555 Timer: It's an analog integrated circuit (IC) used for generating precise time delays or oscillations. It’s often used in things like blinking LEDs, tone generation, or creating clock pulses. It has no memory, no instruction set, and can't be programmed.
Microprocessor: This is a digital computing unit that can perform complex tasks by executing instructions from memory. It’s basically the "brain" of a computer or microcontroller.
Using the 555 timer IC to make an LED blink or flash on and off.