Network & SD Card in operation

To test out the networking operation on the unit, the previous sketch was modified to enable both local SD card writing and network broadcast of the data. This uses a modified version of the Ethernet web server example available with the Arduino software.

I was initially hoping to create a one “sketch fits all” solution as I believe the intention is to collect the data in the trial from several units possible running concurrently. Unfortunately it would appear that this will be a little more problematic than I had anticipated as each Arduino needs to be given its MAC address and IP manually. This could potentially be gotten around by using costly error catching or even random generation to prevent duplicate addresses.

However as each unit will be provided with an SD card, my currently preferred solution to will be to create a file for each unit storing the IP and MAC for that unit and have a standard sketch on all units that will read that info from the SD, removing the need for hard coding.

SD_WEB_OUTPUT

SD Output Sketch

When setting up the Ethernet shield initially the standard sketch provided by Arduino for testing was used. Once the read / write process to the SD card was verified a new sketch was produced to enable the storing of the data produced by DHT11 on the SD card.

The initial sketch produced was a based loosely on the test programs for both devices and worked well. However this crude amalgamation was thought to be taking up too much of the Arduino’s ram at 21k so was rewritten to remove some of the bloat of reducing the size down to 18.5k. This was achieved in the main part by removing the responsibility of doing temperature conversion calculations on the Aurduino and the deletion of all my wonderful comments.

The data is output in a CSV (Comma Separated Value) file that can be defined in the sketch. My initial version had Celsius, humidity and dew point all being written into one file, with the current version writing to three separate files, the final data structure will be decided once we have more of the sensors connected and have the web based back end finalized.

An initial burn test was completed over a period of three hours with the sensor being read in intervals 10000 m/s. The system worked as intended for this initial run but showed very little variance in data over that time, suggesting the temperature and humidity data may be logged at greater intervals.

SDoutputv1

The next stage will be to connect the device to a network and have it decide which storage method to use. It should be possible to have the data be written direct via a network and to the SD card for backup, however we will need to ensure we can uniquely identify each batch of data to prevent duplication.

External Data Storage

To store the data generated during the experiment we will be utilising an Arduino ethernet shiled.

This device piggybacks onto the Arduino and provides pass through for the majority of connections.

The device was chosen as this will enable both local storage, via a micro SD card accessed through the standard Arduino SD library for use in locations where network connectivity is limited,  and direct network storage via the RJ45 Ethernet port.

Network Shield label

The wiring of the board to the sensor remains the same using the pass through equivalent on the Ethernet shield.