Welcome back to the Part Two of our series on how I built an Internet of Things model house with PubNub. Check out Part One here.
When I last left you I had discovered the source of my internet connection bug. Every time I opened the garage door, the internet would go out!
It turns out that I had wired the servos incorrectly. In fact, searching the Arduino forums led me to believe this is a common mistakes hobbyists make. The problem is when the servos need to bear load, they require more power. This explains why the problem was apparent when the house was fully wired, but not when the servos were rolling around on my desk.
Arduino Board Limiters
Arduino board has limiters in place that prevent you from drawing too much power through the board (and frying it). Every time the garage door opened, the servos were drawing all the current, not leaving enough for the Arduino and Ethernet shield to properly function.
I tested my theory with a few external power supplies. When I verified it fixed the problem, I wired in the battery pack you can see in the video.
That was it! I had the working prototype.
Assembling the IoT House
I showed it to my team at PubNub over video chat. They loved it, but seemed a little concerned about how to assemble it. After all, there were about 20 wooden pieces that fit like a puzzle, and then another 20 wires.
There was also a new plan. Now we had a deadline; an upcoming IoT conference in San Francisco. In addition, I wouldn’t be going with the house. It was going right to our CEO Todd who was attending the show.
I started to second guess my original plan of shipping the house to be assembled on spot.
My co-worker at ATX Hackerspace, Alex, picked up an awesome Pelican case to carry his function generator and other crazy electronic gizmos safely to his clients this same day. He gave me quick demo and ensured that this was the way to go. I plopped the assembled house on top of the case and verified it would fit inside. Later that day I drove over to Fry’s and got one myself.
I glued the house together and decided I was going to ship it in as few pieces as possible. I glued the house walls together, cut out the styrofoam, and fit the house snugly inside the Pelican case.
Then I threw it off a table, kicked it, and tossed it down stairs.
I figured that I would subject the house to the worse torture possible while I could still fix it. Who knows what kind of abuse it will need to endure in shipping?
The house survived with minor injury.
I decided it was time to show this thing off. Test it in a live environment.
Showcasing the IoT House
I took it to HackTX, a hackathon hosted at the University of Texas here in Austin and run by my new pal Taylor. My other good pals Swift and Jon happened to be in town too.
I found a seat next to the students and set up the house. I repeatability assured the other contestants that I wasn’t going to be competing for any of the prizes.
There was a problem. I was connected to the UT campus internet, but their security settings prevented the network from being rebroadcast. I couldn’t share the WiFi from my Macbook to the Arduino. I learned after the fact that there is some way around this, but didn’t look to far into it.
Instead, I decided it was time to make this thing wireless. I did 30 minutes of research and decided I was going to replace the Arduino Uno and the WiFi chip with the newer Arduino Yún board. In addition to the WiFi chip, Yún has a second processor that runs Linux.
What better time to get this thing set up then at a hackathon? My roommate Nick showed up to the hackathon, so we both jumped in my hatchback, rolled down the windows, and cruised to a Radio Shack in South Austin. I called to confirm they had the chip, it wasn’t available at every Radioshack.
We didn’t support Yún at the time so I used our REST API documentation to write my own client. I really wanted JSON support and getting it to work with Arduino was difficult. More on this in another post. It took me the entire hackathon, but by the end…
It was complete:
I bought an external battery pack and a WiFi hotspot. I chiseled little spots out of the Pelican case to fit them in, and configured the Arduino to automatically connect to the hotspot.
The I went to Harbor Freight and bought a toolkit, extra tools, a soldering iron, etc. I rounded up extra servos, LEDs, wires, and wrote a debugging guide in case something went wrong with the house. I also recorded a video about how to take the house out of the case and set it up.
Then I dropped it off at FedEx. Overnight shipping to California.
The worst wasn’t over. Now it was time to wait for the call from our CEO Todd so I could walk him through setting it up.
I didn’t get a call, but instead a couple emails. One at 6:43am said:
“If so, call me. Starting set up now.”
Another arrive at 8:20am. I was awake for this one. It read:
I fell back asleep.
Working on this project was incredibly difficult yet also very fulfilling. I don’t have any formal electrical engineering experience, I’m a web developer by trade. I haven’t learned this much this fast since graduating college.
I was working extremely long days to meet the deadline. I would spend the entire morning just shopping for the right components, screws, glue, or paper. Then I would work, sometimes until 3 or 4am, getting everything together.
Thankfully Arduino makes things simple and I had a great network of people who helped me each step along the way. Alex, in particular was extremely helpful with electronics and another member of the space, Riley, spent on late Friday supplying me with every tool and component I needed during assembly like a surgeon’s assistant.
Now to convince PubNub to get me a drone…