{"id":24,"date":"2012-06-23T20:04:00","date_gmt":"2012-06-23T20:04:00","guid":{"rendered":""},"modified":"2021-07-18T19:40:05","modified_gmt":"2021-07-18T19:40:05","slug":"desk-lamp-web-control","status":"publish","type":"post","link":"http:\/\/cockfieldofdreams.com\/blog\/2012\/06\/desk-lamp-web-control.html","title":{"rendered":"Desk Lamp Web Control"},"content":{"rendered":"<p>Once I got the web server working from the last post, it was time to get the parallel port to do something useful. As its first task, I decided to hook it up to my desk lamp so that anyone in the world could turn the light in my apartment on and off. If you would like to try it yourself (and my computer is on), go to <a href=\"http:\/\/108.233.132.201\/\">http:\/\/108.233.132.201\/<\/a>.<\/p>\n<p>THIS IS IMPORTANT: I can&#8217;t tell who is turning my lamp on and off yet. So! If you&#8217;re going to play around with it, please let me know who you are. Phone\/text\/email\/facebook are all acceptable, or just leave a comment below.<\/p>\n<p>I used an AC adaptor I had laying around (from my kitchen light switch  mod from two and a half years ago) to get 12V DC for the relay. When I  actually hook this up in the kitchen, I plan on splicing in to the old  Gateway&#8217;s power supply to get the 12V. I tied the output ground from the  power supply to the 0V pins of the parallel port and put an LED in to  let me know when I had the device powered up. Next I wired up a TIP31  NPN bipolar junction transistor. The base was attached to one of the  parallel pins, the collector was attached to the relay coil (I also put  an LED here just for peace of mind), and the emitter was attached to  ground. And that&#8217;s it! Once I get this in the kitchen (and wired up  properly, i.e. not with live 120AC wires taped to terminals) I&#8217;ll post a  video of it in action.&nbsp; <\/p>\n<p>An overview of the setup. Parallel port on the left, electronics in the middle, AC adaptor, relay, and the lamp&#8217;s plug on the upper right. <\/p>\n<div style=\"clear: both; text-align: center;\"><a href=\"http:\/\/cockfieldofdreams.com\/blog\/wp-content\/uploads\/2012\/06\/2012-06-21_21-32-41_798.jpg\" style=\"margin-left: 1em; margin-right: 1em;\"><img decoding=\"async\" loading=\"lazy\" border=\"0\" height=\"179\" src=\"http:\/\/cockfieldofdreams.com\/blog\/wp-content\/uploads\/2012\/06\/2012-06-21_21-32-41_798-300x168.jpg\" width=\"320\" \/><\/a><\/div>\n<p>A close-up of the electronics. The IC on the right is a 555 timer that&#8217;s not being used.&nbsp; <\/p>\n<div style=\"clear: both; text-align: center;\"><a href=\"http:\/\/cockfieldofdreams.com\/blog\/wp-content\/uploads\/2012\/06\/2012-06-23_15-29-01_416.jpg\" style=\"margin-left: 1em; margin-right: 1em;\"><img decoding=\"async\" loading=\"lazy\" border=\"0\" height=\"179\" src=\"http:\/\/cockfieldofdreams.com\/blog\/wp-content\/uploads\/2012\/06\/2012-06-23_15-29-01_416-300x168.jpg\" width=\"320\" \/><\/a><\/div>\n<p>Everything together including the lamp.&nbsp; <\/p>\n<div style=\"clear: both; text-align: center;\"><a href=\"http:\/\/cockfieldofdreams.com\/blog\/wp-content\/uploads\/2012\/06\/2012-06-23_15-29-38_779.jpg\" style=\"margin-left: 1em; margin-right: 1em;\"><img decoding=\"async\" loading=\"lazy\" border=\"0\" height=\"179\" src=\"http:\/\/cockfieldofdreams.com\/blog\/wp-content\/uploads\/2012\/06\/2012-06-23_15-29-38_779-300x168.jpg\" width=\"320\" \/><\/a><\/div>\n<p>My not-quite-up-to-code wiring, which shows how I fed the 120V AC from the wall, through the adaptor, through the relay, and to the lamp. Not super safe but I won&#8217;t leave it plugged in until I build a more permanent enclosure for it.<\/p>\n<div style=\"clear: both; text-align: center;\"><a href=\"http:\/\/cockfieldofdreams.com\/blog\/wp-content\/uploads\/2012\/06\/2012-06-23_15-31-11_627.jpg\" style=\"margin-left: 1em; margin-right: 1em;\"><img decoding=\"async\" loading=\"lazy\" border=\"0\" height=\"320\" src=\"http:\/\/cockfieldofdreams.com\/blog\/wp-content\/uploads\/2012\/06\/2012-06-23_15-31-11_627-168x300.jpg\" width=\"179\" \/><\/a><\/div>\n<p>Also I promise I had this idea before <a href=\"http:\/\/www.youtube.com\/watch?v=mqp8_ROAIJY\" target=\"_blank\" rel=\"noopener\">this episode of the Big Bang Theory<\/a> aired. WHAT A COINCIDENCE! This is what I felt like though. Then it was creepy when people started turning my lamp on and off.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Once I got the web server working from the last post, it was time to get the parallel port to do something useful. As its first task, I decided to hook it up to my desk lamp so that anyone in the world could turn the light in my apartment on and off. If you &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/cockfieldofdreams.com\/blog\/2012\/06\/desk-lamp-web-control.html\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Desk Lamp Web Control&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":230,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/cockfieldofdreams.com\/blog\/wp-json\/wp\/v2\/posts\/24"}],"collection":[{"href":"http:\/\/cockfieldofdreams.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/cockfieldofdreams.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/cockfieldofdreams.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/cockfieldofdreams.com\/blog\/wp-json\/wp\/v2\/comments?post=24"}],"version-history":[{"count":1,"href":"http:\/\/cockfieldofdreams.com\/blog\/wp-json\/wp\/v2\/posts\/24\/revisions"}],"predecessor-version":[{"id":234,"href":"http:\/\/cockfieldofdreams.com\/blog\/wp-json\/wp\/v2\/posts\/24\/revisions\/234"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/cockfieldofdreams.com\/blog\/wp-json\/wp\/v2\/media\/230"}],"wp:attachment":[{"href":"http:\/\/cockfieldofdreams.com\/blog\/wp-json\/wp\/v2\/media?parent=24"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/cockfieldofdreams.com\/blog\/wp-json\/wp\/v2\/categories?post=24"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/cockfieldofdreams.com\/blog\/wp-json\/wp\/v2\/tags?post=24"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}