tag:blogger.com,1999:blog-38531391854620143952024-03-13T01:04:58.526-04:00Lots of Cool Geeky ThingsBlogging about geeky stuff #LOCGTBen Millerhttp://www.blogger.com/profile/17985234897549353876noreply@blogger.comBlogger16125tag:blogger.com,1999:blog-3853139185462014395.post-35409066185116127362017-05-16T22:46:00.001-04:002017-05-16T22:46:57.797-04:00This is How I Role<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2KJ0fN81TWMPTfQuQ3aowgTRDrQ5UeZPcUgcyZaf36GVivzO87HyBPFzxehYibDzjzeMKu8sZcmWLmjXdX6v9NWzSnLHXI_g-7GVbob1ugr0ZTux164-rURC0cAQkyj6XCgvVPbKSLtV0/s1600/boxtop.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2KJ0fN81TWMPTfQuQ3aowgTRDrQ5UeZPcUgcyZaf36GVivzO87HyBPFzxehYibDzjzeMKu8sZcmWLmjXdX6v9NWzSnLHXI_g-7GVbob1ugr0ZTux164-rURC0cAQkyj6XCgvVPbKSLtV0/s200/boxtop.jpg" width="158" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Actual picture of my first game box</td></tr>
</tbody></table>
There are lots of options these days for playing the beloved classic RPG, D&D. They range from just picking up the <a href="https://www.amazon.com/Dungeons-Dragons-Starter-Wizards-Team/dp/0786965592/" target="_blank">starter kit</a> and rolling dice on the dining room table, to running a full multinational, all-electronic, virtual table top, live stream with special effects. I've spent some time evaluating the plethora options and settled on a setup that gets the tech out of the way, gives me the DM tools I need, and lets everyone have a fun experience.<br />
<br />
<a name='more'></a><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgndpJnPEzsgchV2FsSeuPioweyLFVaY5mEhSC78YOLcwuuZ5pQdXYD1AtdD46vg8J9dCKEmyrL0UJ6nIoxdlh5HdpfVZYlEONhG4sTX8mVBhD7L4ydZKS6XQEDmEZbGtpBO80AIIhkj7DV/s1600/CoverPage.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgndpJnPEzsgchV2FsSeuPioweyLFVaY5mEhSC78YOLcwuuZ5pQdXYD1AtdD46vg8J9dCKEmyrL0UJ6nIoxdlh5HdpfVZYlEONhG4sTX8mVBhD7L4ydZKS6XQEDmEZbGtpBO80AIIhkj7DV/s200/CoverPage.png" width="154" /></a>I enjoy playing D&D. It runs in my geek blood. I played when I was younger and had a chance to get back into it a few year ago. I'm an writer, so clearly I love making stuff up, and D&D lets me don my super hero cape, raise my imaginary sword and have an adventure. I've even written a module on the <a href="http://www.dmsguild.com/product/207214/The-Aeronauts-of-Ismond" target="_blank">DMsguild.com</a>. If you like high adventure on an airship with floating islands, pirates, and plot twists, grab a copy for your party. Okay, shameless plug over.<br />
<br />
With my woeful drawing and painting skills, I'm not the kind of DM who enjoys collecting and painting minis and my hand drawn maps were so crude as to break the immersion of the game. So when I DM, my minis and maps are always electronic and most of the time borrowed. Hence, I prefer to leverage virtual table top software instead of pen and paper. It also lets me keep all my notes organized and accessible.<br />
<br />
I've spent some time refining tools and techniques that help me get a game up and going for a group quickly, with little cost, effort, and lots of fun. It can even be used for a quick spontaneous one-off without tripping over the technology. So I decided to share the methods to my madness.<br />
<br />
<h3>
My Setup:</h3>
<h4>
DM Console:</h4>
<div>
I use an old, retired Thinkpad running windows. It doesn't take much horsepower and those things run forever and you can usually find one on eBay for less than $200. But any laptop, Mac, Linux, or Windows will work. The lid acts as a nice DM screen, so consider printing up something to tape to the back of the lid to add ambiance or help with the adventure.<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmnwSaCpsiu0lEx6wLYmgsoeRBiC_BtSEKg0DV5scKwJO3JdNMBeoLVpjH6pQOsGijUabY0-YBOjir3eg8e9Uj-tFc9XN2e6ZfMgpKy5qiOcGmicSSw6kb9hx8Il2hggp0YCdnHgyl1pUZ/s1600/maponlid.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="223" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmnwSaCpsiu0lEx6wLYmgsoeRBiC_BtSEKg0DV5scKwJO3JdNMBeoLVpjH6pQOsGijUabY0-YBOjir3eg8e9Uj-tFc9XN2e6ZfMgpKy5qiOcGmicSSw6kb9hx8Il2hggp0YCdnHgyl1pUZ/s400/maponlid.jpg" width="400" /></a></div>
<div style="text-align: right;">
</div>
Since I have the laptop for my screen, I also use Google Drive to store my notes on the adventure and my list of random names and NPCs for when the players wander into that part of the world I never planned for. That would never happen, right?<br />
<br /></div>
<h4>
Virtual Table Top Software:</h4>
I've found the most handy virtual table top for my style is <a href="http://roll20.net/">Roll20.net</a>. For the DM, it has a learning curve, but if you take the time to go through the brief tutorials, it's really powerful. You can build very nice maps in the software itself with both free and professional art packs from the built-in marketplace. The market has complete adventures, ready to run, even modules and the Monster Manual from Wizard of the Coast. For spontaneous games, you can even generate a <a href="http://donjon.bin.sh/5e/dungeon/" target="_blank">random dungeon from donjon</a>, save, and upload it to your game. For players, Roll20 is really intuitive, and web based so it's easy to project or pull up on a laptop or tablet. Generally, I project the map so players don't even need to touch tech. It keeps the nice dice, paper, pencil feel for the players.<br />
<br />
<h4>
Sharing the Map:</h4>
I've used both a projector and a TV to share the maps, generally whatever is available in the play space. I use a <a href="https://store.google.com/product/chromecast_2015" target="_blank">Chromecast </a>so I can put the player map up on anything with an HDMI port. It's hard to beat the $35 price tag. Additionally, the Chromecast will share the sound from your laptop so the Roll20 juke box app is perfect for setting the adventure's soundscape.<br />
<br />
<h4>
Pencil and Paper:</h4>
The rest of the game is done on standard character sheets with lots of dice, snacks, imagination, and fun!<br />
<br />
<h4>
Putting it all Together:</h4>
<ul>
<li>I run Roll20 in a Chrome browser for the DM view of the game map. This lets me see my notes, traps, and what monsters lurk behind the fog of war. </li>
<li>Then I run an incognito chrome window and login to the same Roll20 game, this time as a player. This shows the characters minis and the parts of the map the player is allowed to see.</li>
<li>From the player view, chrome window, I activate the broadcast to the chromecast so the players can see the map and hear the mood music.</li>
</ul>
<br />
You can see in the picture below, my cadre of geeklets modeling the setup during actual game play. This configuration keeps the messing around with tech to a minimum for me, doesn't require tech savvy players, and I can run the adventure with just my laptop.<br />
<br />
Notice on the TV screen, the inside of the building is blacked out for the players, but the DM can see what evil lurks inside.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhV4Tvcm_FRAQZyQOiF8ZU4YIyNrwehRQayBqlz7EVm8Dx7Dy_iO28MRzV6xxZvt4V-ZSeR1FeYqX3IXKv6npC49cBFhHs85HKZiBkXsdq6FcCq319MwLIEt4pZJnB9zR2ZiI46esdomFge/s1600/20170327_204751.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhV4Tvcm_FRAQZyQOiF8ZU4YIyNrwehRQayBqlz7EVm8Dx7Dy_iO28MRzV6xxZvt4V-ZSeR1FeYqX3IXKv6npC49cBFhHs85HKZiBkXsdq6FcCq319MwLIEt4pZJnB9zR2ZiI46esdomFge/s640/20170327_204751.jpg" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Map art credits to Jonathan Roberts for the <a href="http://www.fantasticmaps.com/2016/02/the-arcanists-mill_a-wizards-tower-map/" target="_blank">Archanist's Mill</a> maps. Wonderful artwork.</td></tr>
</tbody></table>
Nothing too technical here, just some quick tips from my experience running a hybrid tabletop and virtual game.<br />
<br />
Hopefully this was useful and spared you the time I've spent messing around with different tools and setups. Feel free to share you own tips or tricks for running your sessions in the comments.<br />
<br />
Roll initiative!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />Ben Millerhttp://www.blogger.com/profile/17985234897549353876noreply@blogger.com0tag:blogger.com,1999:blog-3853139185462014395.post-24891376126433538722016-01-13T16:53:00.001-05:002016-01-13T16:53:22.444-05:00Logging SmartThings to the Internet of Things<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-c-IjumBzTMNtEK22rMYYzVLvmxICL2F_Eef0YfRi5rZh_8WaDdycaYphU48MObFwL_bhlgMZRUKMTBABB23NT5jvvp5LHzX5BcXbOniJh6-GpfjJAcLBAxKBs1CJ1CBxR68GjAupeF9M/s1600/roomtemp.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="143" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-c-IjumBzTMNtEK22rMYYzVLvmxICL2F_Eef0YfRi5rZh_8WaDdycaYphU48MObFwL_bhlgMZRUKMTBABB23NT5jvvp5LHzX5BcXbOniJh6-GpfjJAcLBAxKBs1CJ1CBxR68GjAupeF9M/s200/roomtemp.png" width="200" /></a>I got a SmartThings hub for Christmas. It does a lot of cool things, but it doesn't draw graphs for things like temp, humidity, etc. Well, I had to fix that, so this post describes that journey and, frankly, it's easy enough that you can do it too.<br />
<br />
<a name='more'></a><br />
If you are someone who wants to skip the journey and just get the app, <a href="http://locgt.blogspot.com/2016/01/logging-smartthings-to-internet-of.html#TLDR">jump to my TLDR</a> section below. Otherwise . ..<br />
<br />
<h3>
The Backstory</h3>
So yay for cool Christmas presents! I had not researched SmartThings. They had been on the periphery of my geek radar but I hadn't gotten to them yet. Apparently my brother had checked into them and I think the gift was his way of telling me to get off the X10 junk I have working (<strike>some</strike> most of the time) in my house. I had looked at zwave/zigbee stuff in the past, and frankly the cost to replace all the X10 stuff I bought off ebay was a little higher than I liked.<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTUN0qI7dhHFgV3AmU7YAb3xEnzcIq_QdPyu8DPo-5IWTiY8Aq6ltV4zwwf2xwe_-vrcQ1MaCBFAHNd0b7B74N28UA8ljLAqPtLlDiLAVBodjbPgjcYEe5cNaqP0ILtqkEVbPw2DnLdl0g/s1600/Samsung-SmartThings-Hub-Front-Angle.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="125" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTUN0qI7dhHFgV3AmU7YAb3xEnzcIq_QdPyu8DPo-5IWTiY8Aq6ltV4zwwf2xwe_-vrcQ1MaCBFAHNd0b7B74N28UA8ljLAqPtLlDiLAVBodjbPgjcYEe5cNaqP0ILtqkEVbPw2DnLdl0g/s200/Samsung-SmartThings-Hub-Front-Angle.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Image copyright Samsung</td></tr>
</tbody></table>
<br />
Well, with a new toy in hand, I had to explore a bit. Turns out, this thing <b>is</b> really cool. Besides supporting a wide range of zwave, zigbee, bluetooth, and even wifi (tcp) devices, it has an open marketplace of SmartApps that allow truly sophisticated and intelligent behaviors. There is even an <a href="http://ifttt.com/" target="_blank">If This Then That</a> channel to add even more integration and sharing/linking options. But I digress. I found that there was a lack of graphing in the app and for some reason I fixated on this. Many SmartThings devices update their current temperature and/or humidity periodically and you can see it in their status or history log but I didn't find a way to see this over time. It looks like there has been an attempt to do some work on this based on a thread in SmartThings very active forum, <a href="https://community.smartthings.com/t/losing-hope-charts-and-graphs/7422">Losing hope: charts and graphs</a>. But the last time I checked the graphing project was offline. They thread title also didn't inspire hope.<br />
<br />
I just wanted to chart my temperature and I decided to use Adafruit IO as my IoT service. I'd learned about them in my last post: <a href="http://locgt.blogspot.com/2015/12/on-air-light-for-streamers.html" target="_blank">On Air Light for Streamers</a> and I thought their dashboard capability would work great to show a graph of my temperature feed.<br />
<br />
So I checked to see if I could use IFTT as a middleman between SmartThings and Adafruit IO because they support both, but it doesn't appear that IFTT has a "Temperature Update" event in their SmartThings channel. While it would have been a "no code" fix, it would also have been kind of Rube Goldberg-esque to leverage two web services for one measly graph.<br />
<br />
Time to look deeper. After all, what's the use in owning a thing (especially a smart one) if you don't know how to really pwn it? Turns out SmartThings has a <a href="http://docs.smartthings.com/en/latest/" target="_blank">very well documented API</a> for writing SmartApps and even creating new SmartThings integration. This allows you to write apps that handle events from your SmartThings like door opens, or temperature updates as well as take actions like turn on power, unlock doors, play sounds, turn on irrigation, or dim the lights.<br />
<br />
<h3>
The Project</h3>
So I looked like I would need to:<br />
<ol>
<li>Learn to write to a whole new API</li>
<li>In a language I didn't use (Groovy)</li>
<li>Handle a temperature update event</li>
<li>Integrate with an IoT API </li>
<li>Post the data</li>
</ol>
Disappointed, I figured it'd take me a few weeks in spare time at best. I took a peek at how big the learning curve mountain would be and got blown away. The whole project only <b>took me a little over an hour!</b> Seriously, I'm not bragging on me (I'm just a hack at this), but I am duly impressed at the quality of the tutorial, examples, and development environment that are all provided. They have a web based IDE for writing the code integrated with a built in simulator for running your code. You don't even have to own a device to get started. I followed <a href="http://docs.smartthings.com/en/latest/getting-started/overview.html" target="_blank">their tutorial</a> to understand what was happening inside a SmartApp and how to use their IDE and tools and then copied and pasted chunks of code from their <b>Too Hot</b> example app. It showed how to simply handle temperature update events. To post data I would need HTTP tools. Turns out SmartThings has several great HTMLPost,Get,Del,Head, etc methods built-in so I just needed to formulate my POST request properly and send it over.<br />
<br />
<h3>
Adafruit IO Integration</h3>
During my last project I learned that Adafruit IO requires a custom header with a key to post to your feed. You can see how to do this with curl in <a href="https://gist.github.com/deckerego/e1a96b79dd7ee398e09e" target="_blank">this code snippet</a> from DeckerEgo (he also has an <a href="http://blog.deckerego.net/" target="_blank">awesome blog of DIY geekery</a>.) If you haven't used Adafruit IO before follow their <a href="https://learn.adafruit.com/adafruit-io-basics-digital-output/adafruit-io-setup" target="_blank">(also) excellent tutorial</a> on setting up your account and feeds. In order to post the AIO key header, I needed to use the httpPostJson function which allowed me to modify the header values.<br />
<br />
<h3>
SmartApp Structure</h3>
The app is designed to ask the user for:<br />
<ul>
<li>Which temperature sensor to listen to</li>
<li>AIO username</li>
<li>AIO Key</li>
<li>AIO Feed</li>
</ul>
<div>
Once installed (it runs in your hub or the cloud, not your phone) it subscribes to the updates for the device you indicated. Upon receiving an update it posts it to your selected feed with the credentials you added during installation. It's that simple.</div>
<div>
<br /></div>
<h3>
Publishing</h3>
<div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiX7t_ydrp2m51HkW_qAVc4l1izkvRGsxaMcJfrKT2DbsXosPBytbiTLCBpQ0IsS_c3NmC3J5YSh3Rsz96k6A30r446qcPXTTJv2PzGipWBUJD-fd0F0tZOikHohWmA-Ra4LqG7so5W-xQ2/s1600/publish.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="92" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiX7t_ydrp2m51HkW_qAVc4l1izkvRGsxaMcJfrKT2DbsXosPBytbiTLCBpQ0IsS_c3NmC3J5YSh3Rsz96k6A30r446qcPXTTJv2PzGipWBUJD-fd0F0tZOikHohWmA-Ra4LqG7so5W-xQ2/s400/publish.png" width="400" /></a>After running the SmartApp in the simulator and seeing it update my feed I simply published it to myself and installed it in my SmartThings instance. After I learn a bit more about this, I might submit a request to make the app itself public.<br />
Until then, if you want to do the same, follow the steps below.</div>
<br />
<h3 id="TLDR">
TLDR</h3>
<div>
Ok, if the journey was too long and you just want to learn how to get this SmartApp for yourself start here to make it work for you.<br />
<br />
<ol>
<li>Setup your SmartThings stuff - get their app and follow their instructions</li>
<li>Setup your SmartThings <a href="https://graph.api.smartthings.com/" target="_blank">developer account</a></li>
<li>Setup your <a href="https://learn.adafruit.com/adafruit-io-basics-digital-output/adafruit-io-setup" target="_blank">Adafruit IO Account and Feed</a> (note your username, AIO key, and feed name)</li>
<li>Create a new SmartApp in your SmartThings account</li>
<li>Paste in the <a href="https://github.com/locgt/SmartThingsPublic/blob/master/smartapps/lcgt/log-temperature-to-adafruit-io.src/log-temperature-to-adafruit-io.groovy" target="_blank">code from my github repo</a> but use your own namespace i.e. replace the LCGT in the line: <span class="pl-c1" style="background-color: white; box-sizing: border-box; color: #0086b3; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; line-height: 16.8px; white-space: pre;">namespace</span><span style="background-color: white; color: #333333; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; line-height: 16.8px; white-space: pre;">: </span><span class="pl-s" style="background-color: white; box-sizing: border-box; color: #183691; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; line-height: 16.8px; white-space: pre;"><span class="pl-pds" style="box-sizing: border-box;">"</span>lcgt<span class="pl-pds" style="box-sizing: border-box;">"</span></span><span style="background-color: white; color: #333333; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; line-height: 16.8px; white-space: pre;">,</span></li>
<li>Save the app and test it out for yourself it you like</li>
<li>Publish the SmartApp to yourself</li>
<li>Install the SmartApp to your hub using the SmartThings App. Input your creds and feed name from above.</li>
</ol>
<div>
In the future I plan on investigating if I can allow you to select they type of event you want to listen for and post. I could see wanting to see all sorts of events mapped onto a graph. Door open events showing up on a temp chart could lead to some interesting correlations.<br />
<br />
Thanks for taking the journey with me and happy hacking.</div>
<br />
<br />
<br />
<br />
<br />
<br /></div>
Ben Millerhttp://www.blogger.com/profile/17985234897549353876noreply@blogger.com7tag:blogger.com,1999:blog-3853139185462014395.post-59675871107855867492015-12-30T19:14:00.000-05:002015-12-30T19:14:03.614-05:00On Air Light for StreamersFor streamers everywhere, whether you are trying to prevent parental humiliation <br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5ifwohe5zEkAwbvlXpnHiHRBFSBY080p7gNrk6kcHFqwGmoe3sB5e5Nh4ymHCke2ta_QdLp49HSlzszi9iQd4x0_8o59qnTgpygyrKJkeRwCo4Y3hp6PY0kMQ5v1Y4flfumWYMp9eHWGN/s1600/20151230_160046.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5ifwohe5zEkAwbvlXpnHiHRBFSBY080p7gNrk6kcHFqwGmoe3sB5e5Nh4ymHCke2ta_QdLp49HSlzszi9iQd4x0_8o59qnTgpygyrKJkeRwCo4Y3hp6PY0kMQ5v1Y4flfumWYMp9eHWGN/s200/20151230_160046.jpg" width="200" /></a></div>
or roommate intrusion, there needs to be some way to let your cohabitators know that you are on the air.<br />
<br />
My kids, like many others dream of becoming the next top Twitch streamer or YouTuber. After reading the Forbes article about the <a href="http://www.forbes.com/sites/maddieberg/2015/10/14/the-worlds-highest-paid-youtube-stars-2015/" target="_blank">World's Highest Paid YouTube Stars</a> who wouldn't!? So of course we built something really cool and geeky to solve this problem.<br />
<a name='more'></a>My young son's deepest grief in the world is when his recording or stream is interrupted by mom or dad shouting up the stairs to tell him to take out the trash or practice the piano. So UNCOOL! I bet MrMoon or The Diamond Minecart never had to deal with such indignities.<br />
<br />
Enter the On Air light project. The idea is to put a sign somewhere that allows you to send out the message that you are on the air. I wanted to put the sign downstairs from the "studio." But running up and down the stairs to turn the light on and off just seems like silliness to a geek like me (and my son). So it needed to be remote controllable. I've been dying to play with the esp8266 WiFi chip so this is my perfect excuse.<br />
<br />
At the heart of the sign is <a href="https://www.adafruit.com/products/2471" target="_blank">Adafruit's Huzaah</a> breakout board for the esp8266. For those that aren't paging through and memorizing spec sheets for fun, the esp8266 is an inexpensive WiFi chip married to a micro-controller. Adafruit bundled it up with a breakout board and some <a href="https://learn.adafruit.com/adafruit-huzzah-esp8266-breakout" target="_blank">excellent instructions</a> on how to write code for it just like an Arduino board with a WiFi shield. But this is MUCH cheaper and smaller.<br />
<h3>
Here's the theory of operation:</h3>
<ul>
<li>Use <a href="http://io.adafruit.com/" target="_blank">Adafruit's IoT service</a> to set and store the state of the light</li>
<li>The Huzzah uses the REST API to request the latest state of the light's feed on boot</li>
<li>The Huzzah subscribes to the light's IoT feed as an MQTT client and waits for state changes</li>
<li>When it gets an "On" message it brings 4 pins attached to red LEDs high</li>
<li>When it gets an "Off" message it brings 4 pins low</li>
</ul>
To control the light, the budding Internet celebrity simply logs into the dashboard for the light feed. From here, the streamer can observe and control the state of the light.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioX8rmqzh77aQuM3EyVx_oXvqCtC9J95b7uQWzEG7DzEFhW6dvZyypjSeG7cKv17Li-QAmJDgqImjCBfaQ7gvzC_wwL3t2xWd7nmVcyqgHSd6hxBG2hMbA9uZH7EAwV70F6FqufFwwFdSY/s1600/Screenshot_2015-12-30-17-00-03%257E2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="106" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioX8rmqzh77aQuM3EyVx_oXvqCtC9J95b7uQWzEG7DzEFhW6dvZyypjSeG7cKv17Li-QAmJDgqImjCBfaQ7gvzC_wwL3t2xWd7nmVcyqgHSd6hxBG2hMbA9uZH7EAwV70F6FqufFwwFdSY/s200/Screenshot_2015-12-30-17-00-03%257E2.jpg" width="200" /></a></div>
<br />
<h3>
Now on to the build</h3>
The build uses the following parts (<a href="https://www.adafruit.com/wishlists?wid=388557" target="_blank">Adafruit wishlist</a>):<br />
<ul>
<li><a href="https://www.adafruit.com/products/2471" target="_blank">Adafruit Huzzah</a></li>
<li>4 - <a href="https://www.adafruit.com/products/297" target="_blank">Adafruit Super Bright Red LEDs</a> - (this is pack of 25. Only 4 are needed)</li>
<li><a href="https://www.adafruit.com/products/63" target="_blank">9v Power Suply</a></li>
<li><a href="https://www.adafruit.com/products/610" target="_blank">Panel Mount 2.1mm power jack</a></li>
<li><a href="https://www.adafruit.com/products/954" target="_blank">Console Cable</a> (to program the esp8266)</li>
<li><a href="https://www.adafruit.com/products/1540" target="_blank">Right Angle Male Headers</a></li>
<li>4 - 100 Ohm resistors (get an assorted pack)</li>
<li>Bunch of of wires - some female jumper wires (to reduce soldering)</li>
<li><a href="https://www.amazon.com/gp/product/B000NJGHVO" target="_blank">A display box</a></li>
<li><a href="https://www.amazon.com/gp/product/B007MSMZH4" target="_blank">Stick-on letters</a></li>
<li>Piece of Baking Parchment</li>
</ul>
<div>
I won't write a play-by-play of the build, but here are the high points that should get an Arduino hobbiest going.</div>
<h4>
Prepare your Internet of Things account</h4>
<ol>
<li>Setup an Adafruit account and then sign into https://io.adafruit.com to setup your IO account.</li>
<li>Create a feed called "onair" following this <a href="https://learn.adafruit.com/adafruit-io-basics-feeds" target="_blank">tutorial</a></li>
<li>Create a dashboard with a toggle switch widget that switches from "On" to "Off". Try this out a few times and learn how the dashboard works and the feed updates.</li>
</ol>
<h4>
Assemble the hardware</h4>
<ol>
<li>I used right angle headers for my build as it keeps the Huzzah board flat against the back of the case. It's a little trickier soldering, but I'd recommend it.<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRYNa3vaRe4_MJ-ZCIaIoq_OUBjfzk55inhtCZn4JqxbMAZJ3JbDOdmoi10wyEdvdS4BXVKaaLuNSx7Q934unM_w7V7-uHNgTvoqrcXhwAJkH7DCdGVNPNPsXahRv2MpcZKDvaX-zrtNkA/s1600/20151230_102620.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRYNa3vaRe4_MJ-ZCIaIoq_OUBjfzk55inhtCZn4JqxbMAZJ3JbDOdmoi10wyEdvdS4BXVKaaLuNSx7Q934unM_w7V7-uHNgTvoqrcXhwAJkH7DCdGVNPNPsXahRv2MpcZKDvaX-zrtNkA/s320/20151230_102620.jpg" width="320" /></a></div>
</li>
<li>Attach the Huzzah to your computer <a href="https://learn.adafruit.com/adafruit-huzzah-esp8266-breakout" target="_blank">following the instructions</a> from Adafruit.</li>
<ol>
<li>Try out the LUA commands in the tutorial to ensure it can connect to your WiFi.</li>
<li>Follow the instructions further to configure it to work with the Arduino IDE</li>
</ol>
<li>Install the Adafruit IO MQTT and IO REST API libraries into the Arduino IDE <a href="https://learn.adafruit.com/adafruit-io/arduino" target="_blank">per the instructions</a> from Adafruit. The sketch uses the REST API to fetch the state of the feed when the Huzzzah first boots up or if it loses connection and the MQTT library to listen for updates.</li>
<li>Get the code I used <a href="https://github.com/locgt/onair/archive/master.zip" target="_blank">from github</a>. You can see that I borrowed heavily from the Adafruit examples included with the libraries. </li>
<li>Set your SSID and password in the code</li>
<li>Set you IO username and AIO key in the code. </li>
<li>Compile and upload the code to the board (press and hold the GPIO button while pressing the reset button once, then release the GPIO button to put it in bootloader mode before uploading)</li>
<li>Watch the serial console (CTR+SHIFT+M) to see it boot up, connect to WiFi, connect the the MQTT stream, and fetch the last state of the light.</li>
<li>Test switching the light mode with the dashboard. The on board LED of the Huzzah should turn on/off with the state of the feed. You can't see it yet, but the pins 5,12,13,&14 also are turning high/low so LEDs attached to them will turn on.</li>
<li>Assemble the electronics. You can use the Fritzing diagram below as a guide. We'll be using the 9v power supply rather than the battery, but you get the idea. I recommend breadboarding it before assembling it into the display case.</li>
</ol>
<div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhq4ux9UxZOfEJwY0NVGFd1ACNhXncIlr_iJ6tQNMMWYWh5Q5YKsMghdmgSnAj7ZXGjPs_tcmjkLr7tNhGx1w7T7gdqw0iuM-dXlNqP23bFUQApv0Fxgfh5S3P8Tk1pusgPwQ09wA8S2dEk/s1600/OnAirLight_bb.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="609" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhq4ux9UxZOfEJwY0NVGFd1ACNhXncIlr_iJ6tQNMMWYWh5Q5YKsMghdmgSnAj7ZXGjPs_tcmjkLr7tNhGx1w7T7gdqw0iuM-dXlNqP23bFUQApv0Fxgfh5S3P8Tk1pusgPwQ09wA8S2dEk/s640/OnAirLight_bb.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
For my build, I twisted the ends of all four resistors together and soldered them into a female jumper. This allowed me to wire all the LEDs into ground easily. I used female jumpers to go from the IO pins to the LEDs. It made a nice fit, was solderless, and was flexible to allow me to hot glue the assembly into the display box. I also avoided using the pins (TX,RX,V+,GND on the right) that hook up to the console cable in case debugging or programming is needed later.</div>
<h4 style="clear: both; text-align: left;">
Assemble the Display Box</h4>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ol>
<li>Discard the white foam in the display box</li>
<li>Cut a piece of parchment to fit over the back of the glass and tape it into place. This will diffuse the LEDs and hide the electronics</li>
<li>Draw a circle on the back of the display box inside the nut from the panel mount power jack. Cut out this circle and mount the jack in the lower back of the box.<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgM0_5FXOE7tAa-WOA55U2ogp_jpNKJe6shHH_l1CWZ8Vp0WdEmc3KbfW9cWtzwt5Jt1zIoXQ9UbxsGvqwLanMut0vWj8mTuZ14p-fUU_LV8zXN2WseDm-FJX9bst-LiwpZ9PnRcGNwXjIX/s1600/20151230_154140.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgM0_5FXOE7tAa-WOA55U2ogp_jpNKJe6shHH_l1CWZ8Vp0WdEmc3KbfW9cWtzwt5Jt1zIoXQ9UbxsGvqwLanMut0vWj8mTuZ14p-fUU_LV8zXN2WseDm-FJX9bst-LiwpZ9PnRcGNwXjIX/s200/20151230_154140.jpg" width="200" /></a></div>
</li>
<li>Place "ON AIR" letters on the front of the glass</li>
<li>Using hot glue, mount the Huzzah and LEDs inside the back of the case. You can adjust the angle of the LEDs to get the right level of light and diffusion.</li>
</ol>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgY_j3XmgeoyAv_7KtGIlDye78QQcgsVCFSf3RnR5-uLY5dl3ZiqygEPlSA76KSZZIt3HD8heaK-bP-p6WJzFLDN1Zj2v2y-PX0irvpj1q2GLL46896uAhoAJ0kG6S54K-zUGYiuW_AjOcc/s1600/20151230_152641.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgY_j3XmgeoyAv_7KtGIlDye78QQcgsVCFSf3RnR5-uLY5dl3ZiqygEPlSA76KSZZIt3HD8heaK-bP-p6WJzFLDN1Zj2v2y-PX0irvpj1q2GLL46896uAhoAJ0kG6S54K-zUGYiuW_AjOcc/s640/20151230_152641.jpg" width="480" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">I got a little carried away with the hot glue</td></tr>
</tbody></table>
<div>
Find a visible place for your new indicator lamp and plug it in!</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrrn8L61VKoINQYp25TozgQAj7Qq03AsDNXRyrNPH6VlXFRkcj223oZmb-BG8ml-_OyccWjh7fwEz3QSlKp3rYJyFI9seqL22ItGIaJzJAA53eaYr94iihgx4a5tTRlcMorcBKNIFV3UNy/s1600/20151230_155834.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrrn8L61VKoINQYp25TozgQAj7Qq03AsDNXRyrNPH6VlXFRkcj223oZmb-BG8ml-_OyccWjh7fwEz3QSlKp3rYJyFI9seqL22ItGIaJzJAA53eaYr94iihgx4a5tTRlcMorcBKNIFV3UNy/s320/20151230_155834.jpg" width="320" /></a></div>
<div>
<br /></div>
<br />
<div class="separator" style="clear: both; text-align: left;">
Because I miss the html blink tags, I'm going to leave this right here.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiG30VrCOoRyyDpNSvmsyTLnPyOtB9UDAgQP6mrkrXTLIHGGb9C0poc0wmPH9l-QJN6xUWbiZ9g_2vvW4TPWRMmRtyxFsr_vO-NT4fWmCIrCgOuSb1aUpIi7Oaldb1F5Xple_VYOVyHriiR/s1600/20151230_160034-ANIMATION.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiG30VrCOoRyyDpNSvmsyTLnPyOtB9UDAgQP6mrkrXTLIHGGb9C0poc0wmPH9l-QJN6xUWbiZ9g_2vvW4TPWRMmRtyxFsr_vO-NT4fWmCIrCgOuSb1aUpIi7Oaldb1F5Xple_VYOVyHriiR/s320/20151230_160034-ANIMATION.gif" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
I'd love to hear from anyone that gives this a go. Happy Streaming!</div>
<div>
<br /></div>
<div>
<br /></div>
Ben Millerhttp://www.blogger.com/profile/17985234897549353876noreply@blogger.com0tag:blogger.com,1999:blog-3853139185462014395.post-44976710115317270652015-10-13T21:32:00.002-04:002015-10-13T21:32:59.403-04:00How My Son Taught Himself Object Inheritance With Minecraft<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0yoskF26lSRKxtHik6DEg59zHO6Lxx86um8-aVpkNRiBwBS47wcUfmQ_mgRM10TPAH0EVBZwPb7yZ24ipsk404_CYzeN9KOMrj0pRh6cppGAxTPsGm-HRHi-UWovvBcWUgiDKsz1mzX_z/s1600/Minecraftexample.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="153" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0yoskF26lSRKxtHik6DEg59zHO6Lxx86um8-aVpkNRiBwBS47wcUfmQ_mgRM10TPAH0EVBZwPb7yZ24ipsk404_CYzeN9KOMrj0pRh6cppGAxTPsGm-HRHi-UWovvBcWUgiDKsz1mzX_z/s320/Minecraftexample.png" width="320" /></a></div>
Like every elementary school boy on planet Earth, my son has an unhealthy obsession with Minecraft. Long ago he grew tired of building stuff and has been reviewing mods, creating texture packs, and figuring out the boundaries of the sandbox.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimPNkluZ-QXEH27le_PXXdbCS-NB5cn0WXqXmVY6bPtTvdO0KHJxKgf4wcDTWGe7gz_PzbmTmmSUCit0QuGKOR6puzIP_SK6J8X4AfYQITsdrF6j3c3SQyWM3pECPvs_HH6sBIb9cdz01A/s1600/commandblock.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimPNkluZ-QXEH27le_PXXdbCS-NB5cn0WXqXmVY6bPtTvdO0KHJxKgf4wcDTWGe7gz_PzbmTmmSUCit0QuGKOR6puzIP_SK6J8X4AfYQITsdrF6j3c3SQyWM3pECPvs_HH6sBIb9cdz01A/s1600/commandblock.jpg" /></a></div>
With the addition of command blocks and the expansion of the command language in recent releases he has been challenging himself to create new and exciting game play.<br />
<br />
So what does this have to do with with the foundation topic of object oriented programming, <a href="https://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming)" target="_blank">Object Inheritance</a>? Well, let me tell you a story...<br />
<br />
My son wanted to make a friend that would follow him around and carry stuff for him in the game. (Geek Benefit #3: We can make our own friends if we can't make friends.) He started by creating a command block that cloned a mini armor stand and named it Timmy. Timmy unfortunately was a rather boring friend because it just stood in one place and did nothing.<br />
<br />
What to do? Well, there is a thing in the game that does follow a player around. So my son decided to clone a dog. He updated the command block to make Timmy always be where the dog was. That looked weird so he made the dog invisible. Cool! Just like that Timmy has inherited the dog's AI.<br />
<br />
But that was not enough. Timmy needed to follow him around AND carry stuff. Minecraft Riddle: "What's mobile and carries a chest?" Minecraft Answer: "A donkey." So next he cloned an invisible mule and made it stick to Timmy too. <br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcdxNrq4_V-3xxdHMdM-RCjdpK_obJk_UySuvn2XRJ_Mu03exBWKdWlu7xZ1YuwibAnf6p2eCHC0vQp_yNwzJv7z-72l-nvfUeSB0Z3te3Mon8Z8KpoNmkRLsscgjHSQCL4dCOG8NT-x9R/s1600/TimmyTransparent.PNG" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="159" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcdxNrq4_V-3xxdHMdM-RCjdpK_obJk_UySuvn2XRJ_Mu03exBWKdWlu7xZ1YuwibAnf6p2eCHC0vQp_yNwzJv7z-72l-nvfUeSB0Z3te3Mon8Z8KpoNmkRLsscgjHSQCL4dCOG8NT-x9R/s200/TimmyTransparent.PNG" width="200" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtjSeFVuwSPa0UIfBO1nF17R-mBsG_k3GYxOHtDRSrJFvsgljZSlB33l40GcTjaFy1MQbT0erQO2rwvaeE3mX8fIB9GGEq3god4j6vuTm9_41H98Lp4QIwOuIE-QQLa4kLoz8Rz_CKVNgd/s1600/TimmyObjects.PNG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="145" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtjSeFVuwSPa0UIfBO1nF17R-mBsG_k3GYxOHtDRSrJFvsgljZSlB33l40GcTjaFy1MQbT0erQO2rwvaeE3mX8fIB9GGEq3god4j6vuTm9_41H98Lp4QIwOuIE-QQLa4kLoz8Rz_CKVNgd/s200/TimmyObjects.PNG" width="200" /></a></div>
<div style="text-align: left;">
And poof, we now have a mini armor stand named Timmy that has the AI of a dog and the carrying capacity of a mule!<br />
<br /></div>
<br />
So instead of the boring "pet shop" inheritance example in the first C++ book I read <strike>decades </strike>years ago, he used the rather exciting example of Minecraft mobs to build his custom class, Timmy! The armor stand has now inherited the class properties of the dog and the donkey. Okay, I know, it's not a pure example, but it was a very small step illustrate the concept. And he figured it out for himself out as part of his fun. The best type of learning.<br />
<br />
<br />
<br />
<br />Ben Millerhttp://www.blogger.com/profile/17985234897549353876noreply@blogger.com0tag:blogger.com,1999:blog-3853139185462014395.post-83390966415035977532014-11-28T21:00:00.000-05:002014-11-28T22:14:59.965-05:00Like Minds Geek Fiction Now AvailableToday <i>Like Minds</i> is finally published. <i>Like Minds</i> is a near future science fiction thriller that includes AI, Augmented Reality, the FBI, and even a serial killer. After working on the book for over a decade, I'm really excited to announce that the <a href="http://www.amazon.com/Like-Minds-Ben-Miller-ebook/dp/B00Q62KG32/" target="_blank">ebook version is available</a> on Amazon today.<br />
<br />
To read more about the book you can go to the official book page: <a href="http://likeminds.authorbenmiller.com/">http://likeminds.authorbenmiller.com/</a> and I'll post updates to the <a href="https://www.facebook.com/likemindsbook" target="_blank">Facebook page</a> as well if you <i>like</i> that kind of thing.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoof-Hf40pfOhlnAi1XSm3vnCo5ys7mNbCo3fZS1-bwS1Gegci1dVqv8FDgKwafStRMOj6Q9a-zKcW0TZM8cy4egssUCTqGTY3jrscdU0o_s2GX78vjUnssKquJLUi5mpMWoElycuq/s1600/BenMiller_likeminds1+(1).jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoof-Hf40pfOhlnAi1XSm3vnCo5ys7mNbCo3fZS1-bwS1Gegci1dVqv8FDgKwafStRMOj6Q9a-zKcW0TZM8cy4egssUCTqGTY3jrscdU0o_s2GX78vjUnssKquJLUi5mpMWoElycuq/s1600/BenMiller_likeminds1+(1).jpg" height="320" width="210" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<a name='more'></a><br />
I hope you take a look at the page and even a sample of the book. I will let the world know when the treeBook version is also available as soon as the proofs are done.<br />
<br />
<br />Ben Millerhttp://www.blogger.com/profile/17985234897549353876noreply@blogger.com0tag:blogger.com,1999:blog-3853139185462014395.post-75089113211144990082014-03-16T17:05:00.002-04:002014-03-16T17:08:59.441-04:00RasPi Softener Salt Level Monitor<div class="" style="clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjydr8qCQlRxuHs_F1ps15nWumywRVAz0ZamYo4w0nqTGeVK2yALTXkcRyhJt_-W3PG5ZuPzyCe8zp3gD9C9F7RLtD2rxGqbBFG12k5X35sdVCO4YTHdMFMHd7D_9Dwru1O0BscEAhIcOPq/s1600/softener.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjydr8qCQlRxuHs_F1ps15nWumywRVAz0ZamYo4w0nqTGeVK2yALTXkcRyhJt_-W3PG5ZuPzyCe8zp3gD9C9F7RLtD2rxGqbBFG12k5X35sdVCO4YTHdMFMHd7D_9Dwru1O0BscEAhIcOPq/s1600/softener.jpg" /></a>If you can't tell from the fact that this is my first post in 2014 and it's March already that I am not one for routine tasks, then I'll tell you. I'm not one for routine tasks. More often then not, I get distracted or forget. So when it comes to my water softener, I usually discover it's low after the black plastic spatulas all turn white. So it's about time I did something about it.</div>
<div class="separator" style="clear: both; text-align: left;">
I was inspire by the cool (and cheap) HC-SR04 distance sensors. They look like cool little robot heads and can tell you how far away something is. I HAD to use one for something.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuVxF8kfQFS0QYF6ZgiF5DS2ZsoTxBI2j2N8oqy8I_4IdPnf5RHzxPsEGbVOtsjOgedwJ5yDDpMXCnyGBA2EhesRkgQr8Pr6Bn8ZEO58CKMeaOCLS9pFFLwn5iy41bdyNV_9ZPBEs3RVRP/s1600/hc-sr04.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuVxF8kfQFS0QYF6ZgiF5DS2ZsoTxBI2j2N8oqy8I_4IdPnf5RHzxPsEGbVOtsjOgedwJ5yDDpMXCnyGBA2EhesRkgQr8Pr6Bn8ZEO58CKMeaOCLS9pFFLwn5iy41bdyNV_9ZPBEs3RVRP/s1600/hc-sr04.jpg" height="320" width="320" /></a></td></tr>
<tr><td class="tr-caption">Johnny Five</td></tr>
</tbody></table>
The idea was simple. Monitor the distance from the lid of the softener do the bottom and alert when the distance to too far.<br />
<br />
<a name='more'></a><br />
<h3>
So I build up a list of <b>requirements</b>:</h3>
<ol>
<li>Wireless, because there's no network jack near my softener</li>
<li>Simple, because I don't want Frankenstein sitting on top of my softener getting bored. </li>
<li>Sends an alert, because if I'm going to forget to walk downstairs and check the softener tank, I'm certain I'll forget to check some webpage until the spatulas are all white.</li>
</ol>
<div>
<br /></div>
<div>
<h3>
The <b>design</b> came together naturally:</h3>
</div>
<div>
<ol>
<li>Raspberry Pi with a wifi dongle (still cheaper than any Arduino + wifi solution)</li>
<li>HC-SR04 distance sensor, cause this was the original requirement</li>
<li><a href="http://xively.com/" target="_blank">Xively</a> Internet of Things data service. This provides a simple way to push lots of simple data from simple devices to the cloud</li>
<li><a href="http://zapier.com/" target="_blank">Zapier</a> rule engine site. This is a fantastic service that is like <a href="http://ifttt.com/" target="_blank">"If this then that"</a> but with useful data sources rather than just trendy social media things.</li>
</ol>
<div>
<br /></div>
<div>
<h3>
The <b>build</b> was pretty simple:</h3>
</div>
</div>
<div>
<br /></div>
<div>
The Sensor has four pins. The <b>VCC</b> and <b>Ground</b> pins are really simple. I hooked one up the the 5v out on my Pi and one the ground using standard female to female jumpers.</div>
<div>
<br /></div>
<div>
The next pin of interest is the <b>Trig</b> pin. This pin triggers the pulse of sound from the sensor. It can be triggered with a simple 3.3v pulse from a unmodified Pi pin. so far so good. Three pins, three jumpers.</div>
<div>
<br /></div>
<div>
But, oh no! 5v vs 3.3v strikes again! The <b>Echo</b> pin outputs 5v! and that is Bad® for Pi pins. What to do? When lets look at how the sensor works.<br />
<ol>
<li>Sensor gets a 10us pulse on the Trig pin</li>
<li>Sensor sends an audio pulse out</li>
<li>Sensor listens intently for a reply while drumming its fingers</li>
<li>When the sensor finally hears a response it raises its Echo pin voltage for as long as it took for the echo to return.</li>
<li>Sensor continues drumming its fingers until the Trig pin goes high again.</li>
</ol>
<div>
Pretty cool, and you can't hear the sensor, even when it's drumming its fingers.</div>
<div>
<br /></div>
<div>
So this means the <b>Echo</b> pin is not communicating with serial, spi, or i2c protocol. So we can use a simple resistor to drop the return voltage to a tolerable level. A simple 1000 Ohm Resistor (Brown, Black, Red) will do the trick. I split one of my jumper wires and soldered in a resistor.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtQoIkagcug8W7shf7Y5-OuEyptpZgx3F7irTjqX-BFrbllCovjgsklnBJQXktOzsNUKcPdy6MopIrPX28zrYJnLhvdULJSXXMMtqqiXOQBjMsD70PXnSsH1w_uygvb4HFGH45zL83xlqw/s1600/jumperresistor.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtQoIkagcug8W7shf7Y5-OuEyptpZgx3F7irTjqX-BFrbllCovjgsklnBJQXktOzsNUKcPdy6MopIrPX28zrYJnLhvdULJSXXMMtqqiXOQBjMsD70PXnSsH1w_uygvb4HFGH45zL83xlqw/s1600/jumperresistor.jpg" height="164" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Shrink tubing or electricians tape will button this up nicely</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
Ok, so this last wire just goes from the Echo pin to a pin on the Pi.<br />
<b><br /></b>
<br />
<h3>
Next it's all about coding</h3>
<br /></div>
<div>
We need to read the sensor and send the data to the cloud. To do this I borrowed some great python code from Adam Lappin on his <a href="http://www.bytecreation.com/">Byte Creation blog</a>. He creates a <b>reading</b> function that triggers the sensor, times how long the <b>Echo</b> pin is high and then using an average speed of sound calculates the distance the sound traveled.<br />
<br />
Yay! A distance. Now to send it to the cloud. I borrowed some more code because it's already written, so why not, from the <a href="https://xively.com/dev/tutorials/pi/" target="_blank">Xively Raspberry Pi Sample code</a> and combined them. The result is <a href="https://github.com/locgt/sonar" target="_blank">hosted on github</a> for all to use and abuse.<br />
<br />
Before using the code make sure to setup an account with Xively and to setup a device. The API key and Feed ID variables will need to be set from your account. It wont work without them.<br />
<br />
Cool all done right? Nope. Because even though the script pushes data to the cloud, it won't tell me when the distance exceeds a couple feet. That's what Zapier is for.<br />
<br />
<h3>
Setup Alerting is the next step</h3>
<br />
Zapier is a cool web service rule engine that allows you to create rules that have a trigger and an action. Zapier has a trigger called a WebHook. Which is essentially a URL that when it receives structured data, triggers a "Zap" or rule on Zapier. So I setup an account and followed <a href="https://xively.com/dev/tutorials/zapier/" target="_blank">the simple tutorial from Xively</a> on how to create and connect a Xively alert to a Zapier WebHook.<br />
<br /></div>
<div>
I setup an SMS message to go to my phone when the distance is reported greater than two feet. This gives me plenty of time to fetch more salt before the spatulas turn white. I also added a trigger if the feed "freezes" to send an email to me so I know something happened to my Pi or script.<br />
<br />
<h3>
Finally I mounted the hardware</h3>
<br />
My softener has a removable lid, so I used some double sided foam tape to attach the sensor to the bottom of the lid, not too close to the edge as to avoid false echos.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-HwTyEFm_e_U/UyX6zQXOo6I/AAAAAAAAuvE/ToVxe7JRNr4/s1600/20140209_154657.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-HwTyEFm_e_U/UyX6zQXOo6I/AAAAAAAAuvE/ToVxe7JRNr4/s1600/20140209_154657.jpg" height="320" width="240" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Don't put me in the tank!! Noooooo</td></tr>
</tbody></table>
Then I wrapped the cables around the lid and attached the Pi in it's case to the top of the lid.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-RHGqn9BfGiw/UyX6zRVa3YI/AAAAAAAAuvE/MCWDBIQvRkA/s1600/20140209_155322.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-RHGqn9BfGiw/UyX6zRVa3YI/AAAAAAAAuvE/MCWDBIQvRkA/s1600/20140209_155322.jpg" height="240" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">All closed up and running</td></tr>
</tbody></table>
One last bit. I set the script to run when the Pi booted with the following line in the /etc/rc.local<br />
<br />
<pre><span style="background-color: black; color: white; font-family: Courier New, Courier, monospace;">sudo /home/pi/scripts/sonar.py &</span></pre>
</div>
</div>
<div>
<br />
Finally my water softener can talk to me, every home owner's dream.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-flMM4NxSRFc/UyX6zdL6BtI/AAAAAAAAuvE/CGijyxnjgAg/s1600/20140209_152934.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://4.bp.blogspot.com/-flMM4NxSRFc/UyX6zdL6BtI/AAAAAAAAuvE/CGijyxnjgAg/s1600/20140209_152934.jpg" height="240" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Feed Me!!!</td></tr>
</tbody></table>
<br /></div>
Ben Millerhttp://www.blogger.com/profile/17985234897549353876noreply@blogger.com15tag:blogger.com,1999:blog-3853139185462014395.post-88903868788268300032013-12-08T21:43:00.002-05:002013-12-14T18:09:27.060-05:00QR Code Adventure<br />
<div style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;">
<a href="http://chart.googleapis.com/chart?cht=qr&chs=100x100&choe=UTF-8&chld=H|0&chl=http://goo.gl/UW1Egv" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img alt="QR code" border="0" src="http://chart.googleapis.com/chart?cht=qr&chs=100x100&choe=UTF-8&chld=H|0&chl=http://goo.gl/UW1Egv" /></a>Here's a fun game that my kids enjoy. It's a cool techie activity for holiday and vacation time that adds a little excitement and gets kids up and moving about. I call it the QR Code Riddle Hunt.</div>
<br />
<br />
<a name='more'></a><br />
<br />
<h3>
QR Code Riddle Hunt</h3>
This is a fun game, like a scavenger hunt where riddles or clues lead the players from one spot to the next. There can be rewards at each spot or just a grand finale. My parents used to do this for me when I was a kid to lead me to my birthday presents and my guests and I would have a blast running all over the yard and house trying to solve the riddles.<br />
<br />
I updated the game a little just to add a little mystery and tech spice to it. In this game you use a tablet or smartphone to scan a QR code to get the riddle or clue to the location of the next QR code. A fancy web programmer person might be able to spice it up even more only allowing clues in a certain order or creating scores for different players, but this example is something anyone can do with free services.<br />
<br />
<h3>
How Do You Do It?</h3>
I use dropbox and goo.gl, google's link shortening service, for this project. I also used google docs spreadsheet for organization, but you can use what works for you.<br />
<br />
First thing I did was create a spreadsheet of the clues and locations. This is just for organizing your ideas on not for sharing, so it doesn't have to be fancy. Mine looked something like this.<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieXCKdCgveWavfrfjcX-x-o5yFq3T6ltDmSPb1H0SPlY3xRNhTrVAKyykxsLdA2s6aw7BucgJ9BycKjP2u8P1hPfYaBCsi06REcxzRlIEOsaE4b0j2uG0HTiIZLf-iwKrC9Mgzpo_Ahoi4/s1600/Selection_540.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieXCKdCgveWavfrfjcX-x-o5yFq3T6ltDmSPb1H0SPlY3xRNhTrVAKyykxsLdA2s6aw7BucgJ9BycKjP2u8P1hPfYaBCsi06REcxzRlIEOsaE4b0j2uG0HTiIZLf-iwKrC9Mgzpo_Ahoi4/s1600/Selection_540.png" height="113" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Of course you'll have real links in your spreadsheet</td></tr>
</tbody></table>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
This step is essentially the heart of the game. During this phase you are deciding where the clues will take the clueless (that came out wrong). Start by imagining the places you want your clue hunters to go and just write them down in the "Location of this Clue" field.<br />
<br />
Next, figure out a clue or riddle that will lead the party to the location. Put this clue for the location in the PREVIOUS line's "Riddle to next clue" field. For example the clue to the location "In knothole in oak tree" is "I'm knot where you think I am". The clue is in Step 0 that points them to step 1. This might be a little confusing at first, but once you get the hang of it, it will make sense. Or it might never make sense but this is how I keep track of the adventure.<br />
<br />
During this step, you can fill in the "Step" and "HTML file for THIS clue" but you wont have the link yet, so don't worry about leaving that field empty.<br />
<br />
Now that you have the spreadsheet setup, it's time to create the riddle pages. To make them publicly available use Dropbox. The clue files are tiny so a free account works just fine. For my games I start by creating a dedicated game folder in my public folder.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEip3nD5H0lzZ-26HFDwgS1sYASRDvxfMGDV4SBipmwrMfLnQuBXwTuAkvWiOA3QTjrQLBRH1Ctm-7yCpQ5uJ127B8Tvwrd_7pYnFHCVhyphenhyphensxWnZvBMdJgP3iJ2ws8zm5mioftL1GHZp77snr/s1600/Selection_539.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEip3nD5H0lzZ-26HFDwgS1sYASRDvxfMGDV4SBipmwrMfLnQuBXwTuAkvWiOA3QTjrQLBRH1Ctm-7yCpQ5uJ127B8Tvwrd_7pYnFHCVhyphenhyphensxWnZvBMdJgP3iJ2ws8zm5mioftL1GHZp77snr/s1600/Selection_539.png" height="145" width="400" /></a></div>
<br />
Now create a file for each clue. You can do this by opening your local dropbox folder that represents the new folder you created. Then you can use notepad or gedit or your favorite text editor to make the file.<br />
<br />
For this example, I created a file for each clue named clue#.html where # is the number of the step. So I edited clue1.html and it looks like this:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;"><!DOCTYPE HTML><html><head></span><span style="font-family: Courier New, Courier, monospace;"><Title><b>Clue One</b></title></head></span><span style="font-family: Courier New, Courier, monospace;"><body></span><span style="font-family: Courier New, Courier, monospace;"><h2><b>Clue One</b></h2><br /><b>Don't sit on me when you watch the sunset</b><br /><hr></span></blockquote>
Ok, so there's a lot of scary HTML stuff in there, but that's just stuff to help make it look prettier and make sure it loads in a browser on you tablet or phone. Just copy and paste it and replace the bold parts I highlighted. Or if you are a fancy html coder, knock yourself out and do css and javascript and cookies and and images and things.<br />
<br />
Do this to create clue1.html through clueN.html for your hunt. You should now have a list of clue files. For this next step go to the web interface for Dropbox to view the list of your clue files.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjauRzB_SnXtuZ3fTt3ODJkfHHTqmSGjvtj_aM726qhJz_qLtm1ieUfxagQB97xEDTgLEUnFyRwBQgo0n3CaJ8M8klu0M9Sfu9p3Gvm9TXHjlrNVRdcgUKJbFf4zUK3W2kxTe2SULdZUnUn/s1600/Selection_541.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjauRzB_SnXtuZ3fTt3ODJkfHHTqmSGjvtj_aM726qhJz_qLtm1ieUfxagQB97xEDTgLEUnFyRwBQgo0n3CaJ8M8klu0M9Sfu9p3Gvm9TXHjlrNVRdcgUKJbFf4zUK3W2kxTe2SULdZUnUn/s1600/Selection_541.png" height="160" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">List of Clue files</td></tr>
</tbody></table>
Right click on the file to get its public link.<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHocYBiFt03G-ZLNzUVtmtmDWCOJuAD-yNq9rvnj59LStBZiBll88Tpjg5nz1_y3TbWDxMnAfx9-kfwAwDhgc7y7TPACrdKAOtdvZBcEw1hSCkWe4zTOzZMn3Hwtcs4uL85SqjbvxOPVqV/s1600/Selection_542.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHocYBiFt03G-ZLNzUVtmtmDWCOJuAD-yNq9rvnj59LStBZiBll88Tpjg5nz1_y3TbWDxMnAfx9-kfwAwDhgc7y7TPACrdKAOtdvZBcEw1hSCkWe4zTOzZMn3Hwtcs4uL85SqjbvxOPVqV/s1600/Selection_542.png" height="248" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Right click magic!</td></tr>
</tbody></table>
Select "Copy public link"<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4CqsTZ99I8gD1mEAlwvJMRTnFcz3ecRcau_H8eSLSS7tTrcOeV0J47qmIP5mLyqc0iO9YmNPvOW34o7xpzjCUQN0p_SP-SphYg0gs4DD2xnjWaec-w4U9QUBVcdt3zxjz9pmOyFMXN2DF/s1600/Selection_543.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4CqsTZ99I8gD1mEAlwvJMRTnFcz3ecRcau_H8eSLSS7tTrcOeV0J47qmIP5mLyqc0iO9YmNPvOW34o7xpzjCUQN0p_SP-SphYg0gs4DD2xnjWaec-w4U9QUBVcdt3zxjz9pmOyFMXN2DF/s1600/Selection_543.png" height="137" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Your file's public link</td></tr>
</tbody></table>
Yes I obscured the link. Can't give away all the secrets. ;-) Anyway, copy and paste the link for clue#.html into the spreadsheet's "Link to THIS clue field" for the appropriate step.<br />
<br />
You should now have all the fields filled out and you are ready for the QR magic.<br />
<br />
If you don't have a Google account, come out from under your rock or loosen your tinfoil hat and get yourself one.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhB6jskjhVPeFdsnIEcq-GhozCzsiOTaFtknQfE4EV_HJ3WbgweSTlmqzQRvi84ePrwjjFU41fUyHjBX-guSxxdSNg17832i5huDnN-MWFPhF2hBQZpNBuK1rY2c6OowiVPlunwquaPDEe5/s1600/Joaquin-Phoenix-source_IGN.com_.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhB6jskjhVPeFdsnIEcq-GhozCzsiOTaFtknQfE4EV_HJ3WbgweSTlmqzQRvi84ePrwjjFU41fUyHjBX-guSxxdSNg17832i5huDnN-MWFPhF2hBQZpNBuK1rY2c6OowiVPlunwquaPDEe5/s1600/Joaquin-Phoenix-source_IGN.com_.jpg" height="271" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Worrying that Google knows too much, far too late</td></tr>
</tbody></table>
Now go to http://goo.gl<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgspTY8aHEmk_u4R5ObYbgFFsKIxXvcmKZeRHmt_EvWUEuJM9spQUyIwcNJvnOAIbJ01_uLDCYwS3yYMwt9Ftz7X8Xf6clz50KkqVoCRI3dlermV5EHU_nYBulZJnPedd0lfSSlrDYCGCaf/s1600/Selection_544.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgspTY8aHEmk_u4R5ObYbgFFsKIxXvcmKZeRHmt_EvWUEuJM9spQUyIwcNJvnOAIbJ01_uLDCYwS3yYMwt9Ftz7X8Xf6clz50KkqVoCRI3dlermV5EHU_nYBulZJnPedd0lfSSlrDYCGCaf/s1600/Selection_544.png" height="93" width="400" /></a></div>
<br />
<a href="http://chart.googleapis.com/chart?cht=qr&chs=100x100&choe=UTF-8&chld=H|0&chl=http://goo.gl/2Dnxsb" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img alt="QR code" border="0" src="http://chart.googleapis.com/chart?cht=qr&chs=100x100&choe=UTF-8&chld=H|0&chl=http://goo.gl/2Dnxsb" /></a>Paste in the long public link to the file and click <b>Shorten URL</b>. Then click on <b>Details</b> to the right to see the QR code for your link!<br />
<br />
<br />
This QR code is what you will print and hide at each location. Right click on the image and copy the link URL.<br />
<br />
You can stretch the rows of the spreadsheet and then click on <b>Insert->Image</b> from the pasted short URL. The result looks something like this.<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSyAr1nDXez6OpSqSaQf2JrviBEsm0EkY43tnsFIx1WjMdvmGkiGyMz5ya8Gxe6tUEK5BZHXzEsEVr45WoiGOIjPzbL0LOVhDdP6qGQv1efXaJqNu-t_ej0FLLpgqMcZiUljXZcEchgcRo/s1600/Selection_545.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSyAr1nDXez6OpSqSaQf2JrviBEsm0EkY43tnsFIx1WjMdvmGkiGyMz5ya8Gxe6tUEK5BZHXzEsEVr45WoiGOIjPzbL0LOVhDdP6qGQv1efXaJqNu-t_ej0FLLpgqMcZiUljXZcEchgcRo/s1600/Selection_545.png" height="427" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Finished spreadsheet</td></tr>
</tbody></table>
<br />
Now you can print out the finished page. Use your tablet or phone to test each code and make sure the right code matches the right clue. If all is good get out your handy scissors. You remember scissors, they were those things you used to use in grade school to rip apart paper because they were too dull to even cut cheese (that came out wrong). So cut out the squares, one at a time and hide them or tape them in their hiding places. <br />
<br />
Once they are hidden, you are all set to text or email the starting clue at your party! It's a fun activity for kids over the holidays. Imagine you kids traipsing all over the house and neighborhood like <a href="http://www.familycircus.com/" target="_blank">Billy from Family Circus</a>.<br />
<br />
If you get the hang of it, you might even consider branching out and making a Choose Your Own Adventure quest. There's lots of fun ways to play the game and it's a great way to make some of your own fun.<br />
<br />
I hope this helps someone have some fun. I'd love to hear comments from anyone that tries this or some variation.<br />
<br />
<br />Ben Millerhttp://www.blogger.com/profile/17985234897549353876noreply@blogger.com0tag:blogger.com,1999:blog-3853139185462014395.post-23723413990853467152013-11-17T18:39:00.000-05:002016-03-22T12:17:22.213-04:00Raspberry Pi Camera with Pan Tilt<br />
<div style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;">
</div>
<br />
<div class="" style="clear: both; text-align: left;">
I was inspired by <a class="g-profile" href="https://plus.google.com/106224289181527993344" target="_blank">+John Ellis</a>'s posting about his super cool <a href="http://blog.deckerego.net/2013/10/your-barn-door-is-open.html" target="_blank">garage security project </a>to add more video and automation to my Pi projects. He used a webcam in his project like I did in the <a href="http://locgt.blogspot.com/2013/08/frankenfeeder-part-i.html" target="_blank">Frankenfeeder</a> project. But I wanted to play with something new and hearing all the excitement around the camera module for the Raspberry Pi I thought I would take a look at it.<br />
UPDATE: <a href="http://computers.tutsplus.com/tutorials/how-to-build-a-wireless-pi-camera-pan-and-tilt-platform--mac-57052" target="_blank">Step by Step tutorial version is online</a></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<a name='more'></a><br />
<br />
<div class="" style="clear: both; text-align: left;">
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyIu7vdDtv4GIXirHjhIZS15IVDPwUlQLdLAXlD7AFrrcbJGtPobT5I44UkXxk2K46Ms-b027awehtg2y6JCKn7nBioq_oE3ItQDnmNDvbgh5Uqrrs0AsXwV3aMgvdAzHhPaydpAf0gaEy/s1600/1434-04.jpg" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyIu7vdDtv4GIXirHjhIZS15IVDPwUlQLdLAXlD7AFrrcbJGtPobT5I44UkXxk2K46Ms-b027awehtg2y6JCKn7nBioq_oE3ItQDnmNDvbgh5Uqrrs0AsXwV3aMgvdAzHhPaydpAf0gaEy/s200/1434-04.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Camera module & mount kit from Adafruit</td></tr>
</tbody></table>
I picked up a camera module from <a href="http://www.newark.com/" target="_blank">Newark</a> and one of <a href="http://www.adafruit.com/products/1434" target="_blank">these really cool camera mount kits</a> from <a href="http://www.adafruit.com/" target="_blank">Adafruit</a>. <br />
<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7ZjYejDKsM8iLB1ldm2EM-ovhH8bnxjfr34ALbBdXdT9NruRlECmVVwKywLsS-mXDFQc9B3zf_WdRyTpKPOLHnDJ3tXBIrlxjmT9yRrcCh4MXMVkdmRyOfvVNN4te4x3zmbRy7eef1vw-/s1600/20131117_162919.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7ZjYejDKsM8iLB1ldm2EM-ovhH8bnxjfr34ALbBdXdT9NruRlECmVVwKywLsS-mXDFQc9B3zf_WdRyTpKPOLHnDJ3tXBIrlxjmT9yRrcCh4MXMVkdmRyOfvVNN4te4x3zmbRy7eef1vw-/s1600/20131117_162919.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Picture of lab ceiling</td></tr>
</tbody></table>
However a camera just laying on the table only takes good pictures of the ceiling, so what to do?<br />
<br /></div>
<div class="" style="clear: both; text-align: left;">
<br /></div>
<div class="" style="clear: both; text-align: left;">
<a href="https://dlnmh9ip6v2uc.cloudfront.net//images/products/1/0/3/3/5/10335-04.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="200" src="https://dlnmh9ip6v2uc.cloudfront.net//images/products/1/0/3/3/5/10335-04.jpg" width="200" /></a><a href="http://www.sparkfun.com/" target="_blank">Sparkfun</a> to the rescue! They have a nifty pan/tilt assembly that works well with their small servos. Based on some other reading, it appeared to me that the Pi has the ability to drive a couple small servos without having to complicate things with another external power supply.</div>
<div class="" style="clear: both; text-align: left;">
So I ordered a bracket and put it together. I employed my minions to help design a base for it from their lego kit and wired up the signal/ground/power pins on the servos to the Pi. How I wired them up comes in a little later. </div>
<div class="" style="clear: both; text-align: left;">
<br /></div>
<div class="" style="clear: both; text-align: left;">
To get the camera module up and running required following <a href="http://www.raspberrypi.org/camera" target="_blank">these simple instructions </a>on how to connect it and configure it with the <span style="font-family: "courier new" , "courier" , monospace;">raspi-config</span> command. I got something that looked like the picture below. Oh, I also added a wifi adapter, as you can see in the pics, so the whole thing would only require one cable (power) to operate.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoemcOO9NHU_8-Wc3UDQ_Z7F_gSFxebrYbsVOvcdkxwbI1o3AJt-Fz5X6YvZFEMmLwO6o_OATvvSnWr5HwO9JgmzZCJzGLFccq7haX3u9XtdHR1OZgD5mbjzvzbpguxWtne10ChPYaWUB1/s1600/20131117_142400.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoemcOO9NHU_8-Wc3UDQ_Z7F_gSFxebrYbsVOvcdkxwbI1o3AJt-Fz5X6YvZFEMmLwO6o_OATvvSnWr5HwO9JgmzZCJzGLFccq7haX3u9XtdHR1OZgD5mbjzvzbpguxWtne10ChPYaWUB1/s1600/20131117_142400.jpg" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Assembled Sparkfun pan/tilt bracket with Adafruit camera mount and Lego base</td></tr>
</tbody></table>
<div class="" style="clear: both; text-align: left;">
As far as wiring up the servos, that story is linked with the software I used to control the servos. <a href="https://github.com/richardghirst/PiBits/tree/master/ServoBlaster" target="_blank">Servoblaster</a> is a great project by Richard Ghirst that allows very simple command line control of the servos. I am only using two servos for left/right (servo 0) and up/down (servo 1). Using the handy <a href="http://elinux.org/RPi_Low-level_peripherals" target="_blank">Raspberry Pi pin out diagram</a> I wired the power (red wire) for both servos up the +5 pins on the Pi and the black wires to the ground pins. The signal pins (white wire) I wired up as prescribed by the servoblaster readme, GPIO 4 for servo 0's white wire and GPIO 17 for servo 1's white wire. Female to Male jumper wires made hooking up the standard black/red/white cables to the Pi very simple.</div>
<div class="" style="clear: both; text-align: left;">
After downloading and installing servoblaster code, I could now control the pan/tilt with commands like:</div>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">$ echo 0=70 > /dev/servoblaster #left/right</span><span style="font-family: "courier new" , "courier" , monospace;">$ echo 1=120 > /dev/servoblaster #up/down</span></blockquote>
<div>
While this is not a super cool web based point and click interface like <a class="g-profile" href="https://plus.google.com/106224289181527993344" target="_blank">+John Ellis</a> made for his garage project (No! I am not jealous of his leet web haxor skills. yes I am.). But command line works for my proof of concept setup.</div>
<div>
<br /></div>
<div>
The Pi camera also has really simple commands to take pictures and videos like:</div>
<div>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">$ raspistill -o image.jpg #take still pic</span><span style="font-family: "courier new" , "courier" , monospace;">$ raspivid -t 10000 -o video.h264 #take 10sec video</span></blockquote>
</div>
<div>
Again a fairly command line/techie setup, but with simple commands I was able to capture pictures of what happens in my lab when I am not there.</div>
<div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghz8mPBazaj4ZnP-54Uy_7cXCx13FwFo7uFbL_0PENI3f0WU9Z5jKIlC3MatC9HhHfwTUnR46Fl1CsRm8j93g5kXITycEVgdceEs4gv7k8ZHA7BKD_6MMlG-aTWtXdLLGz33U7BtomopWe/s1600/minnions.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="163" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghz8mPBazaj4ZnP-54Uy_7cXCx13FwFo7uFbL_0PENI3f0WU9Z5jKIlC3MatC9HhHfwTUnR46Fl1CsRm8j93g5kXITycEVgdceEs4gv7k8ZHA7BKD_6MMlG-aTWtXdLLGz33U7BtomopWe/s1600/minnions.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">What I imagine happens in my lab</td></tr>
</tbody></table>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div>
This turned out to be a pretty functional setup. I did discover that drawing too much power at once would freak out the Pi. For a stable setup I avoid using both servos, the camera, and the network all at the same time. I could reliably freeze up the Pi if I did all off them at once and I'm using a 2A power supply already.</div>
<div>
<br /></div>
<div>
I did take the project another step further. I wanted to see if I could stream video off of the Pi. I wanted something quick an dirty for POC. So I turned to my old friend netcat (<span style="font-family: "courier new" , "courier" , monospace;">apt-get install netcat</span>). I setup a script that would pipe the output of the camera video to nc pointed at my pc where I was taking the output from netcat and playing it with mplayer. The turned out to work quite well.</div>
<div>
<br /></div>
<div>
My laptop has an IP address of 192.168.1.101 for this example. Not really but because I'm paranoid, I won't tell you the real address. Hold on while I adjust my tinfoil hat. I have actually worn one once. Have you? Then don't knock it. On the laptop I issued the command: </div>
<blockquote class="tr_bq">
<span style="font-size: 15px; line-height: 1.15; white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace;">nc -k -l 192.168.1.101 5001 | mplayer -fps 31 -cache 1024 -</span></span></blockquote>
<div>
<span style="font-family: "arial"; font-size: 15px; line-height: 1.15; white-space: pre-wrap;">Next, on the Pi </span>I issued the command:</div>
<div>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">raspivid -t 1000000 -o - | nc 192.168.1.101 5001 &</span></blockquote>
</div>
<div>
After buffering for a moment, I had an awesome full screen video of the minions working in my lab. You'll notice (especially since I'm going to point it out), that I used the & to drop the video stream into the background. This allowed me to issue the commands to move the servos around while watching the video. One of my real life minions did get suspicious when he heard the noise from the servos and for some mysterious reason the feed did not stay up very long. </div>
<div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdqjnohFj5QCBXtW41OB_ikeMf77E0AvWZ5iiyrM1yAfJaz4l8UzfM-ORBfQYcSFaqaabsrUJLieIEGY-rKn7GWcMgqSq1WVM74To4w4uTSt9kVHsB1w5aLVKX8Ihfr-MXF5rFZsJPLnIF/s1600/20131117_161758.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdqjnohFj5QCBXtW41OB_ikeMf77E0AvWZ5iiyrM1yAfJaz4l8UzfM-ORBfQYcSFaqaabsrUJLieIEGY-rKn7GWcMgqSq1WVM74To4w4uTSt9kVHsB1w5aLVKX8Ihfr-MXF5rFZsJPLnIF/s1600/20131117_161758.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Last good frame of video capture stream</td></tr>
</tbody></table>
It was a fun project. I now have the proof of concept for a nice remote control security, nature photography, or minion spy project. A little more Lego work to enclose the Pi too and it would be a reasonably portable kit.</div>
<div>
<br /></div>
<div>
Now I'm off to find out where the minions hid the camera module. Silly minions.</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
Ben Millerhttp://www.blogger.com/profile/17985234897549353876noreply@blogger.com0tag:blogger.com,1999:blog-3853139185462014395.post-21269422306162390072013-09-28T10:13:00.002-04:002013-09-28T12:20:59.669-04:00Learning Moment and ScienceWe had a great family learning moment and experiment I thought I would share. It was so simple to setup that if you have the parts, it only takes a moment.<br />
<br />
Over dinner, my son (3rd grade) talked about a video they watched at school about a young girl who invented a flashlight that worked by the heat of your hand. I later found the video here: <a href="http://www.youtube.com/watch?v=9CCGUMkcbjg" target="_blank">http://www.youtube.com/watch?v=9CCGUMkcbjg</a>. Big congrats to her, way to go!<br />
<br />
<a name='more'></a><br />
<br />
<a href="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcSJldQE5ma20UHfdhiDun1eqmEWVBQJOOlXdvM6kGCiMGpgiZOk" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcSJldQE5ma20UHfdhiDun1eqmEWVBQJOOlXdvM6kGCiMGpgiZOk" /></a>This led into an excellent conversation about alternative energies sources and the related law of conservation of energy as they got excited about powering a car with the heat of your hands. And no, kids, driving barefoot to add the heat of your feet would unfortunately not add enough energy to the system. But it would be an <b>awesome</b> throwback to the Flintstones! I encouraged the brainstorming for as long as the chips and salsa held out.<br />
<br />
<br />
<br />
Later, at home I pulled out the peltier plate I got for the <a href="http://locgt.blogspot.com/2013/08/frankenstein.html" target="_blank">Frankenstein project</a> (not as sinister as it sounds) and hooked it up to my multimeter. The peltier plate is a component that will convert a heat difference between the two sides into electricity. This is the principle the young lady used to power her flashlight.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibiaL-NgFIUmSzh2DbDOwXFna_VlzTdpohStS7QglxML6Nkfz2M-hawPjvyCWCp5rCgX_jldtKhavRcu8XzbiIGnIlPVPxCfxDJ7dj8WrBYGbp94pqLQB8veN-o4vghYW-ePgKrqzlM6CC/s1600/20130928_094202.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibiaL-NgFIUmSzh2DbDOwXFna_VlzTdpohStS7QglxML6Nkfz2M-hawPjvyCWCp5rCgX_jldtKhavRcu8XzbiIGnIlPVPxCfxDJ7dj8WrBYGbp94pqLQB8veN-o4vghYW-ePgKrqzlM6CC/s1600/20130928_094202.jpg" height="240" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Simple Setup - Multimeter leads clipped to peltier leads</td></tr>
</tbody></table>
<br />
The kids then took turns putting their hand on the plate and watching the voltage change. <br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-OaRgUCjYG9I/Ukbdz8m3jeI/AAAAAAAAdRA/_9dMlhvFXRE/s1600/20130928_094504.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-OaRgUCjYG9I/Ukbdz8m3jeI/AAAAAAAAdRA/_9dMlhvFXRE/s1600/20130928_094504.jpg" height="320" width="240" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Ok, so not my kid's hand. Consider this a reenactment.</td></tr>
</tbody></table>
They took turns blowing in their hands and rubbing them together to see who could make the number go highest. As I pointed out to them, they were adding energy into the system.<br />
<br />
A simple learning moment that only required one electrical component and a multimeter.<br />
<br />
<i>P.S. Yes the voltage in the picture is negative, flip the plate over or flip the leads if that matters to you.</i><br />
<br />Ben Millerhttp://www.blogger.com/profile/17985234897549353876noreply@blogger.com0tag:blogger.com,1999:blog-3853139185462014395.post-31086303506006531762013-09-07T22:12:00.001-04:002013-09-28T12:12:16.803-04:00Frankenstein Update I<div class="separator" style="clear: both; text-align: left;">
Just a quick update on the <a href="http://locgt.blogspot.com/2013/08/frankenstein.html" target="_blank">Frankenstein project</a>. It's been slow getting started, but this will be worth it. We wanted to do some proof of concept testing. So we needed to get a peltier plate in to start working with it. Well Digikey obliged and we now have this little guy to play with.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-7S17sTdUIqY/UiuRLVzORmI/AAAAAAAAcS4/n-1pA3TfbOI/s1600/photo.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://4.bp.blogspot.com/-7S17sTdUIqY/UiuRLVzORmI/AAAAAAAAcS4/n-1pA3TfbOI/s1600/photo.jpg" height="169" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Peltier Plate for solid state cooling</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: left;">
</div>
<a name='more'></a>This is a small guy, about the size of a stamp, but according to the stats on it, it can really move heat well. So we will need good cold and hot side sinks to dissipate the thermal load.<br />
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Here's a picture of the beer (cold) side thermal conductor. The hot side I'm just going to grab from the PC graveyard in my basement.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVYBsuvwL7hy23RVQh1GBGNotzTD4nsDofSCFH7ry7Fl-C6HOmWUXbOMsOkX54tPgVRmiVK_y6Jehdvmn1o2aerpRKCqNLY93ERTI892Yb2sYJ5pBMfAtCwD5kcyhxsGuEjfTg1VAACBqo/s1600/20130907_182948.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVYBsuvwL7hy23RVQh1GBGNotzTD4nsDofSCFH7ry7Fl-C6HOmWUXbOMsOkX54tPgVRmiVK_y6Jehdvmn1o2aerpRKCqNLY93ERTI892Yb2sYJ5pBMfAtCwD5kcyhxsGuEjfTg1VAACBqo/s1600/20130907_182948.jpg" height="320" width="240" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">This has a lot of thermal mass.<br />
Planning on cutting this in half and letting the beer cozy<br />
pull the beer can or bottle into a tight fit with the aluminum</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The plate we have optimally takes 8.6V and draws 3Amps to perform at it's peak. Since the batteries we are talking about using are 12V or 18V we need to trim down the voltage reliably and still allow 3A to flow. For starters, I expect we will experiment using my bench variable power supply, but I found the following power regulator ( <a href="http://www.miniinthebox.com/dc-to-dc-4-5-30v-to-0-8-30v-5a-step-down-converter-voltage-regulator_p531830.html" target="_blank">Here</a> ) pre-assembled and shipped for about $13. So I have this on order and are waiting for it to arrive. </div>
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://cloud12.rightinthebox.com/images/384x384/201303/dc-to-dc-4-5-30v-to-0-8-30v-5a-step-down-converter-voltage-regulator_pkklkm1364522391639.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="http://cloud12.rightinthebox.com/images/384x384/201303/dc-to-dc-4-5-30v-to-0-8-30v-5a-step-down-converter-voltage-regulator_pkklkm1364522391639.jpg" height="320" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">DC to DC 4.5-30V to 0.8-30V 5A Step Down Converter Voltage Regulator</td></tr>
</tbody></table>
<br />
Finally, I've got these guys sitting around that I will start playing with for this project.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5jF_azAq2tnz4vkTms0aDIpoxm7CIa6xLhsnUnPHymdewd1NZYDI6NGH2Soy9985txLeW3tHfvGmI1hVV9KK5F6JbbmISyISthXBZrbW0f5hH-UE4A-xr8o62cgoCnz2W3-G7ATmYYSJ7/s1600/20130629_103626.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5jF_azAq2tnz4vkTms0aDIpoxm7CIa6xLhsnUnPHymdewd1NZYDI6NGH2Soy9985txLeW3tHfvGmI1hVV9KK5F6JbbmISyISthXBZrbW0f5hH-UE4A-xr8o62cgoCnz2W3-G7ATmYYSJ7/s1600/20130629_103626.jpg" height="480" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Tinyduinos!! and my sock.</td></tr>
</tbody></table>
I'm thinking I need another voltage regulator that will drop the voltage to 5V for the <a href="http://tiny-circuits.com/products/tinyduino/" target="_blank">tinyduino</a>. <a href="http://www.digikey.com/product-search/en?WT.z_header=search_go&lang=en&site=us&keywords=P7805-Q24-S5-S+&x=17&y=20&formaction=on" target="_blank">This power regulator</a> looks like it should do the trick at input of up to 32V, 5V output at 500ma. I'll add this to my shopping cart soon.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://media.digikey.com/Photos/CUI%20Photos/P7805-S_sml.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://media.digikey.com/Photos/CUI%20Photos/P7805-S_sml.jpg" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"></td><td class="tr-caption"><span style="font-size: x-small;">P7805-Q24-S5-S Power Regulator</span></td></tr>
</tbody></table>
<br />
Well that's the update for today. Not much progress, but just getting parts. I'll post again after our session of testing out the plate.<br />
<br />
Later,<br />
BenBen Millerhttp://www.blogger.com/profile/17985234897549353876noreply@blogger.com0tag:blogger.com,1999:blog-3853139185462014395.post-20107464717576621022013-08-27T02:10:00.000-04:002013-09-28T12:12:46.319-04:00Wind Chimes (Arduino, Raspi, and Magnets!!)<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-V_51yqki_B4/UgcAQ41v5wI/AAAAAAAAaPE/6vyNhAuraVc/s1600/20130810_222546.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-V_51yqki_B4/UgcAQ41v5wI/AAAAAAAAaPE/6vyNhAuraVc/s1600/20130810_222546.jpg" height="300" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Arduino Uno Talking to Raspi via Serial</td></tr>
</tbody></table>
I'm going to do a quick post on another project I'm working on. This is not complete yet, but I'll share my progress to date.<br />
<br />
<b>Here's the concept:</b><br />
I'm building a wind chime that does not actually chime, well, acoustically that is. Instead, it will allow me to play any sound for a chime instead of a metal or wood clunking sound. I will capture the "striking" of a "chime" (yes lots of quotes) using analog sensors on the Arduino, and then communicate a command to the Pi via a serial line. I am using the Arduino for it's analog pins and its ability to sample incredibly fast. I'm using the Pi to play sounds simultaneously (Nope, there is no simultaneous audio shield for the Arduino). Pi audio is a longer subject worth of its own post. But the audio you hear in the video below will not be the finished product.<br />
<br />
<a name='more'></a><br /><br />
<b>Magnetic pendulum</b><br />
To capture the virtual strike, my plan is to put neodymium magnets around the pendulum hammer and detect when it comes close to one of the chime tubes. The chime tubes will likely be small copper tubes that don't resonate so there will not actually be a sound when the hammer strikes them. I have a steampunk/birdcage style wind chime design. Pictures will post when I have something finished.<br />
<br />
<b>Hall Effect chimes</b><br />
In order to detect the strike, I will be using Hall Effect sensors to determine when the magnetic field comes near and exceeds a threshold. Hall Effect sensors are incredibly easy to work with, especially with an Arduino. If you look at the image above, I have five of the sensors wired to five analog pins and my Arduino is simply looping and sampling the value all the time.<br />
<br />
<b>What's a Strike?</b><br />
How do I tell when a chime has been struck? Well, the Arduino has a setting (in the code) for a threshold. Should the value go above that threshold, then the chime is considered struck.<br />
<br />
<b>How Hard?</b><br />
I also want to know how hard the pendulum struck, so I am keeping a simple memory buffer for each sensor in the memory of the Arduino and pushing the latest value on the top of that buffer. When I detect a strike, I read a certain number of samples back in time and determine the difference in magnetic field values. The greater the difference, the faster the magnet was approaching the chime and the higher the strike strength value is.<br />
<br />
<b>What to do with the value?</b><br />
After the Arduino has determined which sensor and hence chime is struck and how hard, it sends a simple Chime:Value pair across a serial link to the PI. The Pi is listening for this on its serial port and will do the "sound output" part of the job which I will explain in a moment.<br />
<br />
<b>3.3V to 5V</b><br />
Don't just hook up your Arduino to you PI. It will break something. The Arduino is 5V, the Pi is 3.3V. This goes for the serial pins as well as GPIO. Fortunately, <a class="g-profile" href="https://plus.google.com/112526208786662512291" target="_blank">+Adafruit Industries</a> has a quick and inexpensive fix called a "logic level converter".<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.adafruit.com/images/large/ID757_LRG.jpg" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="http://www.adafruit.com/images/large/ID757_LRG.jpg" height="153" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Logic Level Converter</td></tr>
</tbody></table>
<br />
<a href="http://www.adafruit.com/products/757" target="_blank">This board </a>will convert bi-directional high speed serial and i2c communications between high and low voltage sides. This is perfect for bridging serial lines between Pi and Arduino. (I could have just used one channel TX from the Arduino, but I hooked up both TX and RX to be thorough or superstitious). The picture at the top of this post shows the boards communicating through two of the four possible channels available in this inexpensive solution.<br />
<br />
<b><br /></b>
<b>Chiming on the PI</b><br />
<br />
The Pi is listening to the serial port via a simple perl script (if you haven't figured out that is my go to language). When it receives a Chime:Value pair on the bus, it spins off a thread to play a Chime file (.wav) at Value volume. And get this, because real wind chimes bounce around the harder the wind blows, I added a function to do a random roll and see if another chime was struck, the probability based on the strength of the first strike (then call recursively). A really hard strike will results in 3-7 different chimes all sounding in reducing strengths. The video below shows how the Arduino/Pi wind chime proof of concept sounds as I wave the magnet near the hall effect sensors on the breadboard.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dz_tmFRU-KnilAjipqlows5WQ31EQJWTCoiNXgCm1UXBgvSvjKxrdvZb2UC2HonD10ToIVmYt9SBahhniVFYA' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div>
<br />
The sounds I used came from <a href="http://freesound.org/">freesound.org</a>, the bamboo <a href="http://www.freesound.org/people/stomachache/packs/8170/" target="_blank">marimba series</a>.<br />
<br />
<b>Next steps:</b><br />
<br />
<ul>
<li>Finish working out the Pi audio issues. I am going to try the JACK system again for better simultaneous sound and responsiveness. <a href="http://wiki.linuxaudio.org/wiki/raspberrypi" target="_blank">This is a good link</a> to start with here.</li>
<li>Build audio amplifier board (<a href="http://www.amazon.com/Velleman-Mono-Audio-Amplifier-Kit/dp/B0002Z82YY/" target="_blank">Velleman 7W Mono Audio Amplifier Kit</a>)</li>
<li>Design and build way cool wind chime form factor</li>
</ul>
<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="http://upload.wikimedia.org/wikipedia/commons/thumb/9/95/Sciurus-vulgaris_hernandeangelis_stockholm_2008-06-04.jpg/800px-Sciurus-vulgaris_hernandeangelis_stockholm_2008-06-04.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="http://upload.wikimedia.org/wikipedia/commons/thumb/9/95/Sciurus-vulgaris_hernandeangelis_stockholm_2008-06-04.jpg/800px-Sciurus-vulgaris_hernandeangelis_stockholm_2008-06-04.jpg" height="133" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Look at me! I'm a squirrel!</td></tr>
</tbody></table>
I'll post more on this project as it develops. Back to our regularly scheduled posts on FrankenStein unless I get distracted by another project. Look! Squirrel!<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />Ben Millerhttp://www.blogger.com/profile/17985234897549353876noreply@blogger.com0tag:blogger.com,1999:blog-3853139185462014395.post-52697151096160152962013-08-17T22:35:00.000-04:002013-09-28T12:13:05.439-04:00FrankensteinNext Project!<br />
<a href="http://upload.wikimedia.org/wikipedia/commons/9/9a/Faience_beer_stein_with_ball_scene_on_brown_background_07.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="http://upload.wikimedia.org/wikipedia/commons/9/9a/Faience_beer_stein_with_ball_scene_on_brown_background_07.jpg" height="320" width="213" /></a><br />
We brainstormed a lot about what to do next. There was even a brief deep dive into possibly building a self contained tomato growing cabinet for my basement, but alas the investments in this project just outweighed a hobby budget. After a long hot weekend over the 4th of July, we finally landed on a beer cozy that keeps your beer cold. A Franken-Stein!<br />
<br />
These posts will be a little different than the post project Frankenfeeder as I will try to keep up with this as we go. So far our concept is this:<br />
<br />
<ul>
<li>Use a <a href="http://en.wikipedia.org/wiki/Thermoelectric_effect" target="_blank">peltier plate</a> (a solid state component that moves heat from one side to the other when passing current) to cool the beer can in a beer cozy.</li>
<li>Use a heavy duty 12/18V battery from an old drill set to provide the heavier amperage and voltages needed to run a peltier plate</li>
<li>Drink very cold beer on hot days</li>
</ul>
<div>
<br />
<a name='more'></a>Well it seems obvious that we'll need a few things to get started. Here's where we are at so far:</div>
<div>
<ul>
<li>1 - Peltier Plate. Trying to keep this limited to 3Amps so that we can have 30 minutes of run time off of a drill battery with rought 1.5 Amp Hours of capacity. We will likely run this at a partial duty cycle with a thermostat for feedback so we might get a whole hour out of a charge.</li>
<li>1 - Power Regulator. It appears that the power needs of 8.6V and 3Amps push us into a more sophisticated power regulator than just a singe IC. I was pointed to this dandy thing which might do the trick: <a href="http://www.robotshop.com/dc-dc-power-converter-25w.html">http://www.robotshop.com/dc-dc-power-converter-25w.html</a> I think we will want to use the thermostat feedback to PWM control the power going into the plate. From what I've read, reducing the voltage or current is not the way to turn a TEC plate down. One is supposed to use a PWM turning off/on the optimal voltage/current. This is kind of like dimming an LED.</li>
<li>1 - Arduino. Something needs to be the brains for reading the thermostat and adjusting it. But you say, an arduino is huge, that's going to be one huge beer cozy. But wait!! I backed the <a href="http://www.kickstarter.com/projects/kenburns/tinyduino-the-tiny-arduino-compatible-platform-w-s" target="_blank">tinyduino kickstarter campaign</a> and have a couple dime sized arduinos sitting around looking for a project. Yay me. Yay tinyduino.</li>
<li>1 - Thermister for measuring the temp</li>
<li>Thin copper sheet/foil to bend into a liner for the cozy</li>
<li>Thermal paste to attach the peltier plate</li>
<li>Small heat sink to discharge the heat drawn from the beer</li>
<li>Handle and Cozy to put it all into</li>
</ul>
<div>
I'm sure there's a bunch I've missed, but for now we are going about assembling our initial supplies to perform some baseline experiments. We might even have to drink some cold beer.</div>
</div>
<div>
<br /></div>
<div>
That's the first installment of this project. Much more to come in subsequent posts. I hope.</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
Ben Millerhttp://www.blogger.com/profile/17985234897549353876noreply@blogger.com0tag:blogger.com,1999:blog-3853139185462014395.post-33889968161215795312013-08-17T21:09:00.000-04:002014-06-25T17:25:26.936-04:00Frankenfeeder Part III<h2>
Pi stuff and Reassembly</h2>
This is Part III, <a href="http://locgt.blogspot.com/2013/08/frankenfeeder-part-ii.html">Part II is here</a>.<br />
<br />
The Pi and what you can do with it is a deeeeep subject. I'll just stick to the highlights. Turning on/off GPIO pins, high level Wifi and sundry, and the script.<br />
<h3>
GPIO Control</h3>
<a href="https://projects.drogon.net/raspberry-pi/wiringpi/" target="_blank">Wiring Pi</a> by Gordon @drogon, is an excellent project for low level Pi IO control. Actually his whole site is just pure awesomeness if you have the time to read. Anyway, I followed the instructions on downloading and installing Wiring Pi on my Pi. I've heard rumors this is included in the base distro now, but you might want to check your version of the distro to be sure.<br />
With the wiring pi package there is a binary, the gpio util, that allows you to issue command line commands to see the state of the pins and turn them high/low.<br />
<br />
<a name='more'></a><br />
<br />
We're using Pins number 17 and number 22 for our project. The commands to set these into output mode are:<br />
<blockquote class="tr_bq">
<pre>/usr/local/bin/gpio -g mode 17 out
/usr/local/bin/gpio -g mode 22 out
</pre>
</blockquote>
Then to turn them high:<br />
<blockquote class="tr_bq">
<pre>/usr/local/bin/gpio -g write 17 1
/usr/local/bin/gpio -g write 22 1
</pre>
</blockquote>
And low:<br />
<blockquote class="tr_bq">
<pre>/usr/local/bin/gpio -g write 17 0
/usr/local/bin/gpio -g write 22 0
</pre>
</blockquote>
So with that setup, on to ...<br />
<h3>
Wifi</h3>
<div>
<a href="http://ecx.images-amazon.com/images/I/71L6qFnTBQL._SL1500_.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="http://ecx.images-amazon.com/images/I/71L6qFnTBQL._SL1500_.jpg" height="200" width="200" /></a>The hardware part of this is pretty simple. Just pop this little baby in one of the available USB slots and poof. Wifi. </div>
<div>
<br /></div>
<div>
Now, you will need to mess around with the network settings. I won't bore you with details but there are LOTS of articles on configuring wifi with debian for headless, roaming, whatever suits your needs and security. I'm not going to try to replicate them here. But I will say that we chose to go with a static IP address and leave SSH server turned on so we could push code updates and troubleshoot as needed.</div>
<h3>
Log space</h3>
<div>
Another note about configuring the Pi. I had an SD card go bad on me because of all the logging going on from my script. My fault, and cheap SD card. So I chose to put /var/log on tmpfs. <a href="https://wiki.archlinux.org/index.php/Fstab#tmpfs" target="_blank">Here's a little info </a>on doing that if you want to. It means that you lose your logs if the thing reboots, but it means you are not writing a hole into your SD card. Logs write into RAM instead of the SD card.</div>
<h3>
Webcam and Script</h3>
I had a very cheap USB webcam laying about that I threw at this project (Kodak S101). The Pi recognized it by default. But in order to use "streamer" with it to grab pictures from the camera at the command line, I had to fix this kernel parameter in the /etc/sysctl.conf vm.overcommit_memory=1<br />
<br />
Now I can grab pictures from the camera with: streamer -o filename.jpg<br />
<br />
So all the parts are here, GPIO, Wifi, Webcam, oh, and of course perl. The next step was to create a perl script that used all these bits. In the script, we are checking a gmail account to look for a message and trigger the feeder. The details of the script are a whole other subject, but suffice it to say that if folks are interested I'll go through the effort to post my script on github and link it. <b>Update: </b>The script can be found here on github: <a href="https://github.com/locgt/frankenfeeder">https://github.com/locgt/frankenfeeder</a><br />
<br />
Below are some pictures as we reassembled the dog feeder with notes:<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-oHazEeLFRKY/UUm7P9uPC3I/AAAAAAAASrQ/Jx_bCEM1dqU/s1600/20130305_192915.jpg" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="http://4.bp.blogspot.com/-oHazEeLFRKY/UUm7P9uPC3I/AAAAAAAASrQ/Jx_bCEM1dqU/s1600/20130305_192915.jpg" height="640" width="480" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Two of the relay boards glued back to back</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-HcOTY8SJQFo/UUm7P-CwMWI/AAAAAAAASrQ/dA3y7XPw92g/s1600/20130305_200106.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://4.bp.blogspot.com/-HcOTY8SJQFo/UUm7P-CwMWI/AAAAAAAASrQ/dA3y7XPw92g/s1600/20130305_200106.jpg" height="480" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The relay boards in the feeder shell. Lots of hot glue.</td></tr>
</tbody></table>
<br />
The Pi itself we originally hot glued to a foam backing and then to the inner side opposite the feeder PCB. You can see it in the picture above and below. Later when we had to do some fixing up and needed to get access to a video out etc, we removed the glue and foam and replaced it with double-sided Velcro.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-3vRtpiITkS4/UUm7P0sPpSI/AAAAAAAASrQ/C_vclHz6Z28/s1600/20130305_201703.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-3vRtpiITkS4/UUm7P0sPpSI/AAAAAAAASrQ/C_vclHz6Z28/s1600/20130305_201703.jpg" height="480" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Here it is. All wired up.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-0jxlvgQyEbE/UUm7P1p-JlI/AAAAAAAASrQ/OuErUY8NfKs/s1600/20130319_200614.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://3.bp.blogspot.com/-0jxlvgQyEbE/UUm7P1p-JlI/AAAAAAAASrQ/OuErUY8NfKs/s1600/20130319_200614.jpg" height="400" width="300" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">All buttoned up.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-U30r-aAD0ak/UYmnGABfduI/AAAAAAAAVb8/0PBHPgM0a-w/s1600/20130507_201336.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://4.bp.blogspot.com/-U30r-aAD0ak/UYmnGABfduI/AAAAAAAAVb8/0PBHPgM0a-w/s1600/20130507_201336.jpg" height="480" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><div style="text-align: start;">
<span style="font-family: inherit; font-size: x-small;">Because there are two schnauzers to be fed a system to divide up the food was devised. My Dad's a better mechanical engineer than I. This is his handiwork</span></div>
</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-6AsSZP6BWiQ/UYmnGKxoNSI/AAAAAAAAVb8/h-sAwNS8LVY/s1600/20130507_201753.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-6AsSZP6BWiQ/UYmnGKxoNSI/AAAAAAAAVb8/h-sAwNS8LVY/s1600/20130507_201753.jpg" height="480" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">It works! Dog tested and approved. The webcam to the right in the picture sends the picture back.</td></tr>
</tbody></table>
This is now fired up and running and feeding the dogs quite well. We had some tweaks to add to the feeding cycle to deliver enough food. You can see from the picture that the dogs are quite well fed.<br />
<br />
Finally, the proof is in the pudding. Here's a picture from the feeder after a successful feeding.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmjYVYU8FBZBcCcU9ymxjtBmKG0FeRFxdSXL629kOAeHtGfJvTQXEo9N1JHHuoArg0LSS32TzpoEjQcF7XYWDPgBJHh4bzGZu6W8iBjlucuHzTU9V5E8Q4_PClwNKeqf5ijy5XuYYhQnSX/s1600/dogpic.jpeg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmjYVYU8FBZBcCcU9ymxjtBmKG0FeRFxdSXL629kOAeHtGfJvTQXEo9N1JHHuoArg0LSS32TzpoEjQcF7XYWDPgBJHh4bzGZu6W8iBjlucuHzTU9V5E8Q4_PClwNKeqf5ijy5XuYYhQnSX/s1600/dogpic.jpeg" height="300" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Nom nom nom nom</td></tr>
</tbody></table>
<br />
<h3>
Final thoughts</h3>
<div>
The lessons we learned during this we too numerous to write up here which was the point in doing it. We had a blast and learned a lot. The dogs liked our mistakes a lot as well. NOM NOM. We had some false starts, blunders, and in the end a great lesson in hardware hacking with the Raspberry Pi.<br />
<br /></div>
<br />
<br />Ben Millerhttp://www.blogger.com/profile/17985234897549353876noreply@blogger.com8tag:blogger.com,1999:blog-3853139185462014395.post-11473497360220010502013-08-17T13:54:00.005-04:002013-09-28T12:14:15.740-04:00Frankenfeeder Part II<h2>
Pi Controlled</h2>
<div>
This is Part II of the frankenfeeder project. <a href="http://locgt.blogspot.com/2013/08/frankenfeeder-part-i.html">Part I is here.</a></div>
<div>
<br /></div>
<div>
<a href="http://www.circuitstoday.com/wp-content/uploads/2010/02/Energized-Relay-ON.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img alt="Energized Relay (ON)" border="0" src="http://www.circuitstoday.com/wp-content/uploads/2010/02/Energized-Relay-ON.jpg" height="200" width="151" /></a>So how to close a circuit with a Pi. Simple, use a relay. A relay's job is to close (or open) a circuit when current is applied to it. (a <a href="http://www.circuitstoday.com/working-of-relays" target="_blank">nice illustration is here</a> where I borrowed the image) So just pop a relay onto a PI GPIO pin and off we go right? Nope. <br />
<br />
<a name='more'></a><br /></div>
<div>
A couple things to consider first when switching a relay:</div>
<div>
<ul>
<li>A relay has to have enough current (Amps) to create an electromagnet that pulls a tiny switch closed. Pi pins just don't have enough umph. They have very little current.</li>
<li>When an electromagnetic field collapses (when you turn off the current to it) it will send a spike into the system which can damage your PI. Ouch.</li>
</ul>
<div>
I happened to have a bunch of Aleph simple switch relays laying around from another project that failed or at least stalled indefinitely (I might write that up later). <br />
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxQRDxMUEhQWFRUXFR4VGBMWFxQYHRkYIBoiFhYYFB8gHCghGxsxHhwWITElJSkrLi8uFyAzOD8sNygtLiwBCgoKDg0NGhAQGjAcHiQ3KywrLCwsLCwsKyssLCwsLCssLCwsLCwsLDcsKywsLDcrKywsKysrKzcrKzcsKysrK//AABEIAHgAeAMBIgACEQEDEQH/xAAcAAEAAQUBAQAAAAAAAAAAAAAABwIDBAUGAQj/xAA7EAACAQICBggEAwcFAAAAAAABAgADEQQhBQYSMUFhByIyUXGRscETcoGhM9HwFEJSgrLC4RUjQ1OS/8QAFgEBAQEAAAAAAAAAAAAAAAAAAAEC/8QAHREBAQACAwADAAAAAAAAAAAAAAEREgIhURMiMf/aAAwDAQACEQMRAD8Am+IiAiIgIiICIiAiIgIiICIiAiIgIiUVqqopZiFVRcscgAMyTAric9h9d8C+7EKPmuPUTZ4fTFCp2K1NvB1/ODDOieKb7s57AREQEREBERAREQEREBOM6UcYRhUoKbGs2fyJ1m+5QfWdnIx6RsTtY5FB/DoDK/F2JP2RZYI9q6JN5RS0LUdgqAkncBOhBzmx0Zj1o7R2NpiLA3tYd279WlnHtrfpyn7LiqDAXqI3AAkeVjMuhrPpClur1PBjf1nWnHUmq0WO0NhSDcE58M+Od84FCm+J22dGBufDKwDX/WUt4eJ8nrS4fpIxydoo/wAyj2m0wvSxWGT0KZ5hmX85l1NDU6lZV+GtrM3VUC/AC6k3HlMXEatUGts2UlwAA4a63zJ7sr+UmlXbi2mG6WaJ/EoOvysreoE22G6SMC+92T5lPtecZidSl65DEKq3BIGfEjI5cPOaqrqmb2BF8757rbwZLLF+tS7htbMHU7OIp/U29Zs6GMpv2HRvlZT7yA62rNQXNjYG1+e6YraHqqeI+0zldH0bE+eKOMxlHsVaq+DN+c3WhdbdINWp0/jE7TAdYA5ceHdGUvCptiY2jMQalFGO8jPztPJWGVIM6V3vpR+VNB9r+8nOQV0kU2OlK+R/dt4bIzlixyi4hhuZh9TL6aUqjc1/EAyzVpbJINr8jf6eMtETQ6PR+nD8MK7JYuLjNTmwDbQ3EbOYPCZf+vXqU1emoZ6liEZTZCwC3tlfNvoJyJE8tNbJq7bRulUq7bAOljZQBe5zIFwe4b+Y75mYLTFHZDrVCmxcXBGQyJPdxkeq5BXPsnaHI5ZjyHlLgxDBSuVjfO2YBzYA8Ae6XMTVKxxRsV2lY1DfKxJ3f4GUurUfaIIu26wHO/C2d7SKlxgDKRTUbO0bC4BZl2S3IZDIWmThNMtTqmojOvU3Bjk4WykZ7rgHOOqmKko1BuZeNzna2d+rllL61ENyd9gOHWFiLHuzN+Mj6hrDVOJZhWsgYEBwLFRYWuRe9vOWqet9cDrBG47iPQyVZK7hsGh5ZSxTwipi0t+7SZyRzIVf7pz2H13/AOyj/wCX9ivvN5q7jxjKtWoAVBFOkAczxJ3eI8pmyNS1KWjaezQpr3IPSJk2iYQnFa56t18TiENJUKMoV2LFCADwIz7+E7WIXKK9L6kVxRw64dKT1aYdar2VQ63HwwQe0R1sznOZxmr+Mp/iYC/NAT/TJ1w1PZB7yby7LkfOuF0U1d2RMO6MqGo225UBF7R6ynOa5VoMARWK3/iT3B9p9KYlNohSLgggg9xyt5XmBi9WcJV7eGpHnsKPSXYfPw0btdirSb+a3qIbQ9b+C/ykH3kyY3ow0fU3UmQ96Ow+xuJpcR0P0/8AhxdanyZVb0Ky5giyphnXtIw8VI9pakkVujLH0/wsYj8jtp+YlnDajYwmp+122Vps6Gn8Ni9QdlMxx9o6VHwEWm6r6PxFIf7+AqDvKq4HPMZTAbEYcm2y6NuAZhb+YkZCUYdpInRVTubW31gfJbzR6f1Sq4YU2ZqTpU3NT2gEubL8S+8E5BhxG7Odp0T4AptlrZXOXOw+szfwSTERMsk8YXnsQAERECm3W5SqIgIiICWqguw8/SXZTs9a/K0CqY+MwFKsCKtNHByIZVPrMiePuNt9oHL6T1Mw+Jp08ij0qXw6L79he4qTZhuuDNlq5oMYSna4ZyAGcLsggElQFGSjrNu75taQsB4SqXIRESBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERA/9k=" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxQRDxMUEhQWFRUXFR4VGBMWFxQYHRkYIBoiFhYYFB8gHCghGxsxHhwWITElJSkrLi8uFyAzOD8sNygtLiwBCgoKDg0NGhAQGjAcHiQ3KywrLCwsLCwsKyssLCwsLCssLCwsLCwsLDcsKywsLDcrKywsKysrKzcrKzcsKysrK//AABEIAHgAeAMBIgACEQEDEQH/xAAcAAEAAQUBAQAAAAAAAAAAAAAABwIDBAUGAQj/xAA7EAACAQICBggEAwcFAAAAAAABAgADEQQhBQYSMUFhByIyUXGRscETcoGhM9HwFEJSgrLC4RUjQ1OS/8QAFgEBAQEAAAAAAAAAAAAAAAAAAAEC/8QAHREBAQACAwADAAAAAAAAAAAAAAEREgIhURMiMf/aAAwDAQACEQMRAD8Am+IiAiIgIiICIiAiIgIiICIiAiIgIiUVqqopZiFVRcscgAMyTAric9h9d8C+7EKPmuPUTZ4fTFCp2K1NvB1/ODDOieKb7s57AREQEREBERAREQEREBOM6UcYRhUoKbGs2fyJ1m+5QfWdnIx6RsTtY5FB/DoDK/F2JP2RZYI9q6JN5RS0LUdgqAkncBOhBzmx0Zj1o7R2NpiLA3tYd279WlnHtrfpyn7LiqDAXqI3AAkeVjMuhrPpClur1PBjf1nWnHUmq0WO0NhSDcE58M+Od84FCm+J22dGBufDKwDX/WUt4eJ8nrS4fpIxydoo/wAyj2m0wvSxWGT0KZ5hmX85l1NDU6lZV+GtrM3VUC/AC6k3HlMXEatUGts2UlwAA4a63zJ7sr+UmlXbi2mG6WaJ/EoOvysreoE22G6SMC+92T5lPtecZidSl65DEKq3BIGfEjI5cPOaqrqmb2BF8757rbwZLLF+tS7htbMHU7OIp/U29Zs6GMpv2HRvlZT7yA62rNQXNjYG1+e6YraHqqeI+0zldH0bE+eKOMxlHsVaq+DN+c3WhdbdINWp0/jE7TAdYA5ceHdGUvCptiY2jMQalFGO8jPztPJWGVIM6V3vpR+VNB9r+8nOQV0kU2OlK+R/dt4bIzlixyi4hhuZh9TL6aUqjc1/EAyzVpbJINr8jf6eMtETQ6PR+nD8MK7JYuLjNTmwDbQ3EbOYPCZf+vXqU1emoZ6liEZTZCwC3tlfNvoJyJE8tNbJq7bRulUq7bAOljZQBe5zIFwe4b+Y75mYLTFHZDrVCmxcXBGQyJPdxkeq5BXPsnaHI5ZjyHlLgxDBSuVjfO2YBzYA8Ae6XMTVKxxRsV2lY1DfKxJ3f4GUurUfaIIu26wHO/C2d7SKlxgDKRTUbO0bC4BZl2S3IZDIWmThNMtTqmojOvU3Bjk4WykZ7rgHOOqmKko1BuZeNzna2d+rllL61ENyd9gOHWFiLHuzN+Mj6hrDVOJZhWsgYEBwLFRYWuRe9vOWqet9cDrBG47iPQyVZK7hsGh5ZSxTwipi0t+7SZyRzIVf7pz2H13/AOyj/wCX9ivvN5q7jxjKtWoAVBFOkAczxJ3eI8pmyNS1KWjaezQpr3IPSJk2iYQnFa56t18TiENJUKMoV2LFCADwIz7+E7WIXKK9L6kVxRw64dKT1aYdar2VQ63HwwQe0R1sznOZxmr+Mp/iYC/NAT/TJ1w1PZB7yby7LkfOuF0U1d2RMO6MqGo225UBF7R6ynOa5VoMARWK3/iT3B9p9KYlNohSLgggg9xyt5XmBi9WcJV7eGpHnsKPSXYfPw0btdirSb+a3qIbQ9b+C/ykH3kyY3ow0fU3UmQ96Ow+xuJpcR0P0/8AhxdanyZVb0Ky5giyphnXtIw8VI9pakkVujLH0/wsYj8jtp+YlnDajYwmp+122Vps6Gn8Ni9QdlMxx9o6VHwEWm6r6PxFIf7+AqDvKq4HPMZTAbEYcm2y6NuAZhb+YkZCUYdpInRVTubW31gfJbzR6f1Sq4YU2ZqTpU3NT2gEubL8S+8E5BhxG7Odp0T4AptlrZXOXOw+szfwSTERMsk8YXnsQAERECm3W5SqIgIiICWqguw8/SXZTs9a/K0CqY+MwFKsCKtNHByIZVPrMiePuNt9oHL6T1Mw+Jp08ij0qXw6L79he4qTZhuuDNlq5oMYSna4ZyAGcLsggElQFGSjrNu75taQsB4SqXIRESBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERA/9k=" /></a></div>
<div>
These will work fine with the voltage and current from the 5V pin of the Pi, but not the 3V pin. So I needed a way to use the 3V pin of the Pi to switch the 5V pin from the Pi's power input. Again a little research payed off. I found this excellent article by Kevin Sangeelee on using transistors to do exactly that: <a href="http://www.susa.net/wordpress/2012/06/raspberry-pi-relay-using-gpio/">http://www.susa.net/wordpress/2012/06/raspberry-pi-relay-using-gpio/</a>. He even has a nice schematic. <br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://www.susa.net/wordpress/wp-content/uploads/2012/06/Relay-Sample.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.susa.net/wordpress/wp-content/uploads/2012/06/Relay-Sample.png" height="246" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Circuit to control a relay with a Pi GPIO pin</td></tr>
</tbody></table>
<h2>
Build the new circuit:</h2>
</div>
</div>
<div>
We needed more parts to build this circuit. As a matter of fact we needed two sets because we had to simulate pushing the two buttons at once. Here's the parts list:</div>
<div>
<ul>
<li>2 - <span style="background-color: white;"><span style="color: #373737; font-family: Helvetica Neue, Helvetica, Arial, sans-serif;"><span style="font-size: 15px; line-height: 24px;"> 2N3904 Resistors (Be careful to get the right resistors (normally off) and to make sure the polarity is correct. You can put them in backwards (like I did) and if you accidentally overdrive them (like I did) they will work, but they will require a lot more amps. Properly activated they should draw only 2mA (well within the PI's GPIO pin). So read the docs carefully (like I didn't).</span></span></span></li>
<li><span style="background-color: white;"><span style="color: #373737; font-family: Helvetica Neue, Helvetica, Arial, sans-serif;"><span style="font-size: 15px; line-height: 24px;">2 - 1.2K Ohm resistors (I LOVE this handy <a href="http://www.bpesolutions.com/atechnical/ResistorQV.pdf" target="_blank">guide</a>)</span></span></span></li>
<li><span style="background-color: white;"><span style="color: #373737; font-family: Helvetica Neue, Helvetica, Arial, sans-serif;"><span style="font-size: 15px; line-height: 24px;">2 - Aleph SD1A05AWJ relays (Digikey maybe, I forget)</span></span></span></li>
<li><span style="background-color: white;"><span style="color: #373737; font-family: Helvetica Neue, Helvetica, Arial, sans-serif;"><span style="font-size: 15px; line-height: 24px;">2 - </span></span></span><span style="color: #373737; font-family: Helvetica Neue, Helvetica, Arial, sans-serif;"><span style="font-size: 15px; line-height: 24px;">1N4148 diodes (from <a href="http://www.sparkfun.com/" target="_blank">sparkfun</a>)</span></span></li>
<li><span style="color: #373737; font-family: Helvetica Neue, Helvetica, Arial, sans-serif;"><span style="font-size: 15px; line-height: 24px;">2 - <a href="https://www.sparkfun.com/products/8808" target="_blank">Proto boards</a> from sparkfun</span></span></li>
</ul>
<div>
<span style="color: #373737; font-family: Helvetica Neue, Helvetica, Arial, sans-serif;"><span style="font-size: 15px; line-height: 24px;">We used google docs to draw up how to solder the parts on the proto board. The holes in the proto board are traced together in certain sections to make working with it easier. Here's the schematic we came up with and the finished board (one of them):</span></span></div>
</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOhe8BnTdptgjpgeCmcclSwuENpgjO1zu2BGx1rLyfxKKEisqEjwMR2Xm44HyZz37f2gWb81pAzbh_HkMqyNmz2uA2iKofA0dEzY4Y06RBaXuQkAiJWoDW6xriiWqFSOrG9pw4lh-gSsl4/s1600/relayboardschematic-physical.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOhe8BnTdptgjpgeCmcclSwuENpgjO1zu2BGx1rLyfxKKEisqEjwMR2Xm44HyZz37f2gWb81pAzbh_HkMqyNmz2uA2iKofA0dEzY4Y06RBaXuQkAiJWoDW6xriiWqFSOrG9pw4lh-gSsl4/s1600/relayboardschematic-physical.png" height="233" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Relay Schematic</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-F9o0MwMIV7w/UUm7P4KAH9I/AAAAAAAASrQ/wsSIEUrVhfs/s1600/20130129_195551.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img alt="" border="0" src="http://3.bp.blogspot.com/-F9o0MwMIV7w/UUm7P4KAH9I/AAAAAAAASrQ/wsSIEUrVhfs/s1600/20130129_195551.jpg" height="240" title="Finished version" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Finished Version</td></tr>
</tbody></table>
<div>
<span style="color: #373737; font-family: Helvetica Neue, Helvetica, Arial, sans-serif;"><span style="font-size: 15px; line-height: 24px;">Now we had all the parts laid out to plug it all together. We did a bunch of prototyping and wiring the components up with alligator clips, jumper wires, and bubble gum. <a href="http://elinux.org/RPi_Low-level_peripherals#General_Purpose_Input.2FOutput_.28GPIO.29" target="_blank">This site</a> talks about the pins and their functions so we were able to wire up the 5V, ground, and two separate GPIO pins.</span></span></div>
<div>
<span style="color: #373737; font-family: Helvetica Neue, Helvetica, Arial, sans-serif;"><span style="font-size: 15px; line-height: 24px;"><br /></span></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-3kurqh9D5yI/UUm7P0LpCHI/AAAAAAAASrQ/_NIiCk3jrTE/s1600/20130305_183606.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-3kurqh9D5yI/UUm7P0LpCHI/AAAAAAAASrQ/_NIiCk3jrTE/s1600/20130305_183606.jpg" height="240" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-R7FXYhhhpog/UUm7PzAyGXI/AAAAAAAASrQ/XU9DrYsHSbU/s1600/20130305_183616.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-R7FXYhhhpog/UUm7PzAyGXI/AAAAAAAASrQ/XU9DrYsHSbU/s1600/20130305_183616.jpg" height="240" width="320" /></a></div>
<div>
<br /></div>
<div>
<div>
<span style="color: #373737; font-family: Helvetica Neue, Helvetica, Arial, sans-serif;"><span style="font-size: 15px; line-height: 24px;">The long and short of it was that when we tripped the GPIO pins (how is in part III) Frankenfeeder came to life and rumbled around on the desk!!!! We had it prototyped. There was great rejoicing and much mad scientist cackling that was heard throughout the house.</span></span></div>
</div>
<div>
<span style="color: #373737; font-family: Helvetica Neue, Helvetica, Arial, sans-serif;"><span style="font-size: 15px; line-height: 24px;"><br /></span></span></div>
<div>
<span style="color: #373737; font-family: Helvetica Neue, Helvetica, Arial, sans-serif;"><span style="font-size: 15px; line-height: 24px;">The bits about putting it back together and <b>how we controlled the pins etc are in<a href="http://locgt.blogspot.com/2013/08/frankenfeeder-part-iii.html"> Part III</a>.</b></span></span></div>
<div>
<br /></div>
<div>
<br /></div>
Ben Millerhttp://www.blogger.com/profile/17985234897549353876noreply@blogger.com9tag:blogger.com,1999:blog-3853139185462014395.post-25030382733821404162013-08-17T13:03:00.002-04:002013-11-26T09:04:25.609-05:00Frankenfeeder - Part I<h2>
Kick off:</h2>
A while back my folks moved to town in their retirement to be close to their mess of kids and grandkids. It's been great having them closer and in our daily life. My dad and I decided to spend a little time each week just geeking out with something completely unrelated to our jobs (he failed to retire properly) to rest our minds from the daily patterns. He is a pseudo-retired pastor and I do Cloud Computing. But we both enjoyed and wanted to learn more about hobby electronics or just making stuff.<br />
<br />
<a href="http://ecx.images-amazon.com/images/I/71mtY2q2csL._SL1500_.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="http://ecx.images-amazon.com/images/I/71mtY2q2csL._SL1500_.jpg" height="302" width="320" /></a>For our first project we decided to create something that would allowed my dad to feed his dogs remotely if he and my mom were out gallivanting (technical term) about. Don't worry, the dog door allows for the post-processing to occur safely.<br />
<br />
We did some research and found this cool project by Amanda Ghassaei:<br />
<a href="http://www.instructables.com/id/Twitter-Controlled-Pet-Feeder/">http://www.instructables.com/id/Twitter-Controlled-Pet-Feeder/</a><br />
<br />
<a name='more'></a><br />
<br />
She had done a lot of the research already like finding a powered dog feeder and determining how to hack it to work on demand. Apparently, if you push the Volume and Set buttons at the same time it triggers the feed cycle. She shows how to connect to the board and use an arduino to logically push these buttons. We loved it, but wanted to add a few features:<br />
<ul>
<li>Wireless - put where the dogs eat, not where there's Ethernet</li>
<li>Not twitter (giving my dad twitter would be like a giving a rubber boots to a fish)</li>
<li>Feedback! Did it work and are the dogs happy?</li>
<li>Inexpensive (cheap!)</li>
<li>Ability to keep the manual functionality of the buttons</li>
</ul>
<div>
After discussing the arduino + wifi cost we decided that a Raspberry Pi + usb wifi would be much less expensive and possibly more flexible.</div>
<div>
<br /></div>
<div>
So the project parts list started like this:</div>
<div>
<ul>
<li>1 - Rapsberry Pi (Get from your favorite reseller) aprox $35+shipping (a model A for $25 would work for this, but they weren't out when we did this)</li>
<li>1 - Automatic <a href="http://www.amazon.com/Automatic-Electronic-Programmable-Portion-Control/dp/B004SBSNB0/" target="_blank">dog feeder</a></li>
<li>1 - <a href="http://www.amazon.com/gp/product/B005CLMJLU" target="_blank">USB Wifi dongle</a>, Pi compatible</li>
<li>1 - USB Kodak S101 webcam (ancient, but pi compatible) I had laying around.</li>
</ul>
<h2>
Getting Hacking:</h2>
<div>
We knew our first task was to disassemble the dog feeder and attached wires to the Volume and Set buttons on the PCB that controlled the feeder's manual feed function. Amanda's article had excellent pictures and instructions on how to disassemble the feeder and locate these buttons. But we didn't want to drill into the board as she described and possible eliminate the manual use of the buttons. So we followed the traces on the board to find spots where we could solder wires for each button and ground.</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-9euFryJRQuc/UUm7PyksuYI/AAAAAAAASrQ/X0b9NGYhvAo/s1600/20130129_195229.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-9euFryJRQuc/UUm7PyksuYI/AAAAAAAASrQ/X0b9NGYhvAo/s1600/20130129_195229.jpg" height="240" width="320" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<b>The first attempt failed miserably!</b> The wire we used was so thick that any bump to the wire popped the solder joint off the board AND the heat of soldering to the spots we found, desoldered some surface mount components!! Fortunately the components were just <a href="https://en.wikipedia.org/wiki/Zero-ohm_link" target="_blank">zero ohm resistors</a> and I could hack a wire back into place.</div>
<div>
<br /></div>
<div>
<b>Take two</b> had a better result. I apologize for not having a close up of the finished board, but we eventually traced each button and ground to simple, round, fairly isolated, copper pads. We used some magnet wire (enamel burned off at the ends) to solder to the pad to allow the flexibility we needed. <br />
<br />
<b>UPDATE: </b>After requests for more details on where the solder points were on the circuit board, I borrowed a very nice close up image from Amanda's original project and highlighted the traces that we used. We soldered to the round pads you can see highlighted. The outer ring of the button contact was "common" and shared the yellow pad so each set of the relay boards described in <a href="http://locgt.blogspot.com/2013/08/frankenfeeder-part-ii.html" target="_blank">Part II</a> had one wire to the common pad and one wire to the red or green pad as seen in the image below.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVSb1UjYXGClZAZgAnSnwbHHi7PErs1Y4Ps_6IjfFM7shHqzmL7_P4JpciyNDSzNv9DnwWA0DAMk_09pF6a1P294ESexvpRmGxTrv9cVf825eucDIuT-599AKSMDqSf5uWszQor-V_-o1a/s1600/closeup.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVSb1UjYXGClZAZgAnSnwbHHi7PErs1Y4Ps_6IjfFM7shHqzmL7_P4JpciyNDSzNv9DnwWA0DAMk_09pF6a1P294ESexvpRmGxTrv9cVf825eucDIuT-599AKSMDqSf5uWszQor-V_-o1a/s1600/closeup.jpg" height="400" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Close up with traces and pads highlighted</td></tr>
</tbody></table>
We reassembled the feeder, leaving the leads handing out (we did remember to label them :-) ). Also we had to be VERY careful maneuvering around inside this feeder. It has very cheap construction and we accidentally knocked some wires lose a couple times from motors or PCBs. Nothing a little solder couldn't fix, but we learned to be extra careful. </div>
<div>
<br /></div>
<div>
Next task was to figure out how to ground the vol and set button leads when commanded from the Pi.</div>
<div>
<br /></div>
<div>
<b>That's here in <a href="http://locgt.blogspot.com/2013/08/frankenfeeder-part-ii.html" target="_blank">Part II</a></b></div>
<div>
<br /></div>
<div>
<br /></div>
</div>
<div>
<br /></div>
Ben Millerhttp://www.blogger.com/profile/17985234897549353876noreply@blogger.com15tag:blogger.com,1999:blog-3853139185462014395.post-47170618886711018392013-08-17T12:02:00.000-04:002013-08-17T12:02:23.884-04:00Why?<br />
Why this blog?<br />
This is my third attempt at starting a Blog, so why now? why here? Well several reasons.
<br />
<ul>
<li>I have been doing a lot of electronics experimentation and I am inspired to share some of my stories. I thought about doing instructables or something, but couldn't bring myself to get to that level of detail. So I'll try to share stories here. If there is interest I can share more.</li>
<li>I enjoy writing. Possible future posts and news about pending novel publishing, short stories, etc.</li>
<li>I wanted a place to share ideas, and thoughts, I guess thats a blog</li>
</ul>
<div>
Ok, that's about it. So the content here won't be frequent, but hopefully it will be worthwhile.<br />
<br />
Oh, and the name . . .. While the name might seem self evident after a few posts but while I was considering what to call this, my son started relating a dream he had and was very excited that it was full of "Lots of cool geeky things," his words. I thought, Perfect! And here we are. "Lots of cool geeky things."</div>
Ben Millerhttp://www.blogger.com/profile/17985234897549353876noreply@blogger.com0