Introduction: PICAXE - Music Responsive, Fog Producing, LED Light Show and Audio Amplifier All in One

In this instructable I explain and carry out processes such as cutting and using various equipment, by imitating any of the processes in this instructable you do so at your own risk and make sure you follow any safety information for any equipment used and be careful.

I am the type of person who loves being able to have an idea and being able to turn that idea into a physical working product, this probably explains my passion for CAD (Computer Aided Design) software and 3D Printing which when both are used in conjunction with each other can turn a virtual design into reality. I currently 3D print a few designs using Shapways.com (and try and sell some of my designs in the process) however this Instructable is not about 3D printing (most of my other Instructables are) as with this project I had access to techniques far superior in quality (be it with a lot more effort) than 3D printing and more functionality than can be made possible with 3D printing (until 3D printed circuits can be made); with this project I joined both my passion for design and electronics to create a fully working prototype product, the functionality is quite difficult to explain in words so please watch the video below and it will make the functionality very clear and then read my explanation beneath the video.

This is a project I recently endeavoured on as part of an 'Electronic Products' qualification, it seemed a bit ambitious at first but thankfully it all worked perfectly in the end.
I could design any electronic based product I could imagine (within reason and time constraints) and this is what I made, every aspect of this project is my own original design and original conception of function, which i believe to be the first of its kind ever created, which was improved throughout the duration of the making of this project. The entire project was made by myself.

Below is a demonstration of the device in action (a video speaks louder than words):
Unfortunately the project has to stay at school at the moment so this video had to be taken on my phone however I will record a better quality video when I am allowed to take this project home. The room was very loud at the time of this video so please ignore the bad sound quality as my phone's microphone is not the best so I have dubbed the original music track on top of the video. Unfortunately my phone's camera's frame rate is also not high enough (and exposure is to long) to appreciate the full effect of this device due to the low lighting. View the video from half way if you want to see it working finely tuned.
 

So what is it? Simply put, this device has three functions:
1. Firstly this device is a audio amplifier which can plug into your iPod/iPhone/Phone or anything that has a headphone socket (3.5mm jack) and it will amplify the audio with the control of a volume knob on the side of the device, this audio is then outputted through two 10 Watt speakers.

2. With the help of a Picaxe 18M2 microcontroller, this device, while amplifying your music, also flashes rings of LEDs to the 'beat' of the music playing, similar to a 'VU Meter', the sensitivity and brightness of the LED's response to the music can be controlled using two control knobs (potentiometers). This light from the LEDs is projected through a layer of dense fog which is being produced by an Ultrasonic Atomiser fed by ordinary water in the separate box at the back of the unit which 'pours' the fog into the bowl.

3. Using the LCD display and the two push buttons, the user can also navigate a menu system to select 1 of 4 preset LED patterns and adjust their speed using one of the potentiometers, this can be an alternative to having the LEDs being controlled by the music. This makes this device functional even if there is no music playing.

Equipment I Used:
Easy PC (Software)
Printer
Light Box
PCB Etcher
Sandpaper
Pillar drill with 1mm bit?
Soldering Iron + Sponge
Water
Solder
Wire cutters (for the components after soldering)
Laser Cutter
Blow Moulder
Drill + Countersink drill bit
PIXCAXE Programming Editor (PC Software)
PICAXE Download Cable
Autodesk Inventor (Software)
Corel Draw (Software)

Materials I Used:
Blank Photosensitive PCB Board
Picaxe 18m2 IC
Picaxe Download Socket
Capacitors of various capacitances
Variety of Resistors
16* 5mm ultra bright blue LEDs
Low Power Diode
Audio Amplifier IC
3.5mm Audio Jack
3* Potentiometers (100K ohms)
2* Push Buttons
LCD Display
On/Off Switch
Battery Box for 3 AA Bateries
3* AA Batteries
Ultrasonic Atomiser
24v Power Supply
2* 75mm diameter 10 Watt speakers

The total cost of this project was £43.77

Step 1: Conception of Idea

Firstly, I knew that this would probably be the only time I could create something using all the brilliant equipment and facilities available to me at my school so I decided I wanted to create something really ambitious, useful and cool with this opportunity. So after many weeks of thinking I decided I wanted to create a music amplifier that as well as amplifying the music, it housed LEDs that 'danced' to the beat of the music similar to a 'VU meter'. For me this instantly brought to mind the image of concerts where lasers responding to the music are projected through fog so their trail can be seen, this made me now want to recreate this within my design. I had recently seen ultrasonic atomisers on YouTube and I knew these would be perfect for the fog effect within my design as they use ultrasonic sound waves to literally rip apart ordinary water molecules producing a dense cool fog which my LEDs could then project through, this also meant no chemicals were needed or heat was produced for the fog effect.

Below is a video I made of the testing out the ultrasonic atomiser (fogger) with a laser:

With this inspiration, I started to design the electronics within the design, followed by the casing...

Step 2: Electronics - Design

The hardware within this circuit involved a Picaxe 18M2 IC which is the programmable micro-controller in my design which can be programmed using a PC, a TDA2003V IC is also used in the circuit which is used as an audio amplifier to amplify the audio signal coming from a music player connected through a 3.5mm audio jack. There are also many off board components such as an LCD Display module and 3 potentiometers connected to the circuit board using flying leads. This circuit was designed in software called 'Easy PC' first as a schematic diagram then as a PCB layout, this was a long process to design the circuit as compactly as possible without needing any jumper wires in the design but I believe the design ended as compactly as possible without the need of additional jumper wires.

Step 3: Electronics - Manufacture of PCB

The circuit design was then printed out on transparency paper and then this paper was then placed into a light box with a sheet of blank photosensitive PCB board on top and the light box was turned on for 1 minute. The UV light reacted with the photosensitive coating of the parts of the blank circuit board that it was subjected to, this reaction allowed the photosensitive coating that was exposed to the UV light to be removed using a developer which revealed the copper in a negative image of the final design underneath, this now visible copper is then etched away in a PCB Etch Tank revealing the final PCB design, the PCB is then sanded to remove the rest of the photosensitive coating that was not subjected to the light revealing the copper underneath.

Step 4: Electronics - Population and Soldering

As the components I used on the circuit board are ‘through-hole’ components, the PCB had to be drilled to allow the population and soldering of the components to the circuit board, I used a pillar drill for precision and a 1mm drill bit. The components are then soldered in using a soldering iron and solder and the excess wires from the components are cut.
Above is shown the finished populated circuit board, the important components are annotated.

Step 5: Electronics - Programming

I programmed the Picaxe 18M2 chip using the free 'PICAXE Programming Editor' software and the Picaxe Programming Cable to transfer the program to the chip.
The program itself is written in the 'BASIC' programming language and basically allows the chip to take the audio 'tapped off' from the amplifier through a diode and convert it to a digital value using the chips ‘Analogue to DC’ (ADC) converter ability, the chip then uses this value in combination with the positions of 2 of the potentiometers used for 'LED Brightness' and 'LED Sensitivity' through a mathematical formula to decide how many LEDs to light up, the result of this is LEDs that ‘dance’ to the beat of the music dependent on the ‘power’ of the music at that point in time. 
The second section of the programming was the ‘Menu System’ which could be accessed by pressing both push buttons at the same time, this menu system allowed the user to choose between 1 of 4 preset LED patterns, whose speed can be controlled by on the the control knobs, and the original 'music controlled LEDs' program making this device useful even when it is not being used as a music amplifier.

Below is the program I wrote, I am relatively new to Picaxe programming (in BASIC) so there may be simpler and more memory efficient ways of creating this program however this works just fine (text proceeded by a apostraphy ' are notes and are not a part of the program):

main:
pause 500
serout B.5, N2400, (254, 64, 32, 36, 44, 63, 63, 44, 36, 32)
serout B.5, N2400, (254, 72, 32, 36, 38, 63, 63, 38, 36, 32)
serout B.5, N2400, (254, 80, 32, 32, 59, 32, 32, 49, 46, 32)
serout b.5, n2400, ( 254, $80 )                                                     ' First line of LCD display
serout b.5, n2400, ("Maundy's Designs")
serout b.5, n2400, ( 254, $C0 )                                                    ' Second line of LCD display
serout b.5, n2400, ("    Presents... ")
pause 250
high 0
pause 250
high 0, 1
pause 250
high 0, 1, 2
pause 250
high 0, 1, 2, 3
pause 500
low 0
pause 250
low 0, 1
pause 250
low 0, 1, 2
pause 250
low 0, 1, 2, 3
goto VUMeterText

VUMeterText:
serout b.5, n2400, ( 254, $80 )                                             ' First line of display
serout b.5, n2400, ("Music to Lights!")
serout b.5, n2400, ( 254, $C0 )                                            ' Second line of display
serout b.5, n2400, ("Press ",8,"+",9," 4 Menu")
goto VUMeter

VUMeter:
if pinc.7 = 1 then
goto PresetsFlashQ
else
readadc c.1, b1                                        'pin c.1 is the audio input from the audio amplifier circuit
readadc b.7, b2                                        'pin b.7 is the 'LED Sensitivity' Potentiometer
readadc c.0, b3                                        'pin c.0 is the 'LED Brightness' Potentiometer
let b2 = b2/20
let b3 = 255 - b3
if b3 <= 127 then
let b3 = 127 - b3
let w4 = b3 * 15
let w3 = b2*b1-w4
else
let b3 = b3 - 128
let w4 = b3 * 15
let w3 = b2*b1+w4
endif
if w3 > 4000 then
let w3 = 0
endif
if w3 > 600 then four
if w3 > 450 then three
if w3 > 300 then two
if w3 > 150 then one
if w3 <= 150 then zero
endif
goto VUMeter

zero:
low 0, 1, 2, 3
goto VUMeter

one:
low 0, 1, 2, 3
high 0
goto VUMeter

two:
low 0, 1, 2, 3
high 0, 1
serout b.5, n2400, ( 254, $C0 )
goto VUMeter

three:
low 0, 1, 2, 3
high 0, 1, 2
serout b.5, n2400, ( 254, $C0 )
goto VUMeter

four:
low 0, 1, 2, 3
high 0, 1, 2, 3
serout b.5, n2400, ( 254, $C0 )
goto VUMeter

PresetsFlashQ:
if pinc.6 = 1 then
goto PresetsFlash
else
goto VUMeter
endif

PresetsFlash:
serout b.5, n2400, ( 254, $80 )  ' First line of display
serout b.5, n2400, ("   Main  Menu   ")
serout b.5, n2400, ( 254, $C0 )  ' Second line of display
serout b.5, n2400, (8,"   Preset 1   ",9)
low 0, 1, 2, 3
high 0
pause 100
high 0, 1
pause 100
high 0, 1, 2
pause 100
high 0, 1, 2, 3
pause 100
low 0
pause 100
low 0, 1
pause 100
low 0, 1, 2
pause 100
low 0, 1, 2, 3
pause 100
goto Preset1

Preset1:
low 0, 1, 2, 3
serout b.5, n2400, ( 254, $80 )  ' First line of display
serout b.5, n2400, ("   Main  Menu   ")
serout b.5, n2400, ( 254, $C0 )  ' Second line of display
serout b.5, n2400, (8,"   Preset 1   ",9)
pause 200
goto Preset1loop

Preset1loop:
if pinc.7=1 then goto Preset1L                                                 'Pin 7 is the 'Left' Push Button
if pinc.6=1 then goto Preset1R                                                'Pin 6 is the 'Right' Push Button
goto Preset1loop

Preset1R:
pause 100
if pinc.7=1 then goto Preset1RunText
goto Preset2

Preset1L:
pause 100
if pinc.6=1 then goto Preset1RunText
goto PresetVU

Preset1RunText:
serout b.5, n2400, ( 254, $80 )  ' First line of display
serout b.5, n2400, ("    Preset 1    ")
serout b.5, n2400, ( 254, $C0 )  ' Second line of display
serout b.5, n2400, ("Press ",8,"+",9," 4 Menu")
pause 200
goto Preset1Run

Preset1Run:
low 0, 1, 2, 3
high 0
if pinc.6=1 and pinc.7=1 then goto Preset1
readadc c.0, b5
pause b5
high 0, 1
if pinc.6=1 and pinc.7=1 then goto Preset1
readadc c.0, b5
pause b5
high 0, 1, 2
if pinc.6=1 and pinc.7=1 then goto Preset1
readadc c.0, b5
pause b5
high 0, 1, 2, 3
if pinc.6=1 and pinc.7=1 then goto Preset1
readadc c.0, b5
pause b5
low 0
if pinc.6=1 and pinc.7=1 then goto Preset1
readadc c.0, b5
pause b5
low 0, 1
if pinc.6=1 and pinc.7=1 then goto Preset1
readadc c.0, b5
pause b5
low 0, 1, 2
if pinc.6=1 and pinc.7=1 then goto Preset1
readadc c.0, b5
pause b5
low 0, 1, 2, 3
if pinc.6=1 and pinc.7=1 then goto Preset1
readadc c.0, b5
pause b5
if pinc.6=1 and pinc.7=1 then goto Preset1
goto Preset1Run

Preset2:
low 0, 1, 2, 3
serout b.5, n2400, ( 254, $80 )  ' First line of display
serout b.5, n2400, ("   Main  Menu   ")
serout b.5, n2400, ( 254, $C0 )  ' Second line of display
serout b.5, n2400, (8,"   Preset 2   ",9)
pause 200
goto Preset2loop

Preset2loop:
if pinc.7=1 then goto Preset2L
if pinc.6=1 then goto Preset2R
goto Preset2loop

Preset2R:
pause 100
if pinc.7=1 then goto Preset2RunText
goto Preset3

Preset2L:
pause 100
if pinc.6=1 then goto Preset2RunText
goto Preset1

Preset2RunText:
serout b.5, n2400, ( 254, $80 )  ' First line of display
serout b.5, n2400, ("    Preset 2    ")
serout b.5, n2400, ( 254, $C0 )  ' Second line of display
serout b.5, n2400, ("Press ",8,"+",9," 4 Menu")
pause 200
goto Preset2Run

Preset2Run:
low 0, 1, 2, 3
high 0
if pinc.6=1 and pinc.7=1 then goto Preset2
readadc c.0, b5
pause b5
low 0, 1, 2, 3
high 1
if pinc.6=1 and pinc.7=1 then goto Preset2
readadc c.0, b5
pause b5
low 0, 1, 2, 3
high 2
if pinc.6=1 and pinc.7=1 then goto Preset2
readadc c.0, b5
pause b5
low 0, 1, 2, 3
high 3
if pinc.6=1 and pinc.7=1 then goto Preset2
readadc c.0, b5
pause b5
low 0, 1, 2, 3
high 2
if pinc.6=1 and pinc.7=1 then goto Preset2
readadc c.0, b5
pause b5
low 0, 1, 2, 3
high 1
if pinc.6=1 and pinc.7=1 then goto Preset2
readadc c.0, b5
pause b5
goto Preset2Run

Preset3:
low 0, 1, 2, 3
serout b.5, n2400, ( 254, $80 )  ' First line of display
serout b.5, n2400, ("   Main  Menu   ")
serout b.5, n2400, ( 254, $C0 )  ' Second line of display
serout b.5, n2400, (8,"   Preset 3   ",9)
pause 200
goto Preset3loop

Preset3loop:
if pinc.7=1 then goto Preset3L
if pinc.6=1 then goto Preset3R
goto Preset3loop

Preset3R:
pause 100
if pinc.7=1 then goto Preset3RunText
goto Preset4

Preset3L:
pause 100
if pinc.6=1 then goto Preset3RunText
goto Preset2

Preset3RunText:
serout b.5, n2400, ( 254, $80 )  ' First line of display
serout b.5, n2400, ("    Preset 3    ")
serout b.5, n2400, ( 254, $C0 )  ' Second line of display
serout b.5, n2400, ("Press ",8,"+",9," 4 Menu")
pause 200
goto Preset3Run

Preset3Run:
low 0, 1, 2, 3
high 0
if pinc.6=1 and pinc.7=1 then goto Preset3
readadc c.0, b5
pause b5
low 0, 1, 2, 3
high 2
if pinc.6=1 and pinc.7=1 then goto Preset3
readadc c.0, b5
pause b5
low 0, 1, 2, 3
high 1
if pinc.6=1 and pinc.7=1 then goto Preset3
readadc c.0, b5
pause b5
low 0, 1, 2, 3
high 3
if pinc.6=1 and pinc.7=1 then goto Preset3
readadc c.0, b5
pause b5
goto Preset3Run

Preset4:
low 0, 1, 2, 3
serout b.5, n2400, ( 254, $80 )  ' First line of display
serout b.5, n2400, ("   Main  Menu   ")
serout b.5, n2400, ( 254, $C0 )  ' Second line of display
serout b.5, n2400, (8,"   Preset 4   ",9)
pause 200
goto Preset4loop

Preset4loop:
if pinc.7=1 then goto Preset4L
if pinc.6=1 then goto Preset4R
goto Preset4loop

Preset4R:
pause 100
if pinc.7=1 then goto Preset4RunText
goto PresetVU

Preset4L:
pause 100
if pinc.6=1 then goto Preset4RunText
goto Preset3

Preset4RunText:
serout b.5, n2400, ( 254, $80 )  ' First line of display
serout b.5, n2400, ("    Preset 4    ")
serout b.5, n2400, ( 254, $C0 )  ' Second line of display
serout b.5, n2400, ("Press ",8,"+",9," 4 Menu")
pause 200
goto Preset4Run

Preset4Run:
low 0, 1, 2, 3
high 0, 3
if pinc.6=1 and pinc.7=1 then goto Preset4
readadc c.0, b5
pause b5
low 0, 1, 2, 3
high 1, 2
if pinc.6=1 and pinc.7=1 then goto Preset4
readadc c.0, b5
pause b5
low 0, 1, 2, 3
high 0, 1, 2, 3
if pinc.6=1 and pinc.7=1 then goto Preset4
readadc c.0, b5
pause b5
low 0, 1, 2, 3
high 1, 2
if pinc.6=1 and pinc.7=1 then goto Preset4
readadc c.0, b5
pause b5
low 0, 1, 2, 3
high 0, 3
if pinc.6=1 and pinc.7=1 then goto Preset4
readadc c.0, b5
pause b5
low 0, 1, 2, 3
high 0, 1, 2, 3
if pinc.6=1 and pinc.7=1 then goto Preset4
readadc c.0, b5
pause b5
goto Preset4Run

PresetVU:
low 0, 1, 2, 3
serout b.5, n2400, ( 254, $80 )  ' First line of display
serout b.5, n2400, ("   Main  Menu   ")
serout b.5, n2400, ( 254, $C0 )  ' Second line of display
serout b.5, n2400, (8," Music2Lights ",9)
pause 200
goto PresetVUloop

PresetVUloop:
if pinc.7=1 then goto PresetVUL
if pinc.6=1 then goto PresetVUR
goto PresetVUloop:

PresetVUR:
pause 100
if pinc.7=1 then goto VUMeterText
goto Preset1

PresetVUL:
pause 100
if pinc.6=1 then goto VUMeterText
goto Preset4

Step 6: Casing - Design

I decided to design the casing in AutoDesk inventor which although is a 3D design program and I only needed a 2D design program as I intend to laser cut the design out of 3mm acrylic, this program had the advantage of being able to virtually assemble each laser cut face to check the final fit and appearance.The old initial casing design involved the atomiser and water reservoir required for the creation of the fog to be inside of the main unit as you can see in the first picture above however further into the project I realised this would be difficult to manufacture so in the final design the atomiser and water reservoir are now in a separate box which ‘pours’ fog into the bowl as you can see in the second and third picture.

Step 7: Casing - Manufacture

After designing, I exported the design to a format accepted by Coral Draw (which is the software the laser cutter is running off) and then after adding some text to the design, the design was then laser cut out of 3mm black glossy acrylic.
The laser cut parts are then assembled using Dichloromethane which is a chemical used to welt this type of plastic together which results in an extremely strong bond. As I am using countersunk M3 bolts to attach the bottom face of the casing I used a drill and countersink bit to countersink the 4 holes in the bottom face and in the 2 holes in the top face of the separate box for the creation of the fog so the countersunk bolts would lie flat with the surface of the plastic when screwed in.
Next is the manufacture of the Dome within the design.

Step 8: Casing - Manufacture Contintued

The dome within the design is created using a method called ‘Blow Moulding’; blow moulding involves heating up a sheet of plastic (in this case High Impact Polystyrene(HIPS)) until it is soft, it is then placed in a circular airtight clamp and air is pumped in from below creating a dome in the plastic sheet with the circumference of the circular clamp (in this case 6 inches), once the plastic sheet cools it then maintains its new shape.
Sixteen 5mm holes are then drilled in the dome for the later holding of 16 blue LEDs.

Step 9: Assembly - LEDS

The LEDs are glued into the dome using a hot glue gun and each set of 4 on each ‘level’ are wired up in parallel with each LED having its own 6.8 ohm resistor as shown in the schematic above and all the negatives leads of the LEDs are connected together to as a common ground.

Below is a short video of me testing the LEDs and their 'levels':

The dome is then attached to the main casing using the same chemical as before (Dichloromethane) to weld the parts together.

Step 10: Final Assembly

All that is now left is for all the various components to be attached to the casing, the LCD screen, 2 buttons, speakers and 3.5mm audio jack required hot glue however the power button and potentiometers were bolted on.
The rings of LEDs are now connected to the circuit board using flying leads and the circuit board is held in place using a PCB Grip. Finally the battery box is then securely attached to the casing using Velcro to stop it rattling around inside the casing.

Step 11: FINISHED

It's finished!
Check out the video below for a demonstration of the ‘Foggy Music Light Show’ in action!
 
 

If you like this project enough, I would appreciate it if you could vote for this project in the ‘UP! Contest’, Thanks
Please also check out my 3D printing related entry to this contest: TriStand Minimal - 3D Printed Minimalistic iPhone Case with built in KickStands

Step 12: What's Next?

The future is upon us as we speak and with the expansion of 3D printing at a huge rate I have no time to waste before designing the next cool thing that I have the urge to make, be it an iPhone Case or Christmas Ornaments such as my previous instructables (iPhone case with built in flip out stands, Christmas ornament and most of my other instructables) however next on my list that is currently in progress of being designed is none of the above, for this next design, I want to design something completely tactile, something that has no real use but is just awesome to look at and use, and this is what I came up with... 

Here is my latest project which I spent a whole solid day yesterday modelling, I wanted to make something tactile and just fun to use, It has turned out to be a Steampunk themed desk organizer which can hold paperclips etc. in the tray and maybe pencils/pens in the holes around the top or balanced on the handles when not moving:
Animation of the 'Geared Cube' should be displayed here (it's failed to show/load)

This design consists of a cube, on each of 4 sides of the cube are 7 gears: 2 large outer ones that move in opposite directions, the outer has handles on it so it can be easily rotated, the motion between the 2 large cogs is reversed due to 5 smaller gears in a similar layout to a planetary gearbox to reverse the gear's direction on each of these 4 faces. Each of these sets of gears on the 4 faces are all liked through the big gear on each of the 4 faces meshing at 90 degrees with the big gear on each of the 2 neighboring sides. This means that theoretically if any one gear is spun, they should all spin in a memorizing pattern. Best of all it should be printable as one piece.

The design also comes with a stand so it can stand up on a desk, this stand also has a flat plaque with embossed text that I may consider allowing to be customized by the buyer.

I have also just modeled a removable lid that can be placed on the top of the cube and is locked and unlocked by rotating the cogs (the lid locks at the centers of all 4 sides below the gears on the lid) just to make it a bit more interesting and to give it a bit more functionality. This brings up the possibility of designing interchangeable mechanical add-ons that can be put in place of this lid and driven by the rest of the cogs...

Unfortunately due to the very costly nature of 3D printing services such as Shapeways and after my two recent orders of the two prototypes of the 'Centrifugal Puzzle Box' I am going to have a break from 3D printing so I don't run out of money! Hopefully one day I will own my own 3D printer so this will not be an issue.