Category Archives: Raspberry Pi

What is the Raspberry Pi Pico?

The electronic industry uses embedded systems with powerful, low-cost MCUs or microcomputer units. This helps product development by adding capabilities like machine learning and rapid prototyping while supporting many types of tests. In most cases, the designer must understand the MCU in depth while also mastering low-level programming languages. Often, development boards are way too expensive, not readily available, and it may be difficult to get them up and running. As an alternative, designers can go for the Raspberry Pi Pico.

The Raspberry Pi Pico is a readily available, low-cost development board. It uses the RP2040 MCU which offers a wide range of capabilities to the designer. Additionally, it has many extension boards and software development kits that make the task of an embedded system designer easy.

First introduced in 2021, designers can use the Raspberry Pi Pico as a standalone development board. They can also integrate the board into a system by soldering the edge connectors onto a carrier board. The Pico is popular mainly because of its sub $5 cost, which is way less than the $20+ price of other similar development boards.

The RP2040 MCU that the Pico uses is a dual-core processor of the ARM Cortex family. It operates at 133 MHz. It includes 264 kB of SRAM and an external 2 MB flash chip interfacing with the MCU over a quad serial peripheral interface. A user LED, pushbutton, and crystal oscillator are on the board. The user can configure the pushbutton to boot the processor directly or direct it to a bootloader. They can use the crystal oscillator to act as a PLL or phase-locked loop for creating a high-speed CPU clock.

The Pi Pico offers an extensive ecosystem, where developers can use either the C or the MicroPython language to write applications for the board. In reality, there are three types of Pi Pico boards to choose from—the SC0915 with a standard configuration, the SC0197 with the header connectors, and the SC0918 with a low-cost Wi-Fi chip.

Each of the above boards has the same general footprint. The edge connectors are 40-pins providing connection options for peripherals. Among the connections available are those for power, ground, UART or universal asynchronous receiver and transmitter, GPIO or general purpose input and output, PWM or pulse width modulation, ADC or analog to digital converter, SPI or serial peripheral interface, I2C or inter-integrated circuit interface, and debugging.

There are several options for using the Pi Pico for rapid prototyping. One can use a breadboard and populate the headers, but this may result in a mess of wires. The other neater option is to use breakout boards to expand the edge connectors and make them available for easy interfacing.

The Raspberry Pi Pico ecosystem offers MicroPython as an alternative to the older C language. This is a modern language that most designers are already familiar with. They use API or application programming interfaces for accessing hardware and abstracting out the low-level details of the MCU and its related hardware.

Making a PiPlateBot with the Raspberry Pi

Turtle robots of the yesteryears had always fascinated Robert Doerr and he decided to create one with the popular single board computer, the raspberry Pi or RBPi. He hid all components of the robot inside the plate case, and decided to call his robot PiPlateBot.

Robert Doerr is the owner of Robot Workshop, and a dedicated robot builder. He used the Bud Pi Plate case, as this was strikingly similar to the turtle-style robots computer science students used earlier.

The Pi Plate has a circular design. Twisting off the top allows easy access to the space within that can house additional components. That led Robert try to fit an RBPi inside, along with the other parts required to build a moving robot. According to Robert, the PiPlateBot is the only robot that runs on an RBPi and uses an off the shelf RBPi case. Robert claims he is using as many RBPi-type products as possible for the construction.

To get everything to fit, Robert had to cut two rectangular holes in the Pl Plate enclosure base. Then he glued servos to the bottom and clipped the RBPi and RoboPi boards on the top. On the boards, he placed a BZO power bank to work as a battery. To enable communicating wirelessly with the RBPi, Robert uses a USB Wi-Fi adaptor. This allows him to SSH directly into the RBPi.

The RoboPi is an impressive motor controller, and the most powerful one for the RBPi. Using an eight-core 32-bit Parallax Propeller RISC micro-controller at 100 MHz, it allows offloading hard real time IO from the Linux OS running on the RBPi, thereby giving timing with greater precision to projects. The RoboPi will work with any RBPi model.

Each core on the RISC controller works at 25 MIPS, with each instruction taking only four clock cycles to complete. The RoboPi has three ten-pin IO module expansion connectors and they provide 24 servo-compatible headers. Some of these connectors use jumper selectable power from the internal 5 VDC or the external servo power supply for powering the sensors.

The user can connect servos to screw terminals that provide external power. There are eight headers for setting up an eight channel 0-5 V analog to digital converter. The user has a choice of using MCP3008 for 10-bit AD conversion or MCP3208 for 12-bit AD conversion.

Therefore, while the RBPi does the high-level thinking, the Parallax Propeller chip on the RoboPi board handles all the IO controlling and the real-time tasks. As the RoboPi controller has both C and Python libraries, Robert plans to write a Logo Interpreter to make the PiPlateBot use Logo to emulate the early turtle robots.

As the PiPlateBot has only two servos controlling its two wheels, the robot actually wobbles when operated. Robert had to use furniture gliders to prevent this. He attached them to the front and rear of the PiPlateBot. A sonar sensor fitted on the PiPlateBot allows it to sense its surroundings.

Building a robot is the fun way of learning to use the RBPi, and a great way to learn programming on the SBC.

HiFiBerry & Raspberry Pi Put New Life into Old Loudspeakers

If you have some old stereo speakers stored away in your basement, chances are they connect through the old way—with wires—to an amplifier, and that is the reason they were banished to the basement. With HiFiBerry Amp+ and a single board computer, such as the Raspberry Pi (RBPi), you can resurrect your vintage speakers. Using the latest in open source technology, you can now use the renovated loudspeakers wherever you want, since they now operate wirelessly.

HiFiBerry offers their Amp+ as an amplifier for the RBPi. As it is a Class-D power amplifier, it is highly efficient as a stereo module, and you only need to connect the loudspeakers. This high-quality amplifier is ideal for setting up multi-room audio installations.

The amplifier is stable enough to drive 4-Ohm loudspeakers and those with higher impedance as well, pumping out 25 W of output power. However, the best part is the RBPi can fully control the amplifier. As the amplifier includes on-board digital to analog converters, you do not need external sound cards or DACs to provide the 44.1 KHz and 48 KHz sample rates. The board connects directly to the RBPi without needing additional cables, and this provides a full digital sound path for optimal audio performance.

The HiFiBerry Amp+ comes as a pre-fabricated kit, so it needs no soldering. It is a daughter board for the RBPi, and when the RBPi plugs into it, you need to connect only a single external power supply of 12-18 V to supply both the amplifier and the SBC, as the RBPi draws power from the Amp+. You can use the Amp+ with all RBPi models that have the 40-pin GPIO connector. The board sits on four small plastic spacers that come with the kit.

The specialty of the Amp+ kit is it converts the digital signal into audio with far greater clarity than the RBPi can, and delivers that to the speaker as a 25 W audio amplifier. On the reverse side of the board, the female connector is easily visible, so it is easy to plug in the GPIO pins of the RBPi.

On one side of the board are a jack for powering the board, and six wire-terminals. If for some reason you cannot use the jack to power the board, use the two wire-terminals on the left. The rest of the four wire-terminals are for connecting to a pair of stereo loudspeakers, using two audio cables per speaker.

As the board takes in 12-18 V supply and delivers power to the RBPi as well, it is important to not power the RBPi from its usual 5 V power supply. This reduces the number of wires to the assembly. As the Amp+ board is very small, it does not protrude beyond the RBPi. It is important to mount the board on the four plastic spacers to avoid breaking the GPIO pins.

The SD card for the RBPi can be of the 8 GB type and people have reported better performance with Transcend cards. However, you can use 16 GB cards as well.

Raspberry Pi and Traffic Lights

Although we come across traffic lights almost every time we step out of our homes, we rarely stop to think about how they work. However, Gunnar Pelpman has done just that, and he has put the hugely popular single board computer, Raspberry Pi to good use. While most of the tutorials introduce turning on and off LEDs, he has prepared a somewhat more complex tutorial, one that teaches how to program traffic lights. Moreover, he has done this with the Raspberry Pi (RBPi) running the Windows 10 IoT Core.

Traffic Lights may look very complicated installations, but they are rather simple in operation. They mostly comprise a controller, the signal head, and the detection mechanism. The controller acts as the brains behind the installation and controls the information required to light up the lights through their various sequences. Depending on location and time of the day, traffic signals run under a variety of modes, of which two are the fixed time mode and the vehicle actuation mode.

Under the fixed time mode, the traffic signal will repeatedly display the three colors in fixed cycles, regardless of the traffic conditions. Although adequate in areas with heavy traffic congestion, this mode is very wasteful for a side road with light traffic—if for some cycles there are no waiting vehicles, the time could be more efficiently allocated to a busier approach.

The second most common mode of operation of the traffic signal is the vehicle actuation. As its name suggests, the traffic signal adjusts the cycle time according to the demands of vehicles on all approaches.

Sensors, installed in the carriageway or above the signal heads, register the demands of the traffic. After processing these demands, the controller allocates the cycle time accordingly. However, the controller has a preset minimum and maximum cycle time, and it cannot violate them.

The hardware for the project could not be simpler. Gunnar has used three LEDs—red, orange, and green—to represent the three in a traffic light. The LEDs have an appropriate resistor in series for current limiting, and three ports of the RBPi drive them on and off. The rest of the project is the software, for which Gunnar uses the UWP application.

According to Gunnar, there are two options for writing UWP applications—the first a blank UWP application and the second a background application for IoT—depending on your requirement. The blank UWP is good for trying things out as a start, as, at a later point of time, you can build a User Interface for your application.

After creating the project with the blank UWP application, Gunnar added a reference to Windows IoT Extensions for the UWP. Next, he opened the file MainPage.xaml and added his own code, which begins with a test for the wiring. He uses the init() function to initialize the GPIO pins and stop() to turn all LEDs off. Then the code turns on all LEDs for 10 seconds to signal everything is working fine.

According to Gunnar, the primitive code mimics the traffic lights. He uses a separate code for the cycling of the traffic lights, and another for blinking them on and off. He uses the play() function for running ten cycles of the traffic light.

Researching Hearing Aids with the Raspberry Pi

All around the world, millions of people benefit from wearing hearing aids. Apart from helping them to hear in a better way, hearing aids lower people’s risk of developing dementia, the likelihood for loneliness, and the possibility of their withdrawing from society.

Testing hearing aids outside the laboratory can be a tough task, but researchers have found the highly popular single board computer, the Raspberry Pi (RBPi) a sound investment for testing hearing aid algorithms. Therefore, for hearing aid research, they are using the RBPi boards.

Although researchers have spent a lot of time and energy for developing hearing aids over the years, there is yet room for improvement. According to a signal processing engineer Tobias Herzke at HorTech in Oldenburg, in Germany, this is especially true for situations that are difficult acoustically. However, the RBPi is proving to be a next-generation research tool for the scientists.

To compensate for an individual’s hearing loss, it is necessary to tailor the amplification and compression in the hearing aid. Researchers plug a monitor to the RBPi and fire up the Fitting GUI for the tailoring.

For this, a spin-off company of the University of Oldenburg has developed openMHA. They have designed openMHA as a common, portable software platform, useful for teaching and researching hearing aid. According to Hendrik Kayser, with the openMHA platform, researchers can process signals in real-time with low delays. Hendrik develops algorithms for processing signals for digital hearing devices.

The software platform openMHA offers a set of standard algorithms that form a complete hearing aid. It can process the signal a live microphone generates to perform different activities such as directional filtering, amplification, feedback suppression, and noise reduction. The RBPi helps in testing new algorithms as this can be difficult with hearing aids alone. The RBPi and openMHA help hearing aid researchers with processing audio signals instantly and adapting to the hearing loss of the individual. The main advantage is the delays between incoming and outgoing audio is below 10 ms. The hearing aid actually has no GUI, except when fitting the amplifier parts.

In the laboratory environment, researchers can execute the openMHA software on Linux computers. According to Tobias, the sound environment will be different within a laboratory from that in an environment that a hearing aid user is likely to encounter in real life. This has often led to wrong results in the past, and did not offer a true reflection of the use of hearing aids. In such situations, the ARM-based single board computer, the RBPi offers a wonderful solution.

By taking advantage of the portable nature of the RBPi, and running openMHA on it, the researchers were able to evaluate newer algorithms in realistic outdoor conditions in real time. In fact, researchers were able to implement a new algorithm running on a mobile device for finding out how the user hears in real time while he is running around wearing a hearing aid.

Using an RBPi means one does not have to carry around a Linux laptop and it is far less expensive. The RBPi offers decent computing capabilities in a small space, while consuming low power.

A Google Assistant with the Raspberry Pi

This is the age of smart home assistants, but not the human kind. The last couple of years a fever pitch has been building up over these smart home assistants, and every manufacture is now offering their own version. While Apple offers Siri, Amazon presents Echo and Alexa, Microsoft wants us to use Cortana, and Google tempts us with Google Home Assistant, there are several more in the race. However, in this melee, Raspberry Pi (RBPi) enthusiasts can make their own smart speaker using the SBC.

Although you can buy Google Home, the problem is it is not available worldwide. However, it is a simple matter to have the Google Assistant in your living room, provided you have an RBPi3 or an RBPiZ. Just as with any other smart home assistant, your RBPi3 home assistant will let you control any device connected to it, simply with your voice.

The first thing you need to communicate with your assistant is a microphone and a speaker. The May issue MagPi, the official RBPi magazine, had carried a nice speaker set sponsored by Google. However, if you have missed the issue, you can use any speaker and USB microphone combination available. The MagPi offer is an AIY Voice Kit for making your own home assistant. AIY is an acronym coined from AI or Artificial Intelligence, and DIY or DO it Yourself.

The MagPi Kit is a very simple arrangement. The magazine offers a detailed instruction set anyone can follow. If you do not have the magazine, the instructions are available on their AIY projects website. The contents of the kit include Voice HAT PCB for controlling the microphone and switch, a long PCB with two microphones, a switch, a speaker, an LED light, a switch mechanism, a cardboard box for assembling the kit, and cables for connecting everything.

Apart from the kit, you will also require additional hardware such as an RBPi3, a micro SD card for installing the operating system, a screwdriver, and some scotch tape.

After collecting all the parts, start the assembly by connecting the Voice HAT PCB. It controls the microphones and the switch, and you attach it to the RBPi3 or RBPiZ using the two small standoffs. Take care to align the GPIO connectors on the HAT to that on the RBPi, and push them in together to connect.

The combination of the HAT board and RBPi will go into the first box. You will need to fold the box taking care to keep the written words on the outside. Place the speaker inside the box first, taking care to align it to the side with the holes. Now, connect the cables to the Voice HAT, and place the combination inside the box.

Next, assemble the switch and LED, inserting the combination into the box. Take care to connect the cables in proper order according to the instructions. As the last step, use the PCB with the two microphones, and use scotch tape to attach it to the box.

Now flash the SD card with the Voice Kit SD image from the website, and insert it into the RBPi. Initially, you may need to monitor the RBPi with an HDMI cable, a keyboard, and mouse.

What is Raspberry Shake and BOOM?

The Earth below our feet is never still. Although we feel tremors only when they are substantially strong, such as during earthquakes, we can use the highly popular single board computer, the Raspberry Pi or RBPi to monitor what is happening just under us. This tiny seismograph, with an appropriate name of Raspberry Shake, is the smallest one can find.

Although small, Raspberry Shake can record earthquakes of all magnitudes, even those no human senses can detect. It is also capable of recording those huge destructive quakes that occur regularly around the globe. Raspberry Shake has a companion, the Raspberry Boom, and it detects infrasonic sounds given off when the Earth shakes.

During earthquakes, the Earth gives off low frequency sounds that are below the threshold of human hearing, but infrasound travels large distances. Other objects also generate such infrasound, including traffic, trains, airplanes, wind farms, weather systems, meteorites, and many more. The Raspberry Boom is the perfect companion to the Raspberry Shake for detecting and studying infrasound.

You only have to snap the Raspberry Shake and Boom on to an RBPi. The two together form a super capable Earth monitoring network. Plugging their output into a Station View then allows creating a powerful array for monitoring and discovering several fascinating events from around the world in real time.

The Raspberry Shake and Boom combine several technologies. The Raspberry Shake has a powerful processor on its main board, and a digitizer with built-in sensors including a geophone or super-sensitive motion sensor for detecting Earth movements. You can plug this Shake board right into the RBPi board, which will power it. The data from the Shake board uses miniSEED for processing, as this is a standard data format the industry uses. The output is also compatible with jAmaSeis, and that makes it easy to learn, monitor, and analyze.

Other advanced options on the Raspberry Shake allow experienced users to use it by programming their own protocols such as the IFTTT. They can also laser print their own enclosures. Other users, especially novices, can also use the Raspberry Shake easily, as the design of the devices allows them to be plug-n-play. Their design is professional and anyone can use them on home monitors.

Anyone can use the Raspberry Shake range. For instance, Educational facilities, consumer interest groups, professional institutes, makers, RBPi enthusiasts, citizen scientists, hobbyists, and more can simply plug into the network of Raspberry Shakes to start watching the planet vibrate.

It is very easy for any school or university to access data from any Raspberry Shake anywhere in the world, allowing them to monitor seismic activity of any active earthquake area as well as of quiet regions anywhere. They can view any event such as those demonstrated in IRIS Teachable Moments, including micro-tremors or other larger events.

The Raspberry Shakes are compatible with SWARM analytical software and jAmaSeis. This made the Oklahoma Geological Survey acquire 100 units for expanding their network. They rolled these units to schools and educational institutional facilities for raising the awareness and providing valuable educational tools.

Ethoscope with the Raspberry Pi

Although ethoscopes are very popular instruments for detecting or recording the real-time activity of fruit flies, they can potentially be used on other animals as well. The ethoscope platform is actually a collection of interconnected tools that biologists use when designing experiments, to capture and analyze huge amounts of behavioral data.

The ethoscope uses a free and open-source set of tools, both hardware and software. The hardware is a Raspberry Pi (RBPi) while the software is built on top of GNU/Linux and Python. The RBPi also has some custom printed parts.

The ethoscope is capable of real-time video tracking, allowing experimenters to deliver individual stimuli based on the behavior of the animal the biologist is tracking. Simultaneous and effective control of several devices is possible with a modern web-interface. The software package rethomics offers high-throughput and detailed post-hock analysis. The modular design of the ethoscope is straightforward enough to modify both the software and the device, thereby creating new paradigms for experiments. The RBPi based ethoscope is highly scalable and biologists can run multiple and inexpensive ethoscopes in parallel on the same platform.

Using computerized video tracking, the ethoscope uses as its base the small single-board computer, the RBPi, along with a high-definition camera to capture and process in infrared the video with a resolution of 1920×1080 pixels, at 30 frames per second.

Assembling ethoscopes requires a 3-D printed chassis with cables. This produces a footprint of approximately 10x13x20 cm. Although research grade ethoscopes need the 3-D printed chassis, those who simply want to try out can build a fully functional chassis from LEGO bricks or even from folded cardboard, following detailed instructions on the ethoscope website. The LEGOscope or the PAPERscope require only minor technical skills, and are therefore suitable for assembling ethoscope for education and outreach.

Although an RBPi will not help in performing complex brain surgeries, it does help scientists in working out how our minds work. That led researchers to select the low-cost single board computer for conducting experiments and studying neuroscience. The RBPi has the potential to be a machine the scientists use for making groundbreaking discoveries about the mannerisms of the human behavior.

In the Imperial College of London, Dr. Giorgio Gilestro and colleagues first used the RBPi to create the ethoscope. They designed the device to track animal behavior with open-source hardware and software. However, it has a profile for using machine-learning algorithms.

As fruit flies are similar to humans in behavioral and genetic terms, Dr. Giorgio used them for the primary studies. According to the researchers, they can use the ethoscope for studying mental and physical diseases in humans, and the instrument can provide insights into behaviors such as socializing and sleeping.

Earlier, the scientists could only watch the flies manually and score their movements. However, the addition of the RBPi has enhanced the features of the ethoscope and now they can record, process and analyze real-time video, thereby automating the time-consuming process. As the ethoscopes are small, cheap, and easy to maintain, the scientists can study hundreds of flies simultaneously. The RBPis give them enough computer power for analyzing behavior using video imaging.

Raspberry Pi Makes the Pac-Man Game Go 3D

Some avid gamers of today are not even aware of the video games that flourished in the seventies and the eighties. Those who have a collection of retro games may have given their children time to catch up with the old games. One such classic game from the 1980s, a very addictive one, was the pellet-guzzling arcade game with the name of Pac-Man, from Namco. One of the youngsters, Emanuele Coletta, has come up with a 3-D rendition of Pac-Man.

Emanuele wanted to make something funny, while at the same time learn and apply new technology. He decided to add new twist to the project. Therefore, his 3D-printed robots of the main character and the four ghosts, while replacing the dots in the maze of the original game with lights that turn off as the yellow chomper moved over them.

When playing the video game as a single player, Pac-Man must consume all the Pac-Dots, at the same time avoiding the ghosts, as they each move automatically. However, the 3-D Pac Robot Man works differently. Here, four players each control one of the ghosts. The main character, the Pac-Man, now has to escape from the others without being caught, while the others try to catch it. Therefore, this new 3-D Pac Robot Man is a five-player game.

Emanuele and his partners made the playing board from wood. They laser-cut the various pieces and formed the maze. A number of small boards with LEDs and reed switches then went under the gaming field, and they connected these to an Arduino Mini.

The five characters each had an Arduino Uno board underneath, with the main character holding a magnet under it. They connected each robot to 3d-printed joysticks and an Arduino Nano, which allowed the robots to be moved around in the maze. Each joystick communicates with its robot via radio frequencies at 2.4 GHz.

The Arduino Mini communicates with the Raspberry Pi (RBPi), informing it as the main character moves. The Arduino Mini also knows which reed switch the main character has activated, so it switches off the appropriate LED. Each LED the main character ‘eats’ represents points, an all such information, along with the state of the game, reaches the RBPi.

The RBPi projects the scores and the state of the game on a monitor screen, so all players can keep track. Emanuele says he used and open source library named RXTX and the tutorial Arduino Playground to establish a serial communication between the RBPi and the Arduino. The RBPi also plays the original sounds of the game, which give the whole arrangement a sense of being real. The players challenge each other—whoever is able to catch the main character, wins. If the main character escapes by ‘eating’ all the dots, the main character wins.

Pac-Man was one of the most recognized icons in gaming. The game basically involves eating dots, and amassing points, while avoiding four ghosts—Clyde, Pinky, Inky, and Blinky. With the effort Emanuele and his partners have put in, it has revived one of the most addictive games and turned it into a 3-D marvel.

ATtiny Remote Power Switch for the Raspberry Pi

One of the shortcomings of most highly popular single board computers such as the Raspberry Pi (RBPi) is the lack of an on/off power switch. The board springs to life as soon as you insert the micro USB power cable into its socket. If you simply switch off power or pull out the micro USB cable off the RBPi, you stand the risk of not only losing data but also of corrupting the file system. Therefore, to shutdown the RBPi safely, you need to call a shutdown command, which closes down the file system and takes the RBPi into a safe state, allowing you to remove the USB cable.

The above has been the reason for several projects to incorporate a switch with the RBPi that will safely switch it off without corrupting the file system. Most of the projects incorporate a board sitting on the GPIO header of the RBPi along with a micro USB connector and a toggle switch to control the power supply for the RBPi. The entire control of the power supply comes from a tiny microcontroller on the add-on board, which monitors the state of the toggle switch and the RBPi. In turn, the microcontroller switches a MOSFET and an LED indicates the status of power. This also precludes the necessity of unplugging the RBPi from the power module after switch off.

This power switch from Nanomesher, using an Attiny85 microcontroller, adds a new dimension to controlling the RBPi—it has a remote that you can use to remotely control power to the RBPi. The entire arrangement comes as a kit, and you get a hack able and smart power switch for the RBPi that a removable Attiny85 microcontroller controls. There are also four jumper cables that allow the board to connect to the RBPi GPIO, a high quality micro USB cable 20 cm long, and an infrared remote control.

The project is hack able in the sense you can remove the ATtiny85 microcontroller and reprogram it to provide any type of functionality with the remote. Of course, reprogramming the ATtiny85 will require an Arduino-compatible platform such as the Uno. Other Arduino devices with switches are available, and you may already own some, or you may buy them for experimentation. The ATtiny requires wiring up with the Arduino on a breadboard for the programming.

You can use the included remote or any other remote already available with you. Since the kit is hack able and reprogrammable, you can make it recognize many more signals, changing the timings and functioning of the shutdown. For instance, you may add another button for a hard reset, and reprogram the Attiny85 to recognize it.

Although the kit does a fine job of shutting down the RBPi safely, the presence of the jumper wires to connect to the RBPi makes the kit somewhat cumbersome to use. The project would have been much more useful if the kit could be fitted onto the RBPi in the form of a HAT. Of course, the presence of jumpers does make the kit more flexible since one can select the GPIO pins for connection.