4421

This model airplane banner shows the time and some local online weather information

If someone thinks I like clocks of all kinds ... he might be right ;-)
 
 A clock project of the developer of the BASIC-Interpreter ANNEX32   for the ESP8266 / ESP32 with a MAX7219 display inspired me a little.
So I went back to my late childhood, spent a couple of hours gluing a model airplane together ... added some soldering work ... used the fabulous BASIC-Interpreter ANNEX32 ...  and ended up with this nice object.

The banner shows the time and some local online weather information from openweathermap.org and sits on a thin steel rod around which the second wire for the power supply runs.

I used an ESP32 for this - an ESP8266 will do the job as well.,
The dotmatrix display is made of  8 MAX7219 modules (4+4)

Some more detailed information  >HERE<

The code for the project runs in the BASIC-interpreter ANNEX32  . Find its documentation HERE.
' BANNER-CLOCK-AND-LOCAL-WEATHER-INFO
'
'   ANNEX > V1.4 @ ESP32 or ESP8266
'   and a MAX7219 dot matrix module as a banner display
'
'   Toggles between time and weather information
'   8*(MAX7219-8x8-dot-matrix-displays)
'
'   Do not forget to set the time_zone/DST string at the config page 
'   e.g.for AMSTERDAM/BERLIN: CET-1CEST,M3.5.0,M10.5.0/3  
' DB9JG@me.com 03/2021

VERSION$    = "1.2"
GOSUB       INIT_GET_INET_WEATHER
onWgetAsync MAKE_WEATHER_STRING

GOSUB       INIT_DISPLAY
GOSUB       SHOW_IP

'set the 1st timer to display starting with time info
TO_BE_SHOWN$ = "TIME"
GOSUB       SET_TIMER_FOR_WEATHER_OR_TIME

'set 2nd timer to get weather info and display it each 60 seconds
TIMER1 60000, GET_INET_WEATHER
WAIT
end
'#########################################################################
'#########################################################################

SET_TIMER_FOR_WEATHER_OR_TIME:
'=========================================================================
if TO_BE_SHOWN$ = "WEATHER" then
  'Set fast refresh rate for one run of the scrolling weather message
  TIMER0 70, SHOW_WEATHER_RUNNING_TEXT
else
  'refresh the not scrolling time only once per second
  TIMER0 1000, SHOW_TIME
endif
RETURN
'#########################################################################

SHOW_TIME:
'=========================================================================
MAXSCROLL.PRINT " " + left$(TIME$, 8) + " "
MAXSCROLL.SHOW 60, BRIGHTNESS
RETURN
'#########################################################################

SHOW_WEATHER_RUNNING_TEXT:
'=========================================================================
'SHOWS THE COMPLETE WEATHER-STRING SCROLLING and switches then back to SHOW_TIME
MAXSCROLL.SCROLL BRIGHTNESS
MAXSCROLL.TEXT " " + left$(TIME$, 8) + " Uhr " + WEATHER$ 
SCROLL_COUNT = SCROLL_COUNT + 1
if SCROLL_COUNT <= ((len(WEATHER$)+20)*7) then
  TO_BE_SHOWN$ = "WEATHER"
else
  'Back to SHOW_TIME if weather message has been scrolled complete
  SCROLL_COUNT = 0
  TO_BE_SHOWN$ = "TIME"
  GOSUB SET_TIMER_FOR_WEATHER_OR_TIME
endif
RETURN
'#########################################################################

GET_INET_WEATHER:
'=========================================================================
wgetasync("api.openweathermap.org/data/2.5/weather?q=" + town$ + "&lang=" + language$ + "&units=" + Units$ + "&appid=" + Openweather_ID$, 80)
TO_BE_SHOWN$ = "WEATHER"
GOSUB SET_TIMER_FOR_WEATHER_OR_TIME
RETURN
'#########################################################################

MAKE_WEATHER_STRING:
'=========================================================================
a$       = WGETRESULT$
WEATHER$ = ""
WEATHER$ = WEATHER$  + json$(a$, "weather.temp") + chr$(248) + "C  "
WEATHER$ = WEATHER$  + json$(a$, "weather.pressure")+ "hPa  "  
WEATHER$ = WEATHER$  + json$(a$, "weather.humidity") + "% " 
WEATHER$ = WEATHER$  + json$(a$, "weather.description")
WEATHER$ = WEATHER$  + " in "+ TOWN$ +"             "
'convert some characters
WEATHER$ = REPLACE$(WEATHER$, "é", chr$(130))
WEATHER$ = REPLACE$(WEATHER$, "è", chr$(138))
WEATHER$ = REPLACE$(WEATHER$, "à", chr$(133))
WEATHER$ = REPLACE$(WEATHER$, "ö", "oe")
WEATHER$ = REPLACE$(WEATHER$, "Ö", "Oe")
WEATHER$ = REPLACE$(WEATHER$, "ü", "ue")
WEATHER$ = REPLACE$(WEATHER$, "Ü", "Ue")
WEATHER$ = REPLACE$(WEATHER$, "ä", "ae")
WEATHER$ = REPLACE$(WEATHER$, "Ä", "Ae")
WEATHER$ = REPLACE$(WEATHER$, "ß", "ss")
RETURN
'#########################################################################

SHOW_IP:
'=========================================================================
WHILE wifi.status <> 3
  PAUSE 500
  PRINT "No Internet access"
WEND
OPTION.NTPSYNC
MAXSCROLL.PRINT  right$(WORD$(IP$,1),15)& "   "
MAXSCROLL.SHOW 79, BRIGHTNESS
FOR i = 1 to 140
  MAXSCROLL.OSCILLATE BRIGHTNESS
  PAUSE 60
NEXT i
PAUSE 2000
RETURN
'#########################################################################

INIT_DISPLAY:
'=========================================================================
BRIGHTNESS   = 0
MAXSCROLL.SETUP 8, 15
MAXSCROLL.PRINT "LET's GO!"
MAXSCROLL.SHOW 64, BRIGHTNESS
PAUSE 1500
RETURN
'#########################################################################

INIT_GET_INET_WEATHER:
'=========================================================================
'Insert your appid from openweathermap.org
Openweather_ID$ = "xxxxxxxxxxxxxxxxxxxxxxxxxxx"
Town$           = "Krefeld,DE"
Language$       = "de"
Units$          = "metric"
WEATHER$        = ""
RETURN
'#########################################################################