How to prepare electronic projects with Raspberry Pi Pico

0

Chances are you’ve worked with the insides of some electronics. It may have been at school or at home, so chances are you understand the basics. But have you ever prototyped your own electronic circuit? This is where breadboards become extremely useful.

Breadboards are affordable, temporary devices that offer a simple approach to making electronic circuits. Just as an artist will draw a sketch before creating a work of art, breadboards are used to “sketch” a circuit. The components are placed in the breadboard and we use the holes in the breadboard to create temporary connections between the components. You can even insert microcontrollers like the Raspberry Pi Pico in the breadboard and use them to create a circuit.

So let’s take a breadboard apart, learn how it works, and use one to design a quick project using the Raspberry Pi Pico.

What is a breadboard used for?

(Image credit: Tom’s Hardware)

The idea of ​​a breadboard is quite simple. The breadboard is covered with small holes arranged in rows and columns that are electrically connected together, meaning we can insert components into it and make connections.

What types of breadboards are there?

(Image credit: Tom’s Hardware)

There are many sizes and shapes of breadboards available with different connected hole arrangements.

(Image credit: Tom’s Hardware)

A common and useful type of breadboard has columns connected along its long edges which are often marked with a red line and a black line. These are called rails and are meant to be your connections to voltage (most likely 3-5V when working with Raspberry Pi or Arduino) and a connection to GND. Once we connect power and ground from a power supply, all the pins of the corresponding rail become the corresponding voltage/GND pins. This type of breadboard is often quite long, but you can buy a half breadboard that offers the same functionality in a much smaller package.

(Image credit: Tom’s Hardware)

Other types of breadboards, such as mini breadboards, have no rails but still retain the row and column structure.

(Image credit: Tom’s Hardware)

All of the pins in a breadboard are arranged in a row and column configuration. The columns are marked with a letter, the rows are numbered. So, A1 would be at the top left of the chart, and in the chart above, J1 is at the top right.

(Image credit: Tom’s Hardware)

The rows are connected together, so if we were to use a wire from the GND rail to a row, all the pins of that row are connected.

(Image credit: Tom’s Hardware)

But, on the breadboard, there is a break in a row. In the center of the board is a channel, a cut that divides the left and right sides of the board. The break gives us more space for prototype projects, but if we need to link the channel, we can use a jumper wire to connect the two rows together.

How does a breadboard work?

(Image credit: Tom’s Hardware)

Inside the breadboard, each of the rows is connected via a small conductive metal strip.

(Image credit: Tom’s Hardware)

The strip is bent into a U-shape and acts to lightly grip any wires, pins, or component feet that are inserted through the plastic holes in the breadboard. This means that all elements inserted in the same strip are electrically connected.

Blink an LED with a breadboard

In this project, the goal is to understand how breadboards work and practice creating a small circuit on a breadboard. We will be using a Raspberry Pi Pico to flash an external LED.

For this project you will need

1. Insert a Raspberry Pi Pico into the breadboard. Take care to align the pins and check that no pins are bent or crushed. Make sure the Pico pins are on either side of the gap in the middle of the breadboard so that opposite pins are not connected. Many breadboards have each row of pin holes numbered, which can help later in keeping track of connections. Another useful approach is to place the Pico so that the first pins of the pico use the first row of holes on the breadboard, allowing you to easily track or count pins.

(Image credit: Tom’s Hardware)

2. Connect a wire from the GND of the Raspberry Pi Pico to the negative rails. When the USB cable is connected to the Pico and the device is powered on, anything connected to this rail is now connected to the negative or ground connection. Note that if you need more connections, you can use more jumper wires to connect the power rails on one side of the breadboard to those on the other side to extend them.

(Image credit: Tom’s Hardware)

3. Insert the LED with the wires of the two components on separate rows. The LEDs must be connected in a specific way. The positive leg (connected to the anode of the LED) is always the longer cable. The shortest cable connected to the cathode of the LED is the negative (GND) connection.

(Image credit: Tom’s Hardware)

4. Connect the LED to the ground rail. Using a jumper wire, connect the negative lead from the LED to the ground rail we connected to the Pico earlier.

(Image credit: Tom’s Hardware)

5. Connect the LED to pin 28 through the 330 ohm resistor. Connect one of the legs of the resistor to the breadboard row connected to the positive lead of the LED. Insert the other leg at the other end of the resistor into a previously unused breadboard row. Use another jumper wire to connect the resistor to pin 28 of the Raspberry Pi Pico.

(Image credit: Tom’s Hardware)

Control the LED with the code

1. Download and install Thonny for your operating system.

2. Connect your Raspberry Pi Pico to your computer using a microUSB cable.

3. Open Thonny and click Tools >> Options.

(Image credit: Tom’s Hardware)

4. Click on the Interpreter tab and Make sure the interpreter is set to MicroPython (Raspberry Pi Pico) and you can see the USB serial device (the Pico). Click OK to return to the editor. You can find your Pico’s COM port using Device Manager, or through this useful tool.

(Image credit: Tom’s Hardware)

5. In the editor, import two MicroPython libraries to work with the GPIO (machine) and time (utime).

from machine import Pin
import utime

6. Create an object, LEDs which we use to set GPIO 28 as an output. Pins can be inputs or outputs. When a pin is an output, we can send current to a connected component, in this case the LED.

led = Pin(28, machine.Pin.OUT)

seven. Make sure the LED is off.

led.low()

8. Create a loop to continuously run the test code.

while True:

9. Use the toggle function to turn the LED on or off each time the loop iterates. Toggle will set the LED state to the opposite of what it is currently. So we become off, and off becomes on. This is a useful function for saving a line of code.

   led.toggle()

ten. Add a two-second pause to the code. This causes the LED to turn on and off for two seconds each time.

   utime.sleep(2)

11. Click Save, and save the code on the Raspberry Pi Pico as blink.py.

(Image credit: Tom’s Hardware)

12. Click the Run button to run the code. The LED should now appear to be blinking. If there is an error, read the error message to determine where the error occurred. If your Pico appears to be disconnected, click Stop to reconnect.

(Image credit: Tom’s Hardware)

Complete list of codes

from machine import Pin
import utime
led = Pin(28, machine.Pin.OUT)
led.low()
while True:
   led.toggle()
utime.sleep(2)

After learning how to make connections on the breadboard, it is now simple for you to create and experiment with circuits in a non-permanent and reconfigurable way. Breadboards are widely available and affordable, so it’s not uncommon to end up with a small collection of them so you can work on multiple projects at the same time, or leave a working prototype on the breadboard. while you assemble a second version.

Share.

About Author

Comments are closed.