James Mitchell is running another Jam in Berlin. Based at FabLab Berlin, the Jam will be held on 25th June from 12-4pm and will include a mixture of show and tell lightning talks and general chit-chat, along with help for beginners. You can get tickets for the event at Eventbrite and find out more at the Jam website here.
Bare bones Raspberry Pi operating system for NatureBytes camera system
Recently, NatureBytes have managed to fulfil their Kickstarter rewards. This means a lot of units (like the one pictured below) in the hands of users. The system comes with a Raspberry Pi A+ and, because of the lower-spec nature of the board, Richard Hayler has come up with a way to get a very bare-bones version of the Raspbian operating system working. He has documented the process of using Raspbian Jessie Lite and adding various software packages so that the NatureBytes kit will work on his blog.
Controlling a robot arm with analog sliders and a Raspberry Pi
Richard Saville, aka The Average Man, has created a brilliant showpiece for Jams and other events. He’s taken a robot arm controlled by 6 servos and hooked it up to an ABelectronics servo controller board. He added a NiMH battery to power it and a step-down converter to reduce the voltage. Then the really clever part: he added 6 slider potentiometers to control the servos and fastened it all to a base. A clever bit of coding, including help from our Pi community, enabled the arm to move smoothly. You can read a lot more about how he did it on his blog.
High Altitude Balloon flight with the new Raspberry Pi Zero and camera module
When the original Zero came out, high altitude balloonist Dave Akerman said to Eben Upton that he’d love to see a new revision with a camera port, as that would make it ideal for ballooning and taking photographs of the journey. As we know, this has now happened and Dave has sent up the new model with a new camera module. A full account of the launch, chase and recovery can be found here, on Dave’s blog.
Raspberry Pi Music Box – my own project
For a long time, I’ve wanted to do a project which involved two of my passions: the Raspberry Pi and music. I’ve seen several projects which have successfully managed it, in particular the Joytone which used lots of joysticks to create music. More recently, Calvin Cherry created a musical instrument with sensors attached to his body which produced sound based on movement and position.
My effort is pictured above. It’s just called The Music Box – I called it that for so long that, despite asking for suggestions on Twitter, the name stuck.
If you want to watch a video rather than read through my ramblings, head to the bottom of the page.
Hardware
The Music Box is a wooden box (procured from the magical place known as eBay) fitted out with buttons on top and at the back, three 10K potentiometers (with coloured knobs which make all the difference, of course) and an obligatory (purple!) LED at the front. Inside, it is stuffed with all the wiring necessary to connect the buttons, potentiometers and LED to a Raspberry Pi 2 via an Adafruit Proto Pi HAT board. I have used an MCP3008 analog-to-digital converter chip to take the potentiometer readings.
I had initially used a ProtoPal from the Average Man but I messed it up. I just wanted to give a shout-out about the board as it would’ve done the job slightly better than the Adafruit. I will re-use it at some point but I need to get my solder-sucker out and clean it up a bit!
Also in the box is some power circuitry, an amplifier, two speakers and a LIPO battery (I also got a little microUSB charger for the LIPO). The buttons on top (both yellow and white) and most of the other components (including the lovely LED bezel on the front) came from Makersify, which is a fantastic UK-based maker store that carries most of the Adafruit stock and can order in anything that isn’t in stock.
Oh, something I learned while putting The Music Box together: 1K potentiometers will not do the job. The MCP3008 acts as though nothing is connected. A 10K potentiometer, however, will work very nicely. Big thanks to Alex Eames and others on Twitter who helped me to diagnose this. Once again the valuable Raspberry Pi community comes through! If anyone knows why this is, by all means leave a comment!
Here’s a photograph of the inside of the Music Box. My apologies that it isn’t more detailed – there’s only so far I can open the box without the innards falling out! You can see more in the video at the bottom.
Software
The software is a mixture of GPIO Zero, standard Python and the pyFluidSynth library which communicates with FluidSynth, a synthesiser that plays sound fonts. I loaded thirty-two different sound fonts and it will be easy enough to add more as I can just drop them into the folder and the software will automatically load them.
The program imports the necessary libraries, loads the sound font files and then uses GPIO Zero to detect when_pressed and when_released events. When these events are detected, the sound samples are started or stopped accordingly. GPIO Zero is inherently multi-threaded which means I can press more than one button at once to form chords. The code also plays a sample and lights up the LED when the program is ready for use.
The three potentiometers control various aspects of playback. The red pot controls the volume at which the samples are played. The green pot controls which of the thirty-two sound fonts are used, i.e. what instrument is played back. The blue pot controls the set of notes playable on the seven buttons. By turning the pot to the left, lower notes are played whilst turning it to the right raises the pitch.
Thanks to Ben Nuttall for help at the start to understand how the event handlers worked. Also, thanks to Pimoroni who wrote the code for the Pi Piano and got me going. I didn’t end up doing it that way in the end, but the Pi Piano code helped me to work out how to load unlisted files from a directory.
All the code is available on GitHub for you to inspect! Any questions, please leave a comment!
Demonstration
Here is a five-minute walkaround video I made of The Music Box. In it, I describe the hardware and software and also turn it on and play a few sounds.
I hope this won’t be the last music/tech project that I do as I’ve found it really fulfilling. It’s been great to use so many different parts and bring them together to create something which is both portable and, above all, usable.
Any questions about the hardware or software, please feel free to leave a comment or contact me.
Google possibly bringing Android support to the Raspberry Pi 3
Android OS on the Raspberry Pi has been something of a ‘holy grail’ since the device was launched. Up to now, efforts have been extremely disappointing and slow. However, Google may now be developing a version of the operating system that will work on the more powerful Raspberry Pi 3. So far, there is just an empty repository but who knows what will happen over the next few months?