Passez à l'illimité avec Magzter GOLD

Passez à l'illimité avec Magzter GOLD

Obtenez un accès illimité à plus de 9 000 magazines, journaux et articles Premium pour seulement

$149.99
 
$74.99/Année

Essayer OR - Gratuit

MakerSpace

Linux Magazine

|

#293/April 2025: Trojan Horse

If you need to store long-term historical data, you can cobble together some Arduino modules, sensors, and displays and get them all to talk to an SQL server.

- By Pete Metcalfe

MakerSpace

Figure 1: This Arduino project logs data to an SQL database.

In most Arduino projects, devices use messaging protocols like Message Queuing Telemetry Transport (MQTT) [1] or custom dashboard platforms such as Arduino Cloud [2] or ThingsBoard [3] to talk to each other. While those two approaches offer excellent solutions for viewing short-term sensor data, they have limitations when used for long-term historical storage.

A common solution that supports historical storage is to connect MQTT brokers to datalogging packages like Node-RED, InfluxDB, or Grafana. Another approach is to install SQL drivers on the Arduino controllers and then pass sensor data directly to a database server. There are Arduino C/C++ libraries for MariaDB/ MySQL, Microsoft SQL, PostgreSQL and even local SQLite 3 databases. SQL-based solutions have some useful benefits such as:

• No intermediate storage is required

• Access raw historical data or aggregate calculations

• Write custom queries

• Use back-end views and procedures to minimize dashboard code

Depending on your project requirements, using an SQL server could be a good fit for your next Internet of Things (IoT) project.

imageFigure 2: The garage table stores sensor data and a timestamp. The thetime field will default to the current time when a new record is inserted.

This article presents a sensor project that connects Arduino modules to a MySQL/ MariaDB server (Figure 1). Dashboards showing current values and historical trend charts will be created using some SQL widgets in Node-RED.

SQL Libraries for Arduinos

Linux Magazine

Cette histoire est tirée de l'édition #293/April 2025: Trojan Horse de Linux Magazine.

Abonnez-vous à Magzter GOLD pour accéder à des milliers d'histoires premium sélectionnées et à plus de 9 000 magazines et journaux.

Déjà abonné ?

PLUS D'HISTOIRES DE Linux Magazine

Linux Magazine

A couch-gaming OS based on Big Picture streaming Game Master

Play Steam, GoG, and Epic games with one steamy and epic OS.

time to read

8 mins

#297/August 2025: Cleaning Up

Linux Magazine

Shopping Frenzy

To gain insight into his Amazon orders, Mike Schilli writes a Go program that runs statistics and displays the results graphically.

time to read

10 mins

#297/August 2025: Cleaning Up

Linux Magazine

Zack's Kernel News

Chronicler Zack Brown reports on the latest news, views, dilemmas, and developments within the Linux kernel community.

time to read

10 mins

#297/August 2025: Cleaning Up

Linux Magazine

FOSSPicks

Sparkling gems and new releases from the world of Free and Open Source Software

time to read

14 mins

#297/August 2025: Cleaning Up

Linux Magazine

Create interactive fiction with Inform Storyteller

Inform is your guide to the strange worlds of interactive fiction and text-driven games.

time to read

12 mins

#297/August 2025: Cleaning Up

Linux Magazine

MakerSpace Send Raspberry Pi and Arduino notification messages to your desktop You've Been Notified

If you use sensors with a Raspberry Pi or Arduino in your home network, you may want to get desktop notifications on your Linux PC whenever some interesting event is detected. You can send messages via SSH or through simple TCP connections and display them with notify-send.

time to read

4 mins

#297/August 2025: Cleaning Up

Linux Magazine

Linux Magazine

Tuning tools for AMD graphics chips Clockwork

CoreCtrl and RadeonTop monitor the utilization and clock frequency of AMD chips with the potential for boosting performance.

time to read

5 mins

#297/August 2025: Cleaning Up

Linux Magazine

Linux Magazine

Window of Opportunity

Add graphics that automatically update. We show you how to build an analog clock widget with the Cairo and GTK libraries.

time to read

11 mins

#297/August 2025: Cleaning Up

Linux Magazine

Linux Magazine

MADDOG'S DOGHOUSE

The prohibitive expense of early proprietary supercomputers is just part of why Linux has taken (and kept) the lead in this area.

time to read

3 mins

#297/August 2025: Cleaning Up

Linux Magazine

Linux Magazine

Notification Nirvana

If you host a lot of services on your home server, it helps to have them send you timely notifications. With ntfy, you can send push notifications to your phone or desktop. By Koen Vervioesem

time to read

9 mins

#297/August 2025: Cleaning Up