Peppers ❤ Python

Fun fact: I’ve been growing chocolate ghost pepper plants in my office for the past year. Although, due to the oversight of growing these in an office building, I’ve produced plenty of flowers but no peppers because there’s nothing flying around to pollinate them. But, that’s a problem for another day.

One problem I don’t have is maintaining adequate soil moisture. That’s because I’ve built a system using a Raspberry Pi Zero W and some capacitive soil moisture sensors to monitor the soil and change the color of an LED accordingly. Now, my coworkers know to water the plants when they notice a red light. And if they notice a red light along with an annoying sound emitted by a piezoelectric buzzer, they know the helpless office foliage needs water NOW!

After a false start with a defective Adafruit STEMMA Soil Sensor, my friend Tim showed me an awesome Analog-to-Digital converter which converts analog signals to I2C for use with the GPIO pins on the Raspberry Pi. This particular chip has four input channels which paired nicely with the 3-pack of analog moisture sensors I found on Amazon.

Once all the hardware was wired up, I wrote a bit of Python that utilized Adafruit’s ADS1x15 library to query the value reported by each sensor, average them together, and update the LED accordingly. The script is automatically executed by a cron job every minute.

Was all of this really necessary? Absolutely not. But it was a fun weekend project which reminded me that my Computer Engineering degree might have been worth it after all.

ProductPriceVendor
10mm RGB LED [10x]$3.99Micro Center
ADS1115 16-bit I2C Analog-to-Digital Converter$6.99Amazon
Capacitive Soil Moisture Sensor [3x]$10.99Amazon
Piezoelectric Buzzer [3x]$4.99Amazon
Raspberry Pi Zero Case – Clear/Black$4.99Micro Center
Raspberry Pi Zero W$5.00Micro Center

Circuit Wiring Schematic


pepperbot2.py source code


Muzei Saver 2.0.0

Muzei is a pretty awesome live wallpaper app for Android created by Google developers Roman Nurik and Ian Lake. It has an API that allows it to be extended and use custom sources that change throughout the day. I’ve been using it (somewhat ironically) to change my Android wallpaper to the Bing Image of the Day for the past several years. Because sometimes I like to download the artwork and because Muzei makes this really easy with its API, I created a simple Android app called Muzei Saver.

A user recently emailed me with a feature request. Apparently some Muzei source plugins always publish their artwork with the same title/byline. Since the app constructs the filename from this metadata, downloading subsequent artwork would overwrite the previous file.

The user requested that I add a timestamp to the filename. “No problemo”, I thought. Then as I pulled the source code down from GitHub, I realized it was over three years old! A lot has changed with Android since then and this incredibly simple app needed to be rewritten to support modern standards.

The first step was to update the target SDK version from 21 (Lollipop) to 28 (Pie), Gradle from 2.2.1 to 4.10.1, and the Android Studio Gradle plugin from 1.0.0 to 3.3.1. I also took the opportunity to migrate from the old Android Support Library to the new AndroidX namespace. Then, because the old app was written in Java and I’ve since decided that Kotlin is amazing for Android development, I took the opportunity to rewrite it. The app is incredibly simple, so this was trivial. When I did so, I remembered to add a timestamp to the filename, per the original request. 🙂

Finally, I had one more unanticipated hurdle. Android introduced runtime permissions back in API 23 (Marshmallow). Because the app requires the
WRITE_EXTERNAL_STORAGE permission in order to save the artwork to disk, I now had to prompt the user to authorize this permission before saving the file the first time. At this point I was getting slightly irritated, so I pulled in the EasyPermissions library which made this relatively straightforward.

Finally, what I casually assumed would be a one or two line code change resulted in a complete rewrite over the course of an evening. It was a fun exercise, if for no reason than to remind myself how much Android development has changed over the years. And with that, the brand new version 2.0.0 was christened. Check it out for yourself with the links below.

Far Cry 5 on KINGPIN

When running @ 1440p with Ultra graphics settings, on average enabling SLI results in an additional 19 frames-per-second (an increase of 24.7%). Worth it? Even with a 144 Hz G-Sync monitor, probably not.

Single GPUSLI
GPU 0 Temperature82° C
80° C
GPU 1 Temperature37° C67° C
Average Frame Rate77 FPS96 FPS

Here’s the fancy output from the game’s built-in benchmark with SLI enabled.

KINGPIN

My newest gaming rig, retiring DARKHELMET.

ComponentProductPriceVendor
CPUIntel Core i7 9700K$399.99Micro Center
CaseCorsair Vengeance C70$159.99Corsair
CaseCorsair C70 Custom Window CLEAR$32.99Mnpctech
CoolingArctic Silver 5 Thermal Compound$7.99Micro Center
CoolingCorsair Hydro H115i Pro$144.99Micro Center
CoolingCorsair SP120 Fan (2 pack) [2x]$79.98Micro Center
DiskSamsung 860 Evo 1 TB SATA$127.96Amazon
DiskSamsung 970 Pro 512 GB M.2$169.99Micro Center
DiskWestern Digital WD Red 4 TB SATA$124.99Micro Center
GPUNvida GTX 1080 FE (Refurbished) [2x]$859.96Micro Center
HeadsetCorsair VOID Pro RGB Wireless$101.98Micro Center
Headset StandCorsair ST100 RGB$59.99Micro Center
KeyboardCorsair K70 Lux Red$89.99Micro Center
MonitorAcer Predator XB271HU 27″ WQHD 144Hz$599.99Micro Center
MonitorAcer K272HUL (DBMIDPX) 27″ WQHD [2x]
$399.98Newegg
Monitor StandSIIG Triple Monitor Desk Stand$149.99Micro Center
MotherboardGigabyte Z390 Aorus Ultra ATX$199.99Micro Center
MouseCorsair Dark Core RGB SE$89.99Micro Center
Mouse PadCorsair MM1000 Qi Wireless Charging $79.99Micro Center
OSWindows 10 Pro OEM$139.99Micro Center
OpticalLG WH14NS40 BD-RE SATA$59.99Amazon
Power SupplyCorsair RM750x 750W$69.99Newegg
RAMCorsair Vengeance RGB Pro 64GB$499.99Newegg
SLI HB BridgeGigabyte Aorus GC-A2WAYSLI$14.99Newegg
UPSAPC BN650M1 650VA/360W$59.99Micro Center

Hello world!

I guess I have a blog now. This is a place mostly for me to document things I’ve done or think are otherwise interesting.

Actually, I’m just copying my friend Tim. He documents his computer builds on his blog.