Hi, I want to create a JDM Melody Box that plugs into my USB input of my car. I want it to play a greeting track once the ignition starts and the USB power turns on, and then a farewell track when the ignition is turned off (along with the USB power).
I think I need an Arduino Nano, DFplayer mini and a small speaker. I understand how to get it to work when there is power for the greeting track. However, unsure how to have it play the farewell track when the power is switched off.
I have never worked with Arduino's or electronics before but keen for this to be my first project to learn.
That sounds like an interesting project but at this point I feel it will be very difficult for you to proceed successfully with it, I highly recommend you get a copy of the Arduino Cookbook and go through that first, that will give you a basic idea of what you want to do.
It is a very doable project and with a bit of background you will be able to accomplish it. Also realize the automotive 12V system is one of the worst to work with because of environmental factors
Assuming the USB stays powered when the ignition is turned off is questionable. If it does not stay on you can use that to start it but you will need another 12V feed to make it play when the power is turned off. You might consider triggering it with the inside (dome) light circuit.
Hello,
Thanks for the reply and the advice. I will give that book a read.
From what I have read online, my car USB turns off when switched off. Could I use some small capacitor to feed it power when its detected the USB power is off so that it can play the farewell track? And is there an easy way to detect that the USB is no longer powered?
I assume you have never used your car’s USB socket for any purpose before, or you would obviously know! So plug your phone in and see if it still charges.
It can become a little complicated.
You will need a battery to power the Nano when the USB power goes off.
You will need a way to charge the battery when the car is running.
You will need a way to switch the Nano power between USB and battery
You will need a way to disconnect the battery from the Nano when it plays the goodbye.
However, if you don’t mind replacing the battery when it dies, then the simplest solution would be to always power the Nano from the battery and just detect when the USB is on/off.
Without going into a lot of detail: Think about using a time delay relay that is activated by the presence of USB voltage when the ignition is turned on and continues to supply battery voltage to the Arduino for a period of time after the ignition is switched off. There are mechanical relay solutions as well as possibly a solid state solution from companies like Pololu.
It depends how hifi you want it to be. If you are ok about a simple square wave through a piezo then something much smaller will suffice. (just popped into my mind that there are ways to turn a square wave into something different)
That depends on the amount of power you need. A big capacitor might be sufficient