News:

The Savage///Circuits website has been upgraded to a more efficient theme.

Main Menu

Weather Station

Started by granz, Sep 08, 2025, 06:02 PM

Previous topic - Next topic

granz

Yet another project begins.

I have long wanted a weather station for my home. It should sit outside my house (or have sensors outside,) and be able to be read, either from an on-board display, or from the network. For most of today, I have been working on that.

This is the prototype, as it currently stands:

It could actually be taken outside, and placed somewhere safe from rain, and snow, and it will work as far as I've gotten. The OLED starts showing the weather data as soon as it gets the current time from the NTP (Network Time Protocol server - https://en.wikipedia.org/wiki/Network_Time_Protocol.)

When I telnet in, the display waits until on the minute (I think it looks cleaner that way  ;) ,) and then every minute prints the time, and weather readings:


The (PicoMite BASIC) code, as it stands, looks like this:
' Get current time from NTP
On error skip 3
WEB ntp -4
If MM.Errno Then WEB ntp -4
If MM.Errno Then Print "Failed to connect to NTP":End


Dim float t,h
CLS
Do
  t=0
  h=0
  Humid gp15,t,h,1
  temperature$=Str$(t,-1,1)
  temperature_F$=Str$((t*1.8)+32,-1,1)
  humidity$=Str$(h,-1,1)

' Display on OLED every second
  Text 5,5, Time$
  Text 5,15,"Temp(C): "
  Text 75,15, temperature$
  Text 5,25, "Temp(F): "
  Text 75,25, temperature_F$
  Text 5,35, "Humid: "
  Text 75,35, humidity$

' Print only on the minute
  If Right$(Time$,2)="00" Then
    Print Date$,Time$
    Print "Temp: ";temperature$;" C"
    Print "Temp: ";temperature_F$;" F"
    Print "Humidity: ";humidity$,"%"
    Print
    Print
  EndIf
  Pause 1000
Loop

There is a lot of room for improvement. Coming up is a web page interface (the PicoMite manual https://geoffg.net/Downloads/picomite/PicoMite_User_Manual.pdf, bottom of page 72.) This will look much better than the Telnet output (plus I won't have to wait for the top of the minute,) but I want to keep the Telnet output so that when I SSH in to my network, from outside, I will be able to check the weather. Although, connecting to Nyota (my communications server - https://en.wikipedia.org/wiki/Nyota_Uhura) via SSH and running a text-based browser to the PicoMite web server may do the job - more testing is needed.

Of course, it's a pretty poor weather report to have only the current temperature and humidity. So, an anemometer (wind speed) and wind vane (for wind direction) will be coming up. Also, I want a light-level sensor, maybe a UV light sensor, a rain gauge, and sensor to tell if it is currently raining (or someone's lawn sprinkler is hitting my sensor. ;D)

As each of these sensors is added, I will be able to read the weather reports, with the new data, via my network. The increase in sensors will require changes to the displayed data (or maybe a newer, bigger, display. I will be placing this prototype outside soon, and then I will solder up a more permanent system, and give it external connectors for the additional sensors. Keeping records should be included, but I haven't decided how that will go (adding an SD card to the weather station, or having it report to a server to keep a file there.)

One nice thing about the PicoMite is that I can Telnet into the thing, cancel the running program (ctrl-C) and then edit the program over the WiFi network - that is really cool.

JKnightandKARR

Cool might need to check it out.

granz

It is pretty cool, but way below what I want. Thinking about it, there is no record keeping. If I log in in the morning, there is no way to tell what the over-night low temperature was. Likewise, in the evening, there is no way to see what the high temperature for the day was.

Of course, that tiny OLED is way too small for that kind of stuff, but those records will need to be kept. The web page will be big enough to hold that kind of stuff. I can even show graphs of the different measurements.

It seems to me that the record keeping will be the next improvement. Maybe it will be a small record (a few days) kept on-board, and additional data sent to a server somewhere inside my house. After that, I'll begin adding other sensors.