<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8411814736802169319</id><updated>2011-11-27T18:30:11.208-06:00</updated><category term='auto'/><category term='misc'/><title type='text'>Matt's Hacks</title><subtitle type='html'>Here you will find information about my projects. Feel free to copy, modify, and/or distribute anything (source code, schematics, etc.) that you want.

Use any information at your own risk.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://matts-hacks.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8411814736802169319/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://matts-hacks.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Matt</name><uri>http://www.blogger.com/profile/04204526350995094443</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>2</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8411814736802169319.post-5733082994312789657</id><published>2009-04-19T21:24:00.007-05:00</published><updated>2009-04-19T22:10:22.452-05:00</updated><title type='text'>Light Source Tracking in Two Dimensions</title><content type='html'>This project was a proof-of-concept for the idea of tracking the sun throughout the day in order to optimize the efficiency of solar panels. As a proof-of-concept, there aren't any solar panels, so this particular implementation doesn't do much other than follow a flashlight. The project was built around the BASIC Stamp II (BS2) and some simple components.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Components&lt;/span&gt;&lt;br /&gt;1. Light level detection&lt;br /&gt;2. Repositioning of surface&lt;br /&gt;3. I/O processing&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;1. Light Level Detection&lt;/span&gt;&lt;br /&gt;This was done using three photoresistors positioned at right angles to each other:&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_JK8nYiKhMJM/SevfDNnPIrI/AAAAAAAAAAk/QUgPNNvD5lw/s1600-h/pic2_small.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 200px; height: 150px;" src="http://1.bp.blogspot.com/_JK8nYiKhMJM/SevfDNnPIrI/AAAAAAAAAAk/QUgPNNvD5lw/s200/pic2_small.png" alt="" id="BLOGGER_PHOTO_ID_5326596230582575794" border="0" /&gt;&lt;/a&gt;The photoresistors were mounted in LED holders for the sake of convenience. In case you're not familiar with how they work, they decrease resistance with increasing light magnitude. After measuring the light at each of the three points, the values are compared by the BS2 and the servos reposition the array accordingly. The left and top-right values are compared to determine the &lt;span style="font-style: italic;"&gt;x&lt;/span&gt; position, and the top-right and bottom values are compared to determine the &lt;span style="font-style: italic;"&gt;y&lt;/span&gt; position. When the values in question are equal, it simply assumes it's facing the light source and stops moving.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;2. Repositioning of Surface&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt; So say we know where the light source is relative to the surface; now we need a way to reposition this surface such that it's normal to (directly facing) the light source. I happened to have a couple continuous-rotation servos, so I used these and they worked fine. (In hindsight, regular servos would probably have been a better option.) The servos received power from an old computer power supply I had laying around.&lt;br /&gt;Here's a picture of the whole setup where you can see how the servos are positioned:&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_JK8nYiKhMJM/SevhI25IrMI/AAAAAAAAAAs/oIReEPHADMA/s1600-h/pic3_small.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 200px; height: 150px;" src="http://1.bp.blogspot.com/_JK8nYiKhMJM/SevhI25IrMI/AAAAAAAAAAs/oIReEPHADMA/s200/pic3_small.png" alt="" id="BLOGGER_PHOTO_ID_5326598526586105026" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;3. I/O Processing&lt;/span&gt;&lt;br /&gt;As mentioned before, the processing was done with a Basic Stamp II. The light levels could be detected using the RCTIME function in combination with a capacitor. First, the pin the photoresistor is connected to is set as an output and set to high (+5V), charging the capacitor. After a fraction of a second, the capacitor is discharged and the pin is set to an input. The function then returns the amount of time it takes for the pin to measure a 0V, indicating the capacitor has been discharged. More resistance means more time to discharge, so a lower number means more light.&lt;br /&gt;In addition to the autonomous mode, I wired up a switch to toggle the manual mode. There are four momentary switches on the breadboard which control the sensor array. (This is mainly in case the wires coming from the photoresistors get tangled up.)&lt;br /&gt;The three LEDs on the breadboard indicate the status. One turns on when it's in manual mode and off otherwise; the other two light up when the &lt;span style="font-style: italic;"&gt;x&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;y&lt;/span&gt; axes are locked on, respectively.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_JK8nYiKhMJM/SevjLjGQBFI/AAAAAAAAAA0/JFXKzezY0ig/s1600-h/pic1_small.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 200px; height: 150px;" src="http://4.bp.blogspot.com/_JK8nYiKhMJM/SevjLjGQBFI/AAAAAAAAAA0/JFXKzezY0ig/s200/pic1_small.png" alt="" id="BLOGGER_PHOTO_ID_5326600771835266130" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;PBASIC Source Code&lt;/span&gt; (Email me if you want a copy with indentation; it removes it when I post it on here.)&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;blockquote&gt;' {$STAMP BS2}&lt;br /&gt;' {$PBASIC 2.5}&lt;br /&gt;&lt;br /&gt;LSensor VAR Word&lt;br /&gt;RSensor VAR Word&lt;br /&gt;BSensor VAR Word&lt;br /&gt;&lt;br /&gt;XRot VAR Nib '0: left 1: stationary 2: right&lt;br /&gt;YRot VAR Nib '0: lower 1: atationary 2: raise&lt;br /&gt;Mode VAR Bit&lt;br /&gt;&lt;br /&gt;'Set up pin configuration&lt;br /&gt;LRes CON 0 'left photoresistor&lt;br /&gt;RRes CON 1 'right photoresistor&lt;br /&gt;BRes CON 2 'bottom photoresistor&lt;br /&gt;XServo CON 3&lt;br /&gt;YServo CON 4&lt;br /&gt;XSpeed CON 10&lt;br /&gt;YSpeed CON 10&lt;br /&gt;XDeadzone CON 20&lt;br /&gt;YDeadzone CON 20&lt;br /&gt;&lt;br /&gt;Main:&lt;br /&gt;     Mode = IN8&lt;br /&gt;     IF Mode = 1 THEN&lt;br /&gt;          GOSUB Autonomous&lt;br /&gt;     ELSE&lt;br /&gt;          GOSUB Manual&lt;br /&gt;     ENDIF&lt;br /&gt;     GOSUB SetOutput&lt;br /&gt;     GOTO Main&lt;br /&gt;    &lt;br /&gt;Autonomous:&lt;br /&gt;     'Get analog inputs from photoresistors&lt;br /&gt;     HIGH LRes&lt;br /&gt;     HIGH RRes&lt;br /&gt;     HIGH BRes&lt;br /&gt;     PAUSE 1 'let capacitors charge&lt;br /&gt;     RCTIME LRes, 1, LSensor&lt;br /&gt;     RCTIME RRes, 1, RSensor&lt;br /&gt;     RCTIME BRes, 1, BSensor&lt;br /&gt;     IF ABS (LSensor - RSensor) &gt; XDeadzone THEN&lt;br /&gt;          IF LSensor &lt; RSensor THEN&lt;br /&gt;               XRot = 2&lt;br /&gt;          ELSE&lt;br /&gt;               XRot = 0&lt;br /&gt;          ENDIF&lt;br /&gt;          LOW 6&lt;br /&gt;     ELSE&lt;br /&gt;          XRot = 1&lt;br /&gt;          HIGH 6 'Light up LED when locked on&lt;br /&gt;     ENDIF&lt;br /&gt;     IF ABS (RSensor - BSensor) &gt; YDeadzone THEN&lt;br /&gt;          IF RSensor &lt; BSensor THEN&lt;br /&gt;               YRot = 2&lt;br /&gt;          ELSE&lt;br /&gt;               YRot = 0&lt;br /&gt;          ENDIF&lt;br /&gt;          LOW 5&lt;br /&gt;     ELSE&lt;br /&gt;          YRot = 1&lt;br /&gt;          HIGH 5 'Light up LED when locked on&lt;br /&gt;     ENDIF&lt;br /&gt;     LOW 7&lt;br /&gt;     RETURN&lt;br /&gt;    &lt;br /&gt;Manual:&lt;br /&gt;13 of 14&lt;br /&gt;IF IN15 = 1 THEN&lt;br /&gt;     YRot = 0&lt;br /&gt;ELSEIF IN14 = 1 THEN&lt;br /&gt;     YRot = 2&lt;br /&gt;ELSE&lt;br /&gt;     YRot = 1&lt;br /&gt;ENDIF&lt;br /&gt;IF IN13 = 1 THEN&lt;br /&gt;     XRot = 0&lt;br /&gt;ELSEIF IN12 = 1 THEN&lt;br /&gt;     XRot = 2&lt;br /&gt;ELSE&lt;br /&gt;     XRot = 1&lt;br /&gt;ENDIF&lt;br /&gt;LOW 5&lt;br /&gt;LOW 6&lt;br /&gt;HIGH 7 'Indicate mode&lt;br /&gt;RETURN&lt;br /&gt;&lt;br /&gt;SetOutput:&lt;br /&gt;IF XRot = 0 THEN&lt;br /&gt;     PULSOUT XServo, (750 + XSpeed) '750: do nothing&lt;br /&gt;ELSEIF XRot = 2 THEN&lt;br /&gt;     PULSOUT XServo, (750 - XSpeed)&lt;br /&gt;ELSE&lt;br /&gt;     PULSOUT XServo, 750&lt;br /&gt;ENDIF&lt;br /&gt;IF YRot = 0 THEN&lt;br /&gt;     PULSOUT YServo, (750 + YSpeed)&lt;br /&gt;ELSEIF YRot = 2 THEN&lt;br /&gt;     PULSOUT YServo, (750 - YSpeed)&lt;br /&gt;ELSE&lt;br /&gt;     PULSOUT YServo, 750&lt;br /&gt;ENDIF&lt;br /&gt;PAUSE 20&lt;br /&gt;RETURN&lt;/blockquote&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8411814736802169319-5733082994312789657?l=matts-hacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://matts-hacks.blogspot.com/feeds/5733082994312789657/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://matts-hacks.blogspot.com/2009/04/light-source-tracking-in-two-dimensions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8411814736802169319/posts/default/5733082994312789657'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8411814736802169319/posts/default/5733082994312789657'/><link rel='alternate' type='text/html' href='http://matts-hacks.blogspot.com/2009/04/light-source-tracking-in-two-dimensions.html' title='Light Source Tracking in Two Dimensions'/><author><name>Matt</name><uri>http://www.blogger.com/profile/04204526350995094443</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_JK8nYiKhMJM/SevfDNnPIrI/AAAAAAAAAAk/QUgPNNvD5lw/s72-c/pic2_small.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8411814736802169319.post-2354524648879688203</id><published>2009-03-24T22:38:00.009-05:00</published><updated>2010-07-06T21:30:18.912-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><category scheme='http://www.blogger.com/atom/ns#' term='auto'/><title type='text'>Mobile Infrared Transmitter</title><content type='html'>&lt;div&gt;**NOTE: This device will not actually change traffic lights for you: it's no more than a glorified timer circuit. It's obsolete technology, but basically makes a 555 circuit slightly more interesting.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;This is actually something I did over a year ago; it was kind of my foray into electronics. As you can imagine, it's fairly simple, but I thought I'd post it anyway.&lt;br /&gt;&lt;br /&gt;First off, a little introduction. You may have noticed that emergency vehicles (fire trucks, ambulances, etc.) seem to always get a green light at intersections. They do this by using a &lt;span style="font-style: italic;"&gt;mobile infrared transmitter&lt;/span&gt;. Basically all it does is send an infrared signal to receivers mounted on the poles the lights are on. When the receivers get an infrared signal of a certain frequency (I've heard 12 and 14 hertz), they turn those lights green and make the adjacent ones red. I've seen these sold for hundreds of dollars, but as you'll see, it's a ridiculously simple device you can make yourself for less than around $30.&lt;br /&gt;Fortunately (for emergency vehicles) this device is obsolete, as most (if not all) of these systems now use a &lt;a href="http://en.wikipedia.org/wiki/Rolling_code"&gt;rolling code&lt;/a&gt; or other secure system. So this whole device is basically pointless, but hey, I had fun thinking I was a criminal mastermind.&lt;br /&gt;&lt;br /&gt;Now, onto the build. I followed &lt;a href="http://www.i-hacked.com/content/view/176/44/"&gt;this article&lt;/a&gt; for the most part. It's pretty well documented on that site, so it makes my job here easy. The only differences are I mounted an indicator LED on the side of the case that flashes with the IR array, and I mounted the array itself on the lid of the enclosure with a small screw. I just used one of the project boxes from Radio Shack and it worked pretty well.&lt;br /&gt;&lt;br /&gt;Here are some pictures of the final project:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_JK8nYiKhMJM/Scmq87Uw6EI/AAAAAAAAAAM/HoQ8D34ahE0/s1600-h/0324092221-02.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://3.bp.blogspot.com/_JK8nYiKhMJM/Scmq87Uw6EI/AAAAAAAAAAM/HoQ8D34ahE0/s320/0324092221-02.jpg" alt="" id="BLOGGER_PHOTO_ID_5316968798781237314" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_JK8nYiKhMJM/Scmretu4YrI/AAAAAAAAAAU/dNVL-xafgYo/s1600-h/0324092225-00.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://2.bp.blogspot.com/_JK8nYiKhMJM/Scmretu4YrI/AAAAAAAAAAU/dNVL-xafgYo/s320/0324092225-00.jpg" alt="" id="BLOGGER_PHOTO_ID_5316969379248235186" border="0" /&gt;&lt;/a&gt;&lt;span style="font-size:78%;"&gt;The trickiest part of getting everything to fit was the power transistor (on the right). I ended up screwing it down into the case, which isn't the best idea for high-current loads, but it was only driving an LED array so it wasn't a big deal.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_JK8nYiKhMJM/Scmsbv6B2LI/AAAAAAAAAAc/21kaswazdOk/s1600-h/pic7.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://3.bp.blogspot.com/_JK8nYiKhMJM/Scmsbv6B2LI/AAAAAAAAAAc/21kaswazdOk/s320/pic7.jpg" alt="" id="BLOGGER_PHOTO_ID_5316970427803883698" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;Nothing too impressive, but if it was 20 years ago, I'd have green lights wherever I went!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8411814736802169319-2354524648879688203?l=matts-hacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://matts-hacks.blogspot.com/feeds/2354524648879688203/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://matts-hacks.blogspot.com/2009/03/mobile-infrared-transmitter.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8411814736802169319/posts/default/2354524648879688203'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8411814736802169319/posts/default/2354524648879688203'/><link rel='alternate' type='text/html' href='http://matts-hacks.blogspot.com/2009/03/mobile-infrared-transmitter.html' title='Mobile Infrared Transmitter'/><author><name>Matt</name><uri>http://www.blogger.com/profile/04204526350995094443</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_JK8nYiKhMJM/Scmq87Uw6EI/AAAAAAAAAAM/HoQ8D34ahE0/s72-c/0324092221-02.jpg' height='72' width='72'/><thr:total>0</thr:total></entry></feed>
