Computing Projects
Designed by Mark Little
Linux Information
Linux - Wikipedia

Fedora - Operating System

Raspbian - Operating System

SourceForge - Software
Linux Server
Arduino Sensor Controller
MySQL Database
The objective of this software is to interface an Arduino Sensor Controller to the database so that the readings can be recorded and made available to programs that can serve the data to the local web server and the Internet. The software also monitors the Arduino's Clocks and resets them as necessary.

SInce the program becomes associated with a USB Serial Port on the computer running the software, the software is only designed to connect with one client at a time. If there are multiple sensors controllers being used, each instance of the program must have its own configuration file to identify the USB port it should connect to.

The source code and DOxygen documentation for the program can be found here.

Overview

Operation

The first thing that the program does is to initialise the Database, the Serial Port and the Logger. Next, it opens the configuration file that sets various parameters that the program needs to setup the  database and the serial port.

The first command that the program sends to the Arduino is a <V> (version) command which will cause the Arduino to identify the sensor software, including the software version, running on the Arduino. This will allow the program to determine if it can fully decode the messages from the Arduino.

The version information also returns the Username and Password for that particular Arduino. The program uses this information to identify which sensor is connected, so that it knows the station identification when recording the readings.

Program Initialisation

Main Loop

The main loop of the program essentially just sends out periodic requests for readings from the Arduino's sensors.

Although the send of the commands is asynchronous to the reception and processing of the responses, the routine does pause to give enough time for the Arduino to process the received command. This is necessary to prevent the Arduino input buffer being flooded and losing commands.

If not all the responses have been received, the command loop will be repeated, sending out only the requests for commands that have not received a valid response. If the command continually fails to receive a response, the sensor reading is abandoned to prevent the program from hanging.

When the Arduino's Internal Clock is read, the program compares it to its system time. If the readings are different by more than a few seconds, a time setting command will be sent to sync the Arduino to the computer's time which maintained using NTP.

Once the sensor gathering is complete, the sensor data is written to the database and the readings cleared to allow another cycle of sensor commands to be sent. Other programs can access the database without this program being interfered with, or even being aware of that activity,
System Description
Arduino Description
Project Home Page
Weather Station Extension Linux Software