Oh this is exciting! I’ve been trying to figure out how to get motion events from my IP camera into my home-assistant instance running on my Raspberry Pi, and I just did a successful test! It works! Hooray. Briefly, I set up an email server on the Pi, have the camera email the Pi, have the email server trigger a script which parses the email for key words and sends MQTT signals as appropriate, at which point the home-assistant MQTT client sees them and triggers automations (like blinking a light to scare people off). Here’s how I did it.
As documented earlier, I made one of those CRT-in-a-winebottle things. I used a cheap 2-stage mechanical vacuum pump for it. Well, it was so good that my boss wanted to use it as a science demo at some dinners he gives, so it’s been permanently transferred to work. So I need a new pump, and a new chamber!
I got my first motorcycle, a 1997 Suzuki GS500, in 2007. It was great for a long time. I cut my motorcycle maintenance teeth on it, starting with gas line issues, shim adjustments, and an oil leak fix. Things escalated to taking the pistons out and head off to get the top-end rebuilt. Issues kept popping up more frequently than I liked so I sold it in 2012 and got a brand new Suzuki DL650A V-Strom ABS (aka “Glee”), feeling like I had had enough maintenance for a while. I only felt a little shame when I took it in to the shop for some routine maintenance
Well…I guess I’m back in the routine. After I totaled it but kept it, I got warmed up doing basic maintenance stuff on it. So when an issue came up recently, I decided to fix it myself.
UPDATE Jan 2017: Whaddaya know? The stator was just recalled due to a tendancy for this to happen.
I just configured a pretty slick burglar alarm with the open-source Home-Assistant platform running on my Raspberry Pi. It can be armed to trigger when a door is opened and/or when a motion sensor goes off.
Then, a sequence of events happens:
- An IR LED turns on my stereo
- A sound file I cobbled together starts playing. It starts with a computerized voice saying that your entry been detected and recorded, then it beeps for a while (giving you time to disarm), and then it goes into a blaring siren noise. Quite the escalation!
- A light blinks on and off a few times
- A camera takes a series of snapshots of the area
- An email is sent to my phone with the snapshots, showing me what’s going on
Or, how to control your A/C from your phone
You may have seen my earlier post about my new home automation setup. Well I just upgraded it! I just finished testing out a new infrared remote control send and receive capability and it is pure awesome. Here’s what I can do now from within home-assistant:
- Turn on and off my new DeLonghi portable air conditioner from Costco, and set the temperature to whatever
- Turn on and off the TV and press any buttons from its remote control
- Turn on and off the stereo and virtually press any buttons from its remote control (which I never even had!)
- Use an old random blueray remote control to set scenes, turn lights on and off, etc. (basically do anything under home-assistant’s control)
This post is about how I did it on my Raspberry Pi.
Update: A video!
I went out for a quick motorcycle ride one night just as it started to rain. I turned South from Pine onto Broadway towards the gas station and the next thing I knew I was sliding along the ground in the middle of the road. I wasn’t being careful enough and had slipped on the new streetcar rails.
A guy helped me lift the bike and get it out of traffic. I was dazed but the only damage I could see was a broken side-stand. The bike started fine and I rode it a few blocks home, defeated. I leaned it up against the wall and checked for more damage. There was a little scuff on the engine and the side case was scratched. And there was a small ding in the front wheel from hitting the center divider. Not bad. Looks like the crashbars did their job!
I’ve been learning about my Canon EOS D-SLR camera and wanted to try a time-lapse cloud video. It was pretty easy!
Continue reading Time-lapse cloud video
I went over to my friend’s house last night to help get home-assistant on a Raspberry Pi working for his z-wave door sensors and siren. The Ecotech sensor showed up fine but the Aeotech recessed one (Recessed Door Sensor Gen5 , ZW089-A) did not show up by default. After poking around in the logs for a while, we realized that it was sending BASIC_SET command classes instead of BinarySensor commands. Apparently (I thought I had fixed this already), home-assistant doesn’t recognize the BASIC_SET commands just yet. But looking at the config file for this device, we discovered that config item 121 changes which kind of report this sensor sends:
Continue reading Using an Aeotech recessed door sensor in home-assistant
Ever since I installed a mobile ham radio in my Subaru, there has been a pretty noticeable whine that revs up and down with the engine. I got a few complaints that the whine was on my transmitted signal. I can also hear the whine through my subwoofer, though it is quieter. I needed a low-pass filter to let the DC from my battery make it through to the radio while blocking any alternator-induced AC coming along for the ride. I was going to just buy one but then I searched the web a little and found that it was fun and easy to build my own!
In this post, we’ll take a brief measurement of regular old FM radio stations and try to determine where we are. It’s like a GPS but with local FM transmitters instead of satellites. I did this just for fun. I wonder if it could be used for indoor location and stuff? It is nowhere near as accurate as GPS. But whatever.
The first step is to get a reading of all the nearby radio stations. I used gnuradio and a HackRF One software defined radio. A simple flow-chart that takes the FFT and dumps it to a file is all I needed. I had to throttle the I/O or else my computer would freeze. I used 16M sample rate to have as wide a bandwidth as possible.
The file sink saves the FFT results in 4-byte integers and just has one 1024-length vector after the other. In a few seconds, I had a 50 MB of data. I did all the post-processing in an external Python script.
I’ve always dreamed of having a “smart-home.” There’s just something cool about being able to flip switches and read sensors and have a program turn a light on when you open the door, but only if it’s dark. This post is about home automation.
UPDATE: I made a video demoing everything:
Turning 32 may not seem like a very exciting birthday, but it is! In fact, it is the most momentous birthday of all, because it’s the first time in your life that you can’t show your age on a single hand.
Counting in binary.
First, a refresher. Binary, (popularly known as the number system of computers which think in terms of ons and offs, as represented by ones and zeros) is base-2, whereas good old decimal is base-10.
This means that in the decimal system, we have:
Whereas in the binary system, we have:
My wife got me an early birthday present: Philips HUE Color-Changing LED lights! They’re incredible. Look:
Right now I’m controlling them with my tablet, which is fine for changing colors and setting light alarms. I can even control them from afar thanks to my VPN. I will soon hook them up to my nascent Raspberry Pi powered home automation system (using the open-source Home Assistant program) that will allow me to trigger them based on various events like motion, doors opening, weather changing, or whatever. The future is here!
Each bulb uses 9 Watts but makes the same amount of light as a 60W conventional bulb, so they’re very eco-friendly. Furthermore, since they’re LEDs, they should last for 15 years of normal use! They communicate with a little hub that uses the ZigBee protocol (like Bluetooth but lower power and lower speed, good for home automation stuff).
Downside: They’re pretty pricey. I expect their coolness to drive demand enough to bring supply up. Expect these bulbs for $10 in the next few years.
Sending and receiving text with Morse code light pulses across the room (or to your neighbor) is a fun and cheap project you can do on a Raspberry Pi or Arduino or any other microcontroller. This post explains how I did it, and how you can do it too.
The hardware is simple and cheap. Here’s my parts list:
- Raspberry Pi B+ as the controller. This does the sending, receiving, and signal processing.
- Photoresistor – Just a little guy that has variable resistance based on how much light is hitting it
- A 220 Ohm resistor – to make a voltage divider with the photoresistor for reading the input signal
- MCP3008 10-bit Analog-to-Digital Converter (ADC) – Since the RPi doesn’t come with an ADC, this is required for converting analog voltage from the photoresistor into a signal I can process on the RPi.
- Laser module – to transmit with laser light. I got one from sunfounder.com for like 3 bucks.
- Breadboard, wires
You can learn how to use the ADC at this Adafruit tutorial. I decided to talk to the ADC with the RPi’s hardware SPI interface, which I had already enabled. I wanted to be able to go very fast. (You can alternatively do SPI off of GPIO ports with software, if you prefer.) The laser just hooks directly between a GPIO and +5V. Here’s the layout:
And what it actually looks like:
Sensors are fun! I wanted to keep an eye on the temperature of one of my home physics projects and realized I needed a thermocouple and a convenient way to read it. This post is about how I got one and wrote a Python program to send the data from a Raspberry PI over the network to my laptop, which plots the results in real time.
I bought a K-type thermocouple for several dollars that ranges from -100°C to 500°C. The Seebeck effect that makes it work only gives microvolts per degree so I needed a good amplifier for it. And since I wanted to read it on a Raspberry PI (which only has digital inputs), I’d need an analog-to-digital converter (ADC). Conveniently, the MAX31855 does amplification and ADC and is like $15, so I got one. Sweet. There’s even a Python library for it that makes it easy to access. Double-sweet.
Alright, this is an oldie, but ah… well… it’s and oldie where I come from. In 2005, I had some healthy spare time and decided to build a flux capacitor. I posted the details on my old webpage. I just rewired a battery pack on it and it’s working fine so I figured it was time to get it back online again. So, here it is. How to build a LED flux capacitor.
In the movie Back to the Future, Dr. “Doc” Emmett Brown completed his life goal of making the flux capacitor a reality. Here’s the story:
“I was standing on the edge of the toilet hanging a clock, the porcelain was wet, I slipped, hit my head on the edge of the sink — and when I came to I had a revelation! A vision! A picture in my head! A picture of this! This is what makes time travel possible! The Flux Capacitor.”
-Doc, Back to the Future
Unfortunately, I didn’t have room for the time circuits or nuclear reactor to generate the 1.21 jigawatts that the flux capacitor needs to travel in time so we’re going to have to go with the next best thing: A 30 LED sequencer!
Since I’m on a late 1800s physics kick, I’ve been staring at my Crookes radiometer a lot.
You might remember these from the hands-on museum. Today, these are just novelty items, but back in the 1800’s, there were actually scientific instruments that could quantitatively read out the amount of incoming radiation (like visible or infrared light). They were generally read out using a calibrated spinning disk with slots in it. It’s like when you have a fan spinning in a dark room, and you adjust a strobe light until it looks like the fan isn’t spinning. Then, if you know how fast the strobe is blinking, you know how fast the object is spinning. This is called a stroboscope.
Well, I don’t have a stroboscope. But I do have a digital camera and a computer. As it turns out, I can read the Crookes radiometer using that!
Or, why I built a cathode ray tube in a wine bottle.
I was leisurely reading Linus Pauling’s textbook, General Chemistry, the other day, and I found the history he threw in there with the science to be thrilling. For instance, I learned quickly that the Greek word for amber, elekton, forms the base of our word electricity, so named by William Gilbert in the late 1500s because the ancient Greeks knew that rubbing amber with wool would attract feathers and stuff. As a nuclear engineer whose job it is to make electricity, this was a fun revelation. Pauling continues to mix physical realities with the experiments used to prove them, and doing so, he quickly arrives at the cathode ray tube. After reading and thinking about it, I had another revelation. It turns out, I realized, that some large fraction of modernity, from the world order to modern health, the environment, politics, and the media passed through a cathode ray tube. Here’s how.
This post is about how I set up remote operation on my ham radio through a Wifi network, over a VPN, and around the world using a Raspberry Pi, like this:
This could be useful for people who travel a lot and want to be able to use their rig while away. Or for people who want to set up their radio and antenna far away from where they actually live (e.g. apartment dwellers who have friends or parents who live in the boonies and wouldn’t mind you erecting an antenna). If you want to skip the VPN and just control your ham shack from your kitchen, that’s even easier.
I did this all with an ICOM-7100 all-mode radio, a Raspberry Pi B+, a Buffalo DD-WRT router/VPN server, and a laptop running Ubuntu 15.04. This post focuses on the radio control and networked audio but not on setting up the VPN.
I got into ham radio a few months ago and upgraded to a General-class license last weekend. This is a big step for ham radio people… the moment where you go from being able to talk to people ~30 miles away to being able to talk around the world. Anyway I went out and got a new 100W all-band, all-mode radio, an auto antenna tuner, a deep cycle battery, a 30A power supply, and a mini-Buddipole antenna. Woo!
I had a lot of trouble getting my first contact. I tried every night after work all week. I tried from Volunteer Park, my communal rooftop deck, and my friend’s roof on the 33rd floor of his building. I set the Buddipole up for 20m and heard people from the park but they couldn’t hear me. On my rooftop, I got nothing but S9 noise everywhere and couldn’t hear a thing. Same story from friend’s roof.
Well, I found that you can’t just use the settings that come in the Buddipole manual. Especially if you have the 8ft mast. It’s not high enough to do a 20m dipole efficiently (all RF goes straight up in the air. Read this whole book to understand). So you have to set it up as a vertical like this: