How to make a -very- small button/speaker circuit?

Thread Starter

CocoaHere

Joined Jan 18, 2023
13
I need a circuit that turns on an LED and plays a sound repeatedly when a button is pressed, and stops the sound and light as soon as the button is released. It needs to be battery operated, preferably by coin or button batteries.

The issue is that I need it to be very small (1.5cm x 2.5cm), and I can't find a programmable chip that small that has documentation. Is there a way to make a sound circuit that small?
 

KeithWalker

Joined Jul 10, 2017
3,063
I need a circuit that turns on an LED and plays a sound repeatedly when a button is pressed, and stops the sound and light as soon as the button is released. It needs to be battery operated, preferably by coin or button batteries.

The issue is that I need it to be very small (1.5cm x 2.5cm), and I can't find a programmable chip that small that has documentation. Is there a way to make a sound circuit that small?
You only mentioned two of the required dimensions. What is the third?
You did not mention what type of music you want it to play; recorded mono or stereo, or just computer generated tones. If it is the latter, an ATTiny85 would do the job and would be much simpler to program than a Pic. It can be powered from button cells and will work with a supply of 3V to 5V. It is an 8 pin DIP and can be programmed using the Arduino IDE. There a examples of that type of program available on line.
 
Last edited:

Ya’akov

Joined Jan 27, 2019
9,072
Welcome to AAC.

Could you describe how this will be used? It’s a lot easier to provide good advice if we understand the application.
 

BobTPH

Joined Jun 5, 2013
8,813
“Plays a sound” could mean anything. Please clarify. If you just want a beep, all you need is a piezo buzzer and the switch.
 

MisterBill2

Joined Jan 23, 2018
18,176
I need a circuit that turns on an LED and plays a sound repeatedly when a button is pressed, and stops the sound and light as soon as the button is released. It needs to be battery operated, preferably by coin or button batteries.

The issue is that I need it to be very small (1.5cm x 2.5cm), and I can't find a programmable chip that small that has documentation. Is there a way to make a sound circuit that small?
Do you mean eachtime the button is pressed? or to launch a sequence of actions with a single button press???
 

Thread Starter

CocoaHere

Joined Jan 18, 2023
13
You only mentioned two of the required dimensions. What is the third?
You did not mention what type of music you want it to play; recorded mono or stereo, or just computer generated tones. If it is the latter, an ATTiny85 would do the job and would be much simpler to program than a Pic. It can be powered from button cells and will work with a supply of 3V to 5V. It is an 8 pin DIP and can be programmed using the Arduino IDE. There a examples of that type of program available on line.
Apologies for the lack of Info, and apologies for some slight corrections I need to make. After remodeling the part the new dimensions would be 1.1cm x 3.9cm. The space is cylindrical, with the shorter length being its diameter. There is a small opening near one end of the cylinder where a button will have an external physical component press it.
As for the sound, it will be mono, and very high pitched. It will most likely be an audio file rather than a beeper noise. Unless this sound would be easy to recreate with an ATTiny85, in which case I could most likely do some research into how to do that.
 

Thread Starter

CocoaHere

Joined Jan 18, 2023
13
Welcome to AAC.

Could you describe how this will be used? It’s a lot easier to provide good advice if we understand the application.
Apologies, Quick update, since I can't find how to edit my original post. The dimensions should be cylindrical, 1.1cm diameter x 3.9cm. It will be used in a small prop to play a high pitched noise. This is the noise I want to recreate, so if there is a way to generate it instead of using an audio file, that may work better for the small form factor.
 

sghioto

Joined Dec 31, 2017
5,380
the noise I want to recreate, so if there is a way to generate it instead of using an audio file, that may work better for the small form factor.
I suggest using a chip recorder like a surface mount ISD1610, wouldn't need a micro. How loud does it need to be?
 
Last edited:

djsfantasi

Joined Apr 11, 2010
9,156
Apologies, Quick update, since I can't find how to edit my original post. The dimensions should be cylindrical, 1.1cm diameter x 3.9cm. It will be used in a small prop to play a high pitched noise. This is the noise I want to recreate, so if there is a way to generate it instead of using an audio file, that may work better for the small form factor.
Sounds like a simple alternating tone between two high pitched frequencies. I think it would be fairly simple to generate on an ATTiny85.

I use the Arduino IDE and a programmer from Sparkfun to program the ATTiny85. There is a command, tone(), which plays a tone through a pin to a piezo speaker.

The following code example would work.

Code:
unsigned int hitone = somevalue;
unsigned int lotine = anothervalue;
unsigned int timetone = xxx;
unsigned int outpin = pp;

while (-1) {
   tone(outpin, hitone );
   delay(timetone);
   tone(outpin, lotone);
   delay(timetone);
   }
UPDATE: I missed the pushbutton switch. It is easy to modify the sketch to use a pushbutton. Let me know if you need help in modifying the code.
 
Last edited:

djsfantasi

Joined Apr 11, 2010
9,156
I suggest using a chip recorder, wouldn't need a micro. How loud does it need to be?
Size-wise, an 8 pin ATTiny85 would be the best choice. A couple of batteries, a piezo speaker and an 8 pin DIP should fit easily in the TS enclosure.
UPDATE; And a micro pushbutton.
 
Last edited:

KeithWalker

Joined Jul 10, 2017
3,063
Apologies for the lack of Info, and apologies for some slight corrections I need to make. After remodeling the part the new dimensions would be 1.1cm x 3.9cm. The space is cylindrical, with the shorter length being its diameter. There is a small opening near one end of the cylinder where a button will have an external physical component press it.
As for the sound, it will be mono, and very high pitched. It will most likely be an audio file rather than a beeper noise. Unless this sound would be easy to recreate with an ATTiny85, in which case I could most likely do some research into how to do that.
Here is a link to that:
https://www.arrow.com/en/research-and-events/articles/programming-attiny85-with-arduino
 

Ya’akov

Joined Jan 27, 2019
9,072
Apologies, Quick update, since I can't find how to edit my original post. The dimensions should be cylindrical, 1.1cm diameter x 3.9cm. It will be used in a small prop to play a high pitched noise. This is the noise I want to recreate, so if there is a way to generate it instead of using an audio file, that may work better for the small form factor.
So you want to make a sonic screwdriver?

You would be much better off making a long, thin PCB than a circular one.
 

djsfantasi

Joined Apr 11, 2010
9,156
Perhaps, but the ISD1610 has a built in amp and doesn't need programming.
I wasn’t aware of this chip. And I misread your post. I imagined a larger module with several components.

I agree that it looks like an excellent solution. I do have one question? Once the EOM is reached, will it repeat the sound if the play input is still low? The datasheet says it powers down. As it is a practical prop, I’d think the duration of the sound wouldn’t be a constant.

The PCB would have to include headers for the mic and a record switch. Neither would have to be connected during operstion.
 

Audioguru again

Joined Oct 21, 2019
6,674
A piezo transducer can produce the alternating high pitches of sound but not the low frequency buzzing sounds.
The supply voltage will need to be fairly high to produce loud squeak sounds.
 

sghioto

Joined Dec 31, 2017
5,380
I wasn’t aware of this chip. And I misread your post. I imagined a larger module with several components.

I agree that it looks like an excellent solution. I do have one question? Once the EOM is reached, will it repeat the sound if the play input is still low?
Not sure but can test later today as I have that chip.
What's the max time you need the sound for when the button is pressed?
 

Audioguru again

Joined Oct 21, 2019
6,674
The 16 years old datasheet for the ISD1610 recorder chip shows a low digital sample rate but it might play the squeaks fine.
Try it. A newer, better and cheaper chip might be available.
 
Top