Pete's Log: Solar library, part 1

Entry #1942, (Smokepacking, Starcraft)
(posted when I was 42 years old.)

JB spent last night at Jamie's parents, so that means a couple things:

  • StarCraft with Branden and Brian!
  • Spending some time trying to tame the chaos that is our post-vacation house
  • Soldering fun!

I decided it would be fun to make our Little Free Library solar powered. Not quite sure what that means, but I've amassed enough goodies to try some "prototyping" so here goes.

The ESP8266 felt like a promising platform, and as it happened, I happened to have at least five of these lying around (thanks HackerBoxes), most of them in the form of Wemos D1 Mini ESP8266 Modules. I also had a relay shield for this module, so I soldered some headers onto both and then promptly decided to forget about the relay.

Next, after a little research on firmware options, I decided to give ESPHome a shot. Installing it into Home Assistant was a breeze. There were only a couple tiny gotchas I discovered. One is if you're flashing via USB to make sure you plug the device into the Home Assistant machine before opening the ESPHome Web UI, so that it properly discovers the port. It didn't seem to do any periodic refresh, but since re-opening the Web UI worked, I didn't really look into things more. Especially since after the first USB flash, the OTA firmware upgrade functionality worked great.

The other is that my IoT SSID is set to not broadcast. I've been thinking of changing that anyway, but for now it was easy enough to add "fast_connect: true" to the wifi yaml configuration for the device.

Somehow I managed to completely forgot that my 3.3/5V breadboard power supply can only attach to the breadboard from one direction for proper polarity. Luckily the ESP8266 Module didn't mind the incorrect power application and once I flipped things around everything worked.

Next I found an Adafruit NeoPixel ring lying around. Soldered headers onto there and added a light section to the ESPHome device configuration.

light: - id: light_ring internal: False platform: neopixelbus type: GRB variant: SK6812 pin: RX num_leds: 12 method: ESP8266_DMA name: "Library Proto Light"

It worked immediately. Very promising. I think at this point I'm already considering ESPHome for more home automation.

At this point I started feeling curious about energy consumption since this is supposed to be hopefully battery/solar powered. One thing I enjoy about HackerBoxes is the random useful things they come with in addition to the primary projects. HackerBox 62 came with a USB power meter (and also my trusty winter hat). So as an excuse to finally test it, I plugged my little project into USB to check its power use.

No alt text found for this picture. Please email to complain.

The ESP8266 and the LEDs will probably be my main power consumers (I plan to add a few more sensors but don't think they'll be using much power). With the LEDs off, I draw about 80 mAmps. With the LEDs at full brightness, I draw 400 mA. But that is ridiculously bright. At a more reasonable brightness, I seem to draw about 144 mA.

No alt text found for this picture. Please email to complain.

The above all happened during JB's nap yesterday. After her nap, we dropped her off, then stopped at Microcenter for some more goodies. Among other things, I picked up a couple solar panels, rechargeable batteries, and a little circuit to take care of intelligently charging the battery from the solar input. There's better options out there, but that's what Microcenter had and I'm prototyping, so that's good enough for now. By the time we got home and ate dinner and I got the capacitor soldered onto the charging circuit, we were just about to lose our evening sun. But it was just high enough still for a basic test.

No alt text found for this picture. Please email to complain.

I also picked up a strip of Neopixels and a reed sensor. The goal being to have nice lighting around the inside of the library door that is activated when the door opens. As hinted at last night, I ran into some trouble soldering the NeoPixels and also decided I didn't have the right gauge of wire for connecting the pixel strips. But I did get the reed sensor hooked up and working. ESPHome is nice. And it supports automations on the device, so I don't need to round-trip to HA to tell the lights to turn on when the door opens. I do want to see if I can make a nice effect happen as the lights turn on, but for now I'm just happy that they do.

Today I decided to also add temperature (and humidity). The ESP8266 only has one analog input pin, which if anything I want to use to monitor battery level. But conveniently I have a DHT11 sensor lying around and ESPHome makes it super easy to configure those. So here's the breadboard prototype as far as I've brought it to this point:

No alt text found for this picture. Please email to complain.

At Microcenter I had also picked up some perforated prototyping board and started practicing soldering headers and connections onto there, but then I remembered I had a Wemos D1 Mini prototype shield. So I soldered power connectors and headers for the temperature sensor onto there.

No alt text found for this picture. Please email to complain. No alt text found for this picture. Please email to complain.

I have lots more practicing to do when it comes to this kind of soldering. Some guided mentoring (a.k.a. adult supervision) would probably help. But I'm continuing to improve slowly.

Since I have several D1 Minis, I opted to leave the breadboard prototype intact for indoor prototyping and configured a second D1 Mini on this prototype board. I connected it to my battery circuitry and threw it in a box and took it out to the library.

No alt text found for this picture. Please email to complain.

This was the moment of truth in several ways: would it connect to wifi from outside in the library? Would the battery power it? The answer to both questions was yes. And also, I learned it's real hot in the library today.

No alt text found for this picture. Please email to complain.

What's next? Well, I need to continue my battle with the NeoPixel strips. I need to get the door sensor connected. Need to make a hole to feed in the cable from the solar panel. Need to add battery level monitoring. Need to test how long the battery can power this thing (I left it outside for a half hour or so today). Plenty more things to work through I'm sure. But I enjoyed myself. And I'm real excited about ESPHome.

Also, on the way to pick JB up today, we stopped at Microcenter again. Picked up a better gauge of wire for connecting the pixel strips and also some strong magnets, since the fridge magnets I was using for testing the reed switch didn't seem quite right for the job outside.