Behavior Change from USB to 5v DC transformer

I’m working on a project that involves a pressure sensor that responds to pressure with the playing of an audio file. Everything goes as planned when the Arduino is powered through my laptop usb, but once I power it through the DC it begins to loop the audio files on its own, without any pressure being applied. If I apply pressure when it is powered through the DC, it will still respond with the audio file, but it then continues to play through them on its own. I am very new to Arduino, so this is probably a simple correction that I’m unaware of. I’ve attached the code as well.


beaupreproj_mmedit1.ino (4.61 KB)

You don't say how you are applying the 5v. If you are using the barrel jack, 5v is not enough for reliable operation.

Thanks for the response, I've tried both the barrel jack and the usb with a power brick and have gotten the same results for each.

You may have a similar problem with a 5v on the USB port. Voltage OK in theory but inadequate current. (And yes, it is possible to have the problem with a computer USB port)

I see, what could be a solution to this? The project is for a show and I'm a student so I can't quite leave my laptop at the gallery all day.


IF everything works OK with power from the USB port on the laptop, AND doesn't when powered by other means, then clearly you need to change the other means. You need to check the current output of your 5v source. It must be pretty poor, as USB ports are not famous for high power output, but it may just be a bad cable. The most common and reliable means is a 9v 1A wall wart. The system is not very efficient, but it works.

Forget the barrel jack if you have anything less than 7v.