Seeeduino LoRaWAN with the SD Card Shield

Hello,



what I have to do, in order to run the Seeeduino LoRaWAN (include GPS) with the SD Card Shield?



kind regards,



Philipp

Hi Philipp



It works. I use the data logger code as below. thanks.

[code]#include <SPI.h>
#include <SD.h>

const int chipSelect = 4;

void setup() {
// Open SerialUSB communications and wait for port to open:
SerialUSB.begin(9600);
while (!SerialUSB) {
; // wait for SerialUSB port to connect. Needed for native USB port only
}

SerialUSB.print(“Initializing SD card…”);

// see if the card is present and can be initialized:
if (!SD.begin(chipSelect)) {
SerialUSB.println(“Card failed, or not present”);
// don’t do anything more:
while (1);
}
SerialUSB.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 SerialUSB port too:
SerialUSB.println(dataString);
}
// if the file isn’t open, pop up an error:
else {
SerialUSB.println(“error opening datalog.txt”);
}
}

[/code]


Here is the COM port output.

</s>Initializing SD card...card initialized. 744,551,543 567,372,329 743,710,752 424,216,189 693,594,551 341,149,135 489,368,350 625,636,722 382,221,198 735,714,711 323,207,269 <e>

Hello,



thanks for the Answer.

Did you tested with the Seeeduino LoraWan GPS Module?



At the moment i have only this Adapter

<LINK_TEXT text=“https://www.amazon.com/Virtuabotix-Read … way&sr=8-6”>https://www.amazon.com/Virtuabotix-Reader-Writer-Arduino-Microcontrollers/dp/B0089SYU9C/ref=sr_1_6?keywords=sd+card+arduino&qid=1560763543&s=gateway&sr=8-6</LINK_TEXT>



Is it possible the use that? (i receive with your code -> “Initializing SD card…Card failed, or not present”)



I am not sure if the GPS or lora module is causing problems with the serial connection.



thanks.



kind regards,



Philipp

Hi Philipp



Yes, i tested SD card shield with Seeeduino LoraWan GPS Module. it works well. I do not have the your module and i can not test it. You can consider to order one sd card shield. thanks.



<LINK_TEXT text=“https://www.seeedstudio.com/SD-Card-Shi … -1381.html”>https://www.seeedstudio.com/SD-Card-Shield-V4-p-1381.html</LINK_TEXT>