Weather Forecast Clock Using Old Alarm and Arduino

20K15545

Intro: Weather Forecast Clock Using Old Alarm and Arduino

I had a broken alarm clock lying around and came up with an idea to convert it to clock and weather forecasting station.

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

STEP 1: Disassemble Everything

First I disassembled the old clock. Bells, motor, broken clock mechanism...

STEP 2: Buttons for Digital Settings

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.

STEP 3: Capacitor for the Motor

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.

STEP 4: New Face for the Clock

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.

STEP 5: Digital Display From Old Mobile Phone

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!

STEP 6: Connecting the Circuits

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.

STEP 7: Junction Board for Easy Connections

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.

btw Can you see the LDR sensor already installed on the clock face in the first picture?

STEP 8: Setting Up the Power

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.

STEP 9: Micro USB for Charging and Updating Firmware

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 showed in previous sections.

STEP 10: Final Assembly

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.

Hover on the first photo to see where each component was placed.

STEP 11: The Code


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-fin...

STEP 12: Step-by-step Video


If it was difficult to follow what I did above, here is also a video version with all the steps shown.

STEP 13: Final Words

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 and would be grateful if you could support my first Instructable in the Clock contest.

30 Comments

Hi,
thanks a lot for your project. I try to reduce the size of compilation : 32436Bits. I thought that take a oldest library for BME280 and with the 1.0.3 it's the only one solution to minimze the size. 30620/30720max. what is the size for your sketch please ? thanks a lots
Good morning/evening.
I
have a question. I am working on your Weather Forecast Alarm Clock
Arduino Project for a class. I purchased some Nokia screens. However,
what I noticed was the screens I purchased did not come with the red pcb
board around it. It is just a screen. Is there any possible way around
this? Is there anything else I could use in its place to connect the
screen and get it power?
Thank you for your time, I hope to hear from you.
Respectfully,
Gabriel
hi. Are you able to post a picture of both sides of the screen?
Also, a few more questions: I’m new to the arduino stuff do please forgive my stupidity -what range of wire gauges would you use for this project. And, In your video it looks like you initially soldered the motor wires to he bottom of the black plastic piece...I don’t see a conductor there. Or did you solder it to the screw?
Regarding your 5110 screen - as I said earlier it will cost less time and effort to buy the screens with PCBs. In case we're talking about 100 pieces that you already purchased for the class of students it is worth ordering 100 PCBs to stick them to. Here's the solution:
https://forum.arduino.cc/index.php?topic=149181.0

Wire gauges don't really matter. Don't buy the wires, just take any unwanted LAN network cable and strip it. You will get a nice set of colored wires. Soldering them takes some skill - need to be quick before the wire skin melts but I got used to them and only use wires from LAN cables now.

Wires from the motor are attached to the connecting board directly to the transistor.
I found this in my Arduino Kit - It looks similar to the screen your using. How would I connect this piece to the screen I'm using, and get power on?
Hi. I thought you had a 5110 screen. The code of this clock would need extensive modifications to be able to work with your screen. By no means it would be a beginner task, especially that the code takes up all the space so you'd run into other problems too.
I'd recommend to buy a cheap 5110 screen from Aliexpress. It only costs $1.80 including shipping. Totally not worth it to spend time modifying the code.
Here are the links: https://www.aliexpress.com/item/32614385091.html
https://www.aliexpress.com/item/32352832146.html
It might be possible to connect your 5110 screen without PCB however, I'd need to see the back side.
Great design! I'm thinking of making one too.
I checked in your schematic that you use a transitor to turn on the alarm motor. What is the trasitor you used?
Greetings from Portugal.
Hi, I made an alarm, everything works only with an alarm setting that shows crap.....Thank you for your help
Hi,
Your clock looks great. Would be cool to see the whole object :-)
As to the garbage - this might be due to the program being so large that some overflow happens.
What is the purpose of the additional text and icon that you introduced?
Can you share your answer to this question asap pls?

Hi, very nice project. Tested it in 'breadboard style' - without battery and motor part :)

Overall all works fine.

Found some small issues:

- clock date can't be adjusted from menu - need to use Arduino IDE for this.

- first time when set alarm got strange big numbers for hours and minutes - over 23 and 59 - at least they can be lowered with down button.

- project needs 'LCD5110_Graph' library to work, not 'LCD5110_Basic'

- metric units are odd - in Europe we use hPa for pressure.

Btw, never tryed before BME280 pressure sensor and looks like is quite accurate.

What's yours LDR sensor - mine 5k photoresistor not works well ?

Think to add one more sensor - like DS18B20 for temperature instead Battery voltage monitor screen.

Thanks for this project - i hope you win in 'Clocks Contest'.

Wow! Thank you for sharing! It looks great!

Thank you for such valuable feedback. You are right on all points. Here are some responses:

+ Clock date and time were set using the standard example script from the 1307 library (added a note on this into GitHub Readme). As you might have noticed, the current code uses up all memory so we were not able to add the initial date/time setting. In the future we will create a small "initialise" program that will erase alarm clock memory (to prevent garbage data like you got when you set alarm first time) and set the right time.

+ Thanks for pointing out on the right lib. We re-uploaded the correct lib and fixed the links on GitHub.

+ Yes, BME280 is probably the best you can get at the moment.

+ Your LDR is a more expensive type. We used the most basic ones from Aliexpress.

Thank you for fast response.

Yea, i noticed lack of memory when tryed to add DS18B20 sensor - no luck with Nano, on Uno with 1.5k more memory will work :(

+ fixed low LDR resistance with 4.7k resistor in series :)

btw, How works Weather forecast - Sunny, Cloudy, Rainy ?

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

Many thx. for explanation. Just changed 'const int altitude' to 600 (my location).

Congratulations - your project is among finalists !!!

PS. Clock works great and weather indicators are better than father's weather station :)

Thank you and really happy that it worked for you too!

More Comments