I'm using the following circuit to try to simulate a button press in a speaker:
This is supposed to wait 2 seconds, set the output high for ~500ms and then set it to low.
The output of the NE555
is connected to a transistor that is actually driving the switch's contacts, when the transistor switches on, for the duration of the 500ms, the button is "pressed", as if I did it manually.
Note: AD_KEY
is an ADC input on the speaker's MCU, it checks for a certain voltage provided by the voltage divider when the button is pressed.
I get 5V from the 5V pin of an USB connector somewhere inside the speaker.
The problem is that the circuit only works in certain conditions. I have made an equivalent circuit using an Arduino, the arduino project works 100% of the time without a doubt.
This circuit is problematic since the first time I power on the speaker, it doesn't work, although the output of the NE555 is properly generated - using a voltmeter I can see the voltage going up after 2 seconds and after ~2.5 seconds I can see it quickly going to 0V. If I turn the power off and measure (again, using a voltmeter) the output of the NE555, then I can see it slowly going from 1V to 0V, although after the 2.5 initial seconds have passed it was always 0 while the speaker was on - as you'd expect. Then if I turn the speaker on when the output is still in the 0.1V - 0.2V range: the circuit works every time. So power on during 0.1-0.2V window, power off, wait, again power on while the NE555 output is in that range, it works! However if I wait for that output voltage to drop very close to 0V and power on the speaker, the circuit no longer simulates the button press (on the voltmeter I can see that after 2 seconds the output voltage doesn't rise again). The same goes for quickly powering on the speaker after powering it off.
So a capacitor is discharging on the out of the timer IC? Why does it work if I power on the speaker in that 0.1-0.2V range of the output pin?
And to add to the confusion: A similar situation happens on a breadboard with an LED instead of the MCU, but this time, the circuit only works if I allow the out voltage to completely drop to 0V.
PS: This is related to: Pressing a physical button, but digitally using an Arduino in an existing circuit