Home automation system built with RP2040 W and RP2350 W boards

So I’ve been building a system based solely around RP Pico’s. One RP2350 W is the main server displaying these web pages.

All communication via WiFi and no MQTT hub required. The whole system consists of

  • Pico2W handling the webserver and controls
  • the second CPU in the Pico 2W handling an LCD display
  • 2 temperature sensors (living room and garage)
  • 1 temp/humidity/pressure sensor in lanai
  • 2 Shelly plugs controlling lights
  • 1 Kauf bulb over the entry way with flashy red/white/blue every couple minutes
  • 1 PIR sensor on PicoW which controls a Kasa plug lights in a dark garage (my wife thinks this is the best part)
  • Ambient light sensor will turn on a selected light when dark during daytime storms
  • Control of lights based on sunset or time
  • Cloudflare tunnel to access from anywhere
  • PIR sensor with RP2040 controlling light via a Kasa plug.
  • a soil moisture sensor powered from a canabalized solar light

As the RP2350 has 2 CPUs, the idle one was setup to drive a display (necessary, not really just blinking light factor)

So what software is involved -

  • html and css stored on the Pico 2W
  • either BASIC or C to handle the sensor or hub functions
  • low level C for BASIC firmware version
  • C/ BASIC compilers on PC/Linux/RPi

One key to the interactive webpages is /?cgi functions that call underlying routines or display/set variables.

Also a <?web construct that executes routines in the underlying code, or does simple if statements.

And a wprintf in C or BASIC that generates html content for the webpages.

Drop me a line for a link to ALL the sources.

Also some of the enclosures (from Amazon or Pi shop – maybe someday I’ll try my hand at 3D printing). Double sticky taped to USB charger – temp sensors deliberitly outside the boxes, or velcro so I can update them. The PIR sensor was triggered by the RP2040W so had to be seperate.

Ooo, I need to look into this. I’m slowly replacing the Chinese power modules I have installed that require their app to use with Shelley modules. While I trust Shelley Web, I’d still rather run things locally.

You can control Shelly plugs from a webpage

http_ret = http(lr_ip, "/rpc/Switch.Set?id=0&on=true")

All you need is the ip address – from you DNS server

Kasa plugs are controlled by TCP with their older xor security, which so far they still support

Cool beans - Nice work!

So here are the sources to duplicate this setup. All needed compilers and sources will be installed.

Windows C version (installs gnuARM gcc and optional notepad++)

Windows BASIC version (installs BASIC compiler and optional notepad++)

Linux/RPi/Mac C version

Linux/RPi/Mac BASIC version

Documentation here

For BASIC install the Pico firmware from BASICtools

In both next format the “drive” for RP2350, details here

Next copy the home_monitor.html and css from the Examples directory to the RP2350 “drive”

Then compile the home_monitor .bas or .c files from the Examples directory

For the sensors, in BASIC install the RP2040 firmware details here

Then compile the sensor file, various temp sensors, motion, ambient light, or soil moisture programs

Drop me a line or reply with any questions.

This looks beautiful! The RP2040-W and RP2350-W boards are integrated really nicely, and the overall project looks impressive.

Spinning your Pico display in a lathe is not a good idea :grin: