Send temperature data to MicroSD and Arduino IOT Cloud

I've built an Arduino temperature sensor with an LCD screen and I now want to send the data to a MicroSD card for storage and I want to send the data to the Arduino IOT cloud so I can view the data in real time. Can anyone help me with how to do this? I have been following this project


I have bought DIGILENT Pmod MicroSD and DFROBOT TEL0126. I have included images of my current build below and my current code.



#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal_I2C.h>

const int SENSOR_PIN = 13; // Arduino pin connected to DS18B20 sensor's DQ pin

OneWire oneWire(SENSOR_PIN);         // setup a oneWire instance
DallasTemperature tempSensor(&oneWire); // pass oneWire to DallasTemperature library
LiquidCrystal_I2C lcd(0x3F, 16, 2);  // I2C address 0x3F (from DIYables LCD), 16 column and 2 rows

float tempCelsius;    // temperature in Celsius
float tempFahrenheit; // temperature in Fahrenheit

void setup()
{
  Serial.begin(9600); // initialize serial
  tempSensor.begin();    // initialize the sensor

  lcd.init();         // initialize the lcd
  lcd.backlight();    // open the backlight 
}

void loop()
{
  tempSensor.requestTemperatures();             // send the command to get temperatures
  tempCelsius = tempSensor.getTempCByIndex(0);  // read temperature in Celsius
  
  Serial.print(tempCelsius);    // print the temperature in Celsius
  Serial.println("°C");

  lcd.clear();
  lcd.setCursor(0, 0);       // start to print at the first row
  lcd.print("CONCRETE TEMP:");  // print concrete temp wording
  lcd.setCursor(0, 1);       // start to print at the second row
  lcd.print(tempCelsius);    // print the temperature in Celsius
  lcd.print((char)223);      // print ° character
  lcd.print("C");

  delay(1000); // read temperature once every 15 minutes which is 900000 ms
}`Use code tags to format code for the forum`

I can't advise on the IoT stuff. For the SD, you can open a file and write the data using something like file.println(tempCelcius);.

You have some options for this

  1. Open the file once, write as often as you want and close the file when it's time to eject the SD card (use e.g. a button).
  2. Open the file, write the data and close the file. Repeat.

Number (1) is preferred.

Is your SD module this one?

https://digilent.com/shop/pmod-microsd-microsd-card-slot/

If so, it's the wrong module for use with a 5V Arduino. You would need one that shifts the 5V Arduino output lines down to the 3.3V that the SD card expects. It would look like this:

And it would be powered with 5V on the Vcc pin.

Can't help on the IOT stuff.

Thanks for your help. Yes, it seems I have bought the wrong SD card. Can you recommend me a good SD card for me to buy for the 5V arduino? I know you've sent a picture. If you've got a manufacturer name and model number that would be great. Many thanks.

Thank you for your help on this. If I use option 2, do I not need to use a button in my circuit? I could just unplug the SD card once I've finished collecting data for my project?

The best microSD module is the Adafruit:

https://www.adafruit.com/product/254

But it is expensive.

If you get a Nano ESP32 then you will:
(1) have the IoT Cloud facility (WiFI) that you lack with your Uno
and
(2) be able to use your 3V uSD device.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.