Projects‎ > ‎

3D printed Clock


This is an nice application using Annex and its internal support for the MAX7219 dot matrix display.

The design is based on the original project that can be found here

The case can be just be printed using a 3D printer.

The 3D printer .STL files can be downloaded here

All the instructions on how build the 3D case can be found in the original project.

The software is just annex and few lines of code.

The electrical wiring is the one already present in the documentation

This example shows only the date and the time but it can be modified to show many other information such as weather, news in addition to local information as temperature, humidity, etc.

At the bottom of this page, there is another example that adds the weather information.

The code is very simple :

CODE: 3D_Clock.bas
' Simple program using Annex and a MAX7219 dot matrix module
' by cicciocb 2019
'Set 4 8x8 displays with GPIO15 as CS pin
MAXSCROLL.SETUP 4, 15
INTENSITY = 5
'Set the first message with Annex
MAXSCROLL.PRINT "Annex"
MAXSCROLL.SHOW 31, INTENSITY
PAUSE 1000
'Set the refresh rate of the display (50 msec) - lower values -> scroll faster
TIMER0 50, SCROLLME
WAIT

SCROLLME:
 'Scroll the display with the intensity defined before
MAXSCROLL.SCROLL INTENSITY 
' Set the text with the Date and Time
MAXSCROLL.TEXT DATE$ + " " + TIME$
RETURN


Some pictures








CLOCK WITH WEATHER INFORMATION

This slightly more complex program permit to include the weather information for any town in the world and in any supported language.

You just need an APP_ID code that can be received for free simply registering to the site https://openweathermap.org/.

This code, in the form of an hexadecimal string like "aabbccddeeff11223344556677889900 " must be set instead of "YOUR_APPID"

You can then select the town, the language and the units simply modifying the relative lines in the code.

In this example the town is Paris, in France and the language is French.

For more information on the town and the supported languages, please refers to the openweathermap api documentation




CODE: 3D_Clock2.bas

' Simple program using Annex and a MAX7219 dot matrix module
' by cicciocb 2019
' Shows Date, Time and weather information
'Set 4 8x8 displays with GPIO15 as CS pin
Openweather_ID$ = "YOUR_APPID"
Town$ = "Paris,fr"
Language$ = "fr"
Units$ = "metric"

MAXSCROLL.SETUP 4, 15
intensity = 5
'Set the first message with Annex
MAXSCROLL.PRINT "Annex"
MAXSCROLL.SHOW 31, intensity 

weather$ = ""
onWgetAsync asynco

pause 1000
'Set the refresh rate of the display (50 msec) - lower values -> scroll faster
TIMER0 50, SCROLLME
' timer for the weather info; refresh each 20 seconds 
timer1 20000, get_weather
gosub get_weather
WAIT

SCROLLME:
 'Scroll the display with the intensity defined before
MAXSCROLL.SCROLL intensity 
' Set the text with the Date, Time and weather infos
MAXSCROLL.NEXT DATE$ + " " + left$(TIME$, 5) + " " + weather$
RETURN

get_weather:
wgetasync("api.openweathermap.org/data/2.5/weather?q=" + town$ + "&lang=" + language$ + "&units=" + Units$ + "&appid=" + Openweather_ID$, 80)
return

asynco:
a$ = wgetresult$

weather$ = json$(a$, "weather.temp") + chr$(248) + "C " + json$(a$, "weather.pressure") + "hPa " + json$(a$, "weather.humidity") + "% " + json$(a$, "weather.description")
'converts some latin characters
weather$ = replace$(weather$, "é", chr$(130)) 
weather$ = replace$(weather$, "è", chr$(138))
weather$ = replace$(weather$, "à", chr$(133)
)
return



This is the display module to be installed in the case.
It can be found easily on ebay at around than 5€




The ESP8266 is a Wemos Mini available on ebay at around 3€




The wiring is done using the SPI bus plus a dedicated CS pin.























Comments