Emacs: Automatically Adjust Font Size When Frame Width Changes

| Comments

I get annoyed when I resize Emacs, and the window becomes narrower than 80 columns. I’ve had a solution to this problem floating around my head for years, but I just haven’t run into this situation often enough to implement an automated solution. On those rare occasions, it’s just been easy enough to hit a key to change the font size.

Narrow Emacs frames have become more annoying for me recently, so I figured it was about time to create an elisp function that would set the font size based on the width of my Emacs frame. In my case, this turned out to be quite simple. I’m not a fan of tiling window managers—I’ve tried a few, but they always felt uncomfortable.

Emacs at Two Fonts Sizes

I attacked this problem from the other direction. I use the Sawfish window manager, and I have some handy customizations that divide my monitors into columns. These columns aren’t of equal width. My 1080p laptop has a narrow column on the left and a wide column on the right. The 1440p monitors on my desktop have a wide column in the center with narrow column on either side.

These columns are roughly the same width on my desktop and laptop—the desktop just gets an extra column on each monitor. The narrow columns automatically tile vertically, and they’re just wide enough to fit an 80-column terminal window with a comfortably font size.

I have convenient key bindings to push the focused window into any of these columns on either monitor, but I also have some automation that moves new windows into appropriate places—Firefox in the wide column, Thunderbird in the narrow column on the left, and Pidgin chat windows get stacked in the narrow column on the right.

On my desktop, Emacs goes in the wide column in the center of my second monitor. It is usually flanked by several terminal windows. Emacs and my terminal windows both use the Solarized color theme and Inconsolata for their font, but I prefer Emacs to have a larger font size. This is fine, until I decide to push Emacs into one of the narrow columns. Sometimes I actually have two Emacs frames open at the same time. Other times I’m reviewing proofreading notes that I’ve received from my editor—LibreOffice often requires the wider column for the editing notes to be large enough to read.

1
2
3
4
5
6
7
(defun pjr-font-scale-on-frame-width ()
  (if (< (frame-width) 76)
      (text-scale-set -1.1)
    (text-scale-set 0))
  )

(add-hook 'window-configuration-change-hook 'pjr-font-scale-on-frame-width)

At my usual font size, the Emacs frame isn’t much more than 60 characters wide in my narrow columns. As I said, this is easy enough to fix manually, but I’m sick of doing things manually. If my office lights can shut off automatically when Steam launches a game, then surely Emacs can change my font size automatically as well!

My use case is quite simple, since I only need to use two different font sizes. I hooked a function into Emacs that runs any time the window configuration is changed. If the frame is less than 76 characters wide, it scales down the font. Under any other circumstances, it sets the font to the default size.

Camera Strap Upgrade For My DSLR

| Comments

Late last year, I bought a used Canon DSLR. It was an excellent purchase, and I’ve had tons of fun using it to learn more about photography. The DSLR is a lot bigger and bulkier than my phone, but the photos I can shoot with the DSLR just look so much better than anything I’ve ever shot with a camera phone.

There is one thing that has annoyed me about my DSLR since day one—the camera strap. The strap is invaluable when I take my camera out with me—but it is way too bulky to fit in my pocket! The neck strap that comes with every DSLR quickly becomes uncomfortable, and when I’m shooting at home or on a tripod the strap just gets in the way!

My research quickly told me that a shoulder strap is the way to go, and there’s a huge selection to choose from!

I quickly figured out what to avoid

My first instinct was to look at the cheapest shoulder straps I could find. Camera straps are just fabric belts with hooks on the end. How bad could a cheap one be?

As it turns out, a cheap strap can be an extremely bad idea! I read several horror stories about the cheaply made hooks on some straps breaking and resulting in hundreds or thousands of dollars’ worth of camera gear crashing to the ground!

The Altura Quick-Release Shoulder Strap

I looked at quite a few camera straps, but my search kept bringing me back to the Altura Quick-Release Strap. The reviews are good, it has a lot of useful features, and it is only about $20. These are the features that interested me:

  • Sturdy quick-release clip
  • Steel bracket that attached to the tripod mount
  • Pocket in the strap for SD cards and batteries
  • Optional two-point connection to camera

The Altura shoulder strap comes with a steel connector plate that attaches to the bottom of your camera using a big, sturdy tripod screw. The plate has a hole on one end that fits the quick-release clip, and a slot at the other end that can fit a regular camera strap.

Altura Quick-Release Strap

The strap comes with both the quick-release clip and a regular camera strap connector. If you’re very worried about your expensive and heavy camera and lens coming loose, you can attach the normal-style camera strap to the body, and attach the quick-release to the tripod plate. It would be amazingly difficult to accidentally separate the camera from the strap in this configuration!

I’m extremely pleased with the quality of the quick-release clip. It is made from sturdy metal, and the hooks on either side of the clip overlap by almost half an inch when closed. I don’t think my camera is ever going to come loose, and it would be impossible for me to accidentally clip on the camera incorrectly.

How I use the quick-release shoulder strap

I use my camera around the house most of the time. Around here, I always have somewhere to put the camera down, so the neck strap is just a nuisance. My new shoulder strap spends most of its time in my camera bag.

The heavy-duty bracket that came with the strap has found a permanent home on the bottom of my Canon DSLR. It doesn’t get in the way very often, and with it in place, it only takes me a few seconds to clip the strap back on and head out the door with my camera. This is extremely convenient!

The large bolt that attaches the bracket to the camera has a threaded hole in the bottom, and it can be connected directly to your tripod. When I read the product description, I thought this sounded scary. After using this bolt, though, I am very confident that it isn’t going to snap if I attach it to my tripod.

Alutra Quick-Release Strap

I don’t think I’d be likely to use this feature. The bracket on my tripod has a lot of surface area that comes in contact with the camera. At the very least, I’d worry that I’m losing some stability. Even worse, I’d worry about the plastic bracket on the tripod giving way.

It only takes a few seconds to disconnect the bracket, so I don’t think this is a big deal.

My only complaint

All the videos I’ve watched show people reaching across their bodies to lift up the camera with their left hand. I prefer to reach for the camera with my right hand. That means I have to attach the bracket facing in the opposite direction.

The battery door is blocked when you attach the bracket this way. It would be nice if this wasn’t the case, but it really doesn’t cause much trouble—it only takes a few extra seconds to loosen the bracket. It would be simple enough for the manufacturer to correct this problem—they just need to add a second slot for the tripod-mounting bolt.

Conclusion

I took my new shoulder strap to the Texas Pinball Festival last weekend. That was the first time I carried the camera with the strap for several hours, and it did an excellent job! I could almost completely forget that I was carrying my camera while playing pinball, but it was still sitting right there at my side ready to take photographs.

Brian at the Texas Pinball Festival

I don’t think I could play pinball with my camera on a neck strap!

Using dm-cache / lvmcache On My Homelab Virtual Machine Host To Improve Disk Performance

| Comments

Last year, I built a reasonably fast and energy-efficient server to host KVM virtual machines in my office. I included a pair of 240 GB Samsung EVO 850 solid-state drives. That gives me a fast RAID 1 for the operating system, and I was hoping to use the rest of the available space for dm-cache.

dm-cache (a.k.a. lvmcache) is a block device caching layer that was merged into the mainline Linux kernel back in April of 2013. It is a “hotspot” cache that lets you use fast SSDs to cache reads and writes to your slower, old-school spinning media.

Samsung EVO 850 SSD

When I set up my little server, I installed Ubuntu 14.04 LTS. This seemed like a good idea, since I didn’t want to have to touch the host operating system very often. Unfortunately, the dm-cache tools that ship with the 2014 version of Ubuntu aren’t very advanced—you had to do your own sector-level math when setting up your cache.

I tried to get dm-cache going anyway, but I didn’t do a very good job. It seemed to be caching, but my spinning disks were being written to at a constant 1 MB/s for days, and my benchmarks didn’t show any improvement. This seemed like a failure, so I turned off dm-cache.

The Ubuntu 16.04 release is now only a few months away, so I decided to upgrade early to properly test out dm-cache.

Should I be talking about dm-cache or lvmcache?

I haven’t figured this out yet. When I started researching this last year, I don’t remember seeing a single mention of lvmcache. This year, you almost exclusively use lvm commands to set up and control your dm-cache.

I don’t think you can go wrong using either name. It is dm-cache in the kernel, and lvmcache in user space.

What was I hoping to get out of dm-cache?

I had a feeling dm-cache wouldn’t meet all of my expectations, but I thought it was worth giving it a shot. Here are some of the benefits I was hoping to see when using dm-cache.

  • Faster sequential reads and writes
  • Faster random reads
  • Much faster random writes
  • Power savings from sleeping disks

Performance improvements

dm-cache is a hotspot cache—much like ZFS’s l2arc and zil. These hotspot cache technologies may not improve your synthetic benchmark numbers, as my friend Brian recently discovered. At first, I didn’t find any performance improvements either, but this was my own fault.

When I upgraded from Ubuntu 14.04 to 16.04, I didn’t notice that I was still running the old 3.19 kernel. There’s been a lot of dm-cache progress since then, and I wasn’t able to get the smq cache mode to work with the older kernel. Once I upgraded the kernel and switched to smq, things improved dramatically.

1
2
3
4
5
6
7
Version  1.97          ------Sequential Output-------- --Sequential Input-- --Random-
Concurrency   1        -Per Chr- --Block--- -Rewrite-- -Per Chr- --Block--- --Seeks--
Machine           Size K/sec %CP  K/sec %CP  K/sec %CP K/sec %CP  K/sec %CP  /sec %CP
ssd mirror      31776M   317  99 298671  60 184190  36  1924  98 588349  60 +++++ +++
platter mirror  31776M   320  99 143929  28 104534  17  1981  95 398087  30 561.6  29 
mq              31776M   279  99 117243  29  94845  19  1496  91 387993  41 548.3  33
smq             31896M   365  99 255449  60 177057  33  1721  93 882116  81 +++++ +++

As you can see from the benchmarks, smq has been a really big win for me. The write speeds are 75% faster than the uncached disks. In fact, the cached writes are almost as fast as the solid-state drives. The read performance is even more impressive—the cached mirror is 50% faster than the solid-state drives alone!

1
2
3
4
5
6
7
8
9
10
11
-------------------------------------------------------------------------
LVM [2.02.133(2)] cache report of found device /dev/raid10_crypt_vg/kvm
-------------------------------------------------------------------------
- Cache Usage: 41.1% - Metadata Usage: 1.6%
- Read Hit Rate: 85.5% - Write Hit Rate: 94.7%
- Demotions/Promotions/Dirty: 0/971904/6
- Feature arguments in use: writeback
- Core arguments in use : migration_threshold 2048 smq 0
  - Cache Policy: stochastic multiqueue (smq)
- Cache Metadata Mode: rw
- MetaData Operation Health: ok

My cache is over 200 GB. I haven’t even managed to fill half of that, and I’m certain it would work adequately at a fraction of that size. My virtual machines occupy about 2 TB, but the vast majority of that data is taken up by backups and media on my NAS virtual machine. The data that gets accessed on a regular basis easily fits in the cache.

What about power savings?

Most people don’t care about spinning down the hard drives in their servers. My little homelab virtual machine server is very idle most of the time. Spinning down a couple of 7200 RPM hard disks will only save me six or seven watts, but I think it’d be a nice bonus if I could make that happen.

I’ve tried cheating as much as I can, but I just can’t get dm-cache to stop writing to the cached media. I see hours go by throughout the day with no reads on the magnetic media, but with the default smq settings, there is a slow but constant stream of writes to the cached disks. Most of those writes seem to be caused by OpenHAB’s log file.

dstat with dm-cache

I’ve tried cheating by setting the smq’s migration_threshold to zero—low values also seem to work. This often silences the writes to the cached disks, so at least I’m on the right track. Sometimes, the cached disks still see several small writes each minute.

Even when I manage to get dm-cache to keep the cached disks in a very idle state, something is still preventing my disks from going to sleep—even when they haven’t been accessed in over an hour! Google tells me the usual culprits are smartctl, smartd, or hddtemp. I’ve ruled all of these out. I can manually put the disks into standby with hdparm -y, and they will stay asleep for hours.

It would have been nice to get the drives to spin down. They don’t use much power—probably less that 1 kWh every six months—but they are the noisiest thing in my office. Fortunately for me, they don’t need to be in standby to be quiet.

Why not skip the ancient spinning disks?

Solid-state drives are nice, but they’re still small and expensive. At a minimum, I would need a pair of 2 TB ssds in my homelab server. Those 2 TB solid-state drives cost over $600 each. One of those drives costs almost as much as my entire server, and my server has twice as much storage.

The majority of the data my virtual machine server touches regularly fits very comfortably in my 200 GB dm-cache—it has a read cache hit rate of 84.9%. That means my server almost always has the responsiveness and throughput of solid-state drives, while still retaining the benefits of the large, slow, cheap mechanical disks.

I used to have an ssd and a mechanical drive in my desktop, but I had to decide which data to store on each drive. The best part about dm-cache is that I don’t have to worry about that, because dm-cache manages that for me!

Was dm-cache worth the effort?

For a virtual machine host, it was definitely worth the effort. My KVM host is performing much better since enabling dm-cache—almost as well as if I’d only used solid-state disks for my purposes! This is a great value to me, and I can easily and inexpensively add more rotating disks in the future to expand my storage capacity.

I could have saved $50 to $100 if I used smaller solid-state drives, but I’m pleased with my decision to use the 250 GB Samsung EVO 850 SSDs. They have a larger RAM cache than the 120 GB model, but they are still rated for a write load of 41 GB per day—the 500 GB Samsung EVO is rated for 82 GB per day. I won’t be needing the extra endurance of the 500 GB model, and the 120 GB model is just too small for me to make use of anywhere else in the future.

Simple 3D Printed Upgrades For Your FlashForge Creator Pro

| Comments

When I bought my own 3D printer, some of the first things I printed were small 3D-printer upgrades. I find the idea of using a machine to create parts to upgrade itself fascinating. When we bought a pair of FlashForge Creator Pro 3D printers at TheLab.ms, I knew it wouldn’t be long before we’d find a need for some simple and necessary upgrades.

The 3D Printers at TheLab.ms in Plano, TX

Filament alignment bracket

A better filament guide was definitely a requirement for one of our printers. No matter what adjustments we made, the left extruder’s filament would loop behind the spool and get caught up on the spool holder. This was less of a problem on the second printer, but it did happen at least once there. Fortunately, it was easy to fix.

Makersome Filament Guide Makersome Filament Guide

There are quite a few filament-guide parts on Thingiverse, but most of them require support material. I do my best to avoid support material.

Makersome’s filament guide does a great job, and it prints without any supports. In fact, it prints very well without supports. On our printers, the filament-guide tubes are fit loosely in the Makersome filament guide, and they end up moving around during the print. This was easily fixed with some small zip ties.

Filament spool holders

The spool holders that ship with the FlashForge Creator Pro are designed to precisely fit the huge diameter holes in the spools of the filament sold by FlashForge. My favorite spool holder on Thingiverse so far is the Shaxon Spool Holder. Just like the awesome spool holders for my own 3D printer, these print on their sides and require no supports.

Shaxon Spool Holder

Totally by coincidence, the first spool of filament we bought from Fry’s was Shaxon brand filament, and it did fit the holder perfectly. This spool holder is small enough to fit all but one of our spools. That spool is from Hatchbox, and it very nearly fits.

The spool holders I use at home are ridiculously thin compared to the models available to fit the FlashForge, but they are sturdy enough to hold two spools without any trouble. One of these days, I’ll design an even more universal spool holder for our FlashForge printers.

A glass print surface and printable glass clips

The FlashForge Creator Pro ships with a BuildTak sheet installed. When it works, it works surprisingly well. BuildTak seems to work better at higher temperatures, but those high bed temperatures would make our 0.1mm prints warp around the edges.

Try as we might, we just couldn’t get any of our white ABS filament to stick to the BuildTak. It was just too problematic.

Glass clips and knobs

I’ve been printing on glass at home for two years, so I figured we should give it a try over at TheLab.ms. I stopped by the Lowes in Plano, TX, and I had them cut some cheap 2mm glass into 9” by 6” sheets for me. I was able to get six of those and a pair of fresh 8” x 8” sheets for my printer at home for about $15.

ABS sticks beautifully to glass with a bit of hairspray, and the hairspray wipes off quickly after soaking it in water. We don’t actually clean the glass very often—usually only if you need a perfectly smooth finish on the bottom of your print. Most of the glass plates have been in use for two months now, and most of them have never been cleaned.

Next time, I am going to spend a little more on the glass. We have to be careful of the rough, sharp edges. The prints pop right off the glass after a few minutes in the freezer, but at least one member at TheLab.ms has gotten impatient. They pried a large print off while it was still warm and pulled a chunk right out of the middle of the glass.

With the BuildTak, we had to wait for things to cool down before removing a print. With the glass, you can take your print out of the printer immediately. That means the next person in line doesn’t have to wait as long to start their print!

A webcam mount

This one is definitely not a necessity. My own printer’s Logitech C270 camera has been at TheLab.ms ever since we unboxed the first FlashForge Creator Pro back in December. I certainly haven’t missed it, but cameras are much more useful at a public space.

Logitech C270 Mount Logitech C270 Mount

The camera brackets I designed aren’t perfect, but they’re a big upgrades over the IKEA arm mount we were using up until now. The arm mount is awesome—I use two at home, but they’re not well suited to the setup we have at TheLab.ms. They take up a lot of room, and they’re too easy to bump out of alignment. They also see a lot of glare if you point them through the acrylic covers on the printers.

The new camera mount corrects most of these problems, but the angle isn’t perfect yet. They aim at the print jobs, and they’re almost parallel to the glass print surface, so they pick up a lot of glare from the glass print surface during the first few inches of your print job. This isn’t ideal.

I think mounting the cameras on the printer’s handles is a good idea, but I think I can improve the execution quite a bit. Stay tuned for updates!

Control Multiple 3D Printers Using A Single Raspberry Pi and Octoprint

| Comments

UPDATE: I have a Shapeoko CNC machine now. You should check out what I’ve been cutting with it!

When they asked me to run the 3D-printing department over at TheLab.ms makerspace, I knew right away that we had to use OctoPrint. I’ve been using OctoPrint to run my MakerFarm Prusa i3 printer at home, and I have been very pleased with it. OctoPrint presents itself as a web interface, which is a fantastic fit for an open community space like TheLab.ms.

The 3D Printers at TheLab.ms in Plano, TX

OctoPrint’s web interface is handy enough around the house—keeping an eye on my 3D printer from the living room is nice. It is even more useful at TheLab.ms, where you can keep an eye on your print job from Marinara Pizza!

Do I really need a Raspberry Pi for each printer?

So far, we have two 3D printers at the TheLab.ms—a pair of FlashForge Creator Pro 3D Printers. There is an OctoPrint distribution for the Raspberry Pi called OctoPi. OctoPi is awesome. Just about everything you need to get started is configured out of the box—even the webcam!



Raspberry Pis are cheap, and so are MicroSD cards. It wouldn’t be a big deal to buy two of them. I’m looking into the future, though. I don’t want to have to buy a new Raspberry Pi each time we buy a 3D printer. I also don’t want to have to configure another Raspberry Pi, or add another network drop. I’ve spent most of my career building and maintaining servers. I’d much rather maintain one Raspberry Pi.

OctoPrint Consuming Very Little Resources on the Raspberry Pi

OctoPrint isn’t very resource intensive, but it isn’t built to control multiple printers. However, it wasn’t difficult to run multiple instances of OctoPrint on different ports on the same Raspberry Pi. This isn’t surprising, because all it needs to do is send gcode over a serial port.


What have Pat and Brian been up to lately? To find out you can check out the latest episodes of The Butter, What?! Show


Running a 3D print simultaneously on both printers while OctoPrint broadcasts a pair of 480p video feeds doesn’t even use 20% of the CPU power of our Raspberry Pi 2.

Configuring additional OctoPrint instances

You need to run a separate instance of OctoPrint for each 3D printer. OctoPrint defaults to running on port 5000, so I just incremented the port for the second instance and told it to use a different directory to store its configuration. At TheLab.ms, we call our printers badger1 and badger2, so we set up those hostnames in DNS. Since the OctoPi distribution hides OctoPrint and mjpeg-streamer behind HAProxy, all I had to do was add those hostnames to the HAProxy configuration and point them to the correct ports.

Badger1 - A 3D Printer At TheLab.ms in Plano, TX

You can share some of the directories that live inside each OctoPrint instance’s configuration using symlinks. Since our printers are identical, sharing the uploads directory makes a lot of sense—it’s nice to be able to come back a couple days later and print another copy on the other printer. We’re also sharing the timelapse directory.

OctoPrint Serial Port Settings

There’s nothing preventing either instance of OctoPrint from connecting to either printer’s serial port. I’ve gotten around this by creating some udev rules to assign unique names to the printers based on their serial numbers. Badger1 is set to use /dev/ttyBadger1, and badger2 is set to use /dev/ttyBadger2. This prevents people at TheLab.ms from accidentally connecting to the wrong printer.

1
~/oprint/bin/python ~/OctoPrint/run --daemon start --port 5001 --pid /tmp/octoprint2 --basedir ~/.octoprint2

Configuring additional mjpeg-streamer instances

I don’t know much about mjpeg-streamer. It looks like you should be able to stream multiple cameras from a single mjpeg-streamer process, but I wasn’t able to make it work. Instead, I ran a second copy of mjpeg-streamer on the Raspberry Pi—just like I did with OctoPrint.

1
2
3
4
5
# badger1
./mjpg_streamer -i "./input_uvc.so -d /dev/video0" -o "./output_http.so -w ./www"

# badger2 mjpg_streamer
./mjpg_streamer -i "./input_uvc.so -d /dev/video1" -o "./output_http.so -p 8081 -w ./www"

I need to tweak udev to assign each camera a unique device name, but I haven’t gotten around to that yet.

What’s next?

I thought about writing this blog post as a step-by-step guide, but I’d like to eventually automate the creation of new OctoPrint instances on our OctoPi server. I want to be able to run a single command to set up a new instance of OctoPrint and mjpeg-streamer, set up HAProxy to point at those new instances, and configure OctoPrint to point at the new camera.

I’m planning to work on this next month, but we’ll see. At the very least, I better have it working before TheLab.ms needs to purchase a third 3D printer!

The Maker Modem from M2M Circuits

| Comments

I was talking to my friend Don from M2M Circuits last week, and he was telling me about his Maker Modem project. I told him it sounded interesting, and I wanted to try it out. He got me together with Jesse, the other brain behind M2M Circuits, a few days later.

Maker Modem

They explained how the Maker Modem works, what makes it different from other existing solutions, and they handed me one of their prototypes. I am a little late to the party here, so I had to use one of the first-generation prototypes. The new prototypes use a different power connector, and they have more indicator LEDs. For my purposes, they’re identical to the newer prototypes.

Why did M2M Circuits choose Verizon?

Jesse from M2M Circuits explained the problem that started the journey towards their Maker Modem. His father spends hours driving around his farm taking measurements from wells. Jesse accompanied him on one of these trips, and he immediately realized that he could save his father a bunch of time and effort if they automated this process.

He tried the cheap 3G modems you can get from China, but he just couldn’t get a signal out on the farm—even with a giant antenna. Verizon is the only game in town in very rural places, and Verizon doesn’t allow these devices on their network.

I was more than a little skeptical about the idea of a modem designed specifically to be used with Verizon, but Jesse’s story convinced me that there is a very real need for an easy-to-use 3G or 4G modem with Verizon’s seal of approval. If you need to get your “Internet of Things” way out into the middle of nowhere, there’s no better solution than the Maker Modem.

What is M2M?

The guys at M2M Circuits explained to me that “M2M” stands for “Machine to Machine,” and they told me a bit about Verizon’s “M2M” pricing. I thought it sounded outrageous, so I looked up the pricing myself.

Verizon’s pricing starts at $9 for ONE MEGABYTE. Holy potatoes, that’s expensive!

With the Maker Modem, it is extremely easy to send and receive SMS messages. This will be a huge savings on your M2M data plan, and simple text messages will work great for tasks like periodic sensor logging or two-way communication of your remote micro-controller.

I sent SMS messages using an Arduino!

It is ridiculously simple to talk to the Maker Modem from an Arduino. You can connect the Maker Modem to your computer using the USB port, and this worked great for manually testing the device. The modem also has TTL serial pins, which makes it easy to connect it to an Arduino.

Maker Modem

All I had to do was connect ground, transmit, and receive to my Arduino Nano, and I was up and running! From here, it was a simple matter to send the appropriate AT commands to the Maker Modem to send myself a text message.

MakerModemTest
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
void setup() {
  Serial.begin(115200);
  delay(3000);

}

void loop() {
  Serial.println("AT+CMGF=1");
  delay(1000);
  Serial.println("AT+CMGS=\"+8678675309\"");
  delay(1000);
  Serial.println("Test message from Arduino Nano via Maker Modem from M2MCircuits.com!");
  delay(500);
  Serial.write(0x1A);
  delay(500);
  Serial.println("");
  delay(60000);

}

Receiving text messages didn’t look much more complicated, and M2M Circuits has an Arduino library for the Maker Modem to abstract all of this away from the end user. I didn’t have a lot of spare time to dig much deeper, though.

Maker Modem test SMS

The Maker Modem is on Kickstarter!

M2M Circuits just launched a Kickstarter campaign to bring their Maker Modem project to fruition. Getting their Maker Modem certified for use on Verizon’s network is very costly, so they will need your help.

Should I Buy A Used DSLR?

| Comments

Last year, I decided my blog needed a camera upgrade. I’ve been using my smartphone to take pictures for the blog for a long time, and my most recent phone upgrade was actually a huge downgrade as far as the camera was concerned. I wanted a camera with big glass and a big sensor, so a DSLR was the obvious choice.

My Canon Rebel XSi and Lenses

Photo by Andy Michaels

I didn’t know how committed to photography I was going to be, so I decided it would be prudent to purchase an older model DSLR. I am quite pleased with this plan. I was able to buy a used 2008 model Canon XSi DSLR and a camera bag chock-full of goodies for less than the cost of either a Canon EOS Rebel t5i DSLR or the Canon EOS Rebel t6i DSLR.

Pat's Camera Bag

Photo by Andy Michaels

The Canon t5i and Canon t6i have a lot of features that are missing on my older Canon XSi, but I’d be rather surprised if I could manage to take better photographs with either of the newest models. I just don’t have the skills, abilities, or knowledge.

What did I buy?

Here’s what I currently have in my camera bag:

Total cost: $527

NOTE: I already had an unbranded 60” tripod. It isn’t the AmazonBasics tripod, but it is very similar.

As I’m writing this blog, the Canon Rebel t5i costs about $650 at Amazon. That puts me over $100 below the price of a brand-new Canon Rebel t5i. I’m sure the price of the Canon t5i will drop. I’ve seen it on sale as low as $450.

UPDATE: I don’t own the Sigma 18-250mm EF Lens, but I wish I knew about it before I bought my gear. It covers the entire range of the Canon kit lens, and it doesn’t look all that much bigger, either. Even so, it is still able to cover the range of my telephoto lens. I understand this is far from a perfect lens, but at about $350, it looks like a good compromise.

I probably should have bought a DSLR body and the Sigma lens. My camera bag would be lighter, and it would make my lens choice easier when I’m leaving the bag at home!

Why the Canon Rebel XSi?

The Canon XSi (a.k.a. 450D) is the first “Upper-Entry” level Canon DSLR to use an SD card—the earlier models use Compact Flash. I have tons of SD and MicroSD cards around the house, and the XSi didn’t cost much more than the older models. That made the XSi a good starting point.

The next model released after the XSi is the Canon t1i. When I was shopping a few months ago, the used Canon t1i DSLRs cost quite a bit more than than the Rebel XSi. However, as I’m writing this, there are several used Canon t1i cameras on Amazon that are only $10 or $20 more than the XSi models. My Canon XSi can’t record video, while the t1i can. I’d definitely be willing to pay a few extra dollars for a Canon t1i.

Shallow depth of field is awesome

I knew I made the right choice just minutes after unpacking my “new” camera. I popped the battery in, turned on the camera, and took off the lens cap. As I was doing this, one of our cats was on my desk watching me. So I did what any good cat owner would do—I snapped his picture a few times.

My First DSLR Photos My First DSLR Photos

I opened the photo on the computer, and I was simply amazed by what I’d already done. His face was in focus, his body was starting to get blurry, and my monitors were completely out of focus. Aside from all the clutter in the shot, that was one of the most professional photos I had ever taken, and all I did was point and shoot!

Forget about megapixels…

Any camera can take decent photos in sunlight. I wanted to be able to take great pictures in my dimly lit home office. That means I needed a big sensor and big pieces of glass—the tiny lens on a camera phone just doesn’t compare at all. You’ll be able to take much better photos with a 6-megapixel, 1” wide APS-C sensor than a 30-megapixel camera phone.

…It’s all about the lens

The 18-55mm zoom lens that came with my camera is versatile. I’m able to use it right here at my desk to photograph the projects I’m working on, and it was quite usable when taking pictures of trebuchets at SlingFest. It may be good enough for either use, but it isn’t ideal.

I recently read a blog post titled “A Quick Guide to Understanding Your Canon Digital Rebel XTi.” One of the things the author wrote about at length was Canon’s 50mm “Prime” lens. The lens sounded interesting, and it is inexpensive. I asked my friend Andy what he thought about it, and he didn’t have to say very much at all to convince me that this was exactly the lens I needed.

The stock 18-55mm lens has an F-stop of f/3.5-5.6. The Canon 50mm fixed lens goes all the way to f/1.8. That means the camera can open the aperture much wider. This allows more light to get in, and it lets you capture an even shallower depth of field.

Shallow Depth of Field With 50mm lens Shallow Depth of Field With 50mm lens

This EF lens is meant to be used with a full-frame DSLR, so the effective field of view with the APS-C sensor in my Rebel XSi is equivalent to an 80mm lens. Since I can’t adjust the zoom with this lens, my feet now provide the zoom function. I usually have to back away from my desk to take a picture of my projects now, but that shallow depth of field makes the inconvenience totally worthwhile!

I haven’t had my Canon 55-250mm telephoto lens long. I do most of my photography indoors, but I realized very quickly how useful a telephoto lens would have been at SlingFest last year.

18mm Stock Lens 55mm Stock or Telephoto 250mm Telephoto Lens

These pictures of my Space Invaders are pretty boring. I’m going to attempt to plan an outing to put my telephoto lens to good use. That way I can report back here with some better photos!

The external remote flash is handy

If you follow me on Twitter, you already know I can be quite boring. There’s a very high probability I will snap a few photos of my morning latte and tweet one of the better shots. These photos may be boring and repetitive, but I’ve been learning a lot in my attemps to improve them.

One of my biggest problems has always been lighting. No matter what I do to my office lighting, I have a very hard time composing a photo where the brown-and-white foam of the latte isn’t washed out or over-exposed.

Testing My Altura External Flash Testing My Altura External Flash

The remotely controlled flash from Altura was an easy fix for this problem. I plugged the flash-control unit into the hotshoe of my Rebel XSi, and I set the flash down on my desk and pointed it directly away from the delicious coffee. This lit up the mug without casting too much light on top.

I couldn’t do anything like this with the built-in flash, and I’m absolutely certain I’ll find more cool uses for the remote controlled flash as time goes on.

Tripods are awesome

We’ve been working on a mirrored infinity cube over at TheLab.ms makerspace in Plano. It is a large acrylic cube with lights inside. Each side of the cube is a one-way mirror.

The Mirrored Infinity Cube at TheLab.ms

The cube is a difficult subject for my limited photography skills. With a wide open aperture, the various internal reflections are completely out of focus. I knew setting the camera to a high f/stop could bring everything into focus, but there was no way I could hold the camera steady enough.

I happened to be carrying my tripod that night, so I decided to try putting it to good use. I took quite a few pictures with higher f/stop settings and longer exposures. The final shot was taken at f/8.0 with a 15-second exposure. I can’t wait to take some similar shots of the completed project!

Used vs. New

I’m pleased with my decision to purchase a used Canon DSLR. It was a no-brainer when my plans only involved buying the camera—the Canon t5i would have cost me three times as much. After buying a camera bag and filling it with lenses, though, that gap narrows quite a bit. Even so, I’d still prefer to save that money and buy even more lenses!

If I decide to upgrade in a few years, every single item in my camera bag will work with my new camera—as long as it is another Canon with an APS-C sensor, of course. Who knows, maybe I’ll end up with a used Canon t6i in a few years!

3D Printing At TheLab.ms in Plano

| Comments

We decided it was time to buy some 3D printers at TheLab.ms makerspace in Plano. They asked me which printer to order, and I ended up recommending the FlashForge Creator Pro. I’m still a huge fan of the MakerFarm Prusa i3 I have at home, but an open 3D printer with exposed electronics just isn’t a good choice for a community printer at a makerspace.

I’m quite pleased with our pair of FlashForge Creator Pros so far. We had the first one unboxed and printing in less than half an hour, and our initial prints were quite nice. Much nicer than anything I managed to print with my MakerFarm printer in my first few weeks.

TheLab.ms's FlashForge Creator Pro 3D Printers

It didn’t take long to get OctoPrint up and running on a Raspberry Pi, and it wasn’t too difficult firing up a second instance of OctoPrint on the same Pi to control the other printer. OctoPrint doesn’t use up all that much CPU on the Raspberry Pi, even when broadcasting a live video feed and saving images to create a timelapse. I bet we can run at least six or eight 3D printers using a single Raspberry Pi!

Printing on glass is the way to go

The FlashForge Creator Pro comes with a BuildTak printing surface, and we used that for a couple of weeks. It works fairly well, but neither spool of white ABS filament that shipped with our printers would adhere to it very well. Also, I’ve read that the BuildTak is only good for 50 to 100 hours of 3D printing. That would be a lot of sticker changing at TheLab.ms!

I’ve been printing on glass at home for years, so I eventually broke down and had half a dozen 9” x 6” sheets of 2.5mm glass cut at our local Lowe’s. All our ABS filament sticks to glass and hairspray quite nicely, and the glass has improved the efficiency of our 3D-printing workflow at TheLab.ms. With the BuildTak, we had to wait for our prints to cool and remove them from the printer before the next person in line could start their print. Now we just pull the glass out as soon as our print is done, and the next person in line can jump right in and get started.

My favorite part about 3D printing with ABS on glass is how easy it is to remove your print. We just pop the glass in the freezer, and most parts pop right off in about two minutes.

I’m not the only one using the 3D printers at TheLab.ms!

Our new friend j5mc stopped at our makerspace on his journey. He’s traveling around the country visiting as many makerspaces as he can. He is blogging about his journey, and he plans on compiling his data into a makerspace guidebook.

It was a lot of fun having him at TheLab.ms, and he was kind enough to leave something behind for us. He designed and 3D printed an “Open / Nope” sign for us, and we display it proudly on our window. I affectionately refer to it as our “Nopen” sign.

You should go read about j5mc’s makerspace travels on his blog!

j5mc's Open / Nope Sign j5mc's Open / Nope Sign

William has been 3D printing almost nonstop since I showed him how to operate the machines. He’s printed a working crescent wrench, a tiny green TARDIS, and a really cool Storm Trooper Buddha. I can’t wait to see what he prints next, and I hope he prints another Buddha now that we’ve got the 0.1mm settings tuned in on the FlashForge printers!

William's Buddha Trooper William's Crescent Wrench William's Crescent Wrench William's TARDIS

Andy has been making good use of the printers as well. He’s been working hard to modify an existing Makedo hinge from Thingiverse to be more compatible with existing Makedo pieces. The hinge is neat because it prints as a single piece, but it can still pivot at the joint.

Andy also designed a bracket to help attach an IKEA lamp to an IKEA bed using OpenSCAD. His bracket is one of our tallest 3D prints at TheLab.ms so far!

Andy's Minecraft pig Andy's Makedo Compatible Hinge Andy's IKEA Lamp Bracket Andy's IKEA Lamp Bracket

Shortly after the 3D printers arrived at TheLab.ms, I began looking for something quick, easy, and useful we could print to give away to visitors. The best thing I found was the KeyStand at Thingiverse. Unfortunately, the KeyStand wasn’t capable of holding up my 6” clown phone.

I recreated the design using OpenSCAD. I changed some of the angles to move the kickstand behind the phone, and I added “TheLab.ms” to the side of the key. This is the first part we managed to print using both extruders.

TheLab.ms Keystand in two colors

I am teaching classes on operating the 3D printers at TheLab.ms

I’ve been giving some one-on-one instruction here and there, but I just completed our first semi-official 3D printing class at TheLab.ms last night. I gave very little notice that the class was going to happen—less than 24 hours’ notice. I figured that would keep the attendance down, and give me an opportunity to figure out exactly what people need to know.

Even on such short notice, nine people attended the class. We managed to take four or five people from the point of zero 3D-printing experience to successfully printing their first object. In my humble opinion, I’d say the first class was a huge success.

I’ll definitely be scheduling these classes at regular intervals, and I’d like to teach some classes on using OpenSCAD, too.

If you’re a member of TheLab.ms makerspace in Plano, and you’d like to learn how to use our 3D printers, please stop by one of the classes! If you’re not a member, but you’d like to learn how to operate a 3D printer, you’re still welcome to attend one of our classes! We’d be happy to show you around the space and tell you all about the projects we’re working on.

Gift Ideas For Geeks - 2015 Edition

| Comments

It has been almost a year since I wrote my last “gift ideas” post, and Christmas is almost upon us once again. During this time of year, you might be looking to find a gift for a family member, friend, or a coworker. I’m not usually very good at coming up with ideas for gifts, so I’m compiling a short list of things a person in my own demographic would enjoy receiving.

Some fun and useful items from previous years’ lists are making an appearance again, along with some new items. I’ve done my best to keep this list as general as possible. I don’t want you to have to worry about whether the recipient has an Xbox One or Playstation 4, or an Android phone or an iPhone.

I own and regularly use almost every single thing on this list. There are a few items that are no longer available, so I listed a comparable item in those cases.

Rechargeable USB Battery Pack ($7 and up)

Rechargeable battery packs have always been at the top of this list, but they are starting to become far more ubiquitous and much less geeky. I thought I was going to drop them from the list this year, but I still keep finding people that don’t have one of these ridiculously useful items.

Swift Gear 2600mAh battery pack charging my Nexus 7

USB battery packs come in all sorts of different sizes and capacities, and they come in handy all the time. My first battery pack was a small lipstick-sized charger with a flashlight, very much like this PowerBot 3000 mAh battery charger at Amazon.

My small 3000mAh battery pack is light enough that I don’t notice it is in my pocket, and it has enough juice to restore about 60% of my phone’s charge. That little guy has been more than enough to get me through several long airport layovers. The flashlight is a handy little bonus, too!

We also have a giant 20,000 mAh battery pack from Kmashi. That giant Kmashi can charge two devices at once, and it can fill up my tablet and phone more than once without needing a recharge. However, I can’t recommend the 20,000 mAh model—it is just too big and heavy. Kmashi also has 10,000 and 15,000 mAh models. The 10,000 mAh model only weighs about half as much as the 20,000 mAh model, but it still has more capacity than most people would ever need.

Arduino Starter Kit ($55 to $130)

The Arduino is a nifty little hardware prototyping platform, and it is a great way to dip your toe into the world of hardware development. An Arduino board all by itself isn’t very useful. When my first Arduino board arrived, the first thing I did was program it to blink an SOS on its built-in LED.

This isn’t very exciting at all. You need other electronic components if you want to do something interesting. You need parts like LEDs, resistors, buttons, motors, and buzzers. The easiest way to get going is to buy an Arduino starter kit.

I pieced together my own starter kit, but that wouldn’t make a very good gift. The Official Arduino Starter Kit and the Sparkfun Inventor’s Kit are both good choices, and they both come with a similar array of parts. The official kit seems to come with a larger printed guide, while the kit from Sparkfun comes with a nice storage case.

Of the two, I think Sparkfun’s Inventor’s Kit is a better gift and a better value. Sparkfun’s carrying case is a nice touch, and their holder for the Arduino and breadboard looks pretty convenient.

If you’d like to save money, you can go with a more generic kit. This Arduino Uno Ultimate Starter Kit is about half the price of the other two kits. It may have fewer components than the other two kits, but it definitely provides a better “bang for the buck.”

The Swiss Army CyberTool 34 ($80)

My Swiss Army CyberTool is easily the most useful tool I’ve ever owned. This tool was given to me as a gift sometime near the end of the last millenium, and I’ve probably used or misused my CyberTool at least once every month since then.

The CyberTool has all the tools you’d expect to find on a Swiss Army Knife, like knives, scissors, and a corkscrew. It also has additional geeky tools that I find invaluable. The CyberTool has an excellent bit driver with four double-sided bits, and they’re exactly the bits you’re likely to need when working on a computer. In fact, the bit driver is exactly the right size for tightening brass motherboard stand-offs.

Victorinox Swiss Army CyberTool 34

I use my CyberTool 34 along with my 3D printer quite a bit these days. The precision scissors easily remove adhesion pads from the corners of prints, and the awl comes in handy when a hole in the print comes out a bit too small for a screw. I can quickly and carefully make those holes just big enough for the screw to fit.

Many people seem to prefer Leatherman-style multitools—tools based around a full-sized pair of pliers. These are very useful tools, and I carry a Gerber multitool in my laptop bag. I just don’t have a lot of use for a big pair of pliers. If you’re buying a gift for someone like myself that is always taking apart computers or working on electronics projects, then the Victorinox CyberTool 34 is definitely the better choice.

A 3D Printer ($500 to $1200)

There are hundreds of great-looking 3D printers and 3D printer kits available these days, but I’m only going to talk about two printers here. Aside from the two printers I’m going to talk about, there are quite a few kits in the $300 range. A friend of mine bought one of the printers, and while these printers are a viable option, I don’t think these cheap 3D printers would make a very good gift.

My MakerFarm Prusa i3

If you are buying a 3D printer for someone that likes to tinker and build things, then you can’t go wrong with a Prusa i3 printer from MakerFarm. I have had my MakerFarm 8” Prusa i3 3D printer for more than a year now, and it is one of the best things I ever bought. If I were buying another 3D printer today, it would most definitely be the 12” MakerFarm Prusa i3. The MakerFarm printers are well made, and their wood frame is quite rigid. MakerFarm has an 8” model for about $500, a 10” model for around $600, and a their 12” model is closer to $700.

I do realize that a kit might not make the best gift, but I would tend to recommend going that route anyway. Assembling a 3D printer is a great learning experience, and it is useful to understand just what your printer is doing as it is moving around.

If you don’t want to go with a kit, I’d have to recommend the FlashForge Creator Pro. It is a Makerbot Replicator clone that arrives fully assembled and ready to print. The FlashForge Creator’s build volume is comparable to the 8” MakerFarm kit, but the FlashForge Creator costs about twice as much at around $1,200.

We just ordered a FlashForge Creator Pro at TheLab.ms makerspace, and I got it up and running a few days ago. Even with a crowd of people looking over my shoulder the entire time, I had the machine assembled and printing in less than thirty minutes, and I’m impressed with the quality right out of the box.

The FlashForge Creator Pro arrives almost completely assembled. I just had to use two screws to attach the print head, snaps some filament guides in place, and it was ready to print. I was worried when we opened the box, but most of the fasteners were for assembling the acrylic door and lid.

Bodum Double Wall Mugs ($27)

I use my double wall cups from Bodum every single day. They not only look great, but they’re also extremely functional. I use my espresso machine to make an awful lot of lattes, and espresso is a pretty fragile thing. If you pour your tiny shot of espresso into a cold ceramic mug, you will almost immediately bring it down to room temperature and ruin the flavor.

That means I have to warm up my mug first. The double wall cups from Bodum are not only insulated, but the inner layer of glass has very little thermal mass. That means I don’t have to warm up my mugs, and I can start drinking sooner.

My laboratory beaker mug made the list two years ago, and it is probably made out of the same sort of glass as the Bodum cups. The biggest difference would be the lack of a second layer of glass. I used my beaker mug for several years, and I cleaned it in the dishwasher once or twice a week. A few months ago, I found it broken in the dishwasher. To be honest, I didn’t think the dishwasher was the best way to wash the beaker mug, but it did weather the storm of the dishwasher better that I had anticipated!

The beaker is definitely the geekier of the two options, but I still prefer the Bodum cups. They’re just more practical. I prefer the 12-oz size Bodum glasses without handles, but they come in an assortment of different sizes and shapes. They even have them in the right size and shape to keep your beer cold and your hand warm!

A Coffee Subscription ($9 to $25 per month)

Plenty of the geeks I know drink a lot of coffee, including myself. If you know someone that is drinking terrible coffee from the supermarket or even from Starbucks, a coffee subscription is an easy and inexpensive way to upgrade their coffee-drinking experience.

I’ve been enjoying my subscription to Craft Coffee for nearly two years now. My first shipment from Craft Coffee included an Ethiopian Yirgachiffe from Slate Coffee Roasters. The notes on the bag read, “Light, pillowy and clean, with flavors of dried strawberries, confectioner’s sugar, and breakfast cereal.” I thought this sounded like a bunch of hogwash, but boy was I wrong! It really did smell and taste like breakfast cereal—like Frankenberry cereal.

If you do place an order with Craft Coffee, you can use my referral code “pat1245” when you place your order. You’ll receive a 15% discount, and they’ll give me a free month of coffee. People have been using my referral code more often than I would expect, and no one has come back here to complain. I’m assuming that means they also feel that Craft Coffee is an excellent value.

Angel's Cup Shipment

I was lucky enough to be shipped a Black Box from Angels’ Cup last month, and every sample in the box was amazing. The first bag we opened was a delicious natural process Ethiopian coffee. I always enjoy Ethiopian Yirgacheffe beans, and this was without a doubt the best Yirgacheffe I’ve had all year. One of the samples was aged in bourbon barrels before roasting, and it was the most unique coffee I’ve ever brewed.

The only label on each bag of Angels’ Cup coffee is a number and a roasting date, and they have a smartphone app. You punch in the number on the bag, and you tell it what you think of the beans. You tell it how dark they are, what they smell like, and what sort of flavors you can pick out. The app tells you how accurate you were and tells you more about the coffee.

It was fun, and my wife enjoyed figuring out what was in each bag. She was very excited when she was correct about that first bag of Ethiopian Yirgacheffe coffee.

You can use the coupon code “patshead25” at Angels’ Cup, and you’ll save 25% on your first delivery in a new subscription. Unfortunately, this coupon code does not currently work on gifts.

Beginning My Home Automation Journey With The ESP8266 And The ESP210

| Comments

I’ve been contemplating the idea of implementing some home automation for a very long time. The benefits just hadn’t been exciting enough to encourage me to get started. Turning lights on and off didn’t seem all that interesting to me.

A number of small things came together recently that gave me just enough encouragement to start implementing some automation. Every day when I wake up, I make a delicious latte for myself using my Rancilio Silva. It is an excellent machine, but it takes 20 or 30 minutes to get warmed up enough to pull a good shot of espresso.

My home office is upstairs, and my espresso machine is downstairs. I often forget to run downstairs before heading to the office. When I do forget, that means I walk downstairs to a cold espresso machine, and I have to wait at least 20 minutes for my coffee.

Radio Controller Power Outlets

There happened to be a sale on Etekcity RF-controlled power outlets at Amazon one day. I found an article on hackaday.io explaining how to control these AC outlets using an Arduino. I had already been messing around with ESP-01 WiFi dev boards for a while, and I knew how easy it was to load Arduino sketches on them.

Three Etekcity Remote-Control Power Outlets

I immediately ordered a 3-pack of Etekcity remote-controlled power outlets. Building a little WiFi to 433 MHz RF bridge seemed like a good idea, and the 3-pack of Etekcity outlets was about half the price of a single Belkin WeMo outlet. How could I beat that?

Reading the RF codes with an Arduino

I found a write-up over at Hackaday.io about controlling these Etekcity power outlets using an Arduino. He is using the RCSwitch Arduino library to communicate with his Etekcity power outlets, and it turns out the RCSwitch library is very simple to use.

RCSwitch ships with an example sketch named ReceiveDemo_Advanced. All you have to do is wire up an inexpensive RF 433 MHz receiver to your Arduino, and upload this sketch. Then you just start hitting buttons on your Etekcity remote control, and the remote control codes will be printed on the Arduino’s serial port.

I completed this part of the project before any of my ESP8266 boards arrived. I just plugged an RF receiver into on of my Arduino boards, hit all the buttons on my Etekcity remote control, and made a note of the codes.

Transmitting the RF codes with an Arduino

Testing the codes and RF transmitter was even easier than reading the codes from the remote. The RCSwitch library also comes with a sketch named SendDemo. I just added codes corresponding to my own Etekcity power outlets to the demo.

I wired the RF transmitter to the Arduino and uploaded the sketch, and I plugged my IKEA floor lamp into one of the Etekcity outlets. When the Arduino booted back up, the power outlet began turning on and back off once every couple seconds.

This was pretty exciting for me. That lamp was the biggest real-world device I’ve ever controlled with an Arduino!

The Node.IT ESP210 is awesome

I started this project with an ESP-12 on a cheap breakout board adapter. The ESP-12 boards work great, and they are ridiculously inexpensive. Unfortunately, they’re a real pain in the neck during development. I hate having to connect four or five wires to my USB FTDI every time I need to upload new code. Those big, cheap breakout boards for the ESP-12 are kind of a nuisance, too. They’re just too wide to be used conveniently with a breadboard!

Prototype ESP210 RF433 Web Server

The fine folks at Electronic Sweet Peas were kind enough to send me a couple of preproduction models of their wonderful little ESP210 boards. The ESP210 is an ESP8266-based dev board with an integrated USB to serial chip and a voltage regulator. I don’t know how they did it, but they managed to squeeze those two major upgrades and all the pins of an ESP-12 onto a board nearly as tiny as the ESP-01!

It was a piece of cake to pull the ESP-12 out of my prototype and swap in the ESP210 in its place. I was able to upload the code without making any changes, and it worked perfectly!

The ESP210 isn’t just another ESP8266 development board. It is part of the Node.IT family of tiny, modular add-on boards called “+One” modules that plug into the ESP210 board. There are +One modules that offer things like a real-time clock, additional analog or digital GPIO pins, and even humidity sensors or Micro SD card slots.

How far did this get me?

Pretty far! It was simple enough to control the outlets from the command line using curl, or with browser bookmarks on my phone. Before long, I had the lamp in my office turning off every time Steam launched a game. I was also able to use Tasker on my Android phone to turn on my espresso machine as soon as I unplugged my phone in the morning.

This was a good start, and it gave me some idea of how useful home automation can be. Unfortunately, controlling multiple switches from multiple computers won’t scale very well.

Controlling the ESP8266 to RF bridge with OpenHAB

I’ve since set up an OpenHAB server that lives on my power-efficient virtual machine server. It is doing a great job of controlling my devices and keeping track of what I’m doing.

Creating OpenHAB rules for my Etekcity power outlets was easy. OpenHAB has a sendHttpGetRequest function. I just have to call that function with the correct URL whenever a switch is toggled.

1
2
3
4
5
6
7
8
9
10
11
12
13
rule "Turn Office Lamp off"
when
  Item Light_SF_Office_Lamp changed to OFF
then
  sendHttpGetRequest("http://esp8266/switch/5576140")
end

rule "Turn Office Lamp on"
when 
  Item Light_SF_Office_Lamp changed to ON
then
  sendHttpGetRequest("http://esp8266/switch/5576131")
end

I could easily write several thousands words about the things I’ve done so far using OpenHAB. I’ll leave that for future blog posts.

You can find the code for my ESP8266 RF Bridge at Github!

I uploaded a copy of my ESP8266 Wi-Fi to RF433 bridge repository to GitHub. The README file really needs some attention, but other than that, it should be good to go. Just plug the data pin of your RF433 transmitter into GPIO 2, then replace the ssid and password variables with the correct values for your network, upload the sketch to an ESP8266, and you should be ready to go!