Weather Forecast Clock Using Old Alarm and Arduino

14,541

137

18

We are 3 friends who join up forces to make stuff during evenings and weekends. Our biggest passi...

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.

Clocks Contest

Runner Up in the
Clocks Contest

Share

    Recommendations

    • Fix It! Contest

      Fix It! Contest
    • Tiny Home Contest

      Tiny Home Contest
    • Audio Contest 2018

      Audio Contest 2018

    18 Discussions

    2
    None
    warior12

    7 weeks ago

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

    Meteo_1.jpgMeteo_4.jpgMeteo_5.jpg
    5 replies
    0
    None
    LenkaDesignwarior12

    Reply 7 weeks ago

    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.

    0
    None
    warior12LenkaDesign

    Reply 6 weeks ago

    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 ?

    0
    None
    LenkaDesignwarior12

    Reply 6 weeks ago

    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

    0
    None
    warior12LenkaDesign

    Reply 6 weeks ago

    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 :)

    0
    None
    LenkaDesignwarior12

    Reply 6 weeks ago

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

    0
    None
    bugsy_malone 666

    2 months ago

    Initially I thought this was a bit of an odd projected when it popped up on my instructable email, however reading through its Awesome :D I did wonder though, how does it know what sort of weather it is, or is it the digital equivalent of a barometer you hang on the wall? I certainly think its cool enough to try building one, just maybe with a different screen :)

    1 reply
    0
    None
    LenkaDesignbugsy_malone 666

    Reply 2 months ago

    Thanks. The forecast is based on well known calculation process, just like people used to do using barometers.

    0
    None
    bugsy_malone 666LenkaDesign

    Reply 2 months ago

    Will the clock run while charging? Maybe an extra feature would be to have it so the Arduino also turns something on so USB power can permanently applied and when the battery is starting to go flat could bring the charger on so its not always on charge and not always on battery :)

    0
    None
    Artuino

    2 months ago

    I thought its that complex having seen the circular PCB and the stuff. But the electronics can easily be outsourced.nicely done clock..thanks.

    1 reply
    0
    None
    LenkaDesignArtuino

    Reply 2 months ago

    The circular PCB is a decoration. Electronics inside are very simple even for a novice. thanks for the warm comment!