Introduction: Tic Tac Tunes - Now With Tic Tac Beat Box
Micro-organ and drum-kit in a Tic Tac box
This tiny box will give you hours of fun composing your own tunes. You can vary the tune tempo and switch between a pentatonic and blues scale as well as producing a variety of percussion sounds.
Load up a different program and it will compose its own percussion rhythms(Tic Tac Beat Box) or play with half a dozen different musical scales (Tic Tac Scales). Another cool feature is no power switch - It will hibernate when it's not being used.
There are great musicians around . . . and then there's me with no musical talent at all, but even I can get some great sounding tunes out of this. Watch the video and have a listen to the MP3 files to get an idea of what this little marvel can do.
UPDATE - Two new programs added - Tic Tac Scales and Tic Tac Beat Box - See step 6
Couple more sound files added (better quality)
Modification for right-handed version added to step 4.
Step 1: Parts and Tools Required
As well as standard workbench tools and soldering equipment, you will need :-
1 x PicAxe 08M or 08M2 microcontroller chip - see below
2 x 10K resistors - all are 1/4 or 1/8 W
1 x 330R resistor
1 x 22K resistor
1 x 560K resistor
1 x red LED
1 x 10K linear dual gang slide potentiometer (60mm).
2 x 1N4148 or similar diodes. Just about any small diode will do
1 x 0.1 uF capacitor (10V or more)
1 x 28mm x 4mm piezo sounder. This MUST be a low profile type or it won't fit
1 x PX28A 6V keyfob battery (4LR44 PX28A A544 L1325 equivalents)
1 x stereo 3.5mm jack socket
1 x jack plug for probe. This can be 2.5 or 3.5mm, mono or stereo
1 x stripboard 22 x 12 holes
1 x spring from a retractable pen
1 packet of TicTacs. Your choice of flavour
You'll also need a few bits of link wire and something to decorate it. I used the old Blue Peter favourite - sticky back plastic.
If you need to brush up on your soldering technique, there's an excellent guide HERE.
Most of my parts came from Maplin (UK), but Mouser or your friendly local on-line electronics store will have these in other parts of the globe. All the parts (including Tic Tacs and battery) shouldn't come to more that 10 pounds (16 dollars), but that may vary depending on where you are, and doesn't include p+p, or the programming lead (see below).
I've used a PicAxe 08M microcontroller which comes as a blank chip and needs to be programmed. To do this, you will need a programming lead and the free programming editor software. Both the PicAxe chip and the lead are available from Tech Suppliesin the UK or see HERE for other countries. The 08m has been superseded by the 08m2 - Either will work.
Once you have the lead, you only need a PicAxe, two resistors and whatever sensors and output devices you choose to have a full PicAxe development kit which can program any of the PicAxe range, so you can design your own projects. I have an Instructable planned which will get you well on the way.
Step 2: Making the Circuit Board
Take the 22 x 12 stripboard, mark and cut as shown. To cut stripboard, score it deeply with a craft knife (using a ruler) on both sides. Then use a pair of pliers to very gently flex it. The board should weaken and break. Later on I accidentally broke off the thin leg so substituted a brass pin and used this to connect the -ve battery terminal.
This layout developed as I built it, so look at the front and back photos to get the component and cut track locations. A spot face cutter is the best tool, but failing that, use a handheld 5mm (1/4") drill bit or a craft knife. Make sure no thin bridges of track are left.
Put in the programming socket and links first, then the resistors and finally the diodes and IC. Normally I'd use an IC socket, but there's no room for such luxuries here - The sounder wouldn't fit! Trim off anything sticking out the back of the board to reduce height. I did say this was tight!
Because we're not using an I.C socket be very careful when soldering the chip. Solder each pin for the shortest possible time to get a good joint, and let the chip cool down between pins.
For the piezo mounting posts I used brass pins from a wire-wrap IC socket, but any stiff solderable wire would do. Use two pieces (approx 8mm) soldered into the board for the posts the piezo sounder will sit on. Once soldered, bulk them out a bit with heat-shrink. Cut 2 lengths from the biro spring so that when you sit the sounder on the posts and slide the PCB into the box, the sounder is sprung against the top.
I've used the 'repair' brass wire to connect another stiff wire to and solder to the -ve of the battery. This holds the battery reasonably firmly in place. The terminals are easy to solder to, but do it quickly so as not to overheat the battery. Leave the wire from the positive terminal unconnected at the moment, until we're ready to put the whole thing together.
Step 3: Building the 'Keyboard'.
For the keyboard I've used a 10K LINEAR slide dual gang potentiometer. These are the type of thing you'd see on a mixer desk, only smaller. It works in the same way as a normal pot, but in a straight line. Dual gang means there are two of them in the unit (for stereo signals). Linear means the resistance increases evenly across the length.
Firstly, bend up the eight lugs and remove the resistive element, then look closely at the third picture and notice the diagonal lines on the element. This is where the resistive part starts and will be significant later.
Cut off the six legs, and very carefully cut and grind away the board up to the holes as in the sixth picture. Grind away the through-holes on the back a bit and roughen up the back as we will be gluing this later. Careful here - these things aren't all that rugged and the track is easily scratched.
Fit a link across the holes at one end and thin wires from the two at the other end as in the eighth picture. In the picture, the yellow wire will go to the +ve, the blue to the -ve. Build up a blob of solder on the +ve terminal. This will be the contact for controlling the tempo.
For the probe I'm using just the top pin of a 3.5mm jack plug. Stereo or mono, or 2.5mm would be fine. Use good flexible wire for connecting this. Solder a single wire to the centre terminal and ideally add some heatshrink as strain relief.
Step 4: Putting It All Together
To position the sound-hole, put the springs on the posts and put the sounder on top. Gently press down and slide the whole assembly into the box then put the lid on. Mark the position of the sounder hole and then remove the circuit and drill a small hole there. A hot soldering iron is great for tidying the edges up. While you're at it, make a hole in the lid of the tic tac box to let the probe lead through. Also make another hole near the base of the box to allow the wires from the keyboard through.
Feed the probe and keyboard wires through into the box and cut these as short as you safely can then solder them to the board. Connect the wire from the battery +ve terminal. The circuit is now live!
Put the sounder in place and feed everything in for the last time. Use a hooked piece of stiff wire to pull the keyboard wires through so they don't foul the battery placement. Take your time over this step.
Impact adhesive is about the only thing which will stick the pot base to the plastic box, so give them a thin coat and leave to dry. After 5 minutes or so, carefully stick it down.
I'm left handed and have made this to suit a left-handed person. For the right-handed version, stick the resistor strip lower down on the panel and turn the unit around when you're playing it.
The insulating tape is important. It has to go around the box and cross the tracks exactly on the diagonal stripe mentioned earlier. This sets the end-points for the keyboard.
Trim away the tape around the solder blob on the keyboard. This is the control button which turns it on, and sets the tempo and scale.
Decorate it in a style of your choosing and clear the sound-hole with your soldering iron tip. I went for the purple holographic sticky vinyl to give a futuristic look but with a retro purple seventies vibe (and because the shop was selling it cheap).
Step 5: Circuit Diagram
As space is at a premium here, I'm using a small 6V battery and dropping the voltage down by 1.2V to 4.8V with the diodes D1 and D2. The PicAxe chip is happy up to 5V so this is fine.
R1 and R2 are required to allow this to be programmed in-circuit and to re-program I plug in the USB / serial programming lead to the 3.5mm socket under the box lid.
The 0.1uF decoupling capacitor is good practice with any circuit. It absorbs the voltage transients when transistors within the ICs switch. Without these, digital circuits can behave very strangely.
R3 is to pull the input to ground when the probe is not touching the track, otherwise it floats and generates all sorts of spurious noises. The solder blob on the track is to the positive rail to give a definite level for the control.
I've used a wide angle red LED but any LED will do. Drop R5 to 150R or so if using blue or white. There's not a lot of LED activity so as to keep the current consumption down.
Current consumption is around 1mA when active and drops to 200uA when in sleep mode, so the battery should last a fair while.
I used ExpressSCH to draw the schematics, and PDF Redirect to save to a PDF file. Both free.
Step 6: PicAxe Microcontroller and Code
Code posted below in Word and Programming Editor formats. If you have trouble opening the code file, use 'save link as' and rename the .tmp file to .bas. I'll be commenting the code after the current re-write, but here's a quick summary :-
Tic Tac Tunes starts up after programming in 'sleep' mode. When asleep, the unit wakes briefly every 4 seconds and checks one of the ADCs (analogue to digital converters). If this reads 255 it wakes up. The ADC is held at 0 with no contact with a pulldown resistor.
Tic Tac Tunes now uses the ADC to read the track value which gives a reading from 0 to 255. The solder blob is at the positive rail voltage, so reads 255.
When awake, additional 255 pulses increase the tempo of the played notes (flashing the LED for each contact), and once the count gets to 8, it reverts to 1 and also switches to the other scale of notes (long LED flash). The PicAxe can only produce notes with a fixed duration, hence the need for the tempo control.
The tracks are in series, so the far end reads at around 127. This value is split in the software to upper and lower keyboard, and then into 18 notes, with 8 divisions for the percussion. An ADC value of zero (probe not touching) gives silence.
The percussion sounds are generated with a chunk of PicAxe SOUND commands, and the notes using TUNE. A watchdog timing loop is reset every time a note is played and if this doesn't happen at least every 20 seconds or so the unit goes into sleep mode until next awoken.
Tic Tac Scales adds more scales to the box, but drops the percussion. Turn on in the same way as Tic Tac Tunes, and select tempo and scale with the control blob. The LED will flash with tempo changes, and also beep as the scale changes to show the scale loaded. They are :-
1) Minor pentatonic
Tic Tac Beat Box is a free-running beat generator. Start it up by touching the probe anywhere on the top track. It will then invent random beat sequences with 2 to 5 beats, at a range of tempos. It also mixes two sets (at the same count and tempo) to give a bit of variety. Every now and then, it starts a new set. At the start of each set the LED will flash to show the beat count, and gives a brief flash at the start of each bar. Touch the top track again to put it to sleep.
The PicAxe was initially developed for the educational market in UK schools but is being widely used by hobbyists. The PicAxe is based on various PICs but with bootstrap code to interpret the downloaded programs and handle the programming side. They come in all flavours from this suprisingly powerful 8 pin package up to full blown 40 pin.
Look at the manuals and datasheets on the PicAxe site to see the full capabilities. Programming of the chip is via a serial link and done in-circuit. It takes about 20 seconds and you don't even have to unplug the lead to run the program.
I've been in electronics since the early eighties and I've never found a programming environment where the coding / simulation / proving cycle is so simple. Documentation and support from the forum is excellent and there are many robotics enthusiasts using the chips. Control for servos, steppers, ADCs etc are built in to the BASIC-like programming language as well as a host of other goodies. You can also simulate the circuit before you build, and do real-time debugging on a running controller. Look out for more PicAxe based projects from me.
Step 7: Musical Notes
I've no formal musical training and this is a compressed version of what knowledge I've picked up over the years. If anyone finds errors, or has further ideas, please leave a comment.
The PicAxe can produce musical tones across three octaves, which in a full chromatic scale (with the sharps and flats) is 36 notes. Because of the way the waveforms interact and the way the brain interprets this, some notes will sound 'wrong' when played next to each other.
Other scales have developed around the world which use a selection of these notes, and some of these don't allow the disharmonies of the full scale. The pentatonic (5 note) scales are like this. I've chosen a minor pentatonic of A C D E G.
The blues scale is similar, but usually has 6 or 7 notes and combinations of these are harmonious, but do give a sense of tension and resolution in certain combinations. I'm using C Db E Gb Ab Bb.
The chromatic scale is what you would use to play 'proper' tunes from written music, but the lack of definite note positions on TicTacTunes makes hitting the right note difficult. The positions could be marked, but it will take a better musician than me to play a recognisable tune. Improvisation with one of the harmonious scales is the way to go with this gadget.
On the title page are sound files recorded using other selections of 6 notes from the octave which characterise the sound of music from various areas of the world.
Step 8: Future Development
This project is actually a spin-off from another one which I wouldn't have time to complete for the sound contest. The other project has been at the planning stage for some time . . . about thirty years!! With my recent discovery of the PicAxe microcontroller, what I was planning becomes so much easier so I'll be cracking on with it now. (Once I've got a couple of other projects out of the way.)
The Project -
Many years ago I read the 'Vermilion Sands' series of short stories by J.G. Ballard and was intrigued by the 'Sonic Scupltures' which appear in several of the stories. These are sculptures which react in a musical way to the environment and to the presence of people. My first attempt at this was a bank of astable multivibrators made to change frequency in response to temperature and light, and interlinked so as to produce a wide range of bleeps, hoots, whistles and warbles (now I think about it, incredibly similar to theThingamagoop). This never got further than the workbench due to the pressures of 'real life'. With the PicAxe, making a polyphonic, environment sensing structure becomes much easier.
We have a be nice policy.
Please be positive and constructive.