Author Topic: Data logging with Raspberry Pi  (Read 1555 times)

0 Members and 1 Guest are viewing this topic.

Offline BillTopic starter

  • Contributor
  • Posts: 28
  • Country: ch
Data logging with Raspberry Pi
« on: October 17, 2025, 08:05:29 am »
Hi everyone,

I want to collect real-time data from a PLC using Raspberry Pi and Node-RED, and keep it running for a long time (weeks or months).
What do I need for data storage — a local database like InfluxDB or an external server?

Any suggestions or experiences are welcome.
 

Offline NE666

  • Frequent Contributor
  • **
  • Posts: 953
  • Country: gb
Re: Data logging with Raspberry Pi
« Reply #1 on: October 17, 2025, 08:23:27 am »
It is always easier, not to mention more robust, to use local storage rather than introduce dependencies on external services and connectivity.

Of course, that itself depends on there being sufficient local storage available to meet your requirements - which you've made no mention of.
 

Offline BillTopic starter

  • Contributor
  • Posts: 28
  • Country: ch
Re: Data logging with Raspberry Pi
« Reply #2 on: October 17, 2025, 08:37:48 am »
You're right — I don't want to overload the Raspberry Pi.
I actually have a server with large storage capacity, so my idea is for the Raspberry Pi to act only as the data publisher, not both publisher and storage device at the same time.
If it had to write and store the data continuously, it would eventually saturate or wear out the Pi’s SD card.
 

Offline unseenninja

  • Regular Contributor
  • *
  • Posts: 128
  • Country: se
Re: Data logging with Raspberry Pi
« Reply #3 on: October 17, 2025, 10:17:38 am »
If it had to write and store the data continuously, it would eventually saturate or wear out the Pi’s SD card.

Unlikely, unless you're talking about hundreds of megabytes every minute 24/7.

I use a headless Pi to log from my multimeters, often for tests that run for a week at a time. All data is written to the Pi's MicroSD card and I've never had one fail on me. Then again, I don't buy MicroSD cards from eBay or Amazon either, only from trustworthy vendors where I know I'll be getting a genuine product.
 

Online fchk

  • Frequent Contributor
  • **
  • Posts: 429
  • Country: de
Re: Data logging with Raspberry Pi
« Reply #4 on: October 17, 2025, 02:20:13 pm »
I'd use this carrier board with an CM5 instead.
https://www.waveshare.com/cm5-io-base-b.htm

You can mount the RTC battery directly onto the board, you can mount an NVME SSD directly onto the board (more write cycles, more speed), you can use a CM5 with EMMC as boot device (which is faster and more reliable than SDcards), and you can keep the mechanical dimensions of a standard Pi.
 

Offline H.O

  • Frequent Contributor
  • **
  • Posts: 959
  • Country: se
Re: Data logging with Raspberry Pi
« Reply #5 on: October 17, 2025, 07:38:32 pm »
I have RPi3 in a datalogging application running on the same SD card for 6 years and 7 month on the day actually. Still working fine.
I get data every second, every minute I calculate an average that is kept in RAM. Every hour I write 60 minutes worth of data to disk. Worst case I lose an hour of data. A new file is created every 24h.
 

Offline SteveThackery

  • Super Contributor
  • ***
  • Posts: 3474
  • Country: gb
  • 50 year novice
Re: Data logging with Raspberry Pi
« Reply #6 on: October 17, 2025, 09:58:20 pm »
The great thing about an SD card is that you can swap it for a new one at whatever intervals you think necessary, for very little cost. I used an SD card in the Arduino-based data logger I made for my motorcycle.
If it ain't broke, keep fixing it until it is.
 

Offline BennoG

  • Frequent Contributor
  • **
  • Posts: 388
  • Country: nl
Re: Data logging with Raspberry Pi
« Reply #7 on: October 18, 2025, 05:04:46 pm »
it also depends on what you want in case of a power fail.
usually when writing to local storage the last part of the data wil only contain 0x00 bytes, depending on file system type and file flush handling.

For this I use a remote logging server (also the it logs about 20 - 40 MB / day and I want a log for at least a year), in my case when the packet is on the wire it will be logged, so I will only miss the last 1 or 2 ms of logging in case of power fail.

Benno
 

Offline mjkuwp

  • Supporter
  • ****
  • Posts: 269
  • Country: us
  • mechanical engineering defector
    • The Mz Lab
Re: Data logging with Raspberry Pi
« Reply #8 on: October 19, 2025, 11:32:40 am »
Why not to a USB flash drive?
 

Offline NE666

  • Frequent Contributor
  • **
  • Posts: 953
  • Country: gb
Re: Data logging with Raspberry Pi
« Reply #9 on: October 19, 2025, 05:38:49 pm »
it also depends on what you want in case of a power fail.
usually when writing to local storage the last part of the data wil only contain 0x00 bytes, depending on file system type and file flush handling.

Which is why you'd want to use (or use a DB which uses, or can be configured to use) unbuffered IO. So long as it can meet the performance requirements of the application, which again, aren't stated.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->