Line 35 in the sketch: pinMode(2,INPUT);
Digital pin number 2 is declared as the input that triggers the action. So there you have to connect the PIR output. Or you can change it to another input of your choice changing that number.
I've connected the yellow wire to pin 2, the red wire to 5v, and the black wire to ground. I'm not receiving any sound when I walk in front of the sensor, do I need to name my files something specific?
Start with a simple sketch that will tell you if your PIR sensor is working:
void setup() {
pinMode(2, INPUT_PULLUP);
pinMode(13, OUTPUT); // Built in LED
}
void loop() {
digitalWrite(13, digitalRead(2));
}
With the PIR disconnected, the 'L' light should come on.
If you connect Pin 2 to Ground, the 'L' light should go off.
If you connect your PIR as you did above, the 'L' light should tell you the state of the PIR output.
When disconnected, light 13 stays on. When connected, light 13 turns on when I wave my hand in front of the sensor. I'm not sure how to connect pin 2 to ground
emgen277:
When connected, light 13 turns on when I wave my hand in front of the sensor.
Sounds like the PIR is working correctly with INPUT_PULLUP. Try using INPUT_PULLUP in your full sketch in place of INPUT. It might be that the PIR output is Open Collector/Open Drain and needs a pull-up resistor.
I suspect something is wrong with my micro sd. I have an 8GB Unirex sd card. I've loaded the player_simple code under "File->Examples->Adafruit_VS1053->player_simple" to see if the music maker will even read and play the mp3 files properly. This is the readout I get on the serial monitor. I don't understand where the "SYSTEM~1/" directory is coming from. I've been following this guide and they don't have a directory like that on their sd card.
Common (HC-SR501) PIR sensor modules have a normal 3.3volt digital output.
They don't need pull up.
You do have to adjust the time pot to minimum (anti-clockwise) before using it with the Arduino.
Otherwise the output will stay HIGH for about three minutes after (each) trigger.
That could upset the timings in your software.
So time pot fully anti-clockwise, but leave the sensitivity pot in the middle (does not adjust sensitivity).
Agree with wvmarle about formatting the card.
Operating systems leave a lot of hidden junk behind.
I also think filenemes should be in 8.3 format.
Leo..
I've formatted the sd card several times and am still getting the same result. Since the PIR Sensor seems to be working fine, I am now working with the player_simple program under "File->Examples->Adafruit_VS1053->player_simple".
I've changed line 63: printDirectory(SD.open("/"), 0); is now: printDirectory(SD.open("/mp3s/"), 0);
I've also changed lines 77 and 80: musicPlayer.playFullFile("track001.mp3"); is now: musicPlayer.playFullFile("/mp3s/track001.mp3");
same with line 80 respectfully
With these changes, my readout is now:
Adafruit VS1053 Simple Test
VS1053 found
Playing track 001
Playing track 002
Done playing music
My shield still isn't playing any music, but at least the readout is the same as the tutorial...