Using a Car Door Pin to trigger an Event with an Trinket

Adafruit's tiny microcontroller platform. Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
joshuakane
 
Posts: 282
Joined: Sat Apr 13, 2013 4:40 pm

Using a Car Door Pin to trigger an Event with an Trinket

Post by joshuakane »

Hello,

I was thinking of setting up a Trinket to launch a sound event on one of the AudioFX boards. In this case I want a sound to play every time I open my Car Door. I know the AudioFX board has triggering for button state changes, but I was wondering how to trigger it for a door pin that is always closed? I want the event to fire when the door opens. Would it be as simple as setting the pin to "LOW" and when it opens setting it to "HIGH"? I I wanted to use the existing door wiring for the pin. It looks to just be a wire delivering current that is "off" when the door is closed and "On" when it is open. Can I attach to this, and run ground to the body of the car to tell when the state changes?

Thanks,

Joshua

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Using a Car Door Pin to trigger an Event with an Trinket

Post by mikeysklar »

Joshua,

You have the right idea with the AudioFX. I don’t see the Trinket as being necessary.

If you can wire your door to pull to ground when open (eg. play sound). If for some reason the existing built-in cannot be used there are other conductive materials and sensors that might work for you as alternatives.
Remember, you don't have to use a mechanical button or switch - you can use conductive thread, tilt switches, two pieces of tinfoil, the output from some other electronic thingy, just anything that will send a ground signal to the pin.
https://learn.adafruit.com/adafruit-aud ... ring-audio

User avatar
joshuakane
 
Posts: 282
Joined: Sat Apr 13, 2013 4:40 pm

Re: Using a Car Door Pin to trigger an Event with an Trinket

Post by joshuakane »

On this one, I decided to go just with the AudioFX.

If I connect it to the existing door pin I get the following behavior

1) Tnn - (Button Push) Sound plays over and over again, as long as the car door is open
2) TnnLATCH - (Latching) The door plungers are on a spring, so the latching files will only work every other open

Is there a way I can set it to just play the sound once on opening the door?

Thanks,

Joshua

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Using a Car Door Pin to trigger an Event with an Trinket

Post by mikeysklar »

Initially I thought a basic trigger would have worked since it is only supposed to play the Tnn audio file once from beginning to end. The Advanced Background/Foreground suggests adding a NC (normally closed switch) in the circuit to avoid the looping problem.

https://learn.adafruit.com/adafruit-aud ... -1137397-8
The problem here is that you can't release the looping sound since its tied to ground. You could have one button held down all the time or try a latching loop but it's a lot easier if you just use a switch that has NC (normally closed) and NO (normally open) contacts - sometimes called a DPST (double pole single throw) switch

Most low cost switches and buttons do not have a normally-closed output, so make sure to check the specifications. This switch is a good example of one with both, and it even has nice markings!

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

Return to “Trinket ATTiny, Trinket M0”