Hi I am working on a project and I would like some help with programming Arduino Nano, my goal is to have some audio files played when a motion sensor is activated but when a specific audio is played I would like two LEDs to turn off and the lest of the time the LEDs to stay on. If I could please get help with the coding I would very much appreciate it.
-
Tell us what hardware and software experience you have.
-
Here is a generic discussion (Post #1425) that might help you get started.
Another resource is the Arduino Project Hub. Of course google as well. Even very experienced programmers often start with example code.
Sounds Halloween... many projects are on this forum. Maybe @hallowed31 has ideas?
Which Arduino? What sort of audio files? Where and how will the audio be stored? How will the audio be amplified and played?
These days the word "Nano" is just the form factor (the size of the board). I have lost count but there are at least 6 different types and counting.
I am assuming that you have the one on the left, which is a "classic nano".
The problem with that is it can only store enough for about 2 seconds worth of sound. So single words only.
In order to produce longer sounds / music, you need an extra component called a DF board. This is an example using one of these players.
There are several different types of these boards as @jremington says.
These boards can be controlled by an Arduino nano classic. You can even get versions that can play many files at the same time, but these are expensive.
does " and the lest of the time" actually mean " and the rest of the time"?
Is so you can use this circuit:-
Pin 14 of the Arduino is the analogue input, and this will give a reading that changes with the envelope of the inputted sound. So you can use this value to change what LEDs are on or off.
Nano V3, the files will be MP3 stored on micro SD card placed in a DollaTek TF Card U Disk Mini MP3 Player Audio, they will be short sounds.
I too would recommend the DFR MP3 Player module, which would make it easy to achieve what you describe.
If you go ahead with that, do some basic reading. And.search this forum for the hundreds of posts on it. Then come back if you still need to.
It would be helpful to know your skill level, such as whether you have already completed other Arduino projects.
What code have you written so far? What issues are you have encountered with it? If you can post your current code - using the <CODE/> option in the post editor toolbar to enclose and highlight it - then we might be able to help with whatever problem you are stuck on.
I haven't made any coding yet I have found a few codes online that would help with the lights,sounds and sensor but they are not all as one code.
Was meant to put rest but made typing mistake
Is it possible to combine two codes? iv found two codes from Rachel Deb Barros, one code does the light and the other does the sound.
It might be, but without seeing the code, how can we tell? ![]()
In any case, first better test each example individually to see whether it does what you want it to do or whether it will need tweaks or additions. IF they do work and do what you want, then try to understand how they work. One you understand how each example works, THEN you will be in a better position to answer your own question and understand the reasons for any replies that might be given here.
That Dollatek module looks very similar to the DFR module. I’m fairly confident it can use the DFR library. Try it.
And a while ago I wrote a sketch for a circiiit that uses a PIR sensor to trigger MP3 recordings. Conditionally switching LEDs would be a trivial addition.
As per my earlier post 8, come back when you have made a start on your sketch and circuit to discuss further.
Coding and hardware are both your issues. If you do not know what hardware you have it is impossible to do any coding!
So please do not go on about not having issue with the hardware. as I said:-
Your project can not be done with the controller you have. You have to get additional hardware.
If you knew exactly what you needed you would not be asking questions. The question is impossible to answer because you are fixated in ignoring the hardware you need.
If you just want simple snatches of sound I can show you how to do that but it would not fulfil your aim of
I am not storing the sound on the nano I'm storing it on the player module. I am also using this Trigger Sound Effects with Arduino & PIR Motion Sensor as guidance and I have personally contacted them regarding the code and they said it would work with my board.i appreciate the help so what board would you recommend.
If you reply to a specific person you should use the small Reply icon at the bottom right corner of if. Or make it clear by your wording. As I have done in this reply to you.
You seem to say your board is satisfactory but then ask what board we recommend. Please clarify.
I’ve had no reply to my post 15.
I originally clicked to send you a direct message but for some reason It has done it as a post reply.
I was asking about the board because I wanted an opinion especially if you guys think their is a better board to use.
if you just want to play sounds from a DFPlayer and switch on or off some LEDs controled by binary events (PIR sensor) you can use any Arduino board even the most basic if you want and any of all available NANO boards out there on the market will do the job and you can even add more devices (e.g. OLED or TFT display)





