Introduction: 7 Segment Date & Time With BT Adjustment
I rescued some old weigh indicator boards from scrap heap!
I already had a DS3231 rtc & a HC-05 BT module, so I decided to make use of the rescued boards.
I have yet to put them in a posh box - I'm working on that one!
I have not yet decided whether to have this battery or mains powered, but if I choose the battery route, I am considering using a proximity or movement sensor to turn on the Led display for a minute or two, and then timeout to save power.
Step 1: The Hardware
The 7 segment board.
As mentioned, these were rescued from the scrap heap, however, there are several examples of how to wire and drive 7 segment displays on the web.
The on board chip driving the displays is a MAX7219 which is a 24 pin dil.
The LedControl.h lib makes life very simple and there are many examples included and on the web.
All of the code was obtained from this excellent article :
The article describes in detail how to drive both 8 x 8 & 7 segment displays.
Connection to an Arduino is simple because the 7219 has, apart from 5v & 0v, only 3 lines to drive it!
As can be seen in the 3rd picture, I wired directly to the pins of the 7219!
The DS3231 RTC has a back up battery which will keep the settings for at least a year when there is no power & is connected to the Arduino via the I2C bus.
The HC-05 Bluetooth board only requires power & a transmit & receive lines.
It is used to set the date & time settings. I will switch the power to the board as it is redundant most of the time as it is only used for initial setting and adjusting for DST twice a year!
Step 2: The Software
The sketch tells you all you need to know about the hardware connections.
I modified the code slightly to tell the library that I was using 2 x MAX7219's and, this board is hard wired with Display 0 being far right whereas the original code had Display 0 as far left.
The display is updated every second by an interrupt service routine triggered by the 32K pin on the DS3231.
The ISR does not update the routine directly due to the time it takes to read the information, convert it from BCD & then send it to the display! It merely sets a flag to say its happened and the 'Loop' does all of the work and resets the flag.
For Bluetooth communication, I use the excellent Bluetooth Terminal app which I have used in previous projects.
Once paired, sending 'H' shows the Help Screen & sending 'R' shows the DS3231 registers which is helpful for debugging.
I am considering using 7 individual LEDS to denote Mon, Tue etc.