Rain gauge counter and water level sensor

Hi there,
My name is Simo from Morocco,
I would like to develop o project on Netduino 3 ethernet and be able to count pulses from a rain gauge and read water level from a 4-20mA sensor and store them on sd-card (datalogger),
Next step is to send this data to a mysql server over the internet,

could you please direct me where to start,

Best regards


To count pulses in a period and upload the count to an HTTP endpoint you could adapt my Xively connected heart rate monitor.

It uses an interrupt port and a timer to do the counting, and an HttpWebRequest to post the data to an endpoint.

There in no longer a free version of Xively but Adafruit.IO is really robust and reliable (has a free version as well)

Adafruit.IO could get you up an running faster than a DIY backend.

With the MicroSD make sure you flush after write so reduce scope for corrupted files. I usually write file to a temp directory then move to long-term storage directory as last step.

   string message = new String(Encoding.UTF8.GetChars(data));

   string message = new String(Encoding.UTF8.GetChars(data));
   Debug.Print("+" + DateTime.UtcNow.ToString("HH:mm:ss") + " L=" + data.Length + " M=" + message);
   string filename = DateTime.UtcNow.ToString("yyyyMMddhhmmssff") + ".txt";
   string tempDirectory = Path.Combine("\\sd", "temp");
   string tempFilePath = Path.Combine(tempDirectory, filename);
   string queueDirectory = Path.Combine("\\sd", "data");
   string queueFilePath = Path.Combine(queueDirectory, filename);
   File.WriteAllBytes(tempFilePath, data);
   File.Move(tempFilePath, queueFilePath);
   new Microsoft.SPOT.IO.VolumeInfo("\\sd").FlushAll();

What’s the 4-20mA sensor? I have found 4-20mA to I2C or similar convertors can be expensive.