This project uses a median filter to smooth and de-spike data from a DHT22 Temperature and Humidity Sensor. It also uses a DS3231 Real-time Clock Module (AT24C32) to display the date/time on a 0.96 inch Yellow/Blue IIC OLED I2c 128x64 display.
All the hardware fits on a single breadboard and is powered by the USB interface or alternately by an external power supply (typically a wall wart driving a breadboard power supply module.)
I chose a median filter to remove any jitter from the DHT22. This may not necessary for most applications as the DHT22 is quite stable, but this filter is simple and removes any spikes. Experience has shown that it removes almost all noise with very little impact on sensor response time. The width of the filter affects this and can be adjusted in the sketch. The filter width must be an odd number, and 5 or 7 seem to work well. The wider the filter, the more effective it is at removing spikes. The downside is a wide filter will decrease response time.
The RTC is the standard DS3231. You have to initially set the time and date with the SetTime sketch in the DS1307RTC library. You can find that library here:
https://github.com/PaulStoffregen/DS1307RTC
If you install the optional CR2032 battery in the Clock Module this should hold the time for several years, so this is a one-time procedure. The exception is if you wish to use DST, you'll have to run the SetTime sketch each spring and fall.
I am using the U8glib library to drive the OLED display. You can obtain a copy here:
https://github.com/olikraus/u8glib
You can tweak the fonts, adjust the size, etc. as described here:
Comments