A balcony weather station built with Pico W microcontrollers and the C SDK
Find a file
2026-02-24 08:59:42 +01:00
.zed fix zed tab size settings 2025-04-30 12:55:45 +02:00
diagrams grey out todo parts in arch diagram 2026-02-24 08:59:42 +01:00
event_proxy get pm measurment working 2025-12-25 17:53:04 +01:00
old_micro_python_code init converting project from micro python to c 2025-04-06 13:01:48 +02:00
.gitignore init converting project from micro python to c 2025-04-06 13:01:48 +02:00
bme280.c clean up bem280 lib 2025-04-09 18:15:55 +02:00
bme280.h get bem280 humidity reading working 2025-04-09 13:22:29 +02:00
CmakeLists.txt clean up cmake and swap humidity and pressure 2025-12-25 16:38:19 +01:00
flash.sh create helper scripts 2025-04-08 18:49:39 +02:00
LICENSE.md add LICENSE 2023-08-10 10:18:47 +02:00
lwipopts.h get mqtt_client building 2025-04-14 12:21:12 +02:00
lwipopts_examples_common.h wifi scan 2025-04-13 19:14:55 +02:00
mbedtls_config.h get mqtt_client building 2025-04-14 12:21:12 +02:00
mbedtls_config_examples_common.h get mqtt_client building 2025-04-14 12:21:12 +02:00
node1.c add 12h restart 2026-02-22 17:25:38 +01:00
node1_config.json convert mqtt_client from app to lib 2025-09-13 17:04:18 +02:00
node1_old.c add node1_old and turn off all power save modes on the pico wifi chip 2026-02-08 15:36:16 +01:00
node1_payload_example.json create node1 entity in home assistant 2025-04-13 08:45:54 +02:00
node2.c init node2 2026-02-23 22:22:23 +01:00
pico_sdk_import.cmake init converting project from micro python to c 2025-04-06 13:01:48 +02:00
pms5003.c get pms5003 working 2026-02-22 15:33:58 +01:00
pms5003.h start working with timers 2025-04-11 21:48:00 +02:00
README.md grey out todo parts in arch diagram 2026-02-24 08:59:42 +01:00
screen.sh create helper scripts 2025-04-08 18:49:39 +02:00
tasks.txt add wifi status led 2026-02-22 10:57:27 +01:00
tcp.c use llm to write count up tcp test 2025-09-15 21:13:09 +02:00
tcp_client.c format and try to get tcp working 2025-12-27 21:26:44 +01:00
tcp_client.h init llm assisted tcp client 2025-12-21 18:30:49 +01:00
wifi_scan.c wifi scan 2025-04-13 19:14:55 +02:00

Balcony Weather Station

A DIY weather station project on my balcony. The data is sent to Home Assistant to be used as part of home automation projects.

The source code started as CircuitPython following many of the patterns I learned in creating an aquarium controller project. I have since switch to using C for better performance and control.

Capabilities

  • Send data to Home Assistant via MQTT
  • read tempature
  • read humidity
  • read atmospheric pressure
  • read partical matter PM1, PM2.5, and PM10
  • read noise levels
  • read wind speed
  • read wind direction
  • read rain fall
  • read light level

Pics

Node 1 WIP:

node 1 opened up on kitchen table

Node 1 Installed:

node 1 installed on balcony railing

Hardware

Arch

arch

Node1

Sensors:

  • BME280
    • reads tempature, humidity, and atmospheric pressure
  • PMS5003
    • reads partical matter PM1, PM2.5, and PM10

MC: Raspberry Pi Pico W

Weatherproof Enclosure: weatherproof-cover-for-outdoor-sensors

Note: I would not recommend buying from pimoroni from EU as shipping tax is huge!

Dev

Env Setup

From build folder run:

$ cmake -DPICO_BOARD=pico_w ..

This creates the needed makefiles

Build

This turns the test.c file in the root dir into .elf and .uf2 files:

$ make node1

Flash

Once you have the .uf2 file you can transfer it to the pico by putting the pico in bootsel mode (hold button and plug it into pc) or you can flash the .elf file to the pico using openocd:

openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000" -c "program node1.elf verify reset exit"

note: after flashing with openocd the program will be paused. To unpause connect and run "continue"

Shell

You screen

$ fd tty.usb /dev
/dev/tty.usbmodem102
$ screen /dev/tty.usbmodem102 115200

Exit shell Ctrl+A Ctrl+|

Open debug connection

$ openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000"

then in another window

$ lldb ./test.elf

Once in lldb you can do a bunch of stuff, see https://web.navan.dev/posts/2024-08-08-openocd-macos-lldb.html.

(lldb) platform select remote-gdb-server
...
(lldb) process connect connect://localhost:3333

Set breakpoint:

(lldb) breakpoint set --hardware --name main
(lldb) continue # Continue execution
(lldb) step     # Step in
(lldb) next     # Step over
(lldb) finish   # Step out

Check vars:

(lldb) frame variable
(lldb) print variable_name

Restarting the program:

(lldb) process plugin packet monitor reset run

Home assistant debugging

Subscribe to a topic

$ TOPIC=zigbee2mqtt/0xa4c13848a46ea1cf; mosquitto_sub -h 192.168.1.11 -t $TOPIC  -u homeassistant -P xxx

Send message

Config example:

$ mosquitto_pub -h 192.168.1.11 -P xxxxxxxx \
-u homeassistant  -t homeassistant/device/bws/node1_001/config \
-f node1.json -r

Payload example:

$ mosquitto_pub -h 192.168.1.11 -P xxxxxxxx \
-u homeassistant  -t bws/node1/state \
-f node1_payload_example.json