Seeeduino LoRaWAN with the SD Card Shield

Arduino, Seeeduino Serials and mutants. Share your problems and experence on arduino compatible board such as seeeduino/stalker, etc.

Moderators: lily.li, violet, salmanfarisvp

Post Reply
pfr
Pre-kindergarten
Pre-kindergarten
Posts: 2
Joined: Thu Jun 13, 2019 10:56 pm

Seeeduino LoRaWAN with the SD Card Shield

Post by pfr » Thu Jun 13, 2019 11:00 pm

Hello,

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

kind regards,

Philipp

bill.yu
Junior-7
Junior-7
Posts: 732
Joined: Mon Apr 02, 2018 11:05 am

Re: Seeeduino LoRaWAN with the SD Card Shield

Post by bill.yu » Fri Jun 14, 2019 4:07 pm

Hi Philipp

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

Code: Select all

#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");
  }
}



Here is the COM port output.

Code: Select all

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

pfr
Pre-kindergarten
Pre-kindergarten
Posts: 2
Joined: Thu Jun 13, 2019 10:56 pm

Re: Seeeduino LoRaWAN with the SD Card Shield

Post by pfr » Mon Jun 17, 2019 5:31 pm

Hello,

thanks for the Answer.
Did you tested with the Seeeduino LoraWan GPS Module?

At the moment i have only this Adapter
https://www.amazon.com/Virtuabotix-Read ... way&sr=8-6

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

bill.yu
Junior-7
Junior-7
Posts: 732
Joined: Mon Apr 02, 2018 11:05 am

Re: Seeeduino LoRaWAN with the SD Card Shield

Post by bill.yu » Mon Jun 17, 2019 5:48 pm

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.

https://www.seeedstudio.com/SD-Card-Shi ... -1381.html

Post Reply