Home > Group Projects > Musical Box Project
Project concept by Phil Townshend - copyright 2007.

UPDATED:.22:30 22 October 2013

A 8-10 week project that is ideal for Key Stage 3 D&T or KS4 GCSE ELECTRONIC PRODUCTS

This project is a development from the Musical Toy project which uses the UM66 IC. Unfortunately the range of tunes is limited so a circuit and software was developed so that student could create their own tunes.

This was extended to create a Light Operated Musical Box which lends itself to many applications, from fridge alarms to novelty Biscuit Jars and Jewellry Boxes.

The project is used as part of the GCSE ELECTRONIC PRODUCTS course with EDEXCEL and OCR.


There are two versions of project shown. Both use the same PIC12F629 IC and can use the MUSIC FACTORY SOFTWARE to write your own tunes which can then be downloaded into the PIC IC using a basic PIC programmer.

With both versions, the tune will repeat as long as the power is connected. This option can be changed so it plays one time only by drilling out and breaking the PCB track - see PCB details.

There is also an optional output for an LED that lights while the tune is playing.

This uses a basic PCB with only a resistor and transistor to drive the speaker. This is an ideal replacement for the UM66T circuit as used in the Musical Toy project and works out to be very cost effective.

This version plays the tune when light is shone on the LDR. There are many applications for this as shown by the project below.



The basic circuit just has a transistor driver for the speaker, a smoothing capacitor and an optional LED output. The circuit board is only 30mm x 21mm and can be mounted on the back of the speaker by its own speaker connections if single core insulated wire is used.

Circuit Board
Circuit Diagram

PCB size: 30x22mm

Track side: Note option
drill point next to "Melody"

The component count is minimal with R2 and LED1 optional. The circuit will work from 3 to 6 volts but at higher voltages the transistor may get warm.

The large hole on the circuit board is to provide some strain relief to the power wires.

Circuit Diagram
This is the version used in the Musical Box Project. In darkness, the LDr has a resistance of about 1Mohms resulting in almost no voltage at the base of Q1. When enough light shines on the LDR and the voltage at the base of Q1 rises above 0.7volts, Q1 turns on, pulling the base of Q2 low supplying power to the rest of the circuit.

The PIC begins playing, with the output connected to Q3 which in turn drives the speaker.

Current consumption is about 4uA when inactive, (in darkness) rising to about 180mA when playing a tune.

Note in this case the LED has been connected in series with the speaker, for ease of wiring.

Circuit Board
The PCB measures the same as before and cand be mounted on the speaker or remotely on longer wires to help position the LDR. This is a sub-miniature type which should be mounted high off the board to have some lead length to bend the LDR into position.

The speaker and PCB is less than 13mm when flat (left) or can be made into a neat unit by folding the PCB behind the speaker (above). Solid core wire was used to connect to the speaker.

The battery holder can be a simple 2xAA or even 2xAAA type depending on the space available.

The speaker used is an 8ohm ultra-slim type measuring just 40mm diameter.

In most cases the speaker can be used to hold PCB as it is quite small.

Cookie Jar.

The circuit was housed in the lid on a piece of 4mm MDF. A hole was drilled for the LDR to poke through so when the lid was opened ip played a tune.

The top and main jar was made from vacuum formed HIPS using plasticine to get the choc-chip lump effect.

Cream Cake.

Again the circuit is housed inside the lid made in the same way as before. The circuit is enclosed in a white cover to protect it.


This owl has the LDR poking through the base so when you pick it up, plays the tune, (but not in the dark).

A battery holder was made from a piece of 3mm acrylic and bent to shape using a strip heater..

Pasta Jar.

This was made from 2, 2mm birch ply layers soaked in water and glued around a 4" plastic pipe with straps holding it in place.

The circuit was again housed in the lid..

Dinosaur Model.

Night-time ring tone.

Another method of activating the microswitch when the lever is attached to the front of the model using a screw.

Here the speaker was glued with impact adhesive to the HIP case. The case was vacuum formed around a fairly simple MDF base.
This phone version was activated when the light on the LCD lit up. It was of course in silent mode.

The Music Factory software is very easy to use and will create a HEX file for programming the PIC12F629. This enables students to compose tunes relevant to their projects.

Here are some tunes that have been written and used in projects, just click to download:

The software is available as a trial version, or you can purchase the full version from our shop.


The Music Factory sofware produces a HEX file holding the data and the program for the PIC. The PICs used are PIC12F629 type, available in standard 8pin DIL packaging.

The cheapest programmer to use is the Velleman type shown right. This type does however use 9pin serial connections. There are newer models available on the internet.

It has been noticed recently with the upgrade to Windows 7 that the sound quality produced by the Music Factory software is garbled on some machines.
I will look into modifying the program.

Instructions on assembling the PCB.
Contact us by email. - Working Electronics For Students & Teachers