Tag Archives: Raspberry Pi 4

Charge your Tesla automatically with Raspberry Pi

via Raspberry Pi

It’s the worst feeling in the world: waking up and realising you forgot to put your electric car on charge overnight. What do you do now? Dig a bike out of the shed? Wait four hours until there’s enough juice in the battery to get you where you need to be? Neither option works if you’re running late. If only there were a way to automate the process, so that when you park up, the charger find its way to the charging port on its own. That would make life so much easier.

This is quite the build

Of course, this is all conjecture, because I drive a car made in the same year I started university. Not even the windows go up and down automatically. But I can dream, and I still love this automatic Tesla charger built with Raspberry Pi.

Wait, don’t Tesla make those already?

Back in 2015 Tesla released a video of their own prototype which can automatically charge their cars. But things have gone quiet, and nothing seems to be coming to market any time soon – nothing directly from Tesla, anyway. And while we like the slightly odd snake-charmer vibes the Tesla prototype gives off, we really like Pat’s commitment to spending hours tinkering in order to automate a 20-second manual job. It’s how we do things around here.

This video makes me feel weird

Electric vehicle enthusiast Andrew Erickson has been keeping up with the prototype’s whereabouts, and discussed it on YouTube in 2020.

How did Pat build his home-made charger?

Tired of waiting on Tesla, Pat took matters into his own hands and developed a home-made solution with Raspberry Pi 4. Our tiny computer is the “brains of everything”, and is mounted to a carriage on Pat’s garage wall.

automatic tesla charger rig mounted on garage wall
The entire rig mounted to Pat’s garage wall

There’s a big servo at the end of the carriage, which rotates the charging arm out when it’s needed. And an ultrasonic distance sensor ensures none of the home-made apparatus hits the car.

automatic tesla charger sensors
Big white thing on the left is the charging arm. Pat pointing to the little green Raspberry Pi camera module up top. And the yellow box at the bottom is the distance sensor

How does the charger find the charging port?

A Raspberry Pi Camera Module takes photos and sends them back to a machine learning model (Pat used TensorFlow Lite) running on his Raspberry Pi 4. This is how the charging arm finds its way to the port. You can watch the model in action from this point in the build video.

automatic tesla charger in action
“Marco!” “Polo!” “Marco!” “Polo!”

Top stuff, Pat. Now I just need to acquire a Tesla from somewhere so I can build one for my own garage. Wait, I don’t have a garage either…

The post Charge your Tesla automatically with Raspberry Pi appeared first on Raspberry Pi.

Machine Learning made easy with Raspberry Pi, Adafruit and Microsoft

via Raspberry Pi

Machine learning can sound daunting even for experienced Raspberry Pi hobbyists, but Microsoft and Adafruit Industries are determined to make it easier for everyone to have a go. Microsoft’s Lobe tool takes the stress out of training machine learning models, and Adafruit have developed an entire kit around their BrainCraft HAT, featuring Raspberry Pi 4 and a Raspberry Pi Camera, to get your own machine learning project off to a flying start.

adafruit lobe kit
Adafruit developed this kit especially for the BrainCraft HAT to be used with Microsoft Lobe on Raspberry Pi

Adafruit’s BrainCraft HAT

Adafruit’s BrainCraft HAT fits on top of Raspberry Pi 4 and makes it really easy to connect hardware and debug machine learning projects. The 240 x 240 colour display screen also lets you see what the camera sees. Two microphones allow for audio input, and access to the GPIO means you can connect things likes relays and servos, depending on your project.

Adafruit’s BrainCraft HAT in action detecting a coffee mug

Microsoft Lobe

Microsoft Lobe is a free tool for creating and training machine learning models that you can deploy almost anywhere. The hardest part of machine learning is arguably creating and training a new model, so this tool is a great way for newbies to get stuck in, as well as being a fantastic time-saver for people who have more experience.

Get started with one of three easy, medium, and hard tutorials featured on the lobe-adafruit-kit GitHub.

This is just a quick snippet of Microsoft’s full Lobe tutorial video.
Look how quickly the tool takes enough photos to train a machine learning model

‘Bakery’ identifies and prices different pastries

Lady Ada demonstrated Bakery: a machine learning model that uses an Adafruit BrainCraft HAT, a Raspberry Pi camera, and Microsoft Lobe. Watch how easy it is to train a new machine learning model in Microsoft Lobe from this point in the Microsoft Build Keynote video.

A quick look at Bakery from Adafruit’s delightful YouTube channel

Bakery identifies different baked goods based on images taken by the Raspberry Pi camera, then automatically identifies and prices them, in the absence of barcodes or price tags. You can’t stick a price tag on a croissant. There’d be flakes everywhere.

Extra functionality

Running this project on Raspberry Pi means that Lady Ada was able to hook up lots of other useful tools. In addition to the Raspberry Pi camera and the HAT, she is using:

  • Three LEDs that glow green when an object is detected
  • A speaker and some text-to-speech code that announces which object is detected
  • A receipt printer that prints out the product name and the price

All of this running on Raspberry Pi, and made super easy with Microsoft Lobe and Adafruit’s BrainCraft HAT. Adafruit’s Microsoft Machine Learning Kit for Lobe contains everything you need to get started.

full adafruit lobe kit
The full Microsoft Machine Learning Kit for Lobe with Raspberry Pi 4 kit

Watch the Microsoft Build keynote

And finally, watch Microsoft CTO Kevin Scott introduce Limor Fried, aka Lady Ada, owner of Adafruit Industries. Lady Ada joins remotely from the Adafruit factory in Manhattan, NY, to show how the BrainCraft HAT and Lobe work to make machine learning accessible.

The post Machine Learning made easy with Raspberry Pi, Adafruit and Microsoft appeared first on Raspberry Pi.

Commodore 64 + Raspberry Pi 4 = Synth6581

via Raspberry Pi

We have a special blog today from one of our own design engineers, Simon Martin. He’s the designer of Raspberry Pi 400 and our High Quality Camera and spends his free time tinkering with electronic music.

This video is a classic. Settle in…

Simon has wanted to make his own electronic musical instrument with Raspberry Pi for some time. He designed a circuit board for the project a year ago, but it lay around in a drawer in his desk while he finished Raspberry Pi 400. Finally, the winter months gave him the incentive to get it working. 

Simon’s electronic musical journey

Simon: The Synth6581 device doesn’t look much like an electronic musical instrument, but just like circuit boards stacked on top of a Raspberry Pi 4. You have to plug a musical keyboard into a USB port and a pair of speakers into the audio jack on the bottom board to make it work.

Hefty stack ready to play some electronic music

The code is written almost entirely in Python, with a little bit of C to speed up the communications to the chips. I designed and laid out the circuit boards, which were ordered online. The first six boards cost only £20, but the components were another £100. I spent more than a day soldering the components on the boards by hand. It took much more time to check every chip and connection worked, a common problem with hand-soldering new boards.

Synth6581 — no ordinary sounding instrument

The 1982 Commodore 64 – works like Raspberry Pi 400, only slower

And Synth6581 is no ordinary sounding musical instrument. It’s based on the music chip inside a vintage computer: the Commodore 64. The microchips are almost forty years old and they have a quirky sound that kids in the 1980s loved and parents hated. By the way, did you know that the Commodore 64 was the inspiration for Raspberry Pi 400?

The SID chip sound

The MOS6581 SID chip — just a little smaller than a Raspberry Pi Pico board

I was one of many hobby programmers in the 1980s that used to attempt to program Commodore 64s. Much like people today dabble with programming on Raspberry Pi 400s, kids and adults were dabbling with the BASIC programming language on their Commodore 64s back then. Nowadays, Raspberry Pis have video, graphics, and audio readily available, but back in the 1980s, the hardware registers had to be ‘poked’ one by one into the console window. You had to get quite technical just to get the computer to make a musical sound. Those sounds came from the MOS6581 or ‘SID’ chip. It had such a famous sound character that it formed the basis of the chiptune music genre, and people are still writing music on Commodore 64s today.

Using BASIC POKE commands to control SID chips on a Commodore 64. Not the easiest thing to read.

Poking SID chips

By borrowing a few chips from broken Commodore 64s, including one or two lying around Raspberry Pi Towers, I made those 1980s ping noises into a polyphonic synthesiser controlled in Python on Raspberry Pi. The registers in the SID chips are simply being ‘poked’ by Raspberry Pi instead of Commodore 64. I also reverse-engineered the music from old games and made the sound effects and instruments work across the keyboard.

Simon with his creation
Simon with his electronic music creation

One of a kind electronic musical device

This device is unique: only one of these will ever be built, so please don’t wait for a launch date. There were over 10 million chips manufactured for Commodore 64, but production of the chips ended nearly 30 years ago. The Commodore 64s and spare parts for them are still in high demand, which is pushing up second hand prices. Nonetheless, the code and schematics are available online on GitHub, and I invite other Raspberry Pi users to use them to make musical instruments out of other games consoles. I reckon Sega Megadrive has a lot of potential for a Raspberry Pi port…

Simon Martin youtube channel
A few of the demos of the electronic instrument on Simon’s YouTube channel

For more video demos of this instrument, head to my YouTube channel.

The post Commodore 64 + Raspberry Pi 4 = Synth6581 appeared first on Raspberry Pi.

How to play entrance music on your Raspberry Pi

via Raspberry Pi

Imagine walking through a doorway, and your entrance music begins playing. You’re a pro wrestler, or perhaps a character in a 1940’s hardboiled crime drama? Or the Queen, who no doubt gets to hear the national anthem on a regular basis.

Ty and Gig Builds have a tonne of cool Raspberry Pi projects on their YouTube channel, but we especially liked this one. Why? Because it’s the perfect device to welcome everyone to Raspberry Pi Towers each day. At least, once the time comes to leave our home offices and head back to Pi Towers.

Check out Ty and Gig’s build video

How does it work?

A Python script running on a Raspberry Pi continuously searches for nearby Bluetooth devices in a ‘known’ list. It uses the Bluetooth MAC address of each detected phone in range to determine which entrance music its owner wants. All ‘known’ device owners have already nominated a chosen track, which is stored on the Raspberry Pi, and when it recognises one from its list, the Raspberry Pi plays the owner’s chosen audio file.

Watch Ty and Gig make an entrance to their own songs

Raspberry Pi uses the Bluez stack to communicate over Bluetooth, it’s this service that lets the Raspberry Pi talk to your phone. Ty admits this was the fiddliest part of the build, but he explains it all very clearly, step-by-step, from this point in the video. A sound card, connected via USB, lets Raspberry Pi output audio through a big speaker. But you could also make the sound play through an HDMI TV.

Build your own

entrance music loop
It’s all made clear in the build video

Wanna walk into the house with your own entrance music playing? Here’s the github repo with everything you’ll need. A Raspberry Pi 4 powers this project, but any of our boards with Bluetooth support would work.

You’re also going to need a separate sound card and here’s the one used in this build.

What would your entrance music be?

Some suggestions from the soon-to-return to Raspberry Pi Towers team:

Rob from The MagPi magazine would pick Homer’s entrance music in this
  • Back in Black, AC/DC
  • Here You Come Again, Dolly Parton
  • Paint It, Black, The Rolling Stones
  • The Imperial March, John Williams
  • Tiptoe Through the Tulips, Tiny Tim (yes, someone really picked this)

Comment with your entrance tune of choice.

The post How to play entrance music on your Raspberry Pi appeared first on Raspberry Pi.

Shred through Guitar Hero with a Raspberry Pi-powered robot

via Raspberry Pi

Level up your Guitar Hero gaming with Nick O’Hara’s Jon Bot Jovi Guitar Hero robot. While Nick admits this is an expensive project (around $1000 to build), it’s something that was so “ridiculous, hilarious, and awesome” he felt he just needed to do it.

While you’re not great at Guitar Hero, Nick, you ARE good at making robots

You’re halfway to shredding a Bon Jovi chorus perfectly on Guitar Hero and you can taste the fame. Problem is, you’re no Jon Bon Jovi. Or Peter Frampton. Or Slash. So you need Raspberry Pi to assist your rockstar dreams. Enter Jon Bot Jovi.

Kit list

What is a solenoid?

close up of mechanical fret board
Close-up of mechanical fretboard

A solenoid is just a coil of wire, but when you pass an electric current through it acts as an electromagnet, and a magnetic field is generated. When you turn the current off, the magnetic field goes away. Inside the coil of wire is a metal rod, when the current is on and the magnetic field is present, the rod is free to move in the direction of the field. In this way, a solenoid converts electrical energy into movement and the rod moves in or out of the coil depending on the current applied.

Here, a Raspberry Pi controls a bunch of solenoids as they press and release the buttons on the guitar controller to give Nick his god-like skills. Watch the build video on YouTube for a simple walkthrough of how this all works.

It’s tricky

Building the mechanical fingers and solenoids was one of the trickiest parts of the build. Nick ended up burning through a lot of them as he’s new to robotics and didn’t understand the relationship between power, voltage, and current, so they burnt out quickly. Luckily, he found a robotics guy to give him a 30-minute crash course, which set the project on the right path. Heroes come in all shapes and sizes.

guitar hero board up close
Fret board close-up courtesy of Jeremy Cook on hackster.io

Note recognition was also far from an easy task. Nick originally tried to look at specific pixels on the screen, which worked for slow songs, but for faster songs it would miss around 30% of the notes. He eventually turned to OpenCV, but it took a fair amount of effort to hone the perfect filtering to make the note recognition accurate. Fiddly, but worth it.

Shred, guitar hero!

Nick’s favourite part of the project?

“Seeing Jon Bot Jovi absolutely shred on the guitar. Did you see how fast he’s strumming during Through the Fire and the Flames?!”

We love seeing a maker so happy with a final build and we wish we could come and play too! (We are similarly stunted in our guitar-playing abilities.)

Nick wrote a project post on Hacker News for those who are curious about the more technical details. And the original build video on YouTube is a wild ride, so check it out and subscribe to Nick’s channel.

The post Shred through Guitar Hero with a Raspberry Pi-powered robot appeared first on Raspberry Pi.

Raspberry Pi transforms old Wurlitzer into modern digital jukebox

via Raspberry Pi

It’s been a while since we saw a good jukebox retrofit project, so when we saw this old Wurlitzer transformed into a modern, all-in digital jukebox, we had to share it.

Maker Marc Engrie’s cousin came across an old Wurlitzer on a local online second-hand store. The seller had imported it from the US and intended to convert it himself but never got round to it, so he ended up selling it on. Marc’s cousin enticed him with some photos of the Wurlitzer and asked how much it would cost him to breathe new life into the jukebox.

Name your price

Marc already had three Raspberry Pis at home running music streaming software Volumio, so he felt confident he could harness the power of our tiny computer to bring this classic objet d’art back to life. Adding on hardware costs, he figured he could restore it to its former glory for €600 (about £500).

Once the jukebox was delivered, Marc stripped everything away, including the unfinished work of the previous restorer. The iconic enclosure was all that was left, along with the loudspeakers.

Adding new hardware

A 2GB Raspberry Pi 4 and a Raspberry Pi Touch Display form the new brain and face of the Wurlitzer. HiFiBerry‘s DAC+ Pro allows music to play from a USB stick. Other devices can play music from an auxiliary-in port.

Marc added a 2 x 2-channel audio amp (2 x 100W for the woofers plus 2 x 100W for mid/high). It’s easy to install and uninstall in case the jukebox ever needs repairing.

And as a final modern finishing touch, he swapped all the original lights for LEDs.

NEAT wire control

Lots of docs

Marc is a super diligent maker and has crafted a spreadsheet showing all the hardware, prices, and retailers. You can also get your hands on a comprehensive software setup instructions, as well as a hardware map showing you how all the Wurlitzer’s new insides fit together. Better still, there’s a whole user manual showing you how every single button and switch works. We think his middle name should be ‘Thorough’. Super, top, detailed job, Marc.

Play me!

See more from Marc

Check out more of Marc’s electronics projects here. There’s a weather station, an automated greenhouse, a chicken shed with an automatic door, and more.

The post Raspberry Pi transforms old Wurlitzer into modern digital jukebox appeared first on Raspberry Pi.