The Noise Toy kit is fun to use, but if you’re like me – leaving that little “PROGRAM” port unused will drive you crazy.
With little knowledge of AVR programming beyond some fun with Arduino, I taught myself how to upload and hack source code for it. Read on to see how the deed was done and listen to some sample audio.
Part 1 – Hardware hackery
If you’ve never programmed a microcontroller before, the prospect may seem a bit daunting – but it’s really not so tough, and learning this process opens up a ton of new options. (If already know how, you can skip down to Part 3, for pertinent Noise Toy files)
The Noise Toy uses an an Atmel AVR microcontroller chip (the ATTiny85, to be specific). Loud Objects designed the kit so that the chip could be reprogrammed without removing it from the device, or ‘in-circuit’. In fact, the Toy can be seen as a simple AVR ‘target board‘ on which a microcontroller can receive new code from a PC’s serial data conection.
Serial ports are pretty rare on most new machines (and non-existent on Macs), so most people use USB instead. In order to convert that USB data into something more ‘serial’ for our little chip, we use an in-system programmer (ISP for short). The Noise Toy designers arranged that PROGRAM header to interface with a specific ISP – the Tuxgraphics’ AvrUsb500. I didn’t have one of those on hand, but did have another ISP, namely the USBTinyISP from Adafruit Industries. In order to use it with the toy, a bit of adaptation was needed.
The USBTinyISP uses a 6-pin connector, one more pin than the AvrUsb500. To figure out which pins did what, I compared documentation from both devices and cross-referenced the ATTiny85’s datasheet.
It turns out the additional pin on the USBTiny provides optional power to the board, while the AvrUsb500 assumes your chip will already be powered while programming.
With that in mind I disabled the USBTinyISP’s optional power pin by moving a simple jumper inside the device. Using the info gleaned from those pin-comparisons, I drew up a quick schematic describing how the my USBTiny should connect to the toy’s PROGRAM header.
You can use solid core or jumper wire to make the proper connections – for a more permanent solution, I made a little adapter out of perfboard -
Not too tidy, but it gets the job done.
Part 2 – Software fun and programming process
Once the interface was figured out, you’ll need some software to perform the actual programming. I downloaded and installed AVR MacPack on my powerbook (those with windows can use WinAVR) Then I got acquainted with the basic programming process via the handy tutorials on Ladyada.net.
Additional Noise Toy source code can be downloaded from Loud Objects’ site. These are .c files and need to be compiled as .hex before being written to the chip. To do this, you’ll need a ‘makefile’ that specifies some necessary variables. I found a simple template makefile on Psychogenic’s site and updated it with the necessary details -
name of microcontroller:
name of my .c source file:
You can download the edited makefile here.
Save the new makefile as (you guessed it) “
makefile” and place it in a new folder called “
mynoisetoyproject” within the
Loud Objects’ dave_matthews_band.c sounded like a prime target for experimentation, so I opened it up in my favorite text editor, and went to work. Perusing the code, I noticed one bit that looked familiar. Curious, I replaced all instances of
Random() and replaced them with
0 – then saved the file as “mynoisetoyproject.c” in
Once the folder and files were good to go, I proceeded with the following formalities -
Open the Terminal application, and enter these lines:
Connect the ISP to the computer via USB, then to the Noise Toy and enter this following -
avrdude -c usbtiny -p t85 -U flash:w:mynoisetoyproject.hex
After Terminal displayed a quick upload process, I disconnected the toy and gave my little demo hack a listen. Somewhat predictably, I heard a less random version of “dave_matthews_band.c” – I call it “chris_mattews_band”
Just a couple changes to the original program made a substantial difference to the sound produced. If you’ve worked with Arduino before you’ll probably recognize language in these source files. This type of hacking seems a good way to learn more about coding in general – oh, and it’s fun!
Part 3 – Files and such
Here are some samples from the other programs on Loud Objects’ site -
In case you don’t want to hack/write any code, here’s a .zip of all the original programs pre-compiled as .hex files for uploading – Noise Toy hex pack
And here’s the edited makefile and example code hack – mynoisetoyproject makefile
I hope this can help some break the ice with microcontroller development and get some extra milage out of a simple yet very useful kit. If you write/hack a good program for the kit, be sure to share it in the comments below!