Raspberry Pi Zero W Fun

The Raspberry Pi Zero W is likely the basis of my next few projects.

So I have a few things I want to build, and they are sort of coming together a bit. I want to have a way to plug a small sensor board board (1x2 inches or so) into a USB wall wart power supply with vertical power sockets and have it measure temperature, humidity, and motion and connect over wifi. And, I want to pick up my ideas for a robotics development platform that is good for both teaching and actual small robots.

Sensor Board

The sensor board is just a way to remotely measure the conditions in a room far far away. Temperature and humidy are metrics - best stored as a time series, probably in Prometheus. I’m a big fan of Prometheus, both at work and for home projects. I have a nice home network traffic analysis system built around it. Still pondering about the motion sensor parts - but likely would just use those as direct entries into AlertManager. This is all thinking based around work we did on the Observability Framework in 2019.

Earlier testing had me quite fond of these radar boards for motion detection. The cheap IR sensors work, kinda, but they are big and bulky and I found them to be pain to adjust to the sensitivity I wanted. I figured these radar boards could be a daughter board of sorts. If this thing plugs onto the power plug then it could be almost as wide, and that gives me an inch of depth so I could do three boards stacked if I wanted and still have room for a 3D printed case around it.

This project is in the very early stages of thinking and then, along came robotics again.

Robotics

Over the last ten years or so I’ve coached a lot of educational robotics (FLL and VEX). I keep meaning to write more about what I find WRONG with them, but I never seem to do it. The core idea of my disatisfaction is that the existing programs de-emphasize coding, and de-emphasize creativity, all in favor of adopting a specific program, product, and framework. Which is fine, unless you want to break out of that.

I just learned of a new competition called Pi Wars at Home. I am really encouraging folks to check it out. This has rekindled my thinking around robotics, especially how to make it more approachable.

RBOT

I had huge grand plans in early 2019 to build an actuator board I called RBOT. The problem is that it was vastly more work than one person could do. Even if I completely ignored my wife and kids - not something I want to do - there just was not enough time to build and debug the board AND then build and debug the sensors. And, in hindsight, the choice of the ESP32 really would have caused a HUGE time investment that probably would have ended up being counter to some of my core principles. I really want this platform to be open to MORE people learning to code (especially teenagers) not less. The learning curve of ESP32 and FreeRTOS is almost certainly too steep for most of them. It would not have been an approachable tool.

My plans for RBOT were to use a ESP32-PICO-KIT-V4 as the compute daughterboard. It costs $8 at Digikey or $11 at Amazon. I actually designed a specific way to support that as a daughterboard. I developed an Eagle part for it. Now Eagle is stupidly bundled with Fushion 360 - that I don’t need - so it’s not even worth playing with the limited free version. It’s time to spend some time learning KiCad. Damn. More wasted time.

So, my plan had been to use the ESP32 board. But wait… the Raspberry Pi Zero Wireless is $10. Cheaper. And it’s a real linux machine. Sure, it’s single core and it’s a lot slower than a Raspberry Pi 3 or 4, but it’s likely much faster than the ESP32. And developing the code will be MUCH easier. And much more approachable for teenagers and makers in general.

Raspberry Pi Zero W

So I bought one. Here it is with a sensor breakout board connected.

It’s just a BME280 temperature and humidity sensor.

gherlein@raspberrypi:~ $ sudo i2cdetect -y 1
[sudo] password for gherlein: 
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- 77 

The sensor is detected, at least.

Setup

Some notes, for posterity. You really want to treat these boards as headless. That means you reall want to network enable them right away. [Here](https://desertbot.io/blog/setup-pi-zero-w-headless-wifi_ is a post with details on that, but the key things are:

# mount the SD card and cd into the /boot folder
touch /Volumes/boot/ssh
touch /Volumes/boot/wpa_supplicant.conf

Then edit wpa_supplicant.conf to include your details

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="NETWORK-NAME"
    psk="NETWORK-PASSWORD"
}

The pi will use zeroconf so that you can directly ssh it without setting up any DNS foo.

ssh pi@raspberrypi.local

Then set it up like usual.

Software

I’m just starting on planning the software. Stay tuned. Still pondering if I should leverage the linux sysfs interface, write my own i2c drivers, or just stay in user space and go direct to the devices. Design time!

Clicky

Clicky

 Share!