HOWTO: Standalone Operation of the SoundPAL

The Parallax SoundPAL can be programmed, using a BASIC Stamp, to play a sound sequence automatically on powerup. This means that, once programmed, the SoundPAL can be disconnected from the BASIC Stamp and operated standalone, requiring just a 3.5 - 5.5V power supply, capable of providing 75mA or more. The secret is to connect both of the SoundPAL's outside pins to ground and the middle pin to the positive supply, viz:

As shown in the above schematic, a switch can be added to actuate the SoundPAL. This could be a toggle switch, a door switch, a relay, or anything that will switch the appropriate voltage and current to the SoundPAL's supply pin. The switch can also be placed in the ground circuit instead, making it possible to actuate the SoundPAL with an open collector NPN or N-channel MOSFET. The following schematic shows a SoundPAL with a transistor switch and Enable input:

Raising Enable from low to high will start the SoundPAL's programmed sequence.
To program the SoundPAL for autonomous operation, refer to the documentation on page 8 ("Saving Sequences to EEPROM" and "Autoplay Mode"). Here you will see that any sequence saved to EEPROM, beginning at address 1, will autoplay on startup when used with the above circuit. Here's some example PBASIC code that programs the SoundPAL to play Reveille (one of the SoundPAL's predefined sequences) on startup:
It will play Reveille once, then stop. To play it again, the SoundPAL must be powered off, then back on again. It's also possible to play sequences in a continuous loop until power is removed. See the manual under the "Repetition" subsection. (The predefined "siren" sequence works this way.)
In addition to simple doorswitches and the like, you can also set up the SoundPAL to playa programmed sequence when a light comes on (or goes off). Possible applications are:

The two NAND gates form a one-shot that's triggered when the light, striking the photo resistor, pulls U1a's lower input low. Once this happens, the output of U1b, which is normally high, goes low and stays low for about 45 seconds (a funciton of the 2.2M resistor and 22µF cap) — long enough for most finite sound sequences to play. When U1b's output goes low it turns on the PNP switching transistor, providing power to the SoundPAL. The 45-second interval is fixed and will not vary, regardless of what the light sensor sees during this time. Also, to start a new 45-second "on" interval, the sensor must detect dark again, then light, once the prior interval is over.
It should be possible to operate this circuit from batteries for a very long time. Total idle current drain in the dark is about 10µA; in the light, about 60µA. The current consumption increases dramatically while the SoundPAL is playing, of course; but if this happens infrequently, battery life will be extended. A good source of power would be three AAA cells in series, providing 4.5V. Another option is four NiCads or NiMHs in series, for a solid 5V supply.
If you choose to use 6V, the 74HC00 will be happy, but you should add a 5V regulator in series with the PNP's collector and the SoundPAL (with the appropriate filter cap). Do not run the regulator directly from the battery. Most regulators have too high a quiescent current and will drain the battery more quickly.
For higher voltages (like a 9V battery), switch to a CD4011B quad NAND gate, which can tolerate up to a 15V supply. Watch the pinout, though: it's different from the 74HC00!
Some additional notes:
As shown in the above schematic, a switch can be added to actuate the SoundPAL. This could be a toggle switch, a door switch, a relay, or anything that will switch the appropriate voltage and current to the SoundPAL's supply pin. The switch can also be placed in the ground circuit instead, making it possible to actuate the SoundPAL with an open collector NPN or N-channel MOSFET. The following schematic shows a SoundPAL with a transistor switch and Enable input:
Raising Enable from low to high will start the SoundPAL's programmed sequence.
To program the SoundPAL for autonomous operation, refer to the documentation on page 8 ("Saving Sequences to EEPROM" and "Autoplay Mode"). Here you will see that any sequence saved to EEPROM, beginning at address 1, will autoplay on startup when used with the above circuit. Here's some example PBASIC code that programs the SoundPAL to play Reveille (one of the SoundPAL's predefined sequences) on startup:
' {$STAMP BS2} ' {$PBASIC 2.5} io PIN 15 baud CON $8000 + 84 reveille CON $5D 'Reveille play CON $01 'Play the segment at the following address ($01-$FF). PAUSE 10 'Wait for SoundPAL to come out of reset... DO : LOOP UNTIL io SEROUT io, baud, [noparse][[/noparse]"=", play, reveille, 0, "#", 1] 'Program "Reveille" to begin at location 1.
It will play Reveille once, then stop. To play it again, the SoundPAL must be powered off, then back on again. It's also possible to play sequences in a continuous loop until power is removed. See the manual under the "Repetition" subsection. (The predefined "siren" sequence works this way.)
In addition to simple doorswitches and the like, you can also set up the SoundPAL to playa programmed sequence when a light comes on (or goes off). Possible applications are:
- Including a circuit in a gift box to play "Happy Birthday" or "We Wish You a Merry Christmas" when it's opened.
- For dieters, a circuit placed in the fridge that plays "Baby Elephant Walk" when the door is opened and the light comes on.
- An alarm clock that plays "Reveille" or a rooster crow when the sun comes up.
The two NAND gates form a one-shot that's triggered when the light, striking the photo resistor, pulls U1a's lower input low. Once this happens, the output of U1b, which is normally high, goes low and stays low for about 45 seconds (a funciton of the 2.2M resistor and 22µF cap) — long enough for most finite sound sequences to play. When U1b's output goes low it turns on the PNP switching transistor, providing power to the SoundPAL. The 45-second interval is fixed and will not vary, regardless of what the light sensor sees during this time. Also, to start a new 45-second "on" interval, the sensor must detect dark again, then light, once the prior interval is over.
It should be possible to operate this circuit from batteries for a very long time. Total idle current drain in the dark is about 10µA; in the light, about 60µA. The current consumption increases dramatically while the SoundPAL is playing, of course; but if this happens infrequently, battery life will be extended. A good source of power would be three AAA cells in series, providing 4.5V. Another option is four NiCads or NiMHs in series, for a solid 5V supply.
If you choose to use 6V, the 74HC00 will be happy, but you should add a 5V regulator in series with the PNP's collector and the SoundPAL (with the appropriate filter cap). Do not run the regulator directly from the battery. Most regulators have too high a quiescent current and will drain the battery more quickly.
For higher voltages (like a 9V battery), switch to a CD4011B quad NAND gate, which can tolerate up to a 15V supply. Watch the pinout, though: it's different from the 74HC00!
Some additional notes:
- In principal, a TLC555 or LM555C timer chip could be used instead of the two NAND gates. They have a slightly higher current drain, however, which is the reason I chose the the NAND gates instead.
- It's very important to tie the input pins of the two unused gates to ground or Vdd. If these are left to float, current consumption will go up substantially.
- The NAND gate circuit has been tested on a wireless breadboard and is known to work down to about 4.5V. You can extend this range to about 3.5V by attaching a 100µF cap between the SoundPAL's supply line and ground. This is necessary to filter current spikes which would otherwise pull the supply voltage below the SoundPAL's brownout voltage. The cap puts a bit of a strain on the switching transistor when it first gets charged, but I haven't seen any problems resulting from that.
- To make the unit play when things get dark, instead of light, swap the photoresistor and 100K resistor.
- The photoresistor can also be replaced by an intermittent switch or relay, such as might be found in an infrared motion detector.