Important news about HackSpace

We have some important news to share about HackSpace: Issue 81 was the last issue of HackSpace as a standalone magazine, and HackSpace has become part of The MagPi, the official Raspberry Pi magazine. Starting with issue 145, We’ll be adding pages to The MagPi to make room for the stories and tutorials you’ve come to expect from HackSpace.

Introducing Raspberry Pi Pico

By Ben Everard. Posted

There's a brand new microcontroller in town: Raspberry Pi Pico. Pico is designed to be high-performance, low-cost, and provide a flexible way of interacting with other hardware. With two ARM Cortex M0+ cores running at up to 133MHz and 264kB of RAM there’s plenty of processing power for most tasks. The 26 GPIO pins include two I2C, two SPI, two UART, three analogue inputs, and a new feature called Programmable I/O (PIO). There's also 2Mb of flash for your programs and data.

Using these features, Pico could be the brains behind your next robot, DIY smart gadget, games system, electronic musical instrument, and more.

Issue 39 of HackSpace magazine comes with a free Pico. You can get one at your local newsagents or online. You'll also get a free Pico if you subscribe to HackSpace from £10. If you're in the UK you can subscribe here. If you're elsewhere in the world, head here to subscribe. Alternatively, you can get one from your favourite electronics retailer for just $4 plus local taxes and shipping.

Let's take a look at what makes this little microcontroller board so special.

numbered

  1. The RP2040 microcontroller at the heart of Pico is a brand new chip designed by Raspberry Pi. It’s high-performance, low-cost, and has a host of flexible interfacing options. We look at this in detail here.

  2. This oscillator helps your microcontroller keep ticking along at the right speed.

  3. Alongside the RP2040 chip, your Pico also includes 2MB of flash memory. If you’re used to the gigabytes of memory you get in modern computers, this may not sound like much, but microcontroller programs don’t tend to be very large. If you do need to store lots of data (such as if you’re logging sensor values), you could add additional storage such as an SD card.

  4. The micro USB port on the front of Pico can be used to supply power and to send programs and data to the board. It also has more advanced functions. Your Pico can act as a USB device and interact with a computer in a similar way to any other USB device such as a keyboard or mouse. Want to build a custom game controller? Pico can do that. A little unusually, Pico can also act as a USB host. This means you can plug other USB devices into it. You can use a regular USB keyboard or mouse to get data in. In principle, any USB device should work, but bear in mind that your program will need to understand how to communicate with the device. There are some examples of both device and host USB at hsmag.cc/kVFRIG.

  5. You can supply voltage either through the USB port or Vsys. If you attach a power supply (such as a battery) to Vsys via a Schottky diode, the system will take the larger of the two voltages. This allows you to have a backup power supply, or a separate power supply and not need to worry about problems when plugging Pico in for programming. Pico can take a wide range of input voltages: from 1.8 V to 5.5 V. You can power it from a single lithium-ion cell, three AA batteries, or any other power source in the range. There are more details on powering Pico, and example circuits, in the Pico data sheet at rptl.io/pico.

  6. You can turn the 26 GPIO pins on and off, or read whether or not they have voltage applied to them from your code. They can turn LEDs on and off, read button presses, and control all manner of other hardware. If you need to interface with other digital devices, there are two each of I2C, SPI, and UART. There’s also a flexible I/O controller called PIO that makes it easy to connect to a wide range of devices.

  7. GPIO pins 26, 27, and 28 can all read analogue values. They return a 12-bit number that shows the voltage (between 0 and 3.3 V). If you’d rather use a different maximum voltage (up to 3.3 V max), you can set it via the ADC_VREF pin.

  8. The button on Pico is used to enter programming mode. Unplug Pico, hold down this button, then plug it in, and it’ll show up as a USB mass storage device that you can copy UF2 files to. You can get input from this button in your C/C++ programs – take a look at this example for details on how: hsmag.cc/xbYOhc.

  9. GPIO 25 is connected to a green LED that you can program however you like. It can be an indicator that something’s happening on your project, or even a Morse code output.

  10. Debugging microcontrollers can be tricky. When something’s not working, it’s not always easy to work out what’s not working, let alone why. Fortunately, Pico exposes three pins on the bottom edge, and these are for debugging using the Serial Wire Debug (SWD) protocol. If you’re using a Raspberry Pi as your main device to program Pico, you can connect these directly to the GPIO pins with no extra hardware other than a few wires. If you’re using a different computer, you’ll need an extra adapter. Pico can be used as a debug adapter for another Pico using the Picoprobe program. This interface allows you to add up to four breakpoints and two watchpoints. This gives you much more control about how your program runs as you develop software.

Find out more about the RP2040 microcontroller that sits at the heart of Pico here.

You can get your very own Pico by getting a paper copy of HackSpace mag issue 39 or subscribing to HackSpace magazine from just £10. If you're in the UK head here. For delivery elsewhere in the world, take a look here.


https://hsmag.cc

From HackSpace magazine store

Subscribe to our newsletter