Engineering Roundtable - Digitizing Your Electronic Blanket

Check it out as Joel connects his electric blanket to the internet!

Favorited Favorite 0

In today's episode of "Engineering Roundtable," SparkFun product guru Joel Bartlett attempts to burn down his house connect his electric blanket to the internet. You see, the reason is simple - after Joel spends an evening at Boulder's hackerspace Solid State Depot, he likes to come home to nice warm bed. So he decided to create a way to turn on his electric blanket remotely.

Joel did this by hacking the controller of his electric blanket and connecting it to the internet using a WiFly module and an Arduino. Through a slick web interface, Joel can now turn on his blanket to any setting while on the go and come home to a warm bed. He also retained the original functionality of the blanket, and can still manually adjust the settings as well. Check it out!



As always, please feel free to leave any questions or suggestions in the comments section below. We hope you enjoyed this edition of "Engineering Roundtable" and we'll see you again in a few weeks!

Comments 27 comments

  • Kratz / about 9 years ago / 3

    Correct me if I'm wrong, but wouldn't the method you showed using, would only work if you had a static IP address at your house? I believe even DynamicDNS requires support and setup on your home router, or a program running on a computer at home, so it can be informed if your IP address changes. Depending on your ISP, your IP address may change every couple of weeks or so (depending on how long your local ISP leases address for).

    As a side note, you can leave both devices use port 80 on your internal network, you only have to expose two port numbers to the internet (since to the internet, your home is only one IP address). From the inside, you can access both by their IP and port 80.

    Also, many routers may allow you to setup static IP addresses or ranges, which would guarantee that the routers DHCP service would not hand out those addresses, so you don't have to rely on the luck of something else not interfering with your devices address.

    • sgrace / about 9 years ago / 1

      If you have anything like pfSense, what you suggest would be better.

      • BigHomie / about 9 years ago / 1

        PFSense is awesome, I run m0n0wall on a soekris box myself, but even the el cheapo linksys wifi routers support dyndns (or they used to anyway) so I'd have to say that's trivial to setup.

        • sgrace / about 9 years ago / 1

          Very true.

          At home, I run pfSense with an Airport Express bridge. This way I can have wired and wireless connections and not worry about having to set both up. Besides, I'd rather not have something like this available out on the web (even if it is on a different port), and even mentioning it cna bring trouble. I had a Zedboard setup on linux, and when I told friends, they went and tried to DDoS it! Jerks...

          • Soshimo / about 9 years ago / 1

            My lease length is very long at my ISP. My IP has been the same since I got my account (I'm not paying for static IP, but it seems like it's been static). I know I can't depend on that, so I just set up a name server and allowed dynamic updates. A simple perl script kicked off from a cgi call updates it when I need to (which I haven't yet, but it's fun to play with dynamic name records!).

  • Dude, Joel... Saving the world one cold bed at a time. Well done, lol

    • Miskatonic / about 9 years ago / 4

      As someone who often sleeps in the garage, I also approve of this.

  • McGrr / about 9 years ago * / 2

    You know the future is here when you mumble to yourself "I hope nobody breaks into my blanket at 3am and gives me a tan". Great project still.

    • BigHomie / about 9 years ago / 1

      w/ the weather here in MI lately more like "I hope nobody hacks into my blanket @3:00am and gives me the flu".

  • Member #618080 / about 8 years ago / 1

    2 years on, this project still looks so cool, but the files are no longer to be found on github. Any idea where they can be found?

  • jomcl / about 9 years ago / 1

    I've been developing sketches for the arduino Ethernet shield for some time. I must you can improve the code putting the html to the program memory, not just as string, because the RAM requirements are much greater. In my projects I prefer to store the HTML in the SD card of the Ethernet shield. (I know, the wifly shield does not have one)

    Other point is about security. I think is important to put some way to only allow to enter to your system only the authorized people. Have you ever use a port scanner? It’s easy.

    In your code, the comments on line 200, says that you put some code to put a reload button and it breaks everything. How long is the actual HTML output? You always must think about TCP fragmentation, were a TCP packet must be 1500 bytes or less, including headers. If the whole HTML does not fit on a single packet, it will split in two or more packets. That’s called fragmentation. In your code, you must keep an eye in this problem, because the (at least in the Ethernet shield) communication IC does not handle the fragmentation by itself. It just send the packets one after another, without the packet number.

    The packet number is needed by the client to put all the received packets in order, (TCP/Ip does not guarantees the ideal packet route, so the packets can travel using different routes, taking different times and finally arriving in different order) and then passing the data to the browser.

    I strongly recommend to use a TCP/IP sniffer to see the actual traffic going from the server (the arduino + Wifly) to the browser in order to debug. You can reduce the fragmentation programing with AJAX, in order to feed only xml/json files to the browser from the arduino, and hosting the app itself (HTML, .js, css, img) in other web server.

    • Joel_E_B / about 9 years ago / 1

      Thanks for this info. That would definitely explain why it broke after I sent it enough html. I was probably exceeding the packet size and not handling that correctly.

      I'm aware that I should put some sort of security on it to allow only me to control it. My ip cam has a username and password. Though, I'm not entirely sure how to implement that on the WiFly shield.

  • JPitty / about 9 years ago * / 1

    Is the code posted somewhere? I'm not clear on the html or how the WiFly talks to the Arduino.

    • JPitty / about 9 years ago / 1

      No really... WHERE'S THE CODE? Please, someone point me to it.

      • Joel_E_B / about 9 years ago / 1

        The code for this project can be found here

  • noworries / about 9 years ago / 1

    What is the isolation voltage expectation over time of a cardboard box? How about the interconnecting wires? Also, the Wifi antenna that is connected to the Wifly module is exposed, what is its isolation value and does it have a metal ferrule that has no isolation?

    Is the arduino/Wifly module powered from the blanket controller, or via an external power supply? If it is external, is it safe to be connected to a non-transformer isolated device?

    When connecting devices as you did to a UL rated device, you void this rating. From your homeowner insurance point of view you may well be held to the same engineering skill expectations as the designers of the original device. If you do something which would never pass UL Inspection and something bad happens to your home, your insurance company will likely not be willing to pay any claims you may file. You also may find yourself in a legally exposed position should any harm come to any households adjacent to your home.

    Safely connecting anything external to a non-transformer isolated device is tricky. Each wire leaving the device must be evaluated for its hazards in all failure modes conceivable.

    I would suggest you look at using opto-isolators mounted within the controller to control the device. Getting feedback from the device as to when the front panel switches are pressed may also be isolated optically, but could be a bit challenging depending on how the original unit was designed.

    Alternately, you could put the whole design inside a insulating enclosure which precludes access to the interconnecting wires, RF antenna, while alowing access to the front panel controls.

    • MikeGrusin / about 9 years ago / 7

      All good points, but you might want to rethink your username.

      • Kratz / about 9 years ago / 2

        I wonder if doing some episodes on safety wouldn't be a bad idea? Even going over some regulation and legal stuff might be good for those who want to take their widget pro someday.

        • MikeGrusin / about 9 years ago / 2

          Also a good point. Although it sometimes appear otherwise (my comment above didn't help ;), we do take safety seriously around here and try to throw as many warnings as we can into product descriptions and projects that could hurt you if you don't know what you're doing. Expanding on noworries' suggestions in a general approach to mains-powered projects is a very good idea.

          Since it's not our market, we're not experts on the regulatory issues surrounding consumer electronics, but we'll consider that as well. Thanks for the suggestion!

      • noworries / about 9 years ago * / 1

        Avoiding a potentially dangerous situation does not equate to worrying. To choose to do otherwise is a cause to worry.

        • MikeGrusin / about 9 years ago / 1

          Well said, and thanks (sincerely) for pointing out the things one should think hard about when attempting a project like this.

  • CF / about 9 years ago / 1

    You need get an isolation transformer for probing live AC circuits.

  • Joel this is the most excited/enthusiastic i've seen you about your projects!! That's really cool!!!

  • Wow, I have long wanted to control stuff from the internet. This is a great jumping off point. Thanks Joel! ... First world problem .. hilarious!

  • I'm not sure how much one would need an Internet-controlled blanket, but controlling things from the Internet is awesome!

  • RyeMAC3 / about 9 years ago / 1

    That's awesome. I can think of a few cool uses for that. Internet-enabled home security camera?

Related Posts

Recent Posts


All Tags