Howdy! Welcome to the first weekly electronics tutorial — I’m going to be aiming to do this out front of my house every Friday for students walking home from Donegal Intermediate School or folks visiting our Little Free Library to check out!
Some variety of power supply — I’m using a rechargeable 18650 Lithium Ion battery as that’s what I’ve got lying around, but you could just as easily use 3 AA batteries in a holder like this one from Amazon that costs $7.99 for 4
Hot glue gun
A small container you’ve pulled from your recycling bin
Water (food dye optional for fun coloring)
A plastic baggie (to hold your batteries and wires to keep them nice and dry)
First thing we’re going to do is to take our container that will become our fountain, and punch a small hole in the side of it, just above the bottom. This will be what we’re going to feed our wires from the pump out of, so that the pump can be submerged!
Next, we’re going to attach the small length of tubing to the pump (this is what’s going to squirt water up in the air), and use our hot glue gun to attach the base of the pump to the inside base of our container. Thread the wires through the hole we made in the container (or just let them drape over the side if you’d rather), and attach them to the wires from our power supply. No switches today!
Add water, and see it pump! It’ll run for a while until your batteries die off, then you’ll need to recharge or replace them. In future projects, we’ll learn to integrate cheap solar panels into our projects so they can keep running indefinitely!
Curious how water pumps work? It’s kinda like a fan in your home! A motor spins a propeller that then gets forced out and up a hose!
The smarter solution is probably to find a way to run a ground wire through the walls of half hour house and up two floors to go from your junction box to the switch in question.
My solution? Build my own.
The simplest way to cobble together a motion detector light would be something like a PIR sensor attached to a power supply and a relay to safely control mains voltage, but that has no way to manually activate or deactivate the light.
To add a bit more granular control to the system, I decided to build it on top of an Arduino base, so I could add more controls. For space constraints (as well as the fact that I had a spare one lying about), I used a Wemos D1 Mini — easily programmed via the Arduino IDE, and if I ever want to expand its capabilities, I can easily connect it to my home wifi and attach it to Blynk.
As an added bonus, I has a D1 Mini Relay Shield lying about as well. This made one less thing I needed to wire up, and could just plug it in. Add in a momentary switch for human input, and our circuit looks something like this:
(Note, that is the relay shield stacked on top of the D1 Mini, they can be hard to differentiate in the mockup)
After some tinkering, here is my code to get the system working:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
The code could probably be simplified by removing the logging messages, but I like to leave them there for further reference and debugging down the road.
So now that we’ve got the components gathered, it’s time to look at how we put it in! As luck would have it, the electrical box that the previous switch used was a double gang box, so I had a bit of room to work with. I picked up a solid 2-gang cover at my local Home Depot, and drilled two holes in it for the switch and the PIR sensor.
Now, all is right with the world, but we still have to actually power it! Through some creative wiring, we’ve thus far managed to avoid having to splice any wires together (by using both the 5v and 3v3 outs on the board for wiring to different peripherals, and only the PIR needed a ground wire) and to continue that trend, we’re going to be powering it through the D1 Mini’s USB port, and to power that USB port via a 6″ USB cable, connected to a genuine Apple iPhone power adapter — they’re tiny, and very well built transformers (just don’t mess around with cheap knockoffs, they’re terrifyingly dangerous — especially if it’s going to be mounted inside a wall!).
To connect the 120v AC to 5v DC transformer (the aforementioned power adapter) to mains power, my plan is to connect it to home wiring via two crimp terminals and some heat-shrink tubing around that as additional insulation to avoid any exposed metal, as there isn’t an outlet in the box to plug the adapter into.
Well, that’s the plan. As I said — far trickier than just running a ground wire across half my house, but hopefully more fun and I’ve learned a lot in the process. I’m expecting to hook it up in the next couple days, and will update here when it’s live and functioning!
(apologies for the pun, but it was totally intended)
Last night, Nintendo officially announced details and games for their upcoming console, the Switch. This morning I waited outside of a GameStop to preorder mine. I’m excited.
Most of the technical details, while impressive, struck me as basically what was to be expected — nothing out of the ordinary. Better haptic feedback, new sensors, etc. One thing did surprise me, though.
The actual Nintendo Switch charges via USB-C. The controllers also charge via USB-C. This means a couple things, listed roughly in the sequence that they occurred to me:
Huh, that’s interesting. I’ll be able to use the same charging cable that I have for my Pixel phone for the Switch as well! That’s certainly a change, Nintendo has a history of inventing proprietary connectors on, like, everything.
Oh, so if I’m on a plane ride or a trip, I’ll be able to charge it on the go to extend its battery life.
Wait wait wait, if the Switch charges via USB-C when it’s plugged into the TV Dock, I wonder if it uses that single connection for both charging, and the 1080p HDMI video out? It certainly could, I don’t see why it wouldn’t.
Does that mean that the Nintendo Switch’s TV dock is just a glorified version of Apple’s USB-C Digital AV Multiport Adapter — piping the video out through the same single USB-C port that the power comes in via? I wonder if they’d be interchangeable.
I wonder if it would support USB peripherals via a USB-C hub plugged into the Switch.
There’s a lot of tech questions that will only be answered on or about March 3rd, when the Nintendo Switch actually releases — but with Nintendo changing — err, switching — to more modular technology standards, I’m very excited to learn where we go from here.