Intro :
Hello everyone! Currently I'm working with Arduino ATMega2560
As you know there are 2 ways to power arduino
1st by connecting it to arduino via USB
2nd with an external power source
currently I'm using the same as this one
http://playground.arduino.cc/Learning/9VBatteryAdapter
yup, I'm also using the 9V
On my arduino there are :
1 SD Shield with an SD Card
5 TCRT5000 infrared sensor
some resistor
I don't know whether this information will help or not
The problem :
when I connect the arduino to computer via USB, the arduino works well. It could record the data from the infrared to the SD Card
But a problem occurs when i connect it to an external power source
Condition :
- The arduino is turned on (the red lights and the green lights are on)
- it seems normal
- When I eject the SD card from the arduino and read it on my computer, There is no data inside it
Assumption :
- I don't know if this is a coding problem or not
- Maybe a power problem?
Since you suspected your code, you should have posted it. If you suspect power, why not getting an AC adapter instead of a 9V battery? You might be both right.
Ah I did a simple test with this code that I found (credit to Jerremy blum)
And it turns out that the SD card won't record a simple hello :S
#include <SD.h>
#include <SPI.h>
//SPI Settings
//MOSI, MISo, SCLK Set by default
int CS_pin = 10;
int pow_pin = 8;
void setup()
{
Serial.begin(9600);
Serial.println("Initializing Card");
//CS Pin is an output
pinMode(CS_pin, OUTPUT);
//Card will draw power from Pin 8 so set it high
pinMode(pow_pin, OUTPUT);
digitalWrite(pow_pin, HIGH);
//Check if Card is Ready
if(!SD.begin(CS_pin))
{
Serial.println("Card Failed");
return;
}
Serial.println("Card Ready");
}
void loop()
{
String dataString = "Hello";
//open a file to write to
//only one file can be open at a time
File dataFile = SD.open("log.txt",FILE_WRITE);
if(dataFile)
{
dataFile.println(dataString);
dataFile.close();
Serial.println(dataString);
}
else
{
Serial.println("Couldn't access file");
}
delay(5000);
}
Same problem,but I already change the battery into a 12v and used an adapter to change it into 9v
It works well when I connect it into USB to computer and monitor it with a serial monitor. Any suggestion?
What do you mean by not recording? Did you get failure in opening file, starting sd card, or no error but just no text file with hello?
What is a 12V to 9V adapter? Do you have any pictures of your set up?
Hi !
I'm having the same problem as you do. Have you figured out any solution?
Cheers
gabrielcbco:
Hi !
I'm having the same problem as you do. Have you figured out any solution?
Cheers
As you should have recognized, the post is a few month old. Why not starting a new post?