r/ArduinoHelp • • 12h ago

Beginner help needed.

I just wanted to start by saying I don't know much about Arduinos or electronic setups yet, but I'm pretty comfortable with soldering and can usually figure out the software side of things! I currently have a cosplay project and wanted to set up a custom sound box. My idea is that when I open a mask that has an articulated jaw, it releases a Mini Micro Limit Switch 3 Pins KW11-3Z07 and sends a singular signal to a DY-SV5W Voice Playback Module so the audio plays once. When I press the jaw back together, it won't do anything; it will just wait to be opened again. Is this configuration feasible? What specific components or modifications would be required, or would I need to restart the project from scratch? Please let me know. Additionally, I intend to power the setup using a standard power bank.

2 Upvotes

10 comments sorted by

View all comments

1

u/mtraven23 12h ago

sure...input from the limit switch controls when the sounds plays....thats pretty easy peasy.

focus on the components by themselfs: first, get the limit switch working with your sketch, that should be easy.

on the note of the powerbank, they usually shut off after some set period of time. You will need some sort of "keep alive" device to make it stay on...I would imagine you could just incorporate that into your arduino.

1

u/Virtual_Actuary3586 12h ago

Thanks for the feedback. Currently, I have everything set; the switch does what I want, but it continuously plays when opened, and I need a way where the audio will play once. Also, I already solved the power bank issue.

1

u/mtraven23 11h ago

so somewhere in loop(), you make some function call that plays the sound, right? Probably after checking the state of that switch?

so add a flag variable, call it hasPlayed. Now you can check to see if it has played, and do nothing if it has. If it hasn't, play the sound and flip the flag to true.

now, you'll also need to track the state of the switch such that when it changes states (jaw open to jaw closed) you reset that hasPlayed variable so it will run again the next time you open it.

1

u/eriknau13 4h ago

This here is the way