The original post for this project can be found here A link to all the files on GitHub can be found here.
Following a suggestion from Alan Powell I decided to add a Humidity Sensor. The DHT11 is cheap and suited to this project. A lack of variable space meant that I was unable to save the data to the SD Card but as a bonus, the Humidity screen displays the Dew Point. See the end of this blog for more details.
Back in September 2015, I built this Joystick Weather Clock and it has sat on my desk recording pressure and temperature on an SD Card for fifteen months, without missing one hourly record. The data was stored as a CSV file so that it would load into EXCEL or similar spreadsheet program. I decided to see how it was faring after running all that time uninterrupted.
The fact that it was still saving data meant that there had been no stack overflow caused by unused variables filling up available free memory. The DS1307 Real time clock had not done too well, it was now 45 minutes fast, gaining around 38 seconds per week. The OLED display seemed to have lost a number of pixels and in places the display looked a little ragged, the LEDs used to light up under the display were still going strong. The pressure sensor was working perfectly.
So much for the hardware, what about the software? The calendar was perfect, having come through a leap year and the moon phase display was spot on. Data had been recorded exactly as designed and the whole file on the SD Card took up less than 4mb. Over 11,000 hourly temperature and pressure readings had been recorded and I believe this unit could run unattended for several years.
The pressure information was the most interesting, it was possible to follow the remains of a hurricane that hit the UK at the start of January 2016.
The pressure had remained fairly stable at around 102000 pascals until New Year’s Eve, dropping to below 98000 pascals over four days. The result was high winds and flooding.
I am really pleased with the software side, but I feel that a better Real Time Clock module is needed. To protect the OLED I think some kind of simple Screen Saver is needed and I will add this in the new year sometime. The subroutines to calculate the calendar and moon phase have worked flawlessly and, although the data saved on the SD Card is OK, I think that a VBA routine for EXCEL to extract the Pressure and/or the Temperature data and to place it all in a single column is needed. This will allow a graph to quickly be drawn. Please note that the hourly data builds up throughout the 24 hours and only the data saved at 2300 hours contains all the days’ data.
One final addition would be to use a 5-volt power bank as a backup battery, it can be left plugged into the Arduino and would only be used if the mains power was lost. The software saves the last 48 hours in a temporary file on the SD card, if the power is lost then once power is restored this temporary data is loaded, but if the power is lost for more than one hour the data for the time during power down would be lost.
Adding another Sensor:
The Sketch uses 74% of the available space for variables and at 78% usage the Arduino IDE starts to complain, so I have tried to keep below this figure. I decided to try to fit a Humidity sensor, following a suggestion from Alan Powell. The DHT11 although slow is quite cheap and as long as you don’t request data too often it should work well. I started by installing the library and the routine to read the Humidity data. That consumed very little precious variable space. I then added a new screen to display the data. Now I had a working Humidity screen that also displayed the Dew Point.
The DHT11 is a slow device that should not be addressed more than once every few seconds. I decided to save the Humidity value and only update it once an hour when data is saved to the SD card. When you display the Humidity screen the value could be up to an hour out of date, but simply press the joystick and the value is updated immediately.
I fitted a ChronoDot board with a DS3231 RTC chip, this is just a simply plug in replacement, I just needed to swap the SDA and SCL lines. No change to Library or Sketch is needed.
Heres to the next 18 months when I can see how well the new RTC performs.
The new Humidity screen, accessed by moving the Joystick one place left from the Analog Clock Screen. The age of the reading is shown and although this is updated once an hour it can be updated manually at any time by pressing the joystick switch in this screen.
The DHT11 has three pins 5v, OUT and GND. Connect 5v and Gnd to the Arduino and OUT to digital pin 12. While I was fitting the DHT11 I took the opportunity to swap the DS1307 RTC for a (hopefully) more accurate DS3231.
The picture at the top of this post shows the new ChronoDot RTC and DHT11 fitted to the clock.
Use this connection diagram in conjunction with the wiring instructions in the sketch. Check the pinouts on your devices before wiring as they may not match those shown above. The OLED will die instantly if not connected correctly.