Project tutorial
How to Make a Probe

How to Make a Probe

This project will show you how to make a probe using a datalogging Arduino shield, some sensors and an RTC.

  • 2,740 views
  • 2 comments
  • 11 respects

Components and supplies

Apps and online services

About this project

Functionning

The datalogger is a particular mounting which can register values coming from sensors on a support (like an SD card).

This system can be used in many projects that need a periodical measurement (such as probes ;-)).

This probe collects values from sensors and registers them into the SD card of the datalogging shield.

When you plug your SD card into your computer, you will see an excel file with sensors values onto.

Code

/ ! \ First Code ---> That initialize the RTC to makes it synchronize with the probe values

#include <SPI.h>
#include <SD.h>
#include <Wire.h>
#include <ds3231.h>

struct ts t;
const char* filename = "Probe.csv";
File file;

void setup() {
Wire.begin();
DS3231_init(DS3231_INTCN);
/*----------------------------------------------------------------------------
In order to synchronise your clock module, insert timetable values below !
----------------------------------------------------------------------------*/
t.hour=20;
t.min=30;
t.sec=0;
t.mday=25;
t.mon=01;
t.year=2020;

DS3231_set(t);
pinMode(10, OUTPUT);
if (!SD.begin(10)) {
for (;;);
}
file = SD.open(filename, FILE_WRITE);
if (file.size() == 0) {
file.println("Time; Light; Temp; Wat.lev");
file.flush();
}
}

void loop() {
DS3231_get(&t);
measure();
delay(1000);
}

void measure() {
int val1 = analogRead(A0);
int val2 = analogRead(A1);
int val3 = analogRead(A2);

file.print(t.mon);
file.print("/");
file.print(t.mday);
file.print("|");
file.print(t.hour);
file.print(":");
file.print(t.min);
file.print(":");
file.print(t.sec);
file.print("; ");
file.print(val1);
file.print("; ");
file.print(val2);
file.print("; ");
file.println(val3);
file.flush();
}

/ ! \ Second Code ---> The same code without the part of initializing the RTC

#include <SPI.h>
#include <SD.h>
#include <Wire.h>
#include <ds3231.h>

struct ts t;
const char* filename = "Probe.csv";
File file;

void setup() {
Wire.begin();
DS3231_init(DS3231_INTCN);
DS3231_set(t);
pinMode(10, OUTPUT);
if (!SD.begin(10)) {
for (;;);
}
file = SD.open(filename, FILE_WRITE);
if (file.size() == 0) {
file.println("Time; Light; Temp; Wat.lev");
file.flush();
}
}

void loop() {
DS3231_get(&t);
measure();
delay(1000);
}

void measure() {
int val1 = analogRead(A0);
int val2 = analogRead(A1);
int val3 = analogRead(A2);

file.print(t.mon);
file.print("/");
file.print(t.mday);
file.print("|");
file.print(t.hour);
file.print(":");
file.print(t.min);
file.print(":");
file.print(t.sec);
file.print("; ");
file.print(val1);
file.print("; ");
file.print(val2);
file.print("; ");
file.println(val3);
file.flush();
}

Library

For this project you will need the DS3231 library:

https://github.com/rodan/ds3231.

Schematics

Connections between sensors and the datalogger shield are the same that connections shown on schematics. You just have to plug the datalogger shield on the arduino before doing connections.

Project Results

Values are display on 4 columns: Time (provided by the RTC), light, temperature and water level.

Comments

Similar projects you might like

How to Use a Datalogger

by MisterBotBreak

  • 2,183 views
  • 2 comments
  • 15 respects

Wireless Soil Moisture Probe with Helium and DFRobot

Project tutorial by Mark Phillips and Peter Main

  • 15,399 views
  • 9 comments
  • 33 respects

GPS Datalogger, Spatial Analysis, and Azure IoT Hub.

Project tutorial by Shawn Cruise

  • 22,687 views
  • 4 comments
  • 82 respects

Arduino Laser Tripwire

Project tutorial by Ian Cumming

  • 23,959 views
  • 13 comments
  • 56 respects

Arduino Mystery Box - Beginners

Project tutorial by Dragos

  • 2,050 views
  • 1 comment
  • 10 respects

The Troll Switch

Project tutorial by Aitor Gamarra

  • 1,788 views
  • 3 comments
  • 7 respects
Add projectSign up / Login