Mickey Delp dot com

Birdianoforte: Circuit-bent Bird Song Calendar II

I took another run at bending a bird song calendar. I wanted to do something more complex with it than I did the first time . I had planned to enter it in the Second Annual Moog Circuit Bending Challenge, but alas, I did not finish it in time. Oh, well, there’s always next year, and in the meantime, I have this cool bird piano – the Birdianoforte!

The stock functionality of the bird calendar is quite simple – just press a button to hear a bird sound. The Birdianoforte is quite a bit more complex, and far more playable as a musical instrument.

 

 

Birdianoforte

 

Features

The red button in the upper left is the bird selection button. To select a bird, hold down the red button while pressing a bird button (the green, blue and orange buttons at the bottom), then release the red button. The corresponding LED will illuminate to indicate the selected bird. Now, the 12 bird buttons act like a piano keyboard, playing the selected bird at different pitches. The bird sound only plays while the button is pressed, unlike the calendar which plays the full bird song whenever a button is pressed.

The white button in the upper right is the function button. Press and hold the function button while pressing a bird button to access advanced functions. The functions are labeled with an icon just above the bird button and below the LED. From left to right, the buttons are: set low pitch range, set high pitch range, set full pitch range, record, playback, stop (recording or playing), slow down playback and speedup playback. The last four buttons have no function - yet.

The record function is a basic sequencer. It just remembers your key presses until you hit stop. Playback repeatedly plays the sequence. You can even change the selected bird during playback.

 

The Build Process

This is what the bird calendar looks like disassembled:

Bird Calendar Separated

Bird Calendar Disasembled

The sound-making part of the bird calendar is inside a cardboard box attached to the bottom of the calendar. It is glued in, so disassembly is tricky. There are four pieces to it. On the far right is the speaker. On the left is the battery holder and a tiny circuit board that makes that sounds. In the middle is a pressure-sensitive key pad. The keypad is conductive material printed on flexible plastic which is just pressed against the circuit board and held in place by screws.

As with so many circuit bending projects, my plans changed as I progressed through a series of failures. I had originally wanted to build the entire thing into the plastic box and put it back inside of the cardboard box attached to the calendar. However, the plastic box is very short and there is not enough room to work. Even if I didn’t use a board and just soldered wires directly to chips, there would not be enough room. So, I figured I would use an enclosure for my parts and mount the original pressure-sensitive keys on top of it. Well, that didn’t work out either.

I tried to build a tiny board to put in place of the bird board that would make contact with the keys. I would then run wires from my board into the enclosure. Here is my attempt:

Bird Calendar Button Interface Attempt

Try as I might, I could not get the flexible circuit board to reliably make contact with my board. I even tried to build up the traces on my board with conductive copper tape ($13). I also used a solder pen ($10) that writes silver ink to build up the conducting surface of the flexible key board. Nothing worked. Hopefully I can reuse the $23 worth of stuff for something else.

So, what I ended up doing was making my own keyboard. I mounted 12 little tactile buttons on a piece of Plexiglas. I mounted my keyboard to the underside of my enclosure with each tactile button poking up through a hole. Then I glued the cardboard cover of the original bird keyboard to the top of the enclosure. Not what I had wanted, but it works well and looks just fine.

With the keyboard sorted out, I went on to build the rest of the user interface elements: 12 LEDs to indicate the selected bird, a bird select button, a function button, and a power switch. I mounted the original speaker from the bird calendar and, of course, an audio output jack. I used a three AA battery holder in place of the three watch batteries that the calendar uses because they last longer and are cheaper. The icons on the front were printed on vinyl sticker stock and cut out with a digital cutter.

All that remained to do was build the control circuitry. Believe it or not, that was the easy part! I always find the physical aspects of a build to be the biggest challenge. Figuring out the user interface and how to cram everything into the selected enclosure is often the most difficult part. In this case, space was not an issue. Because I wanted to use the original keyboard (or at least the cover) I was forced to use a larger enclosure than I would ordinarily choose and so there was plenty of room for my custom circuit board and wiring.

Here are the guts of the finished project:

Birdianoforte Insides

 

Technical Details

OK, let's get a little more technical. Here is a link to the schematic circuit diagram which I will refer to in my description. Below is an annotated picture of the Birdianoforte control circuitry. The wires are color-coded. Black is ground and red is positive power (naturally). Yellow wires were used for on-board connections and green wires connect to off-board components.

Birdianoforte Board Annotated

The Brains

The main brain is a PIC 16F690 microcontroller. I chose that chip because I had one on hand and figured that 20 pins would be enough. Of course, you can never have enough pins, which became clear as I went along. I am going to buy a few 28 pin microcontrollers so that I have one on hand for the next project. I should have learned that lesson a long time ago, but better late than never.

The LEDs

The 12 LEDs are charlieplexed so they can be controlled with only four digital pins of the microcontroller. Since only one LED is ever illuminated at a time, there is no need for a loop to control them.

The Keyboard

I already talked about the construction of the keyboard. In this close-up view of the keyboard you can see a resistor soldered between each of the tactile switches to form a classic resistor ladder which is connected to an analog input on the microcontroller. It is a simple matter to read the voltage of the pin and determine which key is being pressed. This method only works when there is no need to handle multiple simultaneous key presses, which is the case here. The keys are not directly connected to the bird circuit board. They are connected to the microcontroller, which, in turn, controls the bird board. I will go into more detail on that later.

Pitch Control

The classic circuit bend is to find the pitch control resistor and replace it with a potentiometer. The bird calendar, like most modern sound making gizmos has almost no parts. It has what is commonly referred to as a black blob. That is actually a blob of epoxy covering a tiny single-purpose computer chip that does all of the work of reading the button presses and playing the associated sound. It also has a resistor that controls the pitch. Actually, it controls the speed at which the computer chip runs. Make the chip run faster, and the sound speeds up; make it run slower and the sound slows down. With sound, fast and slow translate into high and low frequency, or pitch. So, I de-soldered the little surface-mount resistor and soldered two wires in place.

Since I wanted to control the pitch with the microcontroller and not a physical potentiometer knob, I used a MCP4152 digital potentiometer from Microchip. That chip has 256 resistors inside of it so you have a digitally controlled variable resistor. The pitch resistor on the calendar is 200K Ohms. The largest resistance I can find on a digital pot is 100K. So, with a fixed 150K resistor in series, that would give me a 150K to 250K range. I tested that and it was not enough. To really get interesting sounds, you have to speed up and slow down the sound more drastically. So, I used a 50K fixed resistor plus the 100K digital pot, plus two more 100K resistors connected through a CD74HC4066 digitally controlled analog switch. That gives me a full range of 50K to 350K, which is much better. I played with three pitch ranges (50-150, 150-250 and 250-250), but there was not enough difference between adjacent notes, so I changed the options to low: 50-250, high: 150-350 and full: 50-350.

I could have also connected a physical potentiometer in series with the pitch control for a pitch bend effect with little effort and no additional programming, but I decided against it mainly because I wanted an all-pushbutton interface that was distinctly different from other circuit bent devices.

Singing

To make the selected bird sing, the microcontroller has to emulate pressing the buttons. The calendar button to board interface is pretty simple. There is a common wire and twelve bird wires. Simply connect one of the bird wires to the common wire and the bird sings. It would be great if the common wire were ground or V+. That way, the board could connect directly to a microcontroller pin. But that is not how it works. So, we need some support chips to connect the wires for us. To that end, I am using a CD4051 1-of-8 multiplexor chip. That chip has one common output pin and eight input pins and it connects one of the eight inputs to the output. Perfect. Of course, there are twelve birds, so we need two 4051s. There are three binary control lines to select the input channel and a chip inhibit pin to select none of them. Those four pins connect to four pins on the microcontroller. There is a 2N2222 transistor in that part of the circuit too, but I will explain that next.

The Speaker

As I mentioned above, the sound stops when you release the key, unlike the calendar which plays the full bird song. Here is another thing that didn't go exactly as I had planned. While hacking at the bird board, I found that if you ground the common pin from the keyboard, the sound stops. I had planned to do the same thing using the microcontroller, but it did not work when the bird board shares the same power as the rest of the circuitry. So, I decided to cut the speaker wire and use the 4066 to turn it on and off. First of all, I had run out of pins on the microcontroller, so I had to free one up. I realized that only one of the two 4451 chips needs to be enabled at a time, so I put in a 2N2222 transistor wired as a NOT gate. So, one pin on the microcontroller now controls the enable (actually inhibit, but same difference) pins for both chips. Now that I had a free microcontroller pin, I used that to control one of the two unused switches in the 4066. It sort of worked. It turned the sound off just fine, but in the on position, the sound was very quiet. It took me a while to figure out why, but it turns out that it was because the on resistance of the 4066 switches is not zero. A physical switch would be nearly zero on resistance. Through an amp, it was fine, but I wanted to be able to use the built-in speaker as well. So, I did two things. Since I had two free switches left on the 4066, I wired them both in parallel. Using Ohm's law for parallel resistance [R = (R1*R2) / (R1+R2)], I halved the on resistance of the switch. It got louder, but I went a step further and swapped out the CD4066 chip for a CD74HC4066 chip. That chip, in addition to having a faster switching time has a lower on resistance. The Birdianoforte is now almost as loud as the unmodified calendar.

The Software

That is it for the hardware. Once the microcontroller was talking to the controls and all of the support chips, it was just a matter of programming to get it to operate the way I want. Maybe it’s just my bias, but software is a lot easier. The only thing on the circuit board we didn’t talk about is the ICSP (in circuit serial programming) header. I use a PICkit2 programmer to load the code onto the board. While I'm talking about it, that is another area where more microcontroller pins would be nice. I am reusing two of the pins used for programming to handle the pushbuttons. That works fine, since there is no need for additional isolation circuitry with buttons, especially since I am using the microconroller's built-in pull up resistors. However, I had to remove the programmer from the header after each upload before I could test the circuit. It would be simplest to have dedicated those pins to the ICSP header.

If you are interested, here is the C source code for the Birdianoforte. It is sparsely commented, but fairly straightforward.

 

That's it! If you have any questions about the Birdianoforte, feel free to contact me.



Most Recent Articles

Login Form