News:

  • August 18, 2026, 05:27:40 AM

Login with username, password and session length

Author Topic: Store & Retrieve data from SD card?  (Read 10211 times)

MarkTTU

  • Hero Member
  • *****
  • Posts: 293
    • SamJackson.com
Store & Retrieve data from SD card?
« on: January 25, 2018, 04:14:12 PM »
Planning to send data to a web server where it will be logged into a database. Got all that worked out, but had the thought of what to do with the data if the web/database server is off-line for a time. Could the SD card be used to store data and then retrieve it and send it on to the server once the server is on-line again? Asking here because I don't have time to dig around and see if this is possible at the moment.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6172
  • Yes Pinky, Do-more will control the world!
Re: Store & Retrieve data from SD card?
« Reply #1 on: January 25, 2018, 04:25:43 PM »
Absolutely. There is a full file API for creating and managing files on both the SDCard and the ram disk.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

MarkTTU

  • Hero Member
  • *****
  • Posts: 293
    • SamJackson.com
Re: Store & Retrieve data from SD card?
« Reply #2 on: January 25, 2018, 04:37:16 PM »
Awesome! Thanks!

Bolt

  • Hero Member
  • *****
  • Posts: 598
Re: Store & Retrieve data from SD card?
« Reply #3 on: January 25, 2018, 07:14:54 PM »
This depends on the volume, frequency, and type of data you are sending to your web server, but what I did recently was create a buffer with 128 strings.  The PLC writes the data to the buffer strings, and then if the connection to server is available, writes to the server.  If the server were to be down, it would keep filling the buffer, and once server comes back online, it will post it all to the database on the server.  For me the 128 strings will keep me happy for a short server outage of an hour or so.  Obviously the buffer could be made larger, at the expense of system memory.  The SD card is a much larger storage option.

MarkTTU

  • Hero Member
  • *****
  • Posts: 293
    • SamJackson.com
Re: Store & Retrieve data from SD card?
« Reply #4 on: January 25, 2018, 08:36:53 PM »
I really like the buffer of strings solution; that could be very very good indeed. We're probably looking at about 100 pieces of data, mostly 3-4 digit numbers, at a frequency of between 30 and 120 writes per hour. In an extreme case I figure we need to be able to store about a weeks worth of data; hence my interest in the SD card.