Schlagwort: minipc

  • Jazz Champion

    Jazz Champion

    Reading Time: 3 minutes

    “The inside was completely missing with the exception of a beautiful keypad,” he recalls. While he wasn’t sure what to do with it at first, and it gathered dust for a couple of years, a conversation with a friend about converting trash objects into musical instruments sparked an idea. “It suddenly clicked: I would turn the chess computer into a jazz computer!”

    Leo noted a striking resemblance between the notation of chords and chess moves: “For example, E6 E7 means in chess that a pawn moves from square E6 to E7. In jazz it would describe E major chords extended by a sixth or seventh note. Also, I much liked the idea that playing a chess game is akin to playing a duet in a call-and-response type of scenario.”

    A little knight music

    The inner workings include a Raspberry Pi Zero with WM8960 Audio HAT, speakers, and 176×220 LCD

    Leo says the musical game he created is very simple to play, involving pressing the machine’s buttons to choose chords. “You enter a jazz chord, wait two seconds while the computer comes up with a matching chord and then it is your turn again. One can choose chords of any key and it can be major or minor, diminished or augmented, and possibly extended by 7th, 9th, 11th or 13th notes.”

    The computer will then seek to come up with a chord that sounds as “cool as possible when played after the given user chord,” he reveals. “It does so by generating 1000 random candidate chords and using a metric to assess how well they fit. The best chord is taken and the computer score is increased by the value according to the metric.”

    Once the user has entered their chord, the same metric is used to add points to their score. “The game has no end – one can play as long as desired, since the main point is not to ‘win’ by scoring more points but to just have fun playing jazz music.”

    Striking the right chord

    It took a couple of attempts to get the 3D-printed base design right and align the LCD under the tinted window

    It took Leo around two months to develop the project, including replacing the chess machine’s original seven-segment display with a 176×220 LCD to show longer chord names, and 3D-printing a new base to house a Raspberry Pi Zero, WM8960 Audio HAT, and speakers.

    By the far the hardest part of creating the Python software was to design an algorithm that rates how well a new jazz chord follows a given one. After trying several musical theory approaches and finding that they didn’t come up with the desired “jazzy feel”, he opted to play all the common chord combinations and rate them manually – a process that took three days and was a “numbing experience.”

    “The ratings form the basis of the metric and I integrated some additional heuristics such that chords do not sound too dissonant, too consonant, too repetitive, nor too simple,” he explains. “I just underestimated how difficult it is to translate human artistic preference into computer code and learned a lot here.”

    As well it being a fun game to play, Leo thinks his Jazz Champion could double as a useful aid for composing jazz music, by generating chord sequences. “It is actually easy: one can just repeatedly input the last computer-generated chord to get an entire sequence!”

  • Review: Grow kit

    Review: Grow kit

    Reading Time: 2 minutes

    The Grow HAT Mini (£30 / $34) in this kit provides a straightforward means of monitoring the moisture levels of up to three plants at once. It can either be used with your existing plants, in which case you will only need the standard £30 Grow Kit, which includes three moisture sensor sticks and cables. Alternatively, there are herb and chilli-growing kits, costing an additional £9.90 ($10.30) each.

    We tested the Grow Herbs kit, reasoning that the selection of basil, rosemary, and coriander would require quite diverse growing conditions and need different watering routines. 

    The Grow HAT Mini is sized for use with Raspberry Pi Zero but works with any Raspberry Pi with a 40-pin GPIO header. Setup involves updating Raspberry Pi OS (as with any software install) and entering the install code into terminal then rebooting. Once set up, the whole caboodle can be run headless (without a monitor) from a USB power supply. 

    The moisture sensors have space to label each plant

    If you’ve got the herb or chilli kit, you need to soak the Cocopress soil tablets in water to rehydrate them before planting the seeds. Label the three seed sensor sticks and gently attach them to the respective plugs on the HAT – rather fiddly as the plugs are tiny – and then insert them into the soil. A tiny (0.96-inch, 160×80 pixels) IPS LCD screen on the HAT immediately indicates whether each pot’s soil is wet enough. Blue means too wet while yellow or amber indicates it’s too dry.

    Soily something wrong

    Should the saturation level of any of the plants being monitored fall below the threshold, the Grow sensor issues a sonic alert – three short beeps at roughly three second intervals – and a blue bell icon appears on the Grow HAT’s display. To deactivate the alarm, just press the cream-coloured button adjacent to the bell. If you don’t water the plant within a few minutes, the alarm will sound again. 

    If the plant in question thrives in a dry environment or, conversely, prefers to be pretty damp, you can adjust the saturation level at which the Grow HAT triggers a warning. Pressing the A button on the HAT cycles through the percentage moisture level of each pot and also takes you to a Settings menu where you can fine0-tune the saturation levels for each plant so the alert doesn’t constantly trigger for your desert-loving aloe vera.

    Verdict

    8/10

    We were very impressed with the kit’s ease of use, aided by a foolproof online installation guide. There were far too many seeds for the size of the pots that came with the herb and chilli kits, but that simply means you can plant successive sets of seeds.

  • Hubble Pi

    Hubble Pi

    Reading Time: 3 minutes

    This camera would work with Santiago’s beloved, but rather small, Maksukov telescope. Having been a huge fan since childhood of all things space-related, and with plans to study astrophysics and masters and PhD level, Santiago suddenly saw how coding might just fit in… and the idea for Hubble Pi was born.

    Mapping the sky

    Santiago’s goal was to use a Raspberry Pi 4 and HQ Camera to take pictures with his telescope of planets, stars, and maybe even DSOs (deep-sky objects). He also decided to load his Raspberry Pi with established astronomy programs such as KStars, which can display a live map of the night sky directly on the telescope using an attached display.

    Santiago realised that the HQ Camera’s “bigger, exposed sensor would allow it to essentially use the telescope as a big mirror lens. It was quite cheap for the quality it could offer.” When it came to controlling the sensor for astrophotography, the flexible, open-source nature of Raspberry Pi appealed too.

    Hubble Pi features a Raspberry Pi 4 and a touchscreen from which image capture can be triggered. The setup can also be accessed using a remote desktop connection

    To achieve this, Santiago developed AstroCam, a Python GUI for controlling the camera for astrophotography. “Using it, I can control ISO, shutter speed and exposure time (with some limitations due to the digital nature of the rolling shutter),” he explains.

    AstroCam can also take multiple exposures automatically, and capture RAW image files – both important capabilities for astrophotography. Controls are triggered locally via a touchscreen or through a remote desktop connection from a laptop connected via Ethernet or a wireless LAN hotspot hosted by Raspberry Pi. He was reasonably confident the project would work, having seen similar endeavours based around Raspberry Pi 3B.

    Santiago had never used Python before, so he began by learning what the sensor could do from the HQ Camera documentation, after which the main challenge was coding the GUI program with Tkinter and adapting it for his astrophotography needs. “I based my AstroCam script’s main loop and the image preview code on that of a Python programmer who had developed it for a normal camera use,” he says. The source is credited in the documentation in Santiago’s GitHub repo.

    Although others had posted similar projects on GitHub, no one had written about using the C-mount adapter for the HQ Camera for astrophotography at the time. Fortunately, C-mount-to-telescope adapters are fairly common and Raspberry Pi itself could simply be mounted using a simple phone adapter.

    Shooting stars

    Santiago is reasonably pleased with the results from Hubble Pi. “Most good USB cameras for astrophotography start at about €200 and require a connected computer at all times. Hubble Pi can also work wirelessly or as a standalone if needs be,” he notes.

    Astronomy programs such as KStars can be installed on Raspberry Pi to provide a map of the night sky

    Raspberry Pi 4 and HQ Camera sensor work very well, but photos are limited by the optical limitations of his telescope, while humidity and light pollution are also factors. “Planets and stars look alright, but somewhat blurry without stacking (atmospheric distortion), and DSOs are very difficult to capture due to the f14 aperture ratio from the small Maksutov (brighter/bigger optics should deliver better results here),” discloses Santiago.

    “My friend’s DSLR doesn’t perform much better when attached to my telescope at prime focus,” he says. “The only real limitation from the sensor side of things is its digital rolling shutter, which means it can’t do hour-long exposures like DSLRs.” But an expensive star tracker (to compensate for the drift during the lengthy exposure) costs upwards of €300.

    When finances allow, Santiago intends to develop Hubble Pi in this direction. For now, he’s pretty pleased with his first Raspberry Pi project. “This may have been the first, but it certainly won’t be the last!”

  • Review: NanoSound ONE Hi-Fi DAC Case

    Review: NanoSound ONE Hi-Fi DAC Case

    Reading Time: 2 minutes

    We’re also a fan of the NanoSound DACs, so we were quite intrigued when we found out about a melding of the two into one product: NanoSound ONE (£59 / $80). On paper it’s a simple change – the board attached to the roof of the case that provides a fan and heatsink is replace with with one that provides a DAC and heatsink. Because of this, the ports on the rear are slightly changed, going from two HDMI ports and a 3.5mm jack to one micro HDMI port and two RCA jacks. This does mean you’re losing the active cooling. However, passive cooling of the heatsink (which is the entire case) is definitely good enough.

    Snug fit

    Installing a Raspberry Pi 4 is simple – you add the little breakout board that plugs into HDMI 0 and the 3.5mm jack on Raspberry Pi, and then connect the GPIO pins with the GPIO header on the top of the case. The breakout board is a bit of a snug fit, so don’t be worried if it looks like it’s not quite spaced out correctly. It is!

    Control it with a smartphone remote or the included remote

    You have your choice of bottom part for the case. The standard piece just encloses the whole thing and provides an SD card port, while there’s also the M.2 SSD storage bay option which we reviewed last month. The whole process is very quick, and we were able to experience some excellent sounds from the DAC part in no time, which uses the same tech as the NanoSound DAC 2. You’re paying a little bit of a premium for the DAC and case together (only about $5), but you are getting a custom version of one of our favourite cases – so it’s definitely worth it.

    Verdict

    8/10

    A great case with great sound at a reasonable price. This could be the one for folks who need the best audio out of a media centre.

  • Cheap All Sky Camera

    Cheap All Sky Camera

    Reading Time: 3 minutes

    What you need is a device that can scan a wide field of sky and snap away whenever it picks up something bright.

    The Cheap All Sky Camera certainly fits the bill. Created by Jippo – whose nickname is a reference to a late 1970s and early 1980s Finnish magazine that encouraged readers to build – it uses a Raspberry Pi 4 as well as the High Quality Camera fitted with a 180-degree CS lens. These components sit under a 20cm acrylic dome, protecting them from the weather.

    “Before this there was a similar project that used Linux, a normal computer, a video capture card and a security camera containing a charged-coupled device,” says Jippo. “But with Raspberry Pi you can build a really cheap and small setup with everything that’s needed placed inside a dome.”

    Stars in their eyes

    The 20 cm acrylic dome protects the electronics beneath while allowing the camera a clear view of the sky

    The build was directly inspired by the Meteotux Pi program written by Jippo’s friend Jani, which was developed to record continuous high-resolution images during the night. “Jani and I had joined an amateur astronomy association here in Finland called URSA and there was a group using Windows computers to capture sky events in order to calculate and identify meteors and meteor showers,” says Jippo.

    “We were both using a Linux computer and we had the idea of developing a Linux program to capture those sky events. Meteotux Pi was developed after Raspberry Pi came with a hi-res [HQ Camera].” This keeps costs to a minimum, especially since Meteotux Pi will also work with older Raspberry Pi models and Camera Modules.

    A Raspberry Pi computer runs Raspberry Pi OS Lite and it’s automated to run Meteotux Pi at sunset, stopping at sunrise. “A simple Shell script runs daily and checks for these times before generating command-line options for the program and running them,” Jippo explains.

    “After Meteotux Pi has taken the images, a Python Shell script starts to generate star trails and normal video from stacked images. This script uses ImageMagick and FFmpeg and when they are ready, [it] moves those images and videos to my network drive via WiFi where I can check them.”

    Just warming up

    Jippo says the project can be compared with commercial all-sky cameras costing as much as $10,000

    To prevent the device from getting too cold, given it is going to be located outside all night, Jippo has used a second Raspberry Pi computer – a Raspberry Pi 3+ with a V2 colour camera, relay controller HAT, and temperature sensor.

    “The sensor monitors the temperature inside the dome and if it gets too cold, the relay board will turn the 10W heat resistors on. This keeps the dome clear from humidity or frost and it removes raindrops a lot faster too,” he reveals.

    The result has been many hours of pleasure as Jippo and Jani discover the countless delights of the sky. Some of the results can be viewed on YouTube. “I’m really happy with the results so far,” says Jippo.

  • Interview: Kids Invent Stuff

    Interview: Kids Invent Stuff

    Reading Time: 3 minutes

    The team of Ruth Amos and Shawn Brown might be able to help these kids, though, with Kids Invent Stuff.

    Kids Invent Stuff in a YouTube channel which brings to life kids’ invention ideas, created to inspire primary aged children around engineering and STEM,” they tell us. “Young people are encouraged to submit their own ideas for inventions to solve novel and entertaining technical challenges. The most creative and entertaining inventions are then showcased as part of Kids Invent Stuff YouTube episodes. The chosen idea is then built and demonstrated on film, with often hilarious consequences; we’ve built furry electric dog cars, popcorn firing doorbells, and alarm clocks that wake you up by dropping pool balls on your head. These have all been inventions designed by children that we have brought to life.”

     The tea train will arrive, whatever type of snow is on the line

    Ruth is a self-taught engineer and inventor. In 2006 she was Young Engineer for Britain with her GCSE product ‘The StairSteady’, which is now sold internationally. She is a keen welder and maker and co-founded #GirlsWithDrills with Kisha Bradley.

    Shawn Brown is an engineer, artist and designer. As a multidisciplinary engineer and artist he has worked on a myriad of projects; from building custom electric vehicles, to bringing to life the 12m tall ‘Man Engine’ – the UK’s largest mechanical puppet. Shawn has both a master’s degree in Energy Engineering and a master’s in Fine Art.

    How has Raspberry Pi helped some of your builds?

    We have used Raspberry Pi in a number of builds. We worked with Estefannie, from Estefannie Explains It All, to hack our rainbow unicorn that poops jellybeans (invented by eight-year-old Tru) to be able to poop jellybeans when someone tweeted it.

    This year, we built nine-year-old Nathan’s foam-firing spy camera, which was built around a Raspberry Pi. You can see it in action here.

    What has the response been to your videos?

    People seem to love seeing kids’ invention ideas come to life and we’ve had some fantastic comments from parents and teachers saying that their children and students have been inspired by the channel; in fact, over 95% of those submitting ideas have said that our channel and challenge had helped improved their child’s understanding of engineering.

     It’s a whole new world out in the harbour on a floating rug

    The project was set up because research showed that it was really important to inspire and keep engaged young people, particularly girls, into STEM while still at primary school. Kids make amazing problem solvers and we wanted to showcase and celebrate that on the channel.

    What are your three favourite builds you’ve done?

    It’s so hard to choose, they have all been so much fun. So we’ve chosen ones that people watching our channel love (not including any of the ones already linked above): the Popcorn-Firing Doorbell, a Giant Rube Goldberg Machine made out of 60 kids’ invention ideas, and Zander’s Robot Shopping Trolley

  • Review: Inky Impression

    Review: Inky Impression

    Reading Time: 3 minutes

    Its 5.7-inch display is much bigger than Pimoroni’s previous e-ink boards, the Inky wHAT and pHAT. Indeed, it’s considerably larger than a full-size Raspberry Pi board, for which an extra female header (to boost height) and metal standoffs are supplied. Care is needed to hold it by the edges when mounting, so as not to push down on the glass panel. Alternatively, it fits flush on a Raspberry Pi Zero without the extra header, for a reduced overall depth – great for putting it in a wooden frame for wall mounting. If using a Raspberry Pi 400, you’ll need a GPIO extender cable.

    The slimline board even features some breakout GPIO pins on the underside, including I2C and SPI, along with four tactile buttons on its left edge – these could be handy for switching between images or sets of them in a headless picture frame setup.

    Now in full colour

     A Raspberry Pi Zero fits neatly on the rear, or the HAT can be mounted on a fullsize model with the extra female header and standoffs

    In addition to its size, the other major plus point about the Inky Impression is that it now uses ACeP (Advanced Color ePaper) to deliver seven colours: black, white, red, green, blue, yellow, orange. This means it can display standard RGB images without the hassle of having to alter the colour mode to a special indexed palette in an image editor, as is required on the Inky wHAT and pHAT. So it’s far easier to download or transfer images to use straight away; they just need to be 600×448 pixels, so may need scaling and/or cropping. Most major file formats are supported.

    We found that simpler images, without too much detail, tended to work best. In particular, the Inky Impression is ideal for showing pop art, comic-book panels, and pixel art. Most standard photos will look fine on it, although you may find that the colours are a little washed out compared to the original image – this can be alleviated somewhat by altering the contrast and colour saturation of the photo.

    As with all e-ink displays, it takes a few seconds to change to a new image (so it’s no use for animations or videos), with some flashing as it refreshes the different colour layers. There is also the possibility of some ‘ghosting’ as strong elements from the previous image may sometimes be noticeable – the best way to solve this is to show an all-white image between them.

    A size comparison with the Inky pHAT and wHAT boards; the Inky Impression (rear) is considerably larger

    Code examples

    To use the Inky Impression, you’ll need to download the Inky Python library (as used by previous boards), either using a one-line installer or cloning/downloading the GitHub repo – the latter may be more up to date. This includes a ‘7color’ folder of Inky Impression code examples to get you started and demonstrate some of its use-cases. 

    Along with code to display a selected image, there’s a nice example for a simple HTML webpage, which offers a convenient way of showing styled text on the screen. There’s also a neat graphing example that plots coloured circles for data, illustrating how the Inky Impression could be useful for showing sensor or weather data in colourful charts. If using using battery/portable power, a big advantage over a conventional display is the extremely low energy drain: it only draws power when changing images, which otherwise stay on screen even with the power disconnected.

    Verdict

    8/10

    While its lengthy screen refresh time means it’s not suitable for every project, it’s ideal for use as a digital art/picture frame or for displaying data in graphical form.

  • Build the ultimate media centre and Raspberry Pi Pico in The MagPi magazine issue #102

    Build the ultimate media centre and Raspberry Pi Pico in The MagPi magazine issue #102

    Reading Time: 3 minutes

    032-039 MagPi#102 FEATURE Media Centre

    This month Rob has written a guide to building a single media centre that does everything. Discover the parts you’ll need, the best accessories and how to set up the software. This feature-packed guide turns Raspberry Pi into the ultimate media centre.

    060-067 MagPi#102 FEATURE Pico

    Raspberry Pi Pico

    Our deep dive into Raspberry Pi Pico covers everything  you need to know about this new microcontroller. Discover the story behind the development of Pico, and get great tips on how to set up and get started with Pico. Microcontrollers are a new technology for Raspberry Pi owners to discover, and our Pico feature will guide your way. 

    050-053 MagPi#102 TUTORIAL C64

    Turn Raspberry Pi 400 into a legal C64 emulator

    The compact all-in-one enclosure of Raspberry Pi 400 puts many people to mind of classic computers. These 8-bit machines hold a place close to our heart, and few as much as the classic Commodore 64. Emulating the C64 properly has been a challenge because the memory ROMs are copyrighted. However, KG has a solution that uses Raspberry Pi 400 and legal ROMs. Rediscover classic computing with this brilliant tutorial.

    022-023 MagPi#102 SHOWCASE JazzChampion

    Upcycling classic machines with Jazz Champion

    We love this project that takes a classic chess computer and turns it into a musical maestro thanks to Raspberry Pi Zero .Jazz Champion replaces chess moves with chord progressions to create a call and response game.

    024-025 MagPi#102 SHOWCASE HubblePi

    Shooting stars with Hubble Pi

    We’ve seen a Raspberry Pi High Quality camera module been put to many good uses, and this Hubble Pi is now a firm team favourite. With the camera hooked up to a Maksutov telescope one maker has been capturing the cosmos.

    076-077 MagPi#102 REVIEW InkyImpression

    Inky impression reviewed

    We enjoy testing out kits in The MagPi magazine and this month Phil King has been hands-on with the latest Inky Impression hat. This 5.7-inch full-colour e-ink display enables you to display static images. It’s a great step up from black and white and previous three colour options, opening a world of artwork and image display to e-paper technology.

    Pick up your copy of The MagPi magazine #102

    The MagPi magazine is available as a free digital download, or you can purchase a print edition from our Raspberry Pi Press store.

  • Win one of ten Raspberry Pi Pico boards and Get Started with MicroPython books!

    Win one of ten Raspberry Pi Pico boards and Get Started with MicroPython books!

    Reading Time: < 1 minute

    Subscribe

  • Programming Raspberry Pi Pico with Python and MicroPython

    Programming Raspberry Pi Pico with Python and MicroPython

    Reading Time: 5 minutes

    You can pick up a Raspberry Pi Pico from just $4 / £3.60, or free with the latest edition of HackSpace magazine.

    Programs written for other MicroPython-compatible microcontroller boards will work on Raspberry Pi Pico, and vice versa – sometimes needing minor modification for different features between boards – giving Raspberry Pi Pico a healthy library of projects and tutorials beyond those developed by Raspberry Pi itself.

    Meanwhile, the C/C++ SDK is fine-tuned to RP2040 and has all the headers, libraries, and build systems necessary to write programs in C, C++, or assembly language. Additionally, the C/C++ SDK provides higher-level libraries for dealing with timers, USB, synchronisation, and multicore programming, along with additional high-level functionality built using PIO such as audio.

    Beginners looking to get started with the MicroPython port should start with the Raspberry Pi Pico Python SDK documentation and be sure to pick up a copy of Getting Started with MicroPython on Raspberry Pi Pico.

    Thonny running a program on Raspberry Pi Pico

    Get Started with MicroPython on Raspberry Pi Pico

    For more physical computing projects to try on your Raspberry Pi Pico, grab a copy of the new book, Get Started with MicroPython on Raspberry Pi Pico. As well as learning how to use Raspberry Pi Pico’s pins as inputs and outputs, you’ll build a simple game, measure temperatures, save and load data to your Pico’s file system, and even make a burglar alarm for your room
    .

    Get Started with MicroPython on Raspberry Pi Pico is available now from Raspberry Pi Press.

    Get Started with MicroPython on Raspberry Pi Pico

    Makers looking to explore the C/C++ SDK should download the Pico C/C++ SDK documentation.

    Raspberry Pi Pico data sheets

    Make sure to read, and bookmark, these new Raspberry Pi Pico and 2040 data sheets.

    Program Raspberry Pi Pico with MicroPython

    Raspberry Pi Pico is set up, by default, for use with the C/C++ Software Development Kit (SDK). The C/C++ SDK is an extremely flexible and powerful way to interact with your Raspberry Pi Pico. However, there’s a more beginner-friendly method: MicroPython, a port of the Python programming language designed specifically for microcontrollers.

    In this tutorial we’re going to switch the Pico firmware from C/C++ to MicroPython and create our first program, which flashes the LED on the board.

    You’ll need

    Open Raspberry Pi Pico in boot mode

    Take your Raspberry Pi Pico and a micro USB to USB-A cable, and connect the small micro USB end of Pico. Hold down the small button on your Raspberry Pi Pico marked ‘BOOTSEL’ and plug the larger USB-A cable end into your computer (we are using a Raspberry Pi).
    Wait a few seconds, then let go of the BOOTSEL button. You will see your computer mount a removable drive. Click OK in the ‘Removable medium is inserted’ window to open Raspberry Pi Pico’s on-board storage.

    Hold Raspberry Pi Pico's BOOTSEL button while connecting power to put Pico into boot mode

    Flash the MicroPython firmware

    Double-click the INDEX.HTM file displayed in Pico’s mounted storage. Your browser will open and display the ‘Welcome to your Raspberry Pi Pico’ webpage. Choose the ‘Getting started with MicroPython’ tab, and click ‘Download UF2 file’ to download the MicroPython firmware. It’s a small file, so it’ll only take a few seconds.

    Open File Manager and locate the micropython-16-DEC-2020.uf2 file in the Downloads folder (the file name may have been updated with a later date). Drag-and-drop the UF2 file to the Raspberry Pi Pico’s removable drive (named ‘RPI-RP2’). After a few seconds, the drive will disappear as the new MicroPython firmware is recognised and installed.

    Flash Raspberry Pi Pico's firmware to MicroPython by downloading the MicroPython UF2 file and dragging it onto Pico's mounted drive

    Switching the back end

    The best way to program in MicroPython on your Raspberry Pi Pico is with the Thonny Python IDE (integrated development environment). Open the Raspberry Pi menu and choose

    Programming > Thonny Python IDE.

    Changing the interpreter in Thonny to MicroPython (Raspberry Pi Pico)

    Thonny is normally used to write programs that run on the same computer you’re using Thonny on; to switch to writing programs on your Raspberry Pi Pico, you’ll need to choose a new Python interpreter. Look at the bottom-right of the Thonny window for the word ‘Python’ followed by a version number: that’s your current interpreter.

    Click ‘Python’ and look through the list that appears for ‘MicroPython (Raspberry Pi Pico)’ – or, if you’re running an older version of Thonny, ‘MicroPython (generic)’.

    Tip! Update Thonny

    If you don’t see MicroPython (Raspberry Pi Pico) in the interpreter list, you’ll need to update Thonny. Open a Terminal window and type:

    sudo apt update && sudo apt full-upgrade -y

    Code Hello World in MicroPython

    Writing a program for your Raspberry Pi Pico is a lot like writing a program for your Raspberry Pi. You can type commands in the Shell area at the bottom of the window to have them immediately executed, or you can write a program in the main part of the window to run on-demand.

    Click in the Shell area, next to the >>>> symbols, and type:

    print("Hello, World!")
    

    When you press ENTER at the end of the line, you’ll see your Raspberry Pi Pico respond. Try typing the same line again, but in the main part of the Thonny window – then click the Run icon. You’ll be asked whether you want to save your program to ‘This computer’ or ‘Raspberry Pi Pico’. Click on ‘Raspberry Pi Pico’, give your program the name hello_world.py, then click OK to save and run your first program.

    Create a program that blinks Raspberry Pi Pico’s LED

    While Raspberry Pi Pico can run Python programs like the one above, its true power comes from interfacing with external hardware like buttons and LEDs. You can start programming a physical computing project without any extra hardware, too, thanks to an on-board LED (assigned to the non-broken-out GP25 pin).

    Click the New icon and type in the blinky_led.py code. Click Run, save the program to your Raspberry Pi Pico, and watch the LED on Raspberry Pi Pico: it will turn on for one second, then off for one second, then repeat.

    import machine
    import utime
    led_onboard = machine.Pin(25, machine.Pin.OUT)
    while True: led_onboard.toggle() utime.sleep(1)

    Raspberry Pi Pico has an on-board LED that can be programmed to flash on and off

  • How to solder GPIO pin headers to Raspberry Pi Pico

    How to solder GPIO pin headers to Raspberry Pi Pico

    Reading Time: 9 minutes

    You can pick up a Raspberry Pi Pico from just $4 / £3.60, or free with the latest edition of HackSpace magazine.

    The easiest way to use Pico, though, is to attach it to a breadboard – and for that, you’ll need to attach pin headers. You’ll need a soldering iron with a stand, some solder, a cleaning sponge, Raspberry Pi Pico, and two 20-pin 2.54 mm male header strips. If you already have a solderless breadboard, you can use it to make the soldering process easier.

    Sometimes 2.54 mm headers are provided in strips longer than 20 pins. If yours are longer, just count 20 pins in from one end and look at the plastic between the 20th and 21st pins: you’ll see it has a small indentation at either side. This is a break point: put your thumbnails in the indentation with the headers in both your left and right hands and bend the strip. It will break cleanly, leaving you with a strip of exactly 20 pins. If the remaining header strip is longer than 20 pins, do the same again so you have two 20-pin strips.

    Turn Raspberry Pi Pico upside-down, so you can see the silkscreen pin numbers and test points on the bottom. Take one of the two header strips and push it gently into the pin holes on the left-hand side of your Pico. Make sure that it’s properly inserted in the holes, and not just resting in the castellations, and that all 20 pins are in place, then take the other header and insert it into the right-hand side. When you’ve finished, the plastic blocks on the pins should be pushed up against your Pico’s circuit board.

    A guide to pin numbers are printed on the underneath of Raspberry Pi Pico

    Pinch your Pico at the sides to hold both the circuit board and the two pin headers. Don’t let go, or the headers will fall out! If you don’t have a breadboard yet, you’ll need some way to hold the headers in place while you’re soldering – and don’t use your fingers, or you’ll burn them. You can hold the headers in place with small alligator clips, or a small blob of Blu Tack or other sticky putty (Figure 1).

    Figure 1 You can hold the headers in place with sticky putty before soldering

    Solder one pin, then check the alignment: if the pins are at an angle, melt the solder as you carefully adjust them to get everything lined up.

    Use a breadboard

    If you have a breadboard, simply turn Raspberry Pi Pico upside down – remembering to keep the headers pinched – and push both the headers and your Pico into the holes on the breadboard. Keep pushing until your Pico is lying flat, with the plastic blocks on the pin headers sandwiched between your Pico and your breadboard (Figure 2).

    Figure 2 Alternatively, use a breadboard to hold the headers in place for soldering

    Look at the top of your Pico: you’ll see a small length of each pin is sticking up out of the pin holes. This is the part you’re going to solder – which means heating up both the pins and the pads on Pico and melting a small amount of a special metal, solder, onto them.

    Put your soldering iron in its stand, making sure the metal tip isn’t resting up against anything, and plug it in. It will take a few minutes for the tip of the iron to get hot; while you’re waiting, unroll a small length of solder – about twice as long as your index finger. You should be able to break the solder by pulling and twisting it; it’s a very soft metal.

    If your soldering stand has a cleaning sponge, take the sponge to the sink and put a little bit of cold water on it so it softens. Squeeze the excess water out of the sponge, so it’s damp but not dripping, and put it back on the stand. If you’re using a cleaner made of coiled brass wire, you don’t need any water.

    Warning! Hot solder!

    Soldering irons get very hot, and stay hot for a long time after they’re unplugged. Make sure that you put the iron in the stand when you’re not using it and don’t touch the metal parts – even after it’s unplugged. See Getting started with soldering for more information.

    Start to solder

    Pick up your soldering iron by the handle, making sure to keep the cable from catching on anything as you move it around. Hold it like a pencil, but make sure your fingers only ever touch the plastic or rubber handle area: the metal parts, even the shaft ahead of the actual iron tip, will be extremely hot and can burn you very quickly.

    Before you begin soldering, clean the iron’s tip: brush it along your sponge or coiled wire cleaner. Take your length of solder, holding it at one end, and push the other end onto the tip of your iron: it should quickly melt into a blob. If it doesn’t, leave your soldering iron to heat up for longer – or try giving the tip another clean.

    Putting a blob of solder on the tip is known as tinning the iron. The flux in the solder helps to burn off any dirt still on the end of the iron, and gets it ready. Wipe the iron on your sponge or cleaning wire again to clean off the excess solder; the tip should be left looking shiny and clean.

    Put the iron back in the stand, where it should always be unless you’re actively using it, and move your Pico so it’s in front of you. Pick up the iron in one hand and the solder in the other. Press the tip of the iron against the pin closest to you, so that it’s touching both the vertical metal pin and the gold-coloured pad on your Pico at the same time (Figure 3).

    Figure 3 Heat the pin and pad

    It’s important that the pin and the pad are both heated up, so keep your iron pressed against both while you count to three. When you’ve reached three, still keeping the iron in place, press the end of your length of solder gently against both the pin and pad but on the opposite side to your iron tip (Figure 4). Just like when you tinned the tip, the solder should melt quickly and begin to flow.

    Figure 4 Add a little solder

    The solder will flow around the pin and the pad, but no further: that’s because Pico’s circuit board is coated in a layer called solder resist which keeps the solder where it needs to be. Make sure not to use too much solder: a little goes a long way.

    Remove solder first

    Pull the remaining part of your solder away from the joint, making sure to keep the iron in place. If you pull the iron away first, the solder will harden and you won’t be able to remove the piece in your hand; if that happens, just put the iron back in place to melt it again. Once the molten solder has spread around the pin and pad (Figure 5), which should only take a second or so, remove the soldering iron. Congratulations: you’ve soldered your first pin!

    Figure 5 Now remove the iron

    Clean the tip of your iron on your sponge or brass wire, and put it back in the stand. Pick up your Pico and look at your solder joint: it should fill the pad and rise up to meet the pin smoothly, looking a little like a volcano shape with the pin filling in the hole where the lava would be, as shown in Figure 6.

    Figure 6 A well-soldered pin

    Once you’re happy with the first pin, repeat the process for all 40 pins on your Pico – leaving the three-pin ‘DEBUG’ header at the bottom empty.

    Remember to clean your iron’s tip regularly during your soldering, too, and if you find things are getting difficult, melt some solder on it to re-tin the tip. Make sure to keep refreshing your length of solder, too: if it’s too short and your fingers are too close to the soldering iron’s tip, you can easily burn yourself.

    When you’re finished, and you’ve checked all the pins for good solder joints and to make sure they’re not bridged to any nearby pins, clean and tin the iron’s tip one last time before putting it back in the stand and unplugging it. Make sure to let the iron cool before you put it away: soldering irons can stay hot enough to burn you for a long time after they’ve been unplugged!

    Finally, make sure to wash your hands – and celebrate your new skill as a soldering supremo!

    Tip! Four corners first

    Solder the four corner pins first. Take your time, don’t rush, and remember that mistakes can always be fixed.

    Soldering issues

    If the solder is sticking to the pin but not sticking to the copper pad, as in example A in Figure 7, then the pad wasn’t heated up enough. Don’t worry, it’s easily fixed: take your soldering iron and place it where the pad and pin meet, making sure that it’s pressing against both this time. After a few seconds, the solder should reflow and make a good joint. On the other hand, if the solder is too hot, it won’t flow well and you’ll get an overheated joint with some burnt flux (example B). This can be removed with a bit of careful scraping with the tip of a knife, or a toothbrush and a little isopropyl alcohol.

    Figure 7 Common soldering problems

    If the solder is entirely covering the pin, as in example C, you used too much. That’s not necessarily going to cause a problem, though it doesn’t look very attractive: so long as none of the solder is touching any of the pins around it, it should still work. If it is touching other pins (as in example D), you’ve created a bridge which will cause a short circuit.

    Again, bridges are easy to fix. First, try reflowing the solder on the joint you were making; if that doesn’t work, put your iron against the pin and pad at the other side of the bridge to flow some of it into the joint there. If there’s far too much solder still, you’ll need to remove the excess before you can use your Pico: you can buy desoldering braid, which you press against the molten solder to suck the excess up, or a desoldering pump to physically suck the molten solder up.

    Another common mistake is too little solder: if you can still see copper pad, or there’s a gap between the pin and the pad which isn’t filled in with solder, you used too little (example E). Put the iron back on the pin and pad, count to three, and add a little more solder. Too little is always easier to fix than too much, so remember to take it easy with the solder!

    Buy Get Started with MicroPython on Raspberry Pi Pico

    This tutorial is also included in our new book, Get Started with MicroPython on Raspberry Pi Pico. Pick up your copy of Get Started with MicroPython on Raspberry Pi Pico and learn about all the great things you can make with Pico.

    Get Started with MicroPython on Raspberry Pi Pico

  • Raspberry Pi Pico microcontroller: specifications, features and RP2040

    Raspberry Pi Pico microcontroller: specifications, features and RP2040

    Reading Time: 5 minutes

    Raspberry Pi Pico is a development board built around this powerful yet low-cost RP2040 microcontroller.

    Like Raspberry Pi computers, Raspberry Pi Pico features a pin header with 40 connections, along with a new debug connection enabling you to analyse your programs directly from another computer (typically by connecting it directly to the GPIO pins on a Raspberry Pi).

    The underside of Pico labels all the pins

    Pico is an incredibly interesting new device from Raspberry Pi. It offers a wealth of connectivity for external hardware – and enough processing power to handle complex tasks. All this in a compact board which costs less than a cup of coffee. You can pick up a Pico from just $4 / £3.60, or free on the latest edition of HackSpace magazine.

    Built with everyone from absolute beginners to professional engineers in mind, Raspberry Pi Pico represents the start of a new era for Raspberry Pi. We can’t wait to see what you all make with it.

    Get to know Raspberry Pi Pico

    Raspberry Pi Pico is a brand new, low-cost, yet highly flexible development board designed around a custom-built RP2040 microcontroller chip designed by Raspberry Pi.

    Raspberry Pi Pico – ‘Pico’ for short – features a dual-core Cortex-M0+ processor (the most energy-efficient Arm processor available), 264kB of SRAM, 2MB of flash storage, USB 1.1 with device and host support, and a wide range of flexible I/O options.

    A close up on the RP2040 chip that powers Pico

    The castellated pin headers ensure Pico is equally at home on a breadboard for experimentation as it is soldered onto a circuit board and driving a finished product. The high-performance processor cores coupled with RAM and storage give it impressive flexibility.

    A real highlight comes in the form of Programmable Input/Output (PIO) capabilities: bridging the gap between software and hardware, Pico’s PIO allows developers to define new hardware features in software – expanding its capabilities beyond any fixed-function device.

    Pico is set to prove itself not just an impressive new tool for Raspberry Pi users, but a must-have gadget for anyone investigating physical computing projects.

    Microcontroller

    RP2040 is a custom-built dual-core microcontroller, designed in-house at Raspberry Pi

    USB

    USB port on the end of Pico

    A micro USB port provides power and data, letting you communicate with and program Raspberry Pi Pico (by dragging and dropping a file)

    Bootsel

    The BOOTSEL button is important for using and modifying your Pico

    Hold the BOOTSEL (boot select) button when powering up Pico to put it into USB Mass Storage Mode. From here, you can drag-and-drop programs, created with C or MicroPython, into the RPI-RP2 mounted drive. Pico runs the program as soon as it is switched on (without BOOTSEL held down)

    Labelling

    Silkscreen labelling on the top provides orientation for the 40 pins, while a full pinout is printed on the rear

    Debugging

    Accessible debugging pins

    A Serial Wire Debug (SWD) header provides hardware debugging capabilities, letting you quickly track down problems in your programs

    Pins

    Yes, 'castellated' is a new word for us, too.

    Raspberry Pi Pico’s pins are castellated, allowing pin headers to be fitted for breadboard use or the entire board to be soldered as a flat module

    Raspberry Pi Pico specifications

    • RP2040 microcontroller chip designed by Raspberry Pi in the United Kingdom

    • Dual-core ARM Cortex-M0+ processor, flexible clock running up to 133MHz

    • 264kB of SRAM, and 2MB of on-board flash storage

    • Castellated module allows soldering direct to carrier boards

    • USB 1.1 Host and Device support

    • Low-power sleep and dormant modes

    • Drag & drop programming using mass storage over USB

    • 26 multifunction GPIO pins

    • 2× SPI, 2× I2C, 2× UART, 3× 12-bit ADC, 16× controllable PWM channels

    • Accurate clock and timer on-chip

    • Temperature sensor

    • Fast floating-point libraries in ROM

    • 8× Programmable IO (PIO) state machines for custom peripheral support

    Say hello to RP2040

    RP2040 is a low-cost microcontroller device, with the same focus on quality, cost, and simplicity that characterises the ‘big’ Raspberry Pi. Microcontrollers interact with the hardware of a board much like an application processor does in a larger device.

    Application processors like the Broadcom BCM2711 used in Raspberry Pi 4 are designed to run multiple programs under an operating system, like Raspberry Pi OS. These programs access external hardware through interfaces provided by the operating system.

    In contrast, microcontrollers like RP2040 interact directly with external hardware and typically run a single program from the moment you turn them on.

    A reel of Raspberry Pi Pico microcontroller boards ready for distribution

    Just as Raspberry Pi is an accessible computer, RP2040 is an accessible microcontroller, containing almost everything makers need to embed it inside a product.

    RP2040 is supported by both C/C++ and MicroPython cross-platform development environments, including easy access to runtime debugging. It has a built-in UF2 bootloader enabling programs to be loaded by drag-and-drop. The built-in USB can act as both device and host. Meanwhile, floating-point routines are baked into the chip for ultra-fast performance. It has two symmetric processor cores and high internal bandwidth, making it useful for signal processing and video applications. The chip has a relatively large amount of internal RAM but uses external flash storage, allowing you to choose how much memory you need.

    Microcontrollers are an exciting new area for Raspberry Pi fans to explore. See the RP2040 data sheet for more information.

    Behind the name 2040

    The post-fix numeral on RP2040 comes from the following:

    1. Number of processor cores (2)

    2. Loosely which type of processor (M0+)

    3. The amount of RAM, from the function floor(log2(RAM / 16kB)); in this case it’s 256kB

    4. The amount of non-volatile storage, from the function floor(log2(non-volatile / 16kB)), or 0 if no on-board non-volatile storage

    Translating the name of RP2040

  • Pirate Audio: Dual Mic review

    Pirate Audio: Dual Mic review

    Reading Time: 2 minutes

    This mini HAT looks very similar to other Pirate Audio products, with an integrated 1.3-inch colour LCD screen surrounded by four push-buttons. Located on either side of the board are two tiny digital microphones. These feature a SiSonic acoustic sensor, a serial ADC (analogue to digital converter), and an interface to convert the signal into the industry-standard 24-bit I2S format. In our tests, we found that they recorded sound with crystal-clear quality, although the mics aren’t that far apart so the stereo effect is limited.

    Portable clip recorder

    To make use of the Pirate Audio: Dual Mic, you’ll need to download the software; this involves entering three commands in a Terminal window to make all the necessary configuration changes behind the scenes.

    Recording an audio clip, with the volume levels shown on the LCD

    One of two Python code examples is an FFT (Fast Fourier transform) program that shows the levels of various sound frequencies on a graph. The other is a simple audio clip recorder which uses the tactile buttons to record, play, skip, and delete clips. Playback (using PulseAudio’s ‘upmix’ feature to avoid resampling) is via HDMI by default and we couldn’t get it to output through Raspberry Pi’s AV jack unless we played the clips separately with OMXPlayer. Portable playback is problematic on a Raspberry Pi Zero (which lacks AV output), too, so you’ll need to use Bluetooth or also attach an audio board using something like the HAT Hacker HAT.

    Verdict

    8/10

    High-quality audio capture in a small package that might be useful for a portable recorder or voice assistant project. It lacks its own audio output, though.

  • PiTubeDirect

    PiTubeDirect

    Reading Time: 3 minutes

    The 1980s gem inspired the affordable microcomputer we’ve come to know and love, so we adore how this project brings both together, using Raspberry Pi to enhance the BBC Micro by allowing another external CPU to be added.

    This idea is not new. BBC Micro maker Acorn included a port called Tube for this very purpose and it released a range of second processors to expand a machine with limited RAM. But Acorn’s original set of second processors can be expensive and tricky to find, so PiTubeDirect recreates them on Raspberry Pi.

    As such, BBC Micro enthusiasts can enhance their computers by adding a second 6502 or they can add external Z80, 32016 and ARM1 second processors – the latter used to develop the Archimedes range.

    “The second processors would take responsibility for running the current language and the user’s programs, leaving the BBC Micro host responsible for the keyboard, screen, and file system,” says project originator David Banks. “The Tube architecture was unique and very innovative at the time.”

    Timing it right

     David Banks originally created a 6502 second processor using a field-programmable gate array. Raspberry Pi reduced the cost, and this was the first prototype

    To enhance a BBC Micro in this way, users need a level-shifter HAT connected to Raspberry Pi’s GPIO interface which, in turn, is hooked to the BBC Micro’s Tube port using a 40-pin IDC cable. After installing the PiTubeDirect software to a microSD card, you simply plug and play.

    Yet getting to this point has been a challenge. “We were brainstorming what it would take to connect Raspberry Pi Zero to the Tube port with the absolute minimal amount of hardware,” recalls David, who began tinkering with the BBC Micro again in 2013 after discovering people were preserving the computer and developing new hardware and software.

    “The BBC Micro’s Tube interface is just an extension of the 6502 microprocessor bus and it uses 5V signal levels. Raspberry Pi uses more modern 3.3V signal levels, so the minimum hardware is just a couple of off-the-shelf level-shifter chips. 

    “But such a solution is only feasible if Raspberry Pi, in software, can do everything else, including responding to Tube requests in real time.” Achieving that was tricky.

    To the bare metal

    The original BBC Micro Model B had 32kB, but Acorn’s originally released 6502 second processor included a 50 percent faster 3MHz 65C02 CPU, as well as 64kB of RAM

    The wizardry used to interface the BBC Micro to a second processor was originally encapsulated in the Tube ULA custom chip. “Every second processor that Acorn produced contained one, providing a set of four bidirectional FIFOs that allow the ‘host’ and ‘parasite’ processors to communicate via a series of well defined messages, called the Tube Protocol,” explains David.

    Emulating this entailed using software running on Raspberry Pi and it needed to meet the hard real-time constraints of the 2MHz Tube interface.

    “We knew running a conventional operating system like Raspberry Pi OS would not yield the required guaranteed response time,” David says. “So, we dispensed with the operating system and engaged in ‚Bare Metal‘ programming, developing software by directly accessing the hardware of Raspberry Pi Zero.”

    To further resolve time-related problems, Dominic Plunkett joined the team and suggested moving the Tube ULA emulation code on to the GPU. Dominic also optimised the emulation speed of the 6502 to 292MHz, thus making it 150 times the speed of the original 2MHz BBC Micro. 

    One thing’s for sure, it’s been an education. “One of the more satisfying aspects of developing PiTubeDirect has been learning about programming at the lowest bare metal level,” notes David. “And that’s very much in the same manner that we would really get to know machines back in the 1980s.”

  • Review: Learn LibreOffice with Raspberry Pi

    Review: Learn LibreOffice with Raspberry Pi

    Reading Time: 3 minutes

    LibreOffice Getting Started Guide

    You don’t need to pay big bucks or for a regular subscription to access high-quality office software. Available on all major platforms, LibreOffice is a fully fledged office suite that includes apps for word processing (Writer), spreadsheets (Calc), presentations (Impress), vector graphics editing (Draw), mathematical formulae (Math), and databases (Base). The whole suite is included in the full version of Raspberry Pi OS, so you can get straight to work on your new Raspberry Pi 400 (or any other model).

    Although the main office programs will feel fairly familiar to many users, this official guidebook (also available as a free PDF download) from the makers explores the suite in detail to help you get the most out of it. A setup chapter goes through various general settings, before the book shows how to create and apply styles and templates (a key feature of LibreOffice) to help speed up document formatting. Subsequent chapters take you through each individual office app, followed by guides to printing, images, HTML files, macros, and customisation.

    Creator: The Document Foundation

    Price: $11

    URL: magpi.cc/librebooks

    Getting Started Book

    LibreOffice Help

    Clicking the Help option within LibreOffice takes you to this comprehensive online resource that should help you solve most issues. Every aspect of the suite is covered in detail and it’s easy enough to navigate. As well as a drop-down list of modules (apps) and a search facility, there’s an index list of keywords for all LibreOffice modules: click on a keyword to open the linked Help page.

    In addition, there’s a handy section for Common Help Topics, such as configuration, version tracking, printing, charts/diagrams, working with PDFs, and automatic functions. A particularly useful topic in this section covers compatibility with documents in Microsoft Office formats – they can all be imported without issue, although some special features may not work in exactly the same way.

    Creator: The Document Foundation

    Price: Free

    URL: magpi.cc/librehelp

    LibreOffice Help

    Udemy LibreOffice courses

    There’s no end of online courses available to learn LibreOffice, at a wide range of prices – you can pay hundreds for some. Udemy’s courses start at a reasonable £19.99 – at the time of writing, many were available at £9.99, so it’s worth looking out for special offers.

    Most of the courses cover a single app and all comprise a series of short video lectures, so it’s bite-size learning that you can dip in and out of easily when you have time. There are also assignments or exercises to complete and example files on which to practise your new-found skills. Complete the course and you’ll receive a certificate, although it can’t be used for formal accreditation.

    Creator: Udemy

    Price: From £19.99

    URL: magpi.cc/libreudemy

    Udemy LibreOffice courses

  • Korg Monotron MIDI

    Korg Monotron MIDI

    Reading Time: 3 minutes

    Recognising that, musician and engineer Zack Scholl got to work on a solution, using a Raspberry Pi to add MIDI functionality. The end result is music to our ears since it not only makes the synthesizer infinitely more playable but has allowed Zack to record an entire music album.

    “The ribbon controller made it near-impossible to play multiple notes in tune because moving your finger just a few millimetres changes the pitch,” Zack explains. “That’s where adding MIDI functionality comes it handy.” Indeed, it means a wide variety of electronic musical instruments and computers can now be added. “The easiest modification is to get a keyboard that speaks MIDI and convert the MIDI notes into voltages that the Korg Monotron understands,” Zack says.

    Tuning in

    A Python script cycles through voltages for 30 seconds to get the Korg Monotron in tune, then a mini keyboard can be attached

    By choosing a Raspberry Pi for the project, Zack was able to avoid the pitfalls of similar mods which tend to require lots of components and PCBs. “The biggest drawback of other projects is that they have had no way of automatically tuning the Monotron – that is, they can’t determine exactly which voltage corresponds to which frequency on the unit,” he says.

    Zack’s approach provided the ideal solution and it means he can play the Monotron with itself and other instruments. “Raspberry Pi can easily understand MIDI via USB and the MIDI input can be converted to a voltage using a DAC [Digital to Analogue Converter] plugged directly into the external pins,” he says.

    Indeed, the build was relatively straightforward. “The biggest challenge has been to keep the Monotron in tune. The cheapness of the synthesizer means it doesn’t have any circuits to keep the pitch locked into a certain scale or tuning, but by routing the audio from the Korg Monotron into the recording input of the USB audio device, Raspberry Pi is able to ‚learn‘ which voltage corresponds to which frequency.”

    A star is born

    Just two connections need to be soldered on the back of the well-labelled Korg Monotron PCB: one to the gate pad and the other to the GND pad

    To achieve this, Zack wrote a custom Python script that could adjust the voltage and frequency, making use of two modes – tune and play – with the former sending out voltages and listening to the USB audio input to calculate the voltage-frequency relationship. “When you put it into play mode it will listen to MIDI and use the calculated voltage-frequency relationship to figure out which voltages to send out to the Korg Monotron, which changes its pitch according to the incoming voltage,” he reveals.

    It’s also possible to play the Korg Monotron without a keyboard at all. A text file can be run instead and Zack wrote the program to do this before he even created the Monotron project. “The software lets me connect to Raspberry Pi via a Secure Shell and directly write notes into a file that will be played by the Korg Monotron,” he explains.

    “This was great because it turned Raspberry Pi into a self-contained musical instrument. Essentially you can just connect it to the synthesizer and it will play whatever you want. It frees up my hands to modulate the effects and it makes for some really impressive-sounding music.“

  • Use a retro DB9 joystick with Raspberry Pi 400

    Use a retro DB9 joystick with Raspberry Pi 400

    Reading Time: 6 minutes

    Step 01: Install the Free Unix Spectrum Emulator

    Also available in the RetroPie emulation distro we’ve used in previous tutorials, the FUSE ZX Spectrum emulator can be found in Raspberry Pi OS’s standard repositories, so installation is a bare minimum of fuss. Open a Terminal window and type:

    sudo apt install fuse-emulator* spectrum-roms opense-basic libspectrum8

    This will install FUSE, its GTK and SDL frontends, and both open-source system ROMs and the original Spectrum system ROMs. Permission has been granted for free modification and distribution of the latter.

    While the open-source ROM can only handle a limited selection of files, that spectrum-roms package will allow you to play a wide array of games, including the latest generation of technically spectacular releases for the platform.

    Step 02: Test FUSE

    Next, we’ll make sure FUSE is working with the ZX Spectrum port of Locomalito’s open-source classic, L’Abbaye Des Morts. In a Terminal, type:

    wget https://spectrumcomputing.co.uk/zxdb/sinclair/entries/0030109/AbbayeDesMorts.tzx.zip
    fuse-sdl

    Press F2 to open FUSE’s file browser, navigate to AbbayeDesMorts.tzx.zip, and press ENTER. The game should load and run automatically. For full-screen mode, press F1, go to Options, and select ‘Full screen’. Take note of the Filter option in the same menu, which lets you choose the emulator’s upscaling method: ‘TV 3x’ gives you some pleasing scan lines and the correct aspect ratio.

    „Wiring up the DP9 port to Raspberry Pi’s GPIO is a fairly simple process“

    Step 03: Wire up your joystick port

    Standard DB9 connectors split the nine pins of your cable into nine screw-down terminals. We found it most convenient to use male-to-female jumper cables for this, clamping the male tips into our DB9 breakout connector.

    For a classic single-button joystick like the Competition Pro Retro we used, pin 1 is up, pin 2 is down, pin 3 is left, pin 4 is right, and pin 6 is fire. Pin 8 connects to ground – we recommend using a green cable for it. Some joysticks may require you to connect port 7 to a 3.3V power connector on the GPIO, but the Competition Pro does not.

    See the ‘DB9 pins’ box for an at-a-glance DB9 connection table.

    Step 04: Wire up Raspberry Pi

    Figure 1 GPIO connection points for two singlebutton joysticks, corresponding to the ‘GPIO connections’ table (below). Joystick 1 is purple, joystick 2 is orange. Use your choice of ground pins for each controller: ground pins 6 and 14 are marked in green here

    Wiring up the DP9 port to Raspberry Pi’s GPIO is a fairly simple process, although you’ll have to do some careful pin counting. On Raspberry Pi 400, pin 1 is at the top right of the horizontally oriented GPIO port and pin 40 is at the bottom left. Remember that GPIO numbers don’t correspond with pin position numbers.

    For a reminder of where everything is, open a Terminal and type:

    pinout

    .

    Our GPIO Connection diagram (Figure 01) shows where the female jumpers connected to your DB9 port need to go on Raspberry Pi. For a single one-button joystick, up goes to GPIO 4, down to GPIO 7, left to GPIO 8, right to GPIO 9, and fire to GPIO 10.

    Step 05: Build the DB9 joystick driver

    Let’s build the driver. Enter this in a Terminal window: 

    sudo apt install dkms raspberrypi-kernel-headers
    git clone https://github.com/marqs85/db9_gpio_rpi.git
    cd db9_gpio_rpi
    sudo cp -r db9_gpio_rpi-1.2 /usr/src/db9_gpio_rpi-1.2/
    sudo dkms add db9_gpio_rpi/1.2
    sudo dkms build db9_gpio_rpi/1.2
    sudo dkms mkdeb db9_gpio_rpi/1.2 --source-only
    sudo modprobe --first-time db9_gpio_rpi map=1,1

    That

    map

    option defines what kind of joystick you’re using, with each number classifying a different type of joystick As we’re using a one-button joystick,

    map=1,0

    would do it, but

    1,1

    means we can connect a second stick of the same type to a second port.

    Step 06: Test your joystick

    Building and loading the driver won’t quite get us to a functional joystick, as the driver isn’t fully compatible with Raspberry Pi OS’s recent use of raspi-gpio instead of gpio. However, this is a great time to test your joystick to make sure that it’s wired up correctly

    sudo apt install jstest-gtk
    jstest-gtk

    You should see your joystick in the peripherals list. When you click into it, if you’re using a Competition Pro Retro or similar joystick, you’re likely to find that the fire button is jammed on and that the horizontal x axis is stuck at the left.

    „Although many Spectrum games support joysticks, you’ll often have to enable support for these“

    Step 07: Pull-ups are good for you

    This is because your GPIO needs to be set up to handle the joystick’s pull-up switches. On a standard DB9 GPIO configuration, this script will do this for you. Create it using your preferred text editor and save it somewhere handy. We’ve put ours in /home/pi/pullup.sh.

    Test it by running:

    sh /home/pi/pullup.sh
    jstest-gtk

    If the joystick is now aligned properly and the button isn’t stuck on, you’re in business.

    chmod +x /home/pi/pullup.sh

    Finally, let’s load those pull-up settings on boot.

    sudo mousepad /etc/rc.local

    Above the

    exit

    line, enter the following:

    /home/pi/pullup.sh

    You can also place the pull-up code directly in rc.local if you wish.

    Step 08: Load on boot

    Once you’re satisfied that your joysticks work, you’ll want to load the driver module on boot.

    sudo mousepad /etc/modules

    …and add:

    db9_gpio_rpi

    After saving and exiting the file, enter:

    sudo mousepad /etc/modprobe.d/db9.conf

    This file should contain the following line:

    options db9_gpio_rpi map=1,1

    If you’re using a different joystick and configuration, you’ll need an appropriate map, and possibly some extra GPIO connections, which you can find here.

    Reboot Raspberry Pi and use

    jstest-gtk

    to ensure that everything is working as it should. You can now use the driver as a generic controller input device.

    Step 09: FUSED joysticks

    The jstest-gui program allows you to test your joystick and also indicates whether it’s working as it’s supposed to

    FUSE doesn’t enable joystick support by default, so we’ll have to set that up. Run

    fuse-sdk

    , then press F1 for the menu. Go to Options > Peripherals > General. Press SPACE to enable Kempston joystick support, then press ENTER.

    Press F1, then Navigate to Options > Peripherals > Joysticks and make sure both Joystick 1 and Joystick 2 are set to Kempston. If not, press ENTER, press ENTER again to open the Joystick type options, navigate to Kempston on the list, and press ENTER again.

    Note that some games may default to using Joystick 2, so you’ll want to configure both, even if you only have a single stick connected.

    When you’re happy with your settings, open the Options menu, and select Save.

    Step 10: Game configuration

    Although many Spectrum games support joysticks, you’ll often have to enable support for these. L’Abbaye des Morts enables joystick support by default, but its menus provide a good example of what to look for.

    Load the game and then press C on the keyboard to access the control configuration. Pressing 1 here enables and disables Kempston joystick support. In other titles, you may need to explicitly choose to use your joystick to control the game if you want it to work.

    Step 11: Get game

    The Spectrum’s been a long-time home-brew favourite, with software continuing to come out for years past its original availability. There’s been a resurgence in popularity of the platform with the release of a number of successors, most recently the ZX Spectrum Next.

    As ever, the indie-friendly itch.io digital distribution platform is one of the best places to find both free and commercial releases for the Spectrum, and we’ve put together a list.

    Step 12: Boot to black

    Finally, let’s start

    FUSE

    on boot for that authentic Spectrum ambience. In /home/pi/.config/autostart create a text file called fuse.desktop. If the directory doesn’t exist, create it. Add the following lines to your new tile:

    [Desktop Entry]
    Type=Application
    Name=FUSE
    Exec=/usr/bin/fuse-sdl --full-screen

    You can exit

    FUSE

    at any point to return to Raspberry Pi OS’s familiar Pixel desktop.

  • FHD Touch Display & Bluetooth Keyboard review

    FHD Touch Display & Bluetooth Keyboard review

    Reading Time: 3 minutes

    The two parts are sold separately, but designed to work together. The result resembles a Raspberry Pi-based Microsoft Surface laptop. To the rear is an adjustable kickstand, which the pi-top [4] case clicks onto. An 80cm display cable connects the two elements. The length ensures you can disconnect the pi-top [4] and have it sitting to one side.

    Weighing it up

    Altogether, the keyboard, screen, pi-top [4] DIY Edition, and display cable weigh in at 1620g. Not spritely for a tablet computer, but light enough for us to throw in a backpack and take to the coffee shop. It was stylish enough to use without raising any eyebrows.

    There’s an elephant in the room that we should address. Together, the FHD Touch Screen and Bluetooth Keyboard will set you back £242. This is on top of £95 for the pi-top [4] DIY Edition case. And you will need to supply your own Raspberry Pi 4 (from £35, or £54 for the 4GB model tested here). So you are looking at around £370-£400 for this setup.

    With that elephant firmly kicked out of the room (for now) we are pleased to report that everything we tested was fantastic.

    FHD Touch Display

    The pi-top [4] DIY Edition clips to the kickstand for a neat all-in-one solution

    First up is the 11.6-inch touchscreen display with a resolution of 1920×1080 at 190ppi (pixels per inch). It’s a great display, although the chunky bezels are a tad retro.

    It is a ten-point capacitive touchscreen and we found it highly responsive. While there is no multi-touch interface support in either pi-top OS or Raspberry Pi OS, it’s very useful to tap buttons and interface elements.

    Bluetooth Keyboard

     A stand-out for us was the touchpad which was snappy and responsive, and deflected accidental touches. A first for a Raspberry Pi laptop

    The Bluetooth Keyboard clips to the base of the screen (again, magnetically) via a connector. There is no need to pair the keyboard. However, set up Bluetooth and you can disconnect the keyboard and use it to one side. We found it an absolute joy to type this review out on it.

    Along the function keys sit a selection of shortcuts, including a dedicated Terminal key that we quickly fell in love with.

    Below the keys is a multi-touch trackpad and, by Jove, they have cracked it. There is no accidental thumb touching, no awkward cursor jumping, and you can left- and right-click with ease. This is the only time we have encountered a Raspberry Pi laptop with a fully decent touchpad.

    pi-top OS

    We spent a couple of hours in Costa writing this review. With pi-top [4], Raspberry Pi comes together into one neat package that’s a delight to work on. All that really leaves is the price, and once again the elephant shows its snout.

    It is a big step up from using a Raspberry Pi with a repurposed keyboard, mouse, and monitor. On the other hand, it is considerably cheaper than a Microsoft Surface. And Raspberry Pi is a much more fun and useful computer.

    Verdict

    9/10

    This setup is packed with clever ideas and we love the keyboard, touchpad, and Raspberry Pi integration. Hands-down the best way to use Raspberry Pi on-the-go.

  • Multi-effects Guitar Pedal

    Multi-effects Guitar Pedal

    Reading Time: 3 minutes

    After buying some commercial guitar pedals, Raphaël noted that they’re normally run in series, but wondered what would happen if they could be run in parallel. “It makes a pretty big difference,” he tells us. “Suppose you have two distortion pedals: if you run them in series, you’ll hear the cumulated effect of both, while if you provide your ‘dry’ (unmodified) signal to each pedal separately and add up their outputs, you’ll then preserve the specifics of each and create a sound impossible to create when running the pedals in series.”

    Unlike off-the-shelf multi-effects units which run their effects in series internally (apply Octaver, then Fuzz, then Delay, for instance), the DIY guitar pedal he built is able to digitally create a complex parallel signal chain: “Something like the modular synth version of guitar pedals.”

    Connecting effects

    The second version of the project has a large enough case to accommodate all the electronics, including a Raspberry Pi and audio interface

    With a Raspberry Pi 3 and all the other components crammed into a handmade wooden case, the unit features six jacks (two in, two out, two expression pedal), a USB ports, three push-buttons, and a rotary encoder to control effects.

    A touchscreen interface (made using the SFML software library) enables the user to create and link multiple nodes for different effects to combine them. There’s also a live board view where you can adjust their parameters of each effect to get exactly the sound you want.

    “The centrepiece is what I call the ‘audio pipeline’,” he says. “It’s moving the audio from node to node (essentially a DFS graph traversal); visually, a node is one brick in the GUI.

    At the moment, I’ve made about 25 individual effects (bricks), each having from two to five input and output slots; you can pretty much add as many bricks as you want and connect them however you want [for] a lot of potential effects.

    “My goal is to provide enough building blocks to recreate the effects of any off-the-shelf pedal, and more, by combining filters, modulation, delays, etc.”

    We can rebuild it

    Raphaël is a 24-year-old software engineer. This is Raphaël’s first ever Raspberry Pi project.

    The project took Raphaël around half his time over a four-month period. While the software aspect was in his comfort zone, “the real hard part for me was cutting wood and soldering things. Seriously, before this project, hardware was pretty much magic to me, and wood wasn’t even a thing!”

    His reasoning for using a Raspberry Pi in the build was simple: „I want to make a pedal. I’ve got a tiny computer and a USB audio card. If I put them both in a box, that’s a pedal, right?“

    For the first version of the pedal, as used in his YouTube demo, he reveals that the wooden enclosure was too small: “There’s a 5mm gap; that’s why I shot the video from a 90° angle.”

    He has subsequently built a brand new version with a bigger enclosure, which allowed him to add an Ethernet port, another USB, and finally close the box.

    “Also, I used another audio interface, which is better suited as it can be torn apart, resoldered, and screwed directly to the enclosure; clearly better than a USB dongle flying around with bulky audio jacks connected to it.”

    Quite a few people have told him they’d love to buy his pedal, as a product or as a kit, which he is considering. “One way or another, I plan on making everything open-source relatively soon; I’d love to see people building their own effects!”

  • Car Head Unit

    Car Head Unit

    Reading Time: 2 minutes

    “My eyes lack depth perception, so I really wanted a backup camera for safety,” he explains. Off-the-shelf options were expensive, so he decided to put his engineering skills to the test. The parts ended up costing him “a fraction” of a readymade product.

    Powering ahead

    Originally, he wanted a backup camera and a large screen to display the camera view, much like the home security setup he’d created previously to keep an eye on his house while he was on holiday. He chose a Raspberry Pi 4 as the basis since he knew that model well and it offers good camera support. “The low cost was a major advantage, as well as being able to replace my plain old radio with a big, beautiful 7-inch touchscreen,” he says. 

    Levi then discovered a company called Blue Wave, which makes open-source head unit software for Raspberry Pi called OpenAuto. “I flashed my Raspberry Pi with their OS. [This provided] a graphical interface and a full suite of apps and other features you would commonly find in many stock infotainment systems, including Android Auto,” he says.

    A voltage divider and signal wire to the reverse lamp circuit in the rear light connect to a GPIO pin on Raspberry Pi. The reversing camera is summoned whenever the car is put into reverse

    Powering it was to prove a challenge as the 12V connections in his car didn’t match that of Raspberry Pi. He used a 12 to 5 volt buck converter to step-down the power supply to Raspberry Pi, though on the first attempt he got his wires mixed up, destroying his Raspberry Pi. To prevent the microSD card corrupting when the power was switched off, Levi cleverly tapped into the ignition wire behind the car dashboard then soldered a PC817 opto-coupler between it and Raspberry Pi.

    “I used a Python script I found online that told Raspberry Pi to look for a falling edge on the opto-coupler,” he reveals. “When you turn off the ignition, the opto-coupler instructs Raspberry Pi to run a shutdown script, ensuring a safe power-off.”

    Looking back

    Levi replaced the car stereo with a Quick FACTS Raspberry Pi 4, a camera to monitor what’s happening behind him, and a 7-inch touchscreen display. He designed and 3D-printed the bezel

    For others wanting to tackle such a project, Levi warns that the electrical work involved is quite challenging. “You’re splicing into electrical harnesses in your car, building voltage dividers, and doing a lot of stuff to your car that wasn’t meant to be done, so you have to be careful and know what you’re doing so you don’t damage things.”

    But it’s fair to say he’s pleased with how his project turned out: “Nothing makes an old car feel like new like a giant touchscreen in the dash,” he beams.

  • Embedded Learner Board review

    Embedded Learner Board review

    Reading Time: 2 minutes

    The Embedded Learner Board (£19 / $26) takes it a step further, though. Also, it’s not a HAT, which allows it to be a bit platform agnostic – it works with Arduino boards as well. The board itself contains a ton of different components: a 16×2 LCD display, a 7-segment display, buttons, LEDs, thermistor, IR sensor, a buzzer, even a light sensor. It packs a lot of functionality and because of that, it’s also larger than a Raspberry Pi.

    Learn to connect

    Everything on the board is well-labelled

    As it’s not a HAT, you’ll need to manually connect wires to specific GPIO pins for what you’d like to use/control. Each element on the board is labelled and each corresponding pin is equally well labelled so it’s not a big issue – especially with the code examples that teach you how each part works. You can then start using bits in conjunction with each other.

    It packs a lot of functionality and because of that, it’s also larger than a Raspberry Pi

    The examples are great and the board is pretty cool, although some of the parts are a bit more advanced for beginners than we’d prefer. Experienced parental supervision is required in our opinion, although it will be a fun shared activity.

    Verdict 

    9/10

    It packs a lot of functionality for quite a low price, although it may be a little fiddly for younger kids.

  • BOSEBerry Pi

    BOSEBerry Pi

    Reading Time: 3 minutes

    David has been a radio enthusiast since he was a kid, and was wrestling with a DAB radio in his kitchen with spotty reception.

    “I thought it might be time to replace this radio and started to wonder if I could build my own connected to the internet,” David explains. “I know this can easily be achieved using a smart speaker setup, but I wanted a radio that just played radio stations. In support of the United Nations sustainable development goal which aims for sustainable consumption, I decided to reuse a traditional radio and build my own system inside it.”

    On David’s search for a suitable radio housing, he came across old BOSE SoundDocks (from the days where iPod docks were all the rage) which were listed as faulty.

    “I suspected that these devices fail from the repeated insertion of the iPod into the docking connector,” David said. “But as I was not going to use that, it would seem a good option to use as the base for my project.”

    Replacing iPod

    Carefully gut your ‘faulty’ iPod dock. Retain
the ‘Vans off the wall’ sticker if you really want
a slice of 2011 remaining.

    Like a lot of upcycling projects, David went with a familiar solution: “I decided to use a Raspberry Pi Zero W for this project as it had plenty of processing power for the task and a very small physical footprint which could fit inside the case with ease.”

    He decided to use a full-on DAC to provide the audio he needed from his Raspberry Pi Zero, delivering audio quality higher than internet radio could ever deliver. After removing the internals of the BOSE system, he found a good space to mount Raspberry Pi Zero and other components using a custom cradle designed in FreeCAD. He also added a small class D amplifier and installed an adapter so he could use a 5 volt power supply.

    Out of a choice of music player and radio software for Raspberry Pi, David decided to keep it simple. “As the radio was not going to use a screen of any kind, I downloaded the latest version of Raspbian [Raspberry Pi OS] Buster Lite and installed it on an SD card,” he says. “All the installation was done through the command line. I installed the music player daemon and music player client which allowed me to check that the hardware was able to play the music stream.”

    He added remote control abilities, programmed in specific stations, and was done.

    Final touches

    A 3D rendering of an element of the build

    Well, nearly. David decided to go a few steps further with a custom fascia with an updated logo.

    “Although this front fascia was now complete, I decided to experiment with the style of it,” he tells us. “I started with an understated panel with embossed letters, but then thought the wording should be highlighted as a feature. This was achieved with some enamel paint to fill the depressions made by the letters. A test piece revealed that the enamel paint was being drawn up along the filaments of PLA printer thread by capillary action. This was solved by first sealing the whole face with a clear acrylic spray, then painting the detail, finishing with some wet and dry paper on the top surface. A final coat of acrylic spray provided the finishing touch of a gloss surface to match the rest of the speaker body. I give you the BOSEBerry Pi.”