ESP32 Airplane Banner

If someone thinks I like clocks of all kinds … he might be right :-)

A project with a dot matrix clock of CiccioCB, the author of ANNEX32, an ESP32 BASIC-Interpreter,  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 … wrote some BASIC-code … and ended up with this:

Image

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

Banner2

I used an ESP32 for this – but an ESP8266 will do the job as well.

Image

Image

The wiring should be clearly visible in the photo – but not so obvious: PIN23 is connected to the data (in) of the FIRST rightmost module.

Here is my ANNEX32-Code for my setup with ESP32 and 8*8×8-DotMatrix-modules:

' 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 PERSONAL API-ID HERE<<<<<<<<<<<<<<<<<<<<<<
Openweather_ID$ = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
Town$           = "Krefeld,DE"
Language$       = "de"
Units$          = "metric"
WEATHER$        = ""
RETURN
'#########################################################################

Image

Should I ever suffer from boredom, I install a subminiature electric motor in the front of the aircraft so that the propeller can then get some pulse-width-modulated fuel from the ESP32 :-)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: