Sonic Bike: Pedal Powered Algorithmic Rave

Project Update… After meditating on this idea for some time I have some new thoughts and I’m shifting the direction a bit – lately I have been working on a jig for the Teensy platform which uses a couple of off the shelf modules. The jig is capable of playing CD quality audio (44.1kHz @ 16bit) from an SD Card, includes a Class D 2W amplifier and has a LiPo battery handling module for charging and voltage boosting.

There are a couple of benefits to this setup over the Raspberry Pi – the biggest being the power consumption, The Raspberry Pi 3 can pull up to 2A (though admittedly I rarely see that) whereas the Teensy 3.2 rarely crosses 200mA. One of the main things holding up the progress of the project was the limitation on the power I could produce from the dynamo. Furthering this, the LiPo handling module can instantly switch between the charging supply and the battery supply without interupting the Teensy sketch running. Finally, the programming of the Teensy is much more straightforward – but I am moving away from the Algorave idea and have something new…

More to come – have to run!

 

Below is the original project spec:

Sonic Bike is a work in progress project. The aim is to run generative techno music with Sonic Pi on a Raspberry Pi + DAC, amp and speaker and all powered by a dynamo charged lithium battery. Not sure if it is all possible yet but it’s all in the spirit of learning and fun!

Project Aims:

  • Build an efficient dynamo trickle charger to charge a lithium leisure battery. My commute to work is about 4km so efficiency means I need to charge more than I consume!
  • Develop a dynamic algorave script with Sonic Pi. Need to explore means of running the code on Raspberry Pi boot, or with a very simple set of controls.
  • Find a good off-the-shelf DAC HAT for the Pi, or build one from scratch. The headphones output on the Pi kinda sucks so better sound quality is desirable.
  • Build a good low-power, decent output power amp to drive a speaker (or stereo pair) – the LM386 chip might be suitable, volume should be loud enough to turn heads but not upset other commuters 🙂
  • Put it all in a protective waterproof case, it will be mounted on the rear pannier on my Carrera Transit folding bike. The pannier is largely unaffected when the bike is collapsed, though might need to make some measurements for how the saddle folds
  • Share everything on this page!

Additional Aims (this is stuff I would like to implement if everything else is dandy):

  • LED display matrix – play messages out for commuters
  • LED rave – neopixels? Kinda needs to happen right?
  • Be 100% green!!

This is my bike, a £300 Carrera Transit, I ride it 8km+ every day:

carerra-actual-size

The dynamo lithium charger:

The challenge of the trickle charger is getting a good ratio of pedal powered recharge to Raspberry Pi / Power Amp consumption – one goal of the project is to be 100% green but this may take a bit of work…

My first web search came up with some results for building a dynamo based USB phone charger, but the charge rate is about 20mAh per km – which is pretty inefficient as I imagine the project is going to consume around 1.5A.

(todo) I need to do a bit of field testing on the RPi 3 power consumption to get a good idea of what I need to provide.The RPi 3 is spec’d at requiring a 2.5A supply, but on first google it seems a good chunk of this is for the provision of USB power for peripherals. With no USB devices attached I have been able to successfully power the RPi 3 from a 20,000mAh lithium battery I bought in 2015 (can’t find any specs other than the cost of £12.99) – one nice feature of this battery is some of the USB ports can provide a decent amount of amps. Battery technology is advancing all the time so it is very possible that a newer battery at the same price will have better charging/use efficiency.

This chart has an appoximation on current draw across the different RPi models:

evrv9

If I use the LM387 to drive the speaker, it can drive up to 2W. At 5V that gives us 0.4A (I = P / V), so this is going to take a good chunk of the charge and that’s just for mono – the LM387 may not run at 2W with a 5V supply, but that also means less volume. (todo) check the LM387 datasheet…

That’s all for now.

fdf048d667668cdd66021570fae8a3a1sonic-pi-web-logo