Creating a burst fire circuit. Facing problems with sound volume.

Hi!
I’ve been tinkering with a circuit for an old Robocop action figure. I wanted to mimic the burst fire of his gun with light and sound. The circuit works and the idea is that I should transfer it to an ATtiny45 when I’m done. But the sound is way too weak and my question is. How do i make it sound louder? I’m not too well-versed in electronics components, but the “speaker” that is used, isn’t it a solenoid that gives off some sound?

I started this 2 years ago and then put it away because I was moving and took it out just now so I can’t remember exactly how everything was connected originally. But I took a picture of this little chip.

The parts that was there originally was a 220k ohm resistor, a C9013 transistor, a 3mm red led and a “speaker”. I’m thinking that it’s not an advanced circuit and that you in here woulda understand just how it was connected originally. Afaik the transistor is what was used originally to create the machine gun sound. A consecutive fire with pauses in between.

This is my code:

int BUTTON_PIN = 7;
int led = 8;
int buttonState = 0;
int delayTime = 45;
void setup() {
  pinMode(led, OUTPUT);
  pinMode(BUTTON_PIN, INPUT);
  Serial.begin(9600);
}

void loop() {
  buttonState = digitalRead(BUTTON_PIN);
  Serial.println(buttonState);
  
  if(buttonState == HIGH){
    digitalWrite(led, HIGH);
    delay(delayTime);
    digitalWrite(led, LOW);
    delay(delayTime);
    digitalWrite(led, HIGH);
    delay(delayTime);
    digitalWrite(led, LOW);
    delay(delayTime);    
    digitalWrite(led, HIGH);
    delay(delayTime); 
    digitalWrite(led, LOW);
    delay(300);    
    buttonState = LOW;
  }
  

}

And this is the circuit in action:

Dagwood:
I wish I could provide a schematic, but I used this video where it is more clear how it's connected.

If you know how it's connected, please sketch a schematic using pencil and paper if necessary. Few helpers here have time to sit through videos.

Please read the how to use this forum sticky post, it will tell you how to post pictures as attachments.
Imgur infests your bowser with all sorts of crap and few people here will look at pictures on that site.

ah ok. thanks. i'll update the post

The OP's images

Well it is interesting, and rather unconventional, having the sounder and LED in series. I am not sure it is a good idea as you don't have much control of the current and you are reducing the voltage across your sounder.

I would use two outputs, one for the LED and include a 220R resistor where you have the sounder now. And another separate output for the sounder that you initialise, turn on and off exactly like you do with the LED now.

Can you measure the resistance of that sounder? if it is greater than 125R ( ohms ) then you can connect it directly to the Arduino pin. Otherwise, if it is lower put a series resistor in to make up the total resistance to 125R, or there abouts. It should be much louder.

isn't it a solenoid that gives off some sound?

Not quite. There are two types that look identical but have very different insides.
One has a coil and it attracts a thin steel diaphragm to flex it and generates the noise. This is likely to have a low resistance.
The other type has a Piezo element and is likely to be high resistance ( we say impedance but it almost means the same thing ).

Thank you so much. I tried setting two outputs, one for the led and one for the speaker, but it didn't make a difference. Taking out the switch made the buzzer louder, but I would really need the switch to be included. Well it doesn't really matter, because when I tried to put it all together, there was no way it would fit as I thought. I would have to 3D-print my own figure and dimension it for the components. But it was nevertheless a good learning experience. And the transistor did help in boosting the volume.

I don't really understand how I would connect the circuit with the switch to be able to power the speaker to its full potential.

The switch should have no effect on the volume you must be doing something wrong if you are finding that it is.

You need to post a photograph of your wiring To have any chance of understand what it is that is wrong.

As to the size, well, a Mega is very big, you could use an ATtiny to get the size down.

Hi,
Did you take note of how the module was wired in the original circuit?

The picture of the module doesn't tell us much as you have not noted the wiring connections.

As @Grumpy_Mike has suggested, a picture of your project will help.

Do you have a DMM?

Thanks.. Tom... :slight_smile:

Grumpy_Mike:
The switch should have no effect on the volume you must be doing something wrong if you are finding that it is.

You need to post a photograph of your wiring To have any chance of understand what it is that is wrong.

As to the size, well, a Mega is very big, you could use an ATtiny to get the size down.

Hm, yes, but I tried rewiring it and as soon as I plugged in a limit switch to be read if it's open or closed, the volume decreased.
But the idea was to transfer it to an ATtiny, but it still wouldn't fit inside the body of the toy so I just scrapped the idea altogether.

TomGeorge:
Hi,
Did you take note of how the module was wired in the original circuit?

The picture of the module doesn't tell us much as you have not noted the wiring connections.

As @Grumpy_Mike has suggested, a picture of your project will help.

Do you have a DMM?

Thanks.. Tom... :slight_smile:

No sorry, that was a really worthless picture. Don't mind it. But I wouldn't have used that at all if I'd replace the electronics.

but I tried rewiring it and as soon as I plugged in a limit switch to be read if it's open or closed, the volume decreased.

That means you are making the same mistake again. What that mistake is we don't know because you are not posting a good picture of your wiring. I repeat that there is no way that using that switch will effect anything providing it is wired up like shown. You could have the resistor at the wrong value or the micro switch contacts not match what you show on the Fritzing thing.

The point is that while you don't want to proceed with the project you are making a mistake that you do not realise is a mistake. So if you just forget it then next time you come to do the same thing you will make the same mistake again, and we will have to start all over again. So to save everyone's time lets try some education now.

Grumpy_Mike:
The point is that while you don't want to proceed with the project you are making a mistake that you do not realise is a mistake. So if you just forget it then next time you come to do the same thing you will make the same mistake again, and we will have to start all over again. So to save everyone's time lets try some education now.

You're right. I just don't have it wired up anymore and it was a pain in the ass to paint it out as I did in the first image. I really would need a better tool. Also I'm having not much time these days, but I understand your frustration and I would like to actually understand what I did wrong. I'll take some time for it soon and reply to this thread.
I'm really grateful for all help.

OK no problem when ever you are ready. I get notifications when ever a new post is made in this thread.