Delay ON Timer

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
hockeyboy423
 
Posts: 11
Joined: Fri Jul 16, 2021 8:28 pm

Delay ON Timer

Post by hockeyboy423 »

So i’m fairly new to circuitry and such and i’ve been working on a small project that uses an adafruit sound board and my current struggle is attempting to make a timer on delay circuit to use to delay the power on of the sound board once power is connected (no use of buttons). I have tried using a 555timer to get a delay but the capacitor on the circuit holds a charge and the next time the 555 timer gets power theres no delay unless I manually discharge the capacitor. any help or input would be greatly appreciated, thank you

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Delay ON Timer

Post by adafruit_support_mike »

It’e even easier than using a 555: just connect a 10uF capacitor between GND and the FX trigger pin that should fire when things power up.

A capacitor’s voltage depends on the amount of charge (electrons) inside it.. the capacitor’s value is the amount of charge necessary to produce 1V between the capacitor’s terminals. For a 1uF capacitor, it takes 1 microcoulombs (1 Coulomb = 6.25e18 electrons) to get 1V .

Charge moving from one place to another is called ‘current’, and the unit of current is 1A = 1 Coulomb of charge per second. If you feed current into a 1uF capacitor at 1A, it will take 1 microsecond for the capacitor’s voltage to change by 1V.

The FX Boards trigger pins need to stay low for about 125ms to play a sound, and we can say anything less than 1V counts as ‘low’. If it takes 10uC of charge to get 1V across a 10uF capacitor, and we want it to take 125ms to get that much charge into the capacitor, our current is 10uC/125ms = 80uA.

There are circuits that can deliver 80uA at any voltage, but there’s an easier option: use a resistor.

The amount of current that flows through a resistor is proportional to the voltage across the resistor. The unit of resistance is the Ohm, and 1Ohm = one Volt per Amp, or 1V/1A.

Charging a capacitor through a resistor makes things a little complicated because the voltage across the resistor changes as the capacitor voltage changes, and the current flowing into the capacitor depends on the current flowing through the resistor.

Getting the exact solution for that takes differential equations, but we can take a good first crack at it by using finite difference equations: instead of trying to charge the capacitor all the way, let’s limit the problem to the amount of time it will take to charge it a little way.. that’s easier to describe in terms of the resistor voltage, so let’s make the question, “how long does it take for the resistor voltage to lose 1/1000th of its starting value?”

That’s a question we can handle directly.. the change in resistor voltage is so small that there’s almost no change in the current. If we assume the resistor voltage starts at 1V and feeds into a 10uF capacitor, and the resistor’s value is 100k, the current through the resistor is about 10uA. It takes 10uF*1mV=10nC of charge to change a 10uF capacitor’s voltage by 1mV, and at 10uC/s, it takes about 1ms to get 10nC.

So for those values, it takes a millisecond for the resistor to lose 0.001 of its starting voltage.

If we do the same thing again for 999mV and a loss of 0.999mV, the nines cancel and we get 1ms again. The same is true for 998mV and a 0.998mV drop, and so on. It takes the same amount of time for the resistor to lose 1/1000th of its voltage, no matter what the starting voltage is.

From there, finding the time necessary to change the resistor voltage by any amount is just a matter of dropping 1/1000th over and over.

To change tracks slightly, we get some interesting results from looking at the component values in terms of their basic units: 100kohm is 100e3V/1A, and 1A=1C/s, so 100e3 Ohm = 100e3Vs/C. 10uF = 10e-6C/1V, and if we multiply those two values, the Volts and Coulombs cancel to leave: 100e3Vs/C * 22e-6FC/V=1s.

That value is called the ‘RC time constant’, and is the time it takes for the resistor to lose about 2/3 of its original voltage, no matter what the original voltage is.

Going back to the FX Board, the trigger pin needs to stay low for 125ms to play a sound. With a 10uF capacitor charging through a 100k resistor, it takes 1 second for the resistor to lose 2/3-ish of its starting voltage. If we assume the resistor voltage starts at 3.3V, it will lose about 2.2V by the end of the first second.

If we hand wave the details and plot a straight line that changes by 2.2V in 1 second, we’ll see about 275mV if change in 125ms. That’s a good enough of the real RC curve to feel comfortable saying the trigger pin’s voltage will stay low enough to trigger a sound for at least the 125ms we need.

The FX Board’s trigger pins have 100k pull-up resistors connected to 3.3V at their high end, so all the calculations above apply to the job at hand: triggering a sound when the FX Board gets power.

The 19uF capacitor will keep charging after the sound triggers, coming close to 3.3V within about 5 RC time constants (5 seconds). Then the pin will stay high and won’t trigger again until the capacitor discharges.. which will happen when you disconnect power, or connect a reasonably low resistance between the capacitor’s leads.

User avatar
hockeyboy423
 
Posts: 11
Joined: Fri Jul 16, 2021 8:28 pm

Re: Delay ON Timer

Post by hockeyboy423 »

I’m pretty sure I’m grasping what you’re saying but the current setup i have on the soundboard is already a 22uf capacitor and a 100k resistor that im using to trigger the pin on startup power of the soundboard but theres no delay for the trigger upon power up, is there anyway I can add anywhere from a 5-10 second delay for the soundboard to turn on?

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Delay ON Timer

Post by adafruit_support_mike »

Ah.. two timed events: a delay before the trigger pin goes low, then the pin stays low long enough to trigger the sound.

You could also rearrange that and say you want a delay between the FX trigger going low and the beginning of the sound. You could do that by adding a few seconds of silence to the beginning of the track.

A 555 can give you the initial delay, and you can connect a capacitor between the 555's output band the FX trigger pin:
555-delay.jpg
555-delay.jpg (251.09 KiB) Viewed 254 times
The diode on the FX side of the capacitor will discharge the cap every time the 555's output goes high. That guarantees no more than about 0.5V across the capacitor when the 555's output goes low.

You can discharge the capacitor even farther by connecting the diode to a lower voltage.. if you use a 10k-56k voltage divider between 3.3V rails, the voltage at the center of the divider will be about 2.8V. When the 555's output goes high, the diode will clamp the voltage at the FX side of the capacitor about 0.5V higher than 2.8V, which is 3.3V. The voltage across the capacitor will be close to 0V when the 555's output goes low.

If you want the 555's 10uF capacitor to discharge when power is disconnected, add a 3.3M resistor in parallel with the capacitor. The capacitor will discharge through the resistor when there's no power, with ac RC time constant of about 33 seconds. A 555 timer's voltage thresholds are 1/3 and 2/3 of VCC, which corresponds to one RC time constant of the timing capacitor, so it should give you another 10 second delay after the power has been disconnected for a minute or so.

User avatar
hockeyboy423
 
Posts: 11
Joined: Fri Jul 16, 2021 8:28 pm

Re: Delay ON Timer

Post by hockeyboy423 »

I don't quiet know what it is I did wrong but I tried the diagram you prepared for me and for some reason it isn't working properly and I can't seem to figure out why. I have power running to the board and the 555 and then I have the 555 output running to pin 1 but for some reason the pin never triggers.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Delay ON Timer

Post by adafruit_support_mike »

Check the voltage at the 555’s output. Does it stay high for a few seconds and then drop low?

User avatar
hockeyboy423
 
Posts: 11
Joined: Fri Jul 16, 2021 8:28 pm

Re: Delay ON Timer

Post by hockeyboy423 »

the output of the 555 stays at 8 volts and after the capacitor reads 1.5 volts and both values stay constant.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Delay ON Timer

Post by adafruit_support_mike »

Hmm..

Connect RESET to the Vcc pin.. it resets the 555 when connected to GND, and shouldn’t really be left floating.

Also try toggling the TRIGGER pin high then low. That should start a pulse.

The capacitor voltage should rise to 2/3 of Vcc while the output is high, then drop to 0V when the output goes low.

User avatar
hockeyboy423
 
Posts: 11
Joined: Fri Jul 16, 2021 8:28 pm

Re: Delay ON Timer

Post by hockeyboy423 »

I connected the RESET pin to vcc and it made no difference. Also I don't quiet understand what you mean about toggling the TRIGGER pin.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Delay ON Timer

Post by adafruit_support_mike »

Connect TRIGGER to Vcc and then connect it to GND. The circuit inside the 555 sees the voltage falling from high to low, and should respond to it.

Post a photo showing your hardware and connections and we’ll look at those too. 800x600 images usually work best.

User avatar
hockeyboy423
 
Posts: 11
Joined: Fri Jul 16, 2021 8:28 pm

Re: Delay ON Timer

Post by hockeyboy423 »

Here is some photos of my current setup, sorry in advance for the messy breadboard if there is any other way you would like me to explain what I have setup or draw it up more clearly I'd be glad to do so.
Attachments
IMG-4669.jpg
IMG-4669.jpg (919.42 KiB) Viewed 234 times
IMG-4667.jpg
IMG-4667.jpg (894.94 KiB) Viewed 234 times
IMG-4666.jpg
IMG-4666.jpg (793.36 KiB) Viewed 234 times

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Delay ON Timer

Post by adafruit_support_mike »

Okay, I do see one issue: plugging jumpers through the holes in a PCB usually doesn’t work.

The standard solution is to solder pin header into the holes. The solder provides both mechanical support and an electrical connection. The non-soldering options use things like pogo pins or test points:

https://www.adafruit.com/product/2430
https://www.adafruit.com/product/3825

Those have some kind of spring that holds the contact against the metal on the PCB.

You can DIY a quick and cheap mechanical contact by pushing the end of a toothpick into the hole along with the jumper pin. The toothpick acts like a wedge that pushed the pin into contact with the PCB pad.

Get the connections to the FX Board solid and see if that has any effect on the circuit overall.

User avatar
hockeyboy423
 
Posts: 11
Joined: Fri Jul 16, 2021 8:28 pm

Re: Delay ON Timer

Post by hockeyboy423 »

Regardless of the connection to the board the the jumpers themselves aren't getting the proper voltage so even if the jumpers didn’t have a secure connection to the board then it wouldn’t make any difference.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Delay ON Timer

Post by adafruit_support_mike »

True, but connection issues can hide other problems, or create symptoms that are hard to understand.

For the short term, move the FX Board off the breadboard and focus on the 555 circuit.

As far as I can tell the connections look right, but the voltage on the capacitor doesn’t make sense for a 555. The value might be a result of meter loading though.. a voltmeter should have high resistance, but a 1M pull-up also has high resistance. Connecting the voltmeter could create a voltage divider.

Try connecting one end of the 1M resistor to VCC and measure the voltage at the other end (with all other connections broken). If the meter is loading the pull-up you’ll see a voltage lower than the supply voltage.

User avatar
hockeyboy423
 
Posts: 11
Joined: Fri Jul 16, 2021 8:28 pm

Re: Delay ON Timer

Post by hockeyboy423 »

I decided to try and revisit this project after failing to complete it the first time and I still seem to be having difficulties. I made the circuit online with a simulator and used the diagram above from one of the previous comments but the circuit still doesn't seem to work. There is no delay and the output is immediately at 5 volts, it seems to be skipping over the 555 and just going right to output
Attachments
circuit.png
circuit.png (33.92 KiB) Viewed 201 times

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”