So there is my simple problem, i got a dataloger and i record data on sd card
but the actual arduino start recording only if i open Serial Monitor once if i plug the arduino
on non usb external power/ battery the (TX Led) don't start transmit data/ record data.
Is there a way to active the dataloger without the computer/Serial Monitor?
Domino60:
How do i make the arduino to start record when it's powered with external battery?
Perhaps by ensuring that the battery is appropriate for the job. If it is a 9v pp3, it surely isn't. The code looks rather incomplete, but if it works when you get power off the USB, I guess it isn't the problem.
I didn't posted all the code because I have multiple sensors and the code is big as hell to post it here
I just posted the main sensor serial and datalog to give an example how it works.
the arduino/SD card module start record data when the serial monitor opens at least once if i plug off the USB and power the module from external battery there is no way how to open serial monitor and the arduino/ SD card don't run (the loop) to record the data.
In the other way if i don't type my sensors output data the SD card had no way how to read the data and
record it on sd card. Im not sure what to do, is there a way to active the serial without the IDE help?
Perhaps by ensuring that the battery is appropriate for the job. If it is a 9v pp3, it surely isn't.
I got a USB power bank I just plug the arduino USB and it's powering up, there is no problem with power
I've been worked in the past like that. (Power Bank 7v 4000mAh -> (circuit regulator) USB 5v).
I can't understand how power can be issue, the arduino operate at 5v with a input voltage from 7 to 20v
The website confirm it:
I use 2x Li-Ion 3.7v = 7.4v 4Ah, how that could be a power supply problem? I tested even 12v not being tarded
but the power supply is not the problem.
To be able to record on the SD card i had the tablet serial always open if even i closed it for a sec the arduino stop serial printing and there is no any data recorded on the sd card, the TX led on the arduino (loop loops) stop looping.
So what i say is maybe from the code but what? I don't know..
Domino60:
I use 2x Li-Ion 3.7v = 7.4v 4Ah, how that could be a power supply problem? I tested even 12v
Quite easily and power may still be your problem. The batteries are capable enough but barely relevant. You are only talking about input, you don't talk about output but, to the Arduino, output is the only thing that matters. Furthermore, if that is the problem, leaning 12v against the input isn't going to fix it.
Quite easily and power may still be your problem. The batteries are capable enough but barely relevant. You are only talking about input, you don't talk about output but, to the Arduino, output is the only thing that matters. Furthermore, if that is the problem, leaning 12v against the input isn't going to fix it.
The USB power the arduino with a 5v 800mA and the hell battery wont power up the arduino? come on.
Since you won't share it, we don't either. So quit whining.
#include <SD.h>
// On the Ethernet Shield, CS is pin 4. Note that even if it's not
// used as the CS pin, the hardware CS pin (10 on most Arduino boards,
// 53 on the Mega) must be left as an output or the SD library
// functions will not work.
const int chipSelect = 4;
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.print("Initializing SD card...");
// make sure that the default chip select pin is set to
// output, even if you don't use it:
pinMode(10, OUTPUT);
// see if the card is present and can be initialized:
if (!SD.begin(chipSelect)) {
Serial.println("Card failed, or not present");
// don't do anything more:
return;
}
Serial.println("card initialized.");
}
void loop()
{
// make a string for assembling the data to log:
String dataString = "";
// read three sensors and append to the string:
for (int analogPin = 0; analogPin < 3; analogPin++) {
int sensor = analogRead(analogPin);
dataString += String(sensor);
if (analogPin < 2) {
dataString += ",";
}
}
// open the file. note that only one file can be open at a time,
// so you have to close this one before opening another.
File dataFile = SD.open("datalog.txt", FILE_WRITE);
// if the file is available, write to it:
if (dataFile) {
dataFile.println(dataString);
dataFile.close();
// print to the serial port too:
Serial.println(dataString);
}
// if the file isn't open, pop up an error:
else {
Serial.println("error opening datalog.txt");
}
}
Domino60:
The USB power the arduino with a 5v 800mA and the hell battery wont power up the arduino? come on.
I note with only faint interest that this is the first time you have bothered to properly enlighten anybody about the 800mA output.
I don't know if it is pertinent to the problem but, clearly, opening the file every time you go round the loop, and never closing it, seems rather pointless. One also wonders at the frequency with which you whizz round the loop. Maybe it is tripping over itself.
clearly, opening the file every time you go round the loop, and never closing it, seems rather pointless.
File dataFile = SD.open("datalog.txt", FILE_WRITE);
// if the file is available, write to it:
if (dataFile) {
dataFile.println(dataString);
dataFile.close();
If you are not using a Leonardo or Micro, waiting for Serial to be ready is WHY your code does not work without opening the serial monitor.
I'm using Uno.
The main question of this topic:
So there is my simple problem, i got a dataloger and i record data on sd card
but the actual arduino start recording only if i open Serial Monitor....
Is there a way to active the dataloger without the computer/Serial Monitor?
So I'm using a dataloger example to record some data from a sensor which I print the data on serial monitor
then the SD Card module store the data on sd card but the SD card module / arduino start recording data only if i open 1st the Serial monitor.
Question:
Is there any way to skip the serial monitor and storing the data on sd card without opening the serial monitor?
My point of keeping the serial monitor and having in the code Serial.print(sensor); and dataFile.println(sensor); is because I wanna see in any time i need what kind of data is the sd card recording thru (phone/tablet/device).
Which is full of #ifdef statements. Why? You are not trying to use the code on different boards, are you? If not, ditch the code that is not needed.
else{
delay(1);
}
What do you expect this to accomplish, if you can't open the file?
else{
delay(1);
}
What do you expect this to accomplish, if you can't read from the sensor?
String Ax = "";
String Ay = "";
String Az = "";
Ax = String(ax);
Ay = String(ay);
Az = String(az);
Pure, unadulturated bullshit.
else{
delay(1);
}
More useless crap.
Get an LED. On every pass through loop(), toggle the state of the pin that the LED is attached to. With the Serial Monitor open, observe the flashing of the LED.
Close the Serial Monitor. Reset the Arduino. Does the LED flash?
Look I worked on this code yesterday, someone asked me to do some tests outside so i made a fast code,
i didn't worked to perfectionate it i just made it to run. about the else_delay(1) i forgot about them, i focused on the code part and make it work fast because i didn't had time.
Get an LED. On every pass through loop(), toggle the state of the pin that the LED is attached to. With the Serial Monitor open, observe the flashing of the LED.
Close the Serial Monitor. Reset the Arduino. Does the LED flash?
On arduino board there is Rx and Tx leds, the Tx led flashes (no needed to put another led), when i open the serial monitor the data starts to print out and led flashes, when I close the serial monitor the led keeps flashing (meaning the data keeps running), when i reset the board there's nothing happening, i need to open the serial monitor to "activate the loop".
I'm not sure why that's happening but i need help and a solution.
On arduino board there is Rx and Tx leds, the Tx led flashes (no needed to put another led), when i open the serial monitor the data starts to print out and led flashes, when I close the serial monitor the led keeps flashing (meaning the data keeps running), when i reset the board there's nothing happening, i need to open the serial monitor to "activate the loop".
That is nonsense. The RX and TX LEDs are controlled by the USB-to-serial converter chip. If the Serial Monitor is not opened, the RX and TX LEDs are not going to blink. Using the fact that they don't blink as proof that the Arduino is not running is silly.