Introduction: LED Rave Solar Shopping Cart Tricycle

In this instructable we're going to take a plastic shopping cart, fill its basket controllable LEDs on custom printed PCBs, use PIC18F4550 microcontrollers to display text and sound responsive patterns on the LEDs, weld better wheels and a bicycle onto the cart, add a solar panel and speakers, then use a Raspberry Pi to play MP3s and send song titles to the microcontrollers through USB.

Required tools:

  • Basic welding equipment (I used a 50 Amp stick welder)
  • Small CNC machine
  • Soldering iron
  • PIC programmer (PICKIT2, PICKIT3, etc)
  • Caulking gun.
  • Utility Knife, screwdrivers, wrenches, and other hand tools.

Required parts (non Electrical):

  • Shopping cart with plastic honeycomb basket. I used a PC 650. Other models may not fit the LED circuit boards I designed.
  • Bicycle minus the front wheel and handlebars x1
  • Matching steel bicycle front forks x2
  • 12.5" bicycle wheels x2
  • Clear Acrylic panel, 1/4" thick, measuring at least 45cm x 80cm
  • Acrylic lighting diffuser panels 2'x4' x3
  • Aluminium foil tape, 3" x 48' roll x1
  • Clear silicone, 290 mL caulking gun tubes x6
  • Slotted angle Iron, 14 gauge, 1.5" wide, 4' long x3

Required parts (Electrical):

  • PIC18F4550 microcontrollers x3
  • PIC18F2550 microcontroller x1
  • MSGEQ7 Audio Processors x6
  • WS2803 LED driver ICs x125
  • CD4051 Demultiplexers x3
  • 74HC164 shift registers x6
  • 2N3906 transistors x12
  • 1N5339 5.6v Zener diode x3
  • TIC116D silicone controlled rectifier x3
  • SL22 protection thermistor x3
  • 20Mhz crystals x4
  • 40 Pin IC Sockets x3
  • 16 Pin IC sockets x3
  • 8 Pin IC Sockets x6
  • Single sided copper clad laminate circuit boards 20cm x 30cm. x10 (Other sizes and quantities can be used)
  • 100 Ω resistors x6
  • 910 Ω resistors x125
  • 1k Ω resistors x16
  • 10k Ω resistors x7
  • 200kΩ resistors x6
  • 220uF electrolytic capacitors x105
  • 10uF electrolytic capacitors x105
  • 22pF ceramic capacitos x10
  • 47 nF capacitor x3
  • 470 nF ceramic capacitors x2
  • 220nF ceramic capacitors x6
  • Raspberry Pi x1
  • 3.5mm Audio Jack x1
  • 8-pin headers x144
  • 8-pin female between board connectors x120
  • 12v 1A Solar charge controller x1
  • 12v-> 5v switching regulators x5
  • 35Ah or larger lead acid battery x1
  • Speakers x4
  • 12v Stereo speaker drivers. x2
  • 3" x 6" 0.5v 1A solar cells x26
  • 5050 RGB LEDs x 200
  • 7-segment common anode LED display x16
  • 5mm "super bright" LEDs
    • Red 2v 30mA 5000mcd x 4000
    • Green 3v 20mA 14000mcd x 3200
    • Blue 3v 20mA 10000mcd x 3000

Step 1: Make the Basket Shiny

The shopping cart had a dark blue plastic basket. This will absorb some of the LED light and cut down on the brightness. To solve this I used two rolls of air duct aluminum foil tape to coat the holes where the LEDs will be mounted.

Start by completely covering the basket's holes with strips of the foil tape. Use a knife to make three cuts over each of the holes. The cuts make a star pattern running from opposite corners of the hexagons. Fold the cut tape inward to cover the sides of the holes.

Step 2: LED Diffusion

The LED circuit boards use individual red, green, and blue LEDs, so it's necessary to diffuse them to get pink, yellow, etc. Diffusion provides a nice glowing panel rather than small retina-burning points of light.

Diffusion is achieved by covering every hole with florescent light covers cut into hexagonal pieces. Lighting covers are inexpensive to begin with and hardware stores will give away cracked and broken ones for free.

A total of 620 hexagons need to be cut. This can be done with a knife and ruler but a CNC machine is a lot faster. I'm including a gcode file which will cut eighty hexagons from a 20cm x 30cm panel. There is also an Eagle board file included which can be used to export other toolpath filetypes. Fluorescent light covers come in 2' x 4' panels so use a knife to cut them int pieces small enough for a CNC machine.

The hexagonal holes in a PC650 shopping cart basket are 16mm in diameter at the outer edge,and narrow to 15 mm at the inner edge. The gcode provided cuts 16mm diameter hexagons. These will come out smaller due to the width of the cuts made by the CNC machine. Keep cuts less than 1mm in width or the hexagon pieces will be too small.

After cutting the hexagons use a liberal amount of clear silicone to hold them in place (I used six tubes in total). The silicone helps to diffuse the LEDs even further.

Step 3: LED Driver Board Explanation

LEDs are driven by WS2803 chips. These have eighteen 30v output channels , 8-bit PWM control, current drivers, and can be chained together as SPI shift registers.

The WS2803 pins are different between the through hole (DIP) version and the surface mount (SOP) version. I have attached an image of the SOP version used on these boards.

Each board contains six RGB LED clusters. Clusters are positioned to line up to the holes in the cart basket. Each cluster consists of four red LEDs (2v, 30mA) in series, three green LEDs (3v, 20mA) in series, and three blue LEDs (3v, 20mA) in series. These are standard 5mm "super bright" LEDs which were chosen because they're cheap and plentiful. A search of Ebay or Alibaba should return bags of 1000 for about $20 USD.

The LED circuit boards take advantage of the WS2803's ability to drive up to 30v from each output. They use 12v for the LED power and 5v for the WS2803 internal logic. 12v for the LEDs was selected because this is standard for deep cycle batteries.

Three 3v LEDs in series gives a voltage drop of 9v. Four 2v LEDs in series gives a voltage drop of 8v. These voltage drops were chosen so the LED panel function properly even when a 12v battery is running to the end of its charge and only outputting 9v. The LED voltage drop must be less than the supplied voltage.

The WS2803 uses current outputs to drive the LEDs. This means the LEDs do not require series current limiting resistors. The current limit is set with a single external resistor following the equation: R_iref = 27.5 / I_limit. The current limit should be 30mA, so R_iref = 27.5/0.03A = 916Ω. The closest standard resistor value is 910Ω.

The total output pf each RGB cluster is 92 candela. (4 x 5000mcd red + 3 x 14000 mcd green + 3 x 10000 mcd blue).

Step 4: LED Driver Board Construction

I am attaching two Gcode files used for printing these boards with a CNC machine. LEDbrd_single contains a single LED driver board and LEDbrd_multiple will cut nine from a 20cm x 30cm single sided copper clad board. I am also including the Eagle board files so the design can be modified or exported into a different filetype.

There are 105 of these boards in the cart basket. Each board contains the following components:

  • Surface Mount (SOP) WS2803

  • 220μF electrolytic capacitor connected from 12v to ground for LED power decoupling.
  • 10uF electrolytic capacitor connected from 5v to ground for logic voltage decoupling.
  • 910Ω resistor from WS2803 Iref pin to ground for current limit control.
  • Twenty-Four 5mm Red LEDs (2v 30mA)
  • Eighteen 5mm Green LEDs (3v 20mA)
  • Eighteen 5mm Blue LEDs (3v 20mA)
  • Two 8pin headers
  • Two jumper wires running between the header pin connections 5v and ground.

The boards are designed such that all LEDs face the same direction. I find this greatly cuts down on how many LEDs I solder in backwards. The LEDs are the only through hole component. Header pins and capacitors are soldered to the copper side of the board. I've provided a set of images showing each component being soldered.

The boards use huge 220μF 50v decoupling capacitors because my local electronics shop had big bags of them on clearance. A much smaller capacitor will also work, something 15v 20μF or higher.

A CNC machine needs a very fine tipped cutting head to print boards for SOP components. If the tool paths are cut wider than 5 mils (0.127 mm) there won't be any copper left to form a trace.

Step 5: Microcontroller Board Explanation

WS2803s are controlled by PIC18F4550 microcontrollers through SPI. The microcontroller boards have three main features:

  1. Process analog audio to generate sound responsive LED patterns using a pair of MSGEQ7 chips for stereo input.
  2. Use USB to receive information such as song titles that can be added to the LED patterns.
  3. Send LED pattern data to WS2803s through an SPI port and CD4051 demultiplexer.

The WS2803s form SPI shift register chains. A drawback to shift chains is that one damaged connection prevents all proceeding shift registers in the chain from receiving data. The LED boards are going into a mobile party tricycle that will be hitting potholes so wires coming loose could be a problem. I'm making this less of an issue by demultiplexing the PIC18F4550's SPI output into eight separate channels using aCD4051. This way there are eight short shift register chains instead of one long one. Far fewer WS2803 boards will become unresponsive if there is a broken connection.

There are three microcontroller boards in the cart. One for each of the sides: front, right, left. A single PIC18F4550 doesn't have the speed and memory requirements to process audio and send data to all 105 LED boards so it's broken up like this. Three separate microcontroller boards also adds redundancy. Two thirds of the LEDs will still be running if one microcontroller board is damaged.

Step 6: Microcontroller Board Construction

The attached gcode file will CNC one microcontroller board. I've also attached the eagle board file so the design can be modified or converted to different file types. The boards are printed on a single sided copper board so there are several jumpers required. All components are soldered to the copper side of the board. The jumpers have been marked with bottom-side wires in the eagle file and attached picture. The boards were designed to use USB sockets but I couldn't find any so I cut open USB cables and soldered wires directly. The USB wire colors have been labeled in case you need to do this too.

Do not solder the red (5v) USB wire. This wire is for devices that get their power through a USB port (mice, webcams, etc). That's not how this project works. Microcontroller boards receive 5v from a switching regulator that will be installed in the next step. Including the red USB wire will put all switching regulator outputs in parallel which will cause problems.

The images show step by step instructions for adding each component.

Step 7: Voltage Regulators

The microcontroller boards have 12v and 5v inputs. 12v isn't used by any of the components on the microcontroller board but it is sent to the LED boards through the output channels. A 12v->5v regulator needs to go between the 12v and 5v sections. This produces 5v to run the microcontroller and WS2803 logic from a 12v battery.

I'm using 10 Amp "Car Power Technology" switching regulators. These are normally used for adding USB charging ports to cars and can be found at most automotive stores. All three microcontroller boards get their own regulators for redundancy.

Step 8: PIC Programmer and Test Program

The programming pins on the PIC18F4550 board match the pin positions on a PIC programmer (PICKIT2, PICKIT3, Vellaman Kits, etc). The programmer can be connected directly to the board or with a short cable. I have included a simple test program (C-code, and MPLABX project files). You can download MPLABX here. MPLABX is a C programming IDE with software for using PIC programmers. It's free unless you require some advanced features and this project doesn't use any of those.

The sample code will blink the indicator LEDs on the PIC18F4550 board and send LED control signals to all eight output channels. Connect an LED board to any of the output channels and it will cycle through solid red, green, blue at a one second period.

Take care not to connect the LED boards backwards. Follow the example in picture seven.

Step 9: Over-voltage Protection

The LED boards require a 5v and 12v power supply. This creates a potentially disastrous situation: If a 12v wire comes loose and touches a 5v wire it will destroy all chips sharing the 5v regulator (WS2803s, PIC18F4550, etc). This problem can be avoided by using a "crowbar circuit".

Crowbar circuits provides over-voltage protection. A 5.6v zener diode detects if the 5v line exceeds its normal level. This triggers a silicone controlled rectifier to connect the 12v supply directly to ground. The 12v battery can not fry anything in this state because it's shorted to ground. The current from the battery will exceed the 20A limit of the SL22 circuit protection thermistor and disconnect the battery at its source. A circuit protection thermistor functions like a circuit breaker.

The SL22 will also prevent the battery from melting down if a loose 12v wire comes into contact with ground.

The attached file contains gcode for printing a crowbar circuit and the eagle board files so the design can be modified or exported to different file types. A crowbar circuit needs to go on all three of the regulators used so far.

Step 10: Installing and Connecting Boards

Attach the LED boards to the inside of the basket using more clear silicone. The microcontroller boards and switching regulators can also be installed using silicone.

This project involves LED position mapping: The microcontrollers need to know the physical position of each RGB cluster so they can do patterns like scrolling text. The program you will install in a few steps has a file containing the positions of every LED cluster on my basket. You need to match the way I positioned and wired the boards if you want this file to be correct. I've attached three diagrams showing how the LED boards are positioned and connected on each of the three sides. Right and Left are from the perspective of someone riding the bike. The diagrams show the positions of the LED boards as seen from the inside (side you silicone the boards to).

The step after next is going to explain how to build a mapping file from scratch so you don't have to follow my layout exactly if you don't want to.

Step 11: Side Panel LED Boards

The basket has a rectangular panel on each side for displaying store logos. I created additional LED boards to go in these sections using WS2803 LED drivers with 5050 RGB LEDs.

If you followed my plans in the previous step channel3 was not used on any of the three microcontroller boards. The lighting control code (downloaded later) expects channel3 to control a side panel board. Connect each side panel board to a microcontroller board output channel3.

Sidepanel.gc is Gcode for CNCing one of these boards and sidepanel.brd is the Eagle board file used to generate the Gcode. The required jumper wires are indicated using bottom-side wires in the eagle file.

Drill holes into the basket to run wires to the microcontrollers.

The side panel boards need covers. SidePanelCover.gc will CNC a cover from a 1/4" piece of clear acrylic. The covers and circuit boards can be attached with clear silicone.

Step 12: Map the LEDs

This step shows how to generate a table of physical positions for the LED clusters. If you followed my layout perfectly two steps ago you can skip this because the table provided for you will be correct.

First download the file PhysicalLoc.h and take a look at it. There is an Array called PhysLoc which takes the form: [Channel][ClusterNumber] = {X,Y}. Channel is the output channel from the microcontroller board's demultiplexed SPI output. ClusterNumber is the order in which the RGB LED clusters are arranged in the chain of WS2803s. The first of RGB cluster on the board closest to the microcontroller is 0.

X,Y is the coordinates of the RGB cluster on the hex grid.

There are actually three versions of the PhysLoc array in PhysicalLoc.h but they are separated by precompiler macros #if SIDE == LEFT, #if SIDE == RIGHT, #if SIDE == FRONT. You will need to fill in all three arrays. Left and Right are from the perspective of a rider sitting in the back.

Hexagonal grids can take some getting used to if you're only familiar with Cartesian grids. I'm using a pointy topped axial hex coordinate system. It's like the Cartesian grid, except the Y axis is slanted at 60 degrees angle. Here is an excellent explanation of how that works: redblobgames.com/grids/hexagons/#coordinates.

Use a dry erase marker and label each of the hexagons on the shopping cart according to the two diagrams provided. Use the same pattern for both the left and right side.

Download RaveCart_MappingHelper.zip. This contains C code and MPLABX project files. Compile the code and program one of your PIC18F4550s. The code will make one LED cluster turn white at a time. The rest will be off. It starts at channel0 cluster0 then goes up to cluster 119 (The last RGB cluster of the 20th board). After this it starts the process again at channel1 and so on. You probably don't have 20 boards in a chain, so there will be no clusters activated for a while at the end of each channel scan. There is a ten second delay between moving to the next cluster. Use this time to record the coordinates you wrote on the illuminated cluster in the PhysLoc array.

For example if the first three RGB clusters that light up on the left side are [1,14] [1,13], [2,13] the PhysLoc array would start like this:

#if SIDE == LEFT
{{{ 1, 14},
{ 1, 13},
{ 2,13},

If a cluster doesn't light up because it couldn't be positioned behind a hole put {EMPTY,EMPTY} into its field. This tells the lighting pattern code to keep that cluster off. At the last cluster of every channel enter {END,END}. ie if a channel has eight boards you put {END,END} at index 48 because 6*8=48.

Also fill in the ChanLength array. This is eight numbers indicating how many clusters are in each of the eight channels.

Step 13: Download the Final Microcontroller Code

RaveCartFinal.zip contains C code and MPLABX project files. This code will make the LEDs scroll the text "BIKE RAVE" and react to audio input with horizontal equalizer bars. There is also USB interface code, but that won't do anything until the Raspberry PI is set up. The USB code is based on an example created by Velleman Inc for their PIC tutor board.

You need to replace PhysicalLoc.h with your own version if you created one. Program all three PIC18F4550s, but change the SIDE flag and recompile for each one. "#define SIDE = " is in PhysicalLoc.h. The options are RIGHT, LEFT, FRONT.

If the scrolling text is corrupted you made a mistake in the mapping step.

Step 14: Test the Audio Response

The code you installed contains audio response functionality. A microcontroller board's audio input wire can be plugged into an MP3 player, walkman, etc. The responsiveness of the lighting patterns will automatically adjust to the input volume levels. The attached video shows LEDs responding to a keyboard. There are 64 different LED response patterns included in the code, but you will need to connect a Raspberri Pi to change between them. That's covered later in this instructable. The example video shows all three microcontroller boards responding in unison because their audio inputs have been connected. That will also be covered later in this instructable.

Step 15: Weld Better Wheels

It's time to start welding bike parts. This step requires two matching steel bicycle front forks.

I don't like burning paint fumes so I used a steel brush to removed all paint from the cart frame and forks before welding. The shopping cart basket needs to be removed from the frame at this point. There are two large bolts in the back holding the two pieces together.

Ideally the wheels would be further forwards so the rave cart isn't so front-heavy, but it was a lot easier to make a strong weld by putting them where they are.

  1. Use a hacksaw to cut the bottom rack off of the shopping cart frame leaving only the handle and section supporting the basket.
  2. Drill a dozen large holes (~ 1/4" ) in each of the bicycle fork steerer tubes.
  3. Cut the handle off the cart frame so you can slide the forks over its down-tubes. Cut in a position that will be overlapped by the fork steerer tubes .
  4. Weld through the holes in the fork steerer tubes to hold them to the shopping cart frame and hold the shopping cart handle back on.

Step 16: Weld Steering Fork and Brake Mounts

A third fork needs to be welded in the center of the shopping cart frame. This is the one the bicycle frame connects to and allows for steering.

I wanted the bicycle's handlebar clamp to connect to the shopping cart's handlebar so I set this up before welding to keep things aligned properly. The handlebar clamp was not long enough to reach from the fork to the shopping cart handle so I used a steer tube extender. Steer tube extenders can be stacked onto each other if one is not long enough.

I welded the fork dropouts to the shopping cart frame then added some reinforcement by welding an additional steel tube behind all three forks.

The shopping cart frame didn't have a good places for mounting front wheel brakes so I welded a piece of square steel tubing underneath. This piece of metal has holes drilled into either end for caliper brake mounting. There are two shorter square tubing pieces under the cart frame to provide additional support.

Step 17: Paint

I sanded the paint off everything before welding, so now everything needs to be repainted. Painting the bicycle frame was unnecessary because it never required any welding and paint removal, but I wanted it to match the cart frame. There are already a number of great bicycle painting instructables like this one, so I'm not going to cover it in great detail. I started with a base coat of Rust-Oleum self etching primer, then a layer of Rust-Oleum fluorescent pink, then Painter's Touch 2X Satin Clear. I used up the entire can in all cases which was enough for three coats of each layer. The fluorescent pink came out red for some reason.

Always remember to wrap the steering fork threads with tape before spray painting.

Step 18: Assemble the Bicycle

The rear wheel, chain, pedals, and everything else on the back half is like any other bicycle, so I'm not going to cover how to put it together. Check out this instructable: How-to-Build-Up-a-Bike. You could even use a functional bicycle for this project and not have to do any bike mechanic work besides re-attaching the front fork after welding and mounting the levers and shifters on new handlebars.

The bicycle frame I used was too small for me which caused my knees to hit the cart frame while making turns. I solved this by adding a banana seat so I could sit further back. Banana seats normally use a sissy bar in the back, but I decided to cludge one together with a front fork and seat clamp instead.

I used brake levers and gear shifters salvaged from an 80's road bike. Some levers and shifters can't be installed on the cart because they need to be slid onto handlebars from the ends. You need to use levers and shifters with clamps that open wide enough to not require sliding.

Step 19: Dual Font Brake

I came up with this contraption so that a single lever could pull both front wheel brakes simultaniously. It's a caliper brake plate with the section meant to hold the pads bent at a 90 degree angle so it faces the cable entry. The brake lever runs to a cantilever brake hanger which connects to a cable running between the two front brakes.

Step 20: Solar Power

I couldn't find a solar panel matching my size and voltage requirements so I put one together from scratch based on this instructable: Build-a-60-Watt-Solar-Panel.

I used a 4' x 2' x 1/4" clear acrylic panel and cut it to the appropriate size with a knife. The frame is built from galvanized slotted angle iron and connects to the basket with hinges.

The panel consists of 26 Evergreen Electric 0.5v 1A 3" x 6" monocrystalline solar cells connected in series and held to the acrylic with silicone. This produces 1A 13v on a sunny day which meets the requirements of the solar charge controller.

I used a 12v 15A Sodial 15A MPPT Solar charge controller . Terminals labeled battery go to battery and terminals labeled solar panel go to solar panel. This particular charge controller was overkill because the panels never get anywhere near the 15A limit. A charge controller rated for 2A would be more appropriate.

Step 21: Batteries

The entire electrical system has an average current draw of ten amps and was designed to take 12v because batteries with this output are common. I use two different batteries depending on the situation. For short rides I use the small one, for long rides I use the large one, and for very long rides I use both. I typically ride at night when there's no sunlight for the solar panel. Charging happens during the day.

The large battery is a 100Ah deep cycle battery meant for RVs and boats. It can keep the lights and music running for almost ten hours but weighs 58lbs. I can ride with it installed, but I have to get off and push to get up even a slight incline. This battery goes inside the basket and is held in place with two tie down straps.

The small battery is a 35Ah sealed lead acid battery meant for electric wheelchairs. This battery can keep the lights running for just over three hours and weighs 26lbs. I attach it with a rear rack and tie down straps. This battery doesn't go in the basket because two batteries in there makes the cart front heavy enough to tip nose down when there isn't a rider in the back.

The solar panels produce only one amp, so it takes two summer days of charging to fill the 35Ah battery to capacity and almost a week for the 100Ah battery. I don't usually take the rave cart out more than once a week so this works fine. I have to cheat and use a car battery charger if I want to ride it two nights in a row.

Lithium-ion batteries are much lighter but considerably more expensive so the system will be powered by lead batteries for the foreseeable future.

Step 22: Speakers and Amplifiers

The rave cart needs music, so two pairs of bookcase speakers are bolted below the basket. This is an area that's open to a lot of improvement as these speakers aren't adequate for large crowds.

The speakers are powered by a pair of 12V 50W class D stereo amplifier boards. You want to find stereo boards that match the power of your speakers.

Step 23: Back Panel and Equalizer

The shopping cart came with a metal wire panel in the back, but this wouldn't fit after the the bicycle steering fork was welded to the frame. I built a new back panel using galvanized angle iron and corrugated plastic (Plaskolite).

I also mounted a band stereo graphic equalizer in the back. The equalizer originally took 120VAC, but converting it to 12VDC was a piece of cake. It's power supply converted 120VAC to 12VDC and was on a completely separate board, so I only had to remove it and provide 12VDC from the batteries.

Step 24: Power Switches

I decided to add three separate power switches for each side of the cart. This means I can turn only one LED panel on if the batteries are low. Opening a switch cuts power to both the 12v and 5v supplies used by the LED panels and microcontrollers because each side of the basket runs from its own 5v regulator powered by the 12v input.

I used regular house switches because I had three of them and a plate in my junk drawer. They're mounted on the back panel discussed in the previous step. About 12 Amps will travel through these switches if every light on a side is at 100% white. Choose switches with a high enough current rating.

Step 25: Power the Raspberry Pi

I didn't want the Raspberry Pi sharing one of the three regulators used by the microcontroller and LED boards, so I gave it one of its own. This is a 3A switching regulator instead of 10A because the Raspberry Pi doesn't need that much current. If you use an older 2-port Raspberry Pi you can use this same regulator to power a USB hub. The regulator connects to the red and black wires in the USB power cable.

There is no crowbar circuit on the Raspberry Pi's 5v regulator because it is very unlikely a 12v wire will contact a 5v wire here.

Step 26: Split Raspberry Pi Audio Output

The music will be coming out of the Raspberry Pi's internal audio DAC. I've read a lot of negative reviews about it, but it sounds perfectly fine to my ears. An external USB audio DAC can be used if it's a problem for you.

The audio output needs to be split five times because it's going to the three microcontroller boards and the two stereo amplifiers. A powered splitter is not required. I could have bought a 1->5 audio splitter but soldering one from scratch was faster than going to the store.

The microcontroller code that generates audio responsive LED patterns automatically adjusts to different volume levels. Turning the volume up on the Raspberry Pi will make the speakers louder but won't oversaturate the LED patterns.

If you installed an audio equalizer like I did in step 23 it needs to go between the Raspberry Pi and audio splitter.

Step 27: Connect USB Cables

The USB cables that were soldered to the microcontroller boards can be connected to the Raspberry PI's USB port now. It does not matter which USB cable goes in which socket. Use a USB hub if your Raspberry Pi only has two USB ports.

Step 28: Raspberry PI Setup

The rave cart is pretty cool, but I want its LED panels to scroll information such as song titles and artists names. This is accomplished by setting up a Raspberry Pi to act as an MP3 jukebox and sending ID3 tag information to the microcontroller boards through USB. ID3 is MP3 metadata containing the song title, release year, artist name, etc.

The Raspberry Pi is not required for the microcontroller boards to function. If they lose USB connection they will continue to respond to the analog audio signal and scroll default text.

Required items:

An SD card interface for your computer
An SD card (recommended 8gb Class 10).
An Ethernet router or hub.
Ethernet cable to connect Raspberry Pi to Ethernet hub.

I'm using ArchLinuxArm because it can boot up from a class 10 SD card in under six seconds. Get ArchLinuxArm setup on your Raspberry Pi by following these instructions:archlinuxarm.org/platforms/armv6/raspberry-pi

ArchLinuxArm runs an SSH server by default. This will allow you to control the Raspberry Pi through an Ethernet network instead of a monitor and keyboard connected directly to it. The Raspberry Pi's IP address is assigned through DHCP. You can discover it by logging in directly (keyboard and monitor to the Raspberry Pi), then entering “arp -a”. I prefer to use a program called Angry IP Port Scanner (angryip.org) to search my network for the Raspberry Pi. The default network name used by ArchLinuxArm is "alarmpi".

Once the Raspberry Pi is located on your network download PuTTy (chiark.greenend.org.uk/~sgtatham/putty) and use its SSH server to connect to the Raspberry Pi's IP address.

Step 29: Raspberry Pi Libraries and FTP Server

Once you've SSH'd into the Raspberry Pi you need to start installing libraries required by the jukebox program:

Python2:
“sudo pacman -S python2”

The jukebox is implemented as a python script.

Raspberry Pi GPIO library:

“sudo pacman -U myplugbox.com/raspberry-gpio-python-0.4.1a-1-any.pkg.tar.xz“

This lets us control/read the GPIO pins which are used for LCD displays and input buttons.

Mutagen MP3 library:

“sudo pacman -U bitbucket.org/lazka/mutagen/downloads/mutagen-1.23.tar.gz”

Allows the Raspberry Pi to play MP3s and extract ID3 information.

FTP server.

Next you need to create an FTP server using VSFTP. This will allow MP3 files and Python scripts to be transferred to the Raspberry Pi. Enter “sudo pacman -S vsftpd”. Enter “Y” when the package manager asks you to confirm the install. Next modify the configuration file to allow remote users write permission: Enter “sudo nano /etc/vsftpd.conf” and modify the file to match the screenshot.

Use ctr-O to save the file, then set VSFTP to launch on startup with the command “sudo systemctl enable vsftpd.service”. Reboot the Raspberry Pi to activate VSFTP. You can now connect to the Raspberry Pi through Filezilla Client (filezilla-project.org).

Step 30: Raspberry Pi Python Project and MP3s

Download and extract the attached RaveCart_RPI_Software.zip

Using Filezilla create the folder “env_python” in “/usr/bin/”. You can also do this using the mkdir command from the PuTTy SSH terminal. FTP the following files into env_python: Adafruit_CharLCD_dual.py , CartBikeControl.py , button-1.mp3.

Adafruit_CharLCD_dual.py is a modified version of the Adafruit LCD library capable of running two LCDs in parallel. CartbikeControl.py is the main script for playing MP3s and sending USB messages. button-1.mp3 is a simple tone used to indicate a successful startup.

You need to supply your own MP3 files. Within the “env_python” directory create a directory named “mp3”. FTP your MP3 files into this directory. Make sure the MP3 filenames do not contain spaces or slashes. Linux does not handle those well.

Step 31: Raspberry Pi Startup Script

The Raspberry Pi needs to launch the Python script on startup. Use this command to make a new startup script file and open it for editing: “sudo nano /etc/systemd/CartBike.service”. Copy the following text into the contents of the file:

[Unit]
Description=Launches cartbike python script
After=syslog.target network.target
[Service]
Type=simple
ExecStart=/usr/bin/python2 /usr/bin/env_python/CartBikeControl.py
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

Save the file with ctrl-O then exit nano with ctrl-X.

Enable the script file with the following command: “systemctl enable /etc/systemd/CartBike.service”

Reboot the Raspberry Pi and you will hear the button-1.mp3 sound effect, then each of your MP3 files played in alphabetical order.

Step 32: Raspberry Pi Button Matrix

The button matrix allows a rider to select songs, control volume, and change lighting patterns. The Python script in step 30 is already set up to use them. The buttons connect to the Raspberry Pi GPIO pins through a switch matrix because this allows 9 buttons to occupy only six pins.

I tried to keep a consistent pattern when assigning buttons to functions. The top row are red pushbuttons that increment a variable. The middle row are black pushbuttons that decrements a variable. The bottom row are toggles that enable options such as cycling through songs randomly instead of sequentially.

Step 33: Raspberry PI LCD Displays

The Python script from Step 30 is setup to output four lines of text to a pair of character LCDs. The LCDs are controlled through the Raspberry PI's GPIO port. The information they display on each line is: Album name, musician name, musical genre, and Raspberry PI system status. Song information is extracted from ID3 tags.

One LCD is sixteen characters by two lines and the other is twenty characters by two lines. Both use HD44780 controllers. The controllers are operating in nibble mode so they only need to use D4 - D7.

Adafruit provides a very good HD44780 python library but I wanted to run two LCDs in parallel. This meant making some minor modifications to the adafruit library. The data and RS wires of the two LCDs are connected together. They both get the same data and reset signals, but their enable (E) pins are connected to independent GPIO outputs so only one accepts an incoming signal at a time.

Step 34: Information Panel

The information panel is created with a PIC18F2550. This chip has an internal USB transceiver like the PIC18F4550. It takes information from the Raspberry Pi over USB just like the microcontrollers running the main lights.

The 8x16 LED matrix scrolls the song title. The 7-segment displays show the song number in the Raspberry Pi's list of MP3s, the Raspberry Pi's audio output volume, the pattern control number for the main lights, the number of seconds remaining on the present song, and the song's recording year (From ID3 tags).

Since this was a one-off project I mostly used previously designed breakout boards. This unfortunately means there is a very large number of jumper wires connecting everything.

DisplayBoardFiles.zip contains the PCB files and MPLAB project for the PIC. The four PCBs are 4Xtransistor, 8xtransistor, 18F2550BreakoutBoard, and LedPanel. There are Eagle .brd files and gcode files provided for all PCBs.

The parts list is as follows:

  • LED 5MM Green 3v, 20mA x 128
  • PIC18F2550 SOIC x1
  • 7-segment LED Display. 0.56” Common Anode x16
  • 74HC164 SOIC x 6
  • 2N3906 TO-92 x 12
  • USB Type A plug/cable x 1
  • 1k resistor x12
  • 10k resistor x1
  • 20Mhz Xtal x1
  • 470 nF ceramic capacitor x2
  • 22pf ceramic capacitor x2

The display board connects to the same 5v regulator as the Raspberry Pi.

Step 35: Future Plans

Things I want to do very soon:

I can't carry anything in the cart basket without strapping it down to prevent it from shaking about and hitting the LED boards. I need to cut and install acrylic panels to put a barrier between the inside of the basket and circuit boards.

The speakers are not load enough for the large crowds of dancing people the lights usually attract. I need to install some large floor speakers in the back.

It takes over a day to recharge the batteries. I could add more solar panels which live inside the cart basket while riding, but can fold outwards when the bike is parked.

Carrying passengers would be a lot of fun, especially a musician to play live music. I need to add a passenger seat inside the basket.

The LED control programming is a bit cludgy. What I should do is write a USB-Artnet stack for the PIC18F4550s. USB-Artnet is a standardized lighting control protocol. This way the Raspberry PI could generate the entire lighting pattern instead of only supplying song information to the PICs. By using a standard protocol I'd be able to control the lights through professional lighting control programs.

Things I might do eventually:

A motor assist would let me get the project places a lot faster. I average about 10km/hour with the 26lb battery installed and half that with the 58lb battery. I'm holding off on this for safety reasons because the caliper brakes I used aren't adequate to stop such a heavy machine going above 10km/h. The bicycle frame and front forks I welded do not accept disc brakes.

Replacing the lead acid battery packs with lithium ion ones would make things a lot lighter. I'm hoping the price comes down on those in a few years.

Adding a generator to the bicycle pedals. This wouldn't be connected while riding because that's difficult enough already. It would be engaged while the bike is parked and allow the batteries to be maintained at night.

Make It Glow! Contest

Participated in the
Make It Glow! Contest

Tech Contest

Participated in the
Tech Contest

Epilog Contest VII

Participated in the
Epilog Contest VII