Windmill

Oh boy, I’ve been working on this one for a while.

A year or two ago I set out to build a model windmill that would pump water from the garden pond in my folks’ yard, just for a fun lawn ornament. I went through several different designs for the rotor, the gearbox, and the pump, until finally deciding to just have the windmill operate a bird silhouette to make it look as though the bird were drinking from the pond.

A brief history of the project:

  1. Started experimenting with airfoil blades
  2. Switched to flat blades to better suit the uneven wind conditions near the ground
  3. Designed a gearbox using a 4:1 spur gear reduction and a pitman slide arrangement to drive a pump rod up and down, very much like typical wind pumps
  4. Tried several pumps including a reciprocating piston pump, a diaphragm pump
  5. Delivered original production model
  6. Production model failed due to many alignment and balance problems
  7. Designed new gearbox that better aligned the shafts and used an 11:1 worm drive reduction, achieved far better torque
  8. Decided diaphragm pump was too leaky, designed and built reciprocating pump using large purchased syringe as the piston; pump worked well
  9. Windmill still did not produce enough torque to drive this pump
  10. Designed Archimedes’ screw pump to raise water; screw worked well, but windmill couldn’t reliably transfer power to it
  11. Switched to drinking bird silhouette idea (present day)

I wanted to be able to pump water, but it’s just asking a lot of a system like this (low to the ground, small rotor). I’m still really happy with the windmill itself–particularly the gearbox–and the drinking bird was just a simple load I knew it could handle.

Below are some videos in approximately chronological order. The server isn’t wanting to let me upload photos at the moment, so I’ll try to edit those in later.

Early pump test
Testing the flat-blade rotor with a fan
The new worm drive gearbox (11:1)
Final lawn ornament drinking bird silhouette

Solenoid Engine

I got the solenoid engine working tonight. I filmed a video of it in action, starting out around 5.5v and increasing to 7.5v. This has a dramatic effect on the engine’s RPM.

The solenoids only got a little warm during the filming of the video, so that’s a good sign. Next steps will be to diagram the circuit in EasyEDA and get a PCB made, then mount the whole thing on a pinewood derby car body. But this is good for now.

Optical Commutation

I finished putting together an optical commutation circuit on a breadboard tonight. It uses an IR emitter/detector pair to trigger timer chips that ultimately turn on power transistors to drive solenoids. The solenoids are logically opposite, so they alternate as the IR beam is made and broken.

The timer chips aren’t strictly necessary, but they prevent the solenoids from staying on too long and burning up. You can see this in the video below when I am blocking and unblocking the IR path using a playing card–I sometimes leave the card in or out for a few moments, during which time whichever solenoid is powered returns to a resting state after about one second.

I’ll use this circuit to drive the two solenoids in my solenoid engine, which will have a rotating half-moon to block and unblock the IR beam.

Ball Game

I finished the first iteration of a Plinko-like ball game I started working on a while ago for my son. It uses printed parts, some plywood, a sheet of Lexan, and a Nerf Rival ball to create a simple combination of pinball and the famous Plinko game from The Price is Right.

The objective isn’t well defined, but the boys enjoy playing with it. A friend suggested replacing some of the peg openings with cups that correspond to score amounts to provide an objective for the player to work toward. I may do that in the next iteration.

Sorry about the video quality–I can’t find my better camera at the moment.

Solenoid Engine Prototyping

I’ve started thinking about how I might build a solenoid engine. I bought a couple solenoids on Amazon, Uxcell brand, and they seem to have quite a bit of zip to them, so I’ve been looking into how to mount them to a block in a way that would allow them to rotate around an axis, eliminating the need for the connecting rod to rotate with the piston head, which in this case is just the armature of the solenoid.

Pictured below is the first three attempts at printing a little box to hold a solenoid. The little wings on the side have 1/8″ holes in them that will fit over a rod, allowing the solenoid assemblies (I plan on having two of those) to lie directly over the crankshaft and rotate back and forth with the cranks.

You can see the design process as it unfolded, first with no venting on the sides, then with vertical venting and finally diagonal venting to allow the solenoids’ windings to cool off better during operation. I don’t know how much of a problem heat will be, though, since I’ll be running somehow around half the rated service voltage of the solenoids, at 50% duty cycle to boot.

I did melt the diagonal vents a little with a heat gun while trying to de-string the object. Oops.

The PRalarm

I have been working on stuff without posting about it this entire time. My latest finished product is the PRalarm, short for Pull Request alarm. It is an Arduino-driven USB device that lights up when somebody pushes a pull request that needs review.

We recently transitioned to this source control pattern at my work, so I decided this device would help me stay on top of reviews better than yet another e-mail alert.

The Arduino is a Teensy LC with a simple “rawhid” program that accepts messages from the PC host. When the device gets any kind of message, it does a three-second lightshow. On the PC side, I just use a cron job that uses the “hub” command-line github client to check the latest PR number and compare it to a hidden file, ~/.pr. If the PR from hub is newer than what’s in the hidden file, or if the hidden file does not exist yet, the script calls a C program that sends one message to the device and then terminates. The script then records this latest PR number back into ~/.pr.

Here is a picture of the device, which is inspired by the git logo. I’ll work on getting a video recorded of the lights in action.

Steam/air engine

I finally built something like a steam engine. This one runs on compressed air, but it’s the same idea. It uses a single cylinder, a flywheel, and a valve arrangement that looks like a cylinder.

The blue parts are all 3D printed, including the flywheel, the crank, and the collars/caps on the brass tubing (which serves as the cylinders for the piston and valve).

The valve works by moving 90 degrees out of phase with the piston and alternately trapping the supplied compressed air and admitting it to the cylinder. When the air is admitted the piston pushes on the crank, and when the air is trapped, the piston pushes the spent (exhaust) air out of the cylinder, back through the airway, and out through the bottom of the valve’s brass tube.

The valve is like a two-headed piston with an air chamber between the heads.

Below is a picture of the air supply system I rigged up. It allows the user to pump air into a soda bottle and then open the blue butterfly valve to allow the air into the engine. This is all just PVC, plastic tubing, and a brass airtank fill valve.

Finally, here’s a video of the engine in action. Future improvements include a more compact air system and actual piston rings that should help the piston and valve seal better inside the brass tubes.

RGB LED Sectional Chart Weather

I worked on this project for my brother. It was inspired by something he found online. The idea is to mount a paper aviation sectional chart (it’s like a special map) on the wall and place RGB LEDs at the locations of airports you care about on the chart. Every so often, a Pi checks the weather conditions at those airports and changes the colors of the LEDs, allowing you to see the weather conditions at the various airports in your area at a glance, right there on the wall.

I designed a custom circuit board for interfacing with a NeoPixel light strand I got from Amazon. The circuit uses a level-shifted chip to adjust the Pi’s GPIO output 3v3 voltage to the 5v level expected by the NeoPixels. The circuit also incorporates a barrel-plug adapter and a 5x20mm fuse holder. It’s pictured below and can be viewed on EasyEDA here: https://easyeda.com/ditchwater/sectional-chart-board

I wrote some Python code that will hit the US’s aviation weather web service to get the weather data and update the lights. I’ll post the code here. I made a last-minute untested change to it, but it should be pretty close to working. The code is permissively licensed (https://opensource.org/licenses/MIT). It is based on the CircuitPython library here: https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel.

Note: Make sure you pass the station identifiers to the web service in all capitals. Otherwise, you may get a confusing error saying station_id is not a valid field.

# Copyright 2019 Kyle Hansen
# 
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
# 
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
# 
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

import json
import urllib.request
import urllib.parse
from neopixel import *
import xml.etree.ElementTree as etree
from ledgfx import gfx

PURPLE = (155,0,155)
RED    = (15,0,0)
BLUE   = (0,0,155)
GREEN  = (0,155,0)

# LED strip configuration:
LED_COUNT      = 18      # Number of LED pixels.
LED_PIN        = 18      # GPIO pin connected to the pixels (18 uses PWM!).
#LED_PIN        = 10      # GPIO pin connected to the pixels (10 uses SPI /dev/spidev0.0).
LED_FREQ_HZ    = 800000  # LED signal frequency in hertz (usually 800khz)
LED_DMA        = 5      # DMA channel to use for generating signal (try 10)
LED_BRIGHTNESS = 255     # Set to 0 for darkest and 255 for brightest
LED_INVERT     = False   # True to invert the signal (when using NPN transistor level shift)
LED_CHANNEL    = 0       # set to '1' for GPIOs 13, 19, 41, 45 or 53


def get_color(ceiling, visibility):

    try:
        visibility = float(visibility)
    except Error as e:
        print('ERROR could not parse visibility: %s, defaulting to 10 SM' % visibility)
        visibility = 10.0
        
    if visibility < 1:
        return PURPLE
    elif visibility >= 1 and visibility < 3:
        return RED
    elif visibility >= 3 and visibility < 5:
        return BLUE

    # at this point visibility must be OK, so check ceiling
    if ceiling is None:
        return GREEN
        
    try:
        ceiling = int(ceiling)
    except:
        print('ERROR could not parse ceiling: %s, defaulting to 3000' % ceiling)
        ceiling = 3000
        
    if ceiling < 500:
        return PURPLE
    elif ceiling >= 500 and ceiling < 1000:
        return RED
    elif ceiling >= 1000 and ceiling < 3000:
        return BLUE
    else:
        return GREEN

with open('airports.json') as f:
  airports_json = f.read().upper()
airports = json.loads(airports_json)

request_string = 'https://aviationweather.gov/adds/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&stationString=%s&hoursBeforeNow=2&mostRecentForEachStation=constraint&fields=station_id,sky_cover,cloud_base_ft_agl,visibility_statute_mi' % '%20'.join([airport for airport, led_index in airports.items()])
print(request_string)
 
f = urllib.request.urlopen(request_string)
response = f.read().decode('utf-8')
print(response)
root = etree.fromstring(response)

# Create NeoPixel object with appropriate configuration.
strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL)
# Intialize the library (must be called once before other functions).
strip.begin()
for i in range(LED_COUNT):
    strip.setPixelColorRGB(i, 0, 0, 0)

for metar in root.iter('METAR'):
    station_id = metar.find('station_id').text.upper()
    print(station_id)
    ceiling = metar.find('sky_condition').get('cloud_base_ft_agl')
    visibility = metar.find('visibility_statute_mi').text
    print('Visibility, sm : %s' % visibility)
    print('Ceiling, ft agl: %s' % ceiling)
    print('Setting light %s to %s' % (airports[station_id], get_color(ceiling, visibility)))
    color = get_color(ceiling, visibility)
    strip.setPixelColorRGB(airports[station_id], color[0], color[1], color[2])

strip.show()



What a fascinating modern age we live in

I have entered the modern era with a 3D printer. In particular, it’s an “Original Prusa i3 MK3,” kit version. Assembling the kit was not complicated or confusing, but it was a serious test of my limited dexterity and took about 20 hours of focused work.

Nevertheless, the printer is assembled and working, and in case it ever helps anyone, problems with X-axis length errors and XYZ calibration can possibly be resolved by loosening the screws holding the back-plate on the extruder assembly. That plate puts pressure on the X-axis bearings and can cause your extruder to not slide as far as it should on the X axis. If your Auto Home check is correct in Y but not X, maybe look into this.

Below are some pictures of my first couple results and some videos showing the printer in action.