I had a broken alarm clock lying around and came up with an idea to convert it to clock and weather forecasting station.
Full write-up with pictures is also available here.
For this project, you will need:
- Old circular alarm clock
- Arduino Nano
- BME280 sensor module (temp, humidity, pressure)
- LCD display module from Nokia 5110
- DS1307 RTC clock
- TP4056 Lithium battery charger
- Old Li-ion battery salvaged from mobile phone
- Small 3.7v to 5v booster module
- Light Dependent Resistor (LDR - light meter)
- Buzzer (used salvaged one from old PC)
- 3 push buttons
- A bunch of resistors (2x10k, 270 ohm) and a transistor (2N2222A or similar)
- Some wide shrink tube
- scrap PCB to use as front plate decoration
- Micro-USB extension cable (both female and male sides are Micro-USB)
- 2x8cm prototype board and some wires
First I disassembled the old clock. Bells, motor, broken clock mechanism...
Since the new clock will be fully digital with a mini-computer inside, I added 3 simple nice-looking buttons on the side.
Using a scrap piece of aluminium I cut out overlay to create a label. The letters for the labels were created by using the letter-punches and a black marker.
I will keep the old bells to power the alarm with the motor. The old broken clock mechanism had a ceramic capacitor with the label 104. I removed it from the circuit board and soldered it directly to the motor - this will help prevent power spikes when turning on the motor during alarm. Also important to note is that motor will be controlled through transistor but more on this later.
Since I decided to make a new face for the clock - I took a circuit board from my dumpster pile and used a builder heatgun to quickly remove all components. The hole in the middle is made for the digital screen of the new clock.
For this project I decided to use an LCD screen from old Nokia 5110 mobile phone. These screens are widely available for sale as a module, they draw very little power and there are good libraries for the Arduino. If you are buying a new module with 5110 screen - you're saving the planet because all new modules are created from salvaged 5110, 3110 and 3210 phones!
You might have already guessed that I was planning to use Arduino board to control this clock. The project is easily repeatable even for beginner Arduino fans because I did not create my own circuit boards. It is an Arduino Nano board with modules connected to it - BME280 temperature, pressure and humidity sensor, DS1307 RTC clock, TP4056 Lithium battery charger, small 3.7v to 5v booster module, Light Dependent Resistor (LDR - light meter) and a buzzer (taken from the old PC).
Have a look also at the sketches - they show all connections. I think everything is very easy to read and understand but if you have any questions just ask in the comments below.
Few notes about the setup:
- Motor is connected directly from battery through the transistor. Arduino controls the transistor through resistor and PWM pin D5.
- Pins D7-12 are used for LCD connector. Ground and VCC are connected to the rail on junction board.
- LDR was installed on the clockface and resistor + 3 outgoing wires were soldered right on the back of the clock face.
- For button connection I used internal PULLUP function inside Arduino. The Menu button is attached to the interrupt and I realized only later that you can also use internal PULLUP for the interrupt too. The interrupt for Menu button is required so that the code doesn't scan the state of the buttons all the time.
- The clock will monitor and display also the state of the battery so battery is directly connected to pin A0. Battery voltage is never higher than 4.2V so it is safe to connect the battery directly to the Arduino analog pin.
- Buzzer is directly connected to PWM pin D6. Although this is not a good practice, I got away with it because Arduino Nano could handle higher spec than stated and also because the buzzer won't be continuously working. The same setup would easily burn the pins on ESP boards so in those cases I recommend using the transistor control.
- The clock already had a switch so I decided to use it. It looks natural on the back.
All of the modules require positive and ground connections so I decided to use 2x8cm prototype board and soldered 5V and Ground rails to it. I also made a small I2C rail there too since I had several modules using I2C interface.
On the other side I soldered standard pins so that I could connect and disconnect the modules when required.
Some of the additional components were also soldered there such as transistor and resistor for motor control and a resistor for Menu button which uses Interrupt. I showed the schematics in the previous section.
I used an old Lithium-ion battery from my cellphone to power this clock. Usually the mobile phone batteries that are replaced still have good capacity in them (at least half of what it was when new). Their advantage is that they have an in-built discharge protection circuit and they are also very thin so can be used in small space scenarios.
To connect the battery you simply solder the wires to + and - pins on the battery. Don't worry, you won't damage the cell because there is a controller and some empty space between pins and the chemicals of the cell.
On this picture you can see the battery and also the TP4056 charge controller as well as 5V booster connected together and to battery. I used some shrink-wrap tubing to make everything isolated and compact.
Once I had soldered everything, I glued the buzzer and temp/pressure/humidity sensor on the back panel. They all fitted nicely in the existing slots from old clock dial controls.
It was now time to install the Micro USB port on the back. Why Micro USB if Nano uses Mini USB? Simply because in household, most USB cables are from cellphones and it would be convenient if the clock was able to take that too.
Since I wanted to use it for both charging and updating the clock and weather station functions - I stripped the USB cable, routed the power wires through TP4056 charger and Data+/Data- wires directly to the USB socket of Arduino Nano. You can see this on the schematic I attached.
It was now time to pack everything back into the original clock. I used shrink tube to isolate components and modules. Even the Arduino was wrapped in shrink tube.
As you can see, the clock is fully packed inside. This allowed to create something more sophisticated than the old clock I had - given that there are some programming skills of course. I wrote the initial code but asked my friend to step in and help me out.
So far, besides the clock itself, these are the functions that this project is already supporting:
- Time and date display (as well as time and activation of alarm on the same screen)
- Screen lights up in dark conditions or when movement is detected (based on changes of light)
- Weather forecast (Sunny, Cloudy, Rainy)
- Display of temperature, pressure and humidity (for humidity it will indicate whether it's too dry)
- Menu for settings: alarm, changing time, enable/disable date display, enable/disable weather change sound notifications and switch between imperial and metric units
- Alarm settings - on/off, setting the time, setting the melody and/or bells for notifications
Latest code: https://github.com/LenkaDesign/Weather-Forecast-A...
The code is going to be updated in the future with new features so be sure to check back for firmware updates :-)
If you are new to Arduino world, these are the steps I would recommend doing:
- Install USB driver for your board (e.g. CH340)
- Install Arduino IDE
- Install libraries used in this project
- Download from GitHub and upload the latest Project code to the clock using Micro USB cable (you can use one from mobile phone)
Forecasting algorithm is the following:
Arduino Nano gets new data from BME280 sensor every 12 minutes. The measurement cycle is 3 hours. After 3 hours the range of pressure monitoring (max and min value during 3 hours) shifts relative to average values during the current range and current pressure value. Every hour the direction of pressure change with current pressure value are saved. kPa units are used for forecast calculation.
Due to memory limitations of Nano the forecasting algorithm had to be simplified. But despite simplifications, it is able to forecast precipitation in next 12-24 hours even though the forecasting is now more pessimistic - the default value is "Cloudy Weather".
"Sunny Weather" - current value of pressure is higher than norm by 7 points, pressure is not falling and difference between min and max values during the last 3 hours is not more than 2 points.
Possible precipitation "Rainy Weather" - current pressure is 15 points lower than norm and difference between min & max values is more than 2 points OR Pressure is falling and difference between current value and norm is 3 - 30 points.
To improve the quality of forecasting it is recommended to change your "altitude" in the main code file. You can get your altitude for example here: https://www.daftlogic.com/sandbox-google-maps-find-altitude.htm
If it was difficult to follow what I did above, here is also a video version with all the steps shown.
Overall, from my point of view, the difficulty level of this project is not high and anyone could make it.If you don't have an old clock, you can find one cheap at a local flea-market.
All the components are low price and are available on SparkFun/Aliexpress/eBay/Amazon.
I hope this tutorial was interesting to you!