Perform analysis on sensor data

Hello everyone,

I’m slowly becoming familiar with Arduino and all that it has to offer. As a learning project I’m putting together a self watering garden.

I’m planning to have several sensors hooked up to an Arduino Nano to decide if it’s time to water the plant and for how long (capacitive soil moisture, light brightness, flow meter, ambient temperature, etc..)

I’d like the Nano to connect via Wi-Fi to my home network.

What would be the best way to store this data in a database of sorts to perform some analysis on it? It would be time series data and I was thinking with a frequency of 10 seconds.

Thank you in advance

A popular way to do it, once you've added wifi capability for the nano to use is to have it perform a GET request on a web page somewhere, carrying your data. Whether that's your web server or one in the cloud somewhere is up to you. Once the web server has the data, it can take care of putting it in a database.

There's also a library that lets your nano interact directly with a MySQL instance.

Another alternative is to send it to a cloud service such as Adafruit.io. Note that with such services, you either have to accept restrictions about how much data will be retained or sign up for one of their paid tiers.

Thank you for your prompt answer.

Kind of a noob question, would it be possible to run a MySQL instance off some old laptop that I have always running with windows?

Yes. It's not going to be consuming many resources with a ping every ten seconds. Having said that, what are you going to measure that changes so frequently?

I’m trying to use this project as a learning exercise more than anything, so I do recognize that such high frequency is not required.

The one channel for which it might matter is the flow meter, since I want to aggregate how much volume of water I’m adding every day and I wanted to do this calculation on the server side.

Is setting up a local MySQL server a relatively simple task I imagine? Would it be accessed via the IP address that the router has assigned the laptop off which I’m running it? (If this is not the right place to ask this, I apologize)

I wanted to do this calculation on the server side

The Arduino can do that, and send the aggregated data along with the other, less frequently collected data.

It is not a good idea to have a remote server directly control a time sensitive process, like watering.

That is a very valid point. So maybe in the code I should just aggregate the flow into a volume and push it every 15 minutes or so.

I think I’m going the MySQL route. I’ll try to set it up on an old laptop that I have always running and connect my Arduino nano to it.

Hopefully I haven’t bitten more than I can crew.

Thanks again

You can tell it's spring when all the sprinkler projects pop up (grin).
In September, it will be the Halloween effects.
In November it will be the Christmas light shows.

I am guilty as well, but I started my sprinkler project last year. Just tinkering with it now.

There are probably a dozen different ways to get your data. Here's my approach.

I have a Wemos D1 Mini with a capacitive moisture sensor attached. The moisture and temperature data are sent by MQTT message every ten minutes.

For analysis, I am using Node-Red to receive the data then send it to a file in .csv format. I can then open that file in Microsoft Excel and make a graph.

Lol yeah, I’m definitely guilty of that too!

Would it work similarly if I use an ESP8266 instead to connect to WiFi?

Thanks!

adruino405:
Lol yeah, I’m definitely guilty of that too!

Would it work similarly if I use an ESP8266 instead to connect to WiFi?

Thanks!

The Wemos D1 Mini is an ESP8266 in a better form.

Ok this is probably a very basic question but do you have the sensor connected to the Wemos D1 Mini and then to an Arduino? It it’s just the Wemos?

Also, do the moisture sensor readings trigger a solenoid valve?

Sorry for piggy-bagging off your project :stuck_out_tongue: