tag:blogger.com,1999:blog-81431363934644130902024-03-13T21:42:15.658-06:00Ashish's Programming JournalAshish Derhgawenhttp://www.blogger.com/profile/16949464781799641662noreply@blogger.comBlogger55125tag:blogger.com,1999:blog-8143136393464413090.post-23060898403403964242023-10-14T19:17:00.004-06:002023-10-14T19:17:24.135-06:00This blog has moved<p>This blog has moved to <a href="https://ashishrd.com/">https://ashishrd.com/</a>. Check out the new website to see my recent projects!</p>Ashish Derhgawenhttp://www.blogger.com/profile/16949464781799641662noreply@blogger.com0tag:blogger.com,1999:blog-8143136393464413090.post-1098226085935950042016-03-20T16:21:00.000-06:002016-05-09T18:12:04.669-06:0019th century radio technology meets the Beaglebone<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-L15c_eyeR-c/Vu8ajl-eCfI/AAAAAAAABwQ/WRwIY2Hhqz8DWIMx4-Ltad0pINZ141Eqg/s1600/spark.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="225" src="https://2.bp.blogspot.com/-L15c_eyeR-c/Vu8ajl-eCfI/AAAAAAAABwQ/WRwIY2Hhqz8DWIMx4-Ltad0pINZ141Eqg/s400/spark.png" width="400" /></a></div>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">In my <a href="http://ashishrd.blogspot.com/2015/11/rediscovering-magic-of-wireless.html" target="_blank">last post</a>, I described how I made a spark-gap transmitter and receiver. For the transmitter, I used a car's ignition coil to produce high voltage sparks, and for the receiver, I used a coherer to detect the transmissions. A coherer is a simple device - it consists of iron filings between two electrodes. Normally the filings have very high electrical resistance (tens of megaohms), but when the coherer detects electromagnetic waves, its resistance drops to about 10-20 ohms.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Back in the day, spark gap transmitters and coherers were widely used for wireless communication. One of the early pioneers in the field of wireless communication was <a href="https://en.wikipedia.org/wiki/Artie_Moore" target="_blank">Arthur "Artie" Moore</a>. He has a very interesting story. As a teenager, he built a steam engine using water-wheel driven lathe, and entered the model in a competition. He received as his prize a book by <a href="https://en.wikipedia.org/wiki/Oliver_Lodge" target="_blank">Sir Oliver Lodge</a> titled <a href="http://www.free-energy-info.com/Lodge.pdf" target="_blank">"Modern Views of Electricity"</a> which sparked his interest in the world of wireless. He, along with his friend Richard Jenkins, began to experiment with the ideas presented in Lodge’s book. They successfully built their own spark-gap transmitter and coherer receiver and taught themselves Morse code. Artie built a little radio station in his attic, and he would stay there all night listening to signals emanating from ships traveling the coastal waters around Wales.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<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/-qA378i6DBdA/Vu8a7GlRhjI/AAAAAAAABwY/Eth9Y8vrldU1pbC4IJ0dllPPQVjMIi-yA/s1600/_46060412_mill1911038_copyrightglynjones.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="257" src="https://3.bp.blogspot.com/-qA378i6DBdA/Vu8a7GlRhjI/AAAAAAAABwY/Eth9Y8vrldU1pbC4IJ0dllPPQVjMIi-yA/s400/_46060412_mill1911038_copyrightglynjones.jpg" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Artie Moore's radio shack</td></tr>
</tbody></table>
<br />
<span style="font-family: "verdana" , sans-serif;">In the early hours of 15 April, 1912, Artie received a faint Morse code signal on his coherer receiver:</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><i>"CQD Titanic 41.44N 50.24W."</i></span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">CQD meant "come quickly distress." In its next message, the ship also used the newer SOS signal -</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><i>"CQD CQD SOS de MGY Position 41.44N 50.24W. Require immediate assistance. Come at once. We have struck an iceberg. Sinking."</i></span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Artie was copying the signals, hardly believing the words he was writing. The final transmission he received was - <i>"Come as quickly as possible old man; our engine-room is filling up to the boilers."</i></span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">The RMS Titanic was sinking in the North Atlantic with more than 2,000 passengers and crew, and Artie was receiving the oceanliner’s final distress calls almost 3,000 miles away on his homemade radio. Artie continued to copy the increasingly desperate messages until the Titanic went silent about two hours after the first distress call.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">The news of the disaster had not reached UK at that time, and no one believed Artie when he said that the Titanic was sinking. They thought that the Titanic was unsinkable. It was only two days later when it was announced in the national press, people realized he had been right. The receiving of these signals is believed to be the only land-based reception of the Titanic’s last transmissions in the UK, possibly the world.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<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/-MRGiLBLZ8ug/Vu8bjD9-cYI/AAAAAAAABwo/UWICCuHuFnI9WGt8ABZReFNHBTptJ7HEQ/s1600/titanic_marconi_room.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="275" src="https://4.bp.blogspot.com/-MRGiLBLZ8ug/Vu8bjD9-cYI/AAAAAAAABwo/UWICCuHuFnI9WGt8ABZReFNHBTptJ7HEQ/s400/titanic_marconi_room.jpg" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Titanic's wireless room replica</td></tr>
</tbody></table>
<br />
<h3 style="text-align: left;">
<span style="font-family: "verdana" , sans-serif;">The receiver</span></h3>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Getting back to our story, I built <a href="http://ashishrd.blogspot.com/2015/11/rediscovering-magic-of-wireless.html" target="_blank">my own coherer</a> in a vinyl tube with iron filings:</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<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://1.bp.blogspot.com/mQfyJWp6CN0hVp8e5janNQoQM1xgw-X6QKMzA50sDGMTeCqfyiyND8d5ebglVccEQxjdiPD1p-4AmK3rKRlCOATqqP1jeuFMhH-fCb7KBzzOuLlFQz4fFtHyzxstxoguUm8-Sf_k" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://1.bp.blogspot.com/mQfyJWp6CN0hVp8e5janNQoQM1xgw-X6QKMzA50sDGMTeCqfyiyND8d5ebglVccEQxjdiPD1p-4AmK3rKRlCOATqqP1jeuFMhH-fCb7KBzzOuLlFQz4fFtHyzxstxoguUm8-Sf_k" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Iron filings coherer</td></tr>
</tbody></table>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">A problem with the coherer is that once it gets activated, a physical tap is needed to reset it so that it can receive signals again. The system that resets a coherer is called a decoherer. I built a decoherer mechanism using a doorbell. Whenever the coherer gets triggered, it switches on a doorbell, and the bell's hammer hits the coherer and resets it.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<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/-DFGWgTqOhcY/Vu8cAceR2WI/AAAAAAAABww/mS8oKe0X_6MreL1459068AF-1uVf2xh4g/s1600/IMG_2538.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="266" src="https://4.bp.blogspot.com/-DFGWgTqOhcY/Vu8cAceR2WI/AAAAAAAABww/mS8oKe0X_6MreL1459068AF-1uVf2xh4g/s400/IMG_2538.JPG" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Decoherer mechanism</td></tr>
</tbody></table>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">The coherer cannot drive the bell directly, because it draws a lot of current. So, I use a transistor to amplify the signal from the coherer, and the transistor drives a small relay. The relay switches on the doorbell.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<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/-1Vy0y_jIHIY/Vu8cbOwJMOI/AAAAAAAABw8/0Kgg0e_-VxIdeNJFgimZH5P1Ff2166PGA/s1600/decoherer%2B%25281%2529.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="166" src="https://3.bp.blogspot.com/-1Vy0y_jIHIY/Vu8cbOwJMOI/AAAAAAAABw8/0Kgg0e_-VxIdeNJFgimZH5P1Ff2166PGA/s400/decoherer%2B%25281%2529.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Receiver circuit</td></tr>
</tbody></table>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">I connected the receiver to a Beaglebone to decode the received signals. I use an optoisolator to connect the output of the receiver to the Beaglebone. The optoisolator is an extra safety precaution to ensure that the Beaglebone is protected from any unwanted transients in the receiver circuit. I also added a flyback diode on the doorbell’s electromagnet to protect the optoisolator. Lastly, you’ll notice that there’s a brown capacitor in the doorbell to reduce sparking on the contacts. This is not necessary, but it should extend the life of the contacts.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<br />
<h3 style="text-align: left;">
<span style="font-family: "verdana" , sans-serif;">The transmitter</span></h3>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">In my previous post, I used a 555 timer-based ignition coil driver in my transmitter. I kept blowing the MOSFETs in that circuit from the inductive kickback produced by the ignition coil. So, I built the driver using a relay instead. The relay has been wired as an oscillator so that it turns the ignition coil on and off very quickly. This electromechanical driver is simpler and a lot more reliable. There's an automotive ballast resistor in the circuit to reduce the current on the primary side. I also salvaged a capacitor (aka condenser) from a car and put it across the relay's poles to reduce arcing on the relay. It's a standard ignition coil capacitor, and it filters out the inductive kickback coming from the coil.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<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/-KU02b1okDGg/Vu8ck1_437I/AAAAAAAABxI/IMkHSV2kLuQyA1FOxpvzn_b6amVP-Uxlw/s1600/ignition-coil-driver-2%2B%25282%2529.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="135" src="https://1.bp.blogspot.com/-KU02b1okDGg/Vu8ck1_437I/AAAAAAAABxI/IMkHSV2kLuQyA1FOxpvzn_b6amVP-Uxlw/s400/ignition-coil-driver-2%2B%25282%2529.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Transmitter circuit (ignition coil driver)</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/-EjeBc8FxCHs/Vu8dJBPx6CI/AAAAAAAABxU/myRfoLrQfhQ-ryrnht7N6NgVEO8eEwyVA/s1600/IMG_2472.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://3.bp.blogspot.com/-EjeBc8FxCHs/Vu8dJBPx6CI/AAAAAAAABxU/myRfoLrQfhQ-ryrnht7N6NgVEO8eEwyVA/s400/IMG_2472.JPG" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Spark-gap transmitter</td></tr>
</tbody></table>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">It is important to know that operating spark-transmitters is illegal because they create lots of RF interference. This transmitter can be operated without an antenna to keep the signals from going too far. </span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<br />
<h3 style="text-align: left;">
<span style="font-family: "verdana" , sans-serif;">Connecting the coherer to a Beaglebone and decoding Morse code!</span></h3>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">I connected my coherer to a Beaglebone, and wrote some Python code to decode the messages it receives back to text (receiver circuit above explains the circuit connections). You can find my code <a href="https://github.com/aderhgawen/morse-decoder" target="_blank">here</a>.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Here is a video of the system automatically decoding Morse code signals!</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/eL-ndyN-mGU/0.jpg" frameborder="0" height="315" src="https://www.youtube.com/embed/eL-ndyN-mGU?feature=player_embedded" width="560"></iframe></div>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<br />
<h3 style="text-align: left;">
<span style="font-family: "verdana" , sans-serif;">A strange phenomenon</span></h3>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">While I was testing my program with the coherer, a loose wire in the receiver's circuit got disconnected, and the decoherer (bell) stopped working. To my surprise, I noticed that my program continued to receive the signals I was sending, and it was even correctly decoding them back to text! How could the system work if the decoherer wasn't even resetting the coherer? I disconnected the Beaglebone from the receiver, and just kept the interface circuit (the optoisolator) connected to it. Now, the receiver wasn't even connected to the Beaglebone. I started sending signals with my transmitter, and to my surprise, the same thing happened again. The Beaglebone was receiving the signals and decoding them! It took me a moment to realize that I had accidentally built a <a href="http://www.techlib.com/electronics/crystal.html" target="_blank">crystal radio</a> (aka cat's-whisker radio). The LED inside the optoisolator was receiving the RF from the spark transmissions, and lighting up. The photo-transistor darlington pair in the optoisolator was amplifying this weak signal, and this was changing the state of the Beaglebone's GPIO pin. How interesting!</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">This "unintentionally made" crystal radio receiver doesn't have a very good range (only a couple of feet), but I’m sure it could be improved upon to make a more sensitive receiver (and without any mechanical parts).</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">I hope you enjoyed this project as much as I did. I'd love to hear your thoughts and comments.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><b>EDIT: </b>There is a better explanation for the strange behavior of the 4N33 optoisolator. I received this comment from Perry Harrington on <a href="http://hackaday.com/2016/03/29/spark-gap-and-coherer-meet-beagle-bone/" target="_blank">Hackaday</a>:</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<i><span style="font-family: "verdana" , sans-serif;">"</span><span style="font-family: verdana, sans-serif;">If you look at the 4N33, the base of the darlington pair is brought out to a pin. This pin is left necessarily floating, but a darlington pair has typically a ~10,000 gain, so even a small current on this floating base will result in the pair amplifying a current. The bias transistor will have 3.3ma of current flow through it when fully triggered. My experience with 3.3v logic is that it has a ~2.7v input trigger threshold, so you’re looking at about 2.7ma flowing through the darlington to trigger the BBB. If my math is right, it would take about 270na of stray current to trigger the darlington of the optoisolator without a current being present on the LED.</span></i><br />
<span style="font-family: verdana, sans-serif;"><i><br /></i></span>
<span style="font-family: verdana, sans-serif;"><i>You could probably replicate the results with a TIP120 wired up the same, with the base pin floating. If you are using a breadboard, the grid tie it is connected to would act as an antenna."</i></span></div>
Ashish Derhgawenhttp://www.blogger.com/profile/16949464781799641662noreply@blogger.com21tag:blogger.com,1999:blog-8143136393464413090.post-73687688506893818492015-11-17T12:48:00.001-07:002015-11-22T11:32:59.332-07:00Rediscovering the magic of wireless communication<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: "cambria"; font-size: 14.6666666666667px; margin-left: 1em; margin-right: 1em; vertical-align: baseline;"><img alt="IMG_1142.JPG" height="300" src="https://lh5.googleusercontent.com/RWOLmZccCCdsE6TKs0RwHC3P6Fk2FCejNljCXuCjGyF_1TKwfuTSqWwFrr0sRL4-yTWRi-IkuUhPdXoeZgPkFwge67wPcYYSG7mRCfmF4jOqGRCqpT5g3rKK1BcoCwQRhzu4Qf5m" style="-webkit-transform: rotate(0rad); border: none; transform: rotate(0rad);" width="400" /></span></div>
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span id="docs-internal-guid-c87ef2b6-16f8-0196-7655-161efcd5725a"></span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">In this modern age of high tech gadgets, it is easy to take the technology around us for granted. If we look at the world around us as if we have never seen it before, it would be impossible not to be filled with awe and wonder. In this article, I will tell you the story behind one of the most important technological inventions of modern times - wireless communication. I will also describe some of my own experiments with high voltage spark transmitters and coherers! But before I talk about those, a little background is necessary to appreciate how they work. We’ll have to step into the shoes of the early pioneers in the field of electricity and see the world in a completely different way!</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Many years ago, when there were no cell phones or Internet, a great scientist by the name of Michael Faraday speculated the existence of electromagnetic waves when he observed the influence of magnetic fields on polarized light (</span><a href="https://en.wikipedia.org/wiki/Faraday_effect" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Faraday Effect</span></a><span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">). Faraday speculated that light could be a form of electromagnetic disturbance propagating through space. However, this idea was received with considerable skepticism, and it was rejected by everyone until a mathematician by the name of James Clerk Maxwell proved it mathematically in his paper </span><a href="http://rstl.royalsocietypublishing.org/content/155/459.full.pdf+html" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">“The Dynamical Theory of the Electromagnetic Field”</span></a><span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> (1865). Maxwell predicted the existence of electromagnetic waves that could travel indefinitely at the speed of light until absorbed. He proved their existence mathematically without any experimental proof. </span><br />
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">About thirteen years later, David Edward Hughes (an Anglo-American concertina player and inventor) observed something very bizarre. When working on his Induction Balance, a loose contact was creating sparks. Hughes noticed that a telephone circuit connected to his carbon microphone on the other side of the room was somehow picking up that noise. He took the telephone circuit outside, and he could still hear the clicks made from the induction coil up to 500 yards away! You could consider this the first mobile phone call in history. Hughes wrote -</span><br />
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">“Further researches proved that an interrupted current in any coil gave out at each interruption such intense extra currents that the whole atmosphere of the room (or in several rooms distant) would have a momentary invisible charge, which became evident if a microphonic joint was used as a receiver with a telephone. This led me to experiment upon the best form of a receiver for these invisible electric waves, which evidently permeated great distances, and through all apparent obstacles such as walls &c. I found that all microphonic contacts or joints are extremely sensitive.”</span></div>
<br />
<span style="font-family: "cambria"; font-size: 14.6666666666667px; vertical-align: baseline; white-space: pre-wrap;">Apparently, when Hughes showed this to members of the Royal Society, the scientists thought it was merely the result of induction. They did not realize that Hughes had accidentally discovered the electromagnetic waves that Maxwell and Faraday had predicted. Hughes never published his findings.</span><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://upload.wikimedia.org/wikipedia/commons/5/55/Hughes_wireless_apparatus.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="153" src="https://upload.wikimedia.org/wikipedia/commons/5/55/Hughes_wireless_apparatus.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Hughes wireless apparatus, a modified version of his carbon microphone detector (left), and a clockwork driven spark transmitter and battery (right) (<a href="https://commons.wikimedia.org/wiki/File%3AHughes_wireless_apparatus.jpg" target="_blank">source</a>)</td></tr>
</tbody></table>
<span style="font-family: "cambria"; font-size: 14.6666666666667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span style="font-family: "cambria"; font-size: 14.6666666666667px; vertical-align: baseline; white-space: pre-wrap;">In the 1880s, physicist Heinrich Hertz was trying to confirm the existence of Maxwell’s electromagnetic waves. After observing induced sparking in a <a href="https://en.wikipedia.org/wiki/Riess_spiral" target="_blank">Riess spiral</a>, Hertz concluded that this phenomenon could be used to detect the waves. He set up a spark gap transmitter, and a receiver (which consisted of wire loop with a small spark gap). Hertz thought that if the spark gap transmitter created electromagnetic waves, the wire loop antenna would pick it up, and he would see a small spark at the gap in the antenna. Hertz would look at that gap in a dark room with a magnifying glass to see if any sparks appeared.</span><br />
<span style="font-family: "cambria"; font-size: 14.6666666666667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<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.sparkmuseum.com/images/Misc-Images/HERTZ_TABLE.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.sparkmuseum.com/images/Misc-Images/HERTZ_TABLE.JPG" height="270" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">source: <a href="http://www.sparkmuseum.com/">http://www.sparkmuseum.com/</a></td></tr>
</tbody></table>
<span style="font-family: "cambria"; font-size: 14.6666666666667px; vertical-align: baseline; white-space: pre-wrap;"><span id="docs-internal-guid-c87ef2b6-16cd-5a75-2705-114f2a14ae8f"></span></span><br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Around the same time, a scientist named Oliver Lodge was investigating some issues with lightning rods. To simulate lightning, he was using two <a href="https://en.wikipedia.org/wiki/Leyden_jar" target="_blank">Leyden jars</a> to create high voltage sparks. He had two wires connected to the gap (as shown in the figure below) with multiple spark gaps between them. He observed that when the Leyden jars discharged, sparks appeared at all the spark gaps simultaneously. He also noticed that sparks at certain locations were more intense than others. In a darkened room, he could clearly see a visible glow between the wires at one-half wavelength intervals. When Lodge saw this pattern, he knew that he had discovered the electromagnetic waves predicted by Maxwell.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span></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://1.bp.blogspot.com/-HIBGyEmU5-g/Vkt5jjll-eI/AAAAAAAABos/RGXOqZ3LMP0/s1600/lodge-experiment.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="215" src="http://1.bp.blogspot.com/-HIBGyEmU5-g/Vkt5jjll-eI/AAAAAAAABos/RGXOqZ3LMP0/s320/lodge-experiment.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Oliver Lodge's experiment (source: <a href="http://www.antiquewireless.org/uploads/1/6/1/2/16129770/48-oliver_lodge.pdf" target="_blank">"Oliver Lodge: Almost the Father of Radio"</a> by James Rybak)</td></tr>
</tbody></table>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Hertz also saw the spark he was hoping to see. Through the experiments of Lodge and Hertz, the existence of Maxwell’s elusive electromagnetic waves was finally confirmed. </span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><b id="docs-internal-guid-c87ef2b6-16d4-f02d-080e-3e0a46668335" style="font-weight: normal;"><br /></b></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Lodge went on to design better devices (detectors) to detect these waves. The detector that Lodge used was called a “coherer”. I think it was based on the idea of Hughe’s carbon microphone detector. A coherer consists of iron filings between two electrodes. Normally, the resistance between the two electrodes is very high. When a spark is created, the resistance between the electrodes drops.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><b style="font-weight: normal;"><br /></b></span></div>
<h3 style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: left;">
<span style="font-family: "cambria"; font-size: 14.6666666666667px; line-height: 1.38; white-space: pre-wrap;">My homemade coherer</span></h3>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "cambria"; font-size: 14.6666666666667px; line-height: 1.38; white-space: pre-wrap;"><br /></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "cambria"; font-size: 14.6666666666667px; line-height: 1.38; white-space: pre-wrap;">After reading the story behind the discovery of electromagnetic waves, I wanted to make my own coherer. The amazing thing about the coherer is how simple it is. Why it works is also mysterious. It seems the electromagnetic waves somehow magnetize the filings, and they get closer to each other. I built my coherer inside a vinyl tube with iron filings between two ¼” bolts.</span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: "cambria"; font-size: 14.6666666666667px; margin-left: 1em; margin-right: 1em; vertical-align: baseline; white-space: pre-wrap;"><img alt="IMG_1165.JPG" height="300" src="https://lh4.googleusercontent.com/mQfyJWp6CN0hVp8e5janNQoQM1xgw-X6QKMzA50sDGMTeCqfyiyND8d5ebglVccEQxjdiPD1p-4AmK3rKRlCOATqqP1jeuFMhH-fCb7KBzzOuLlFQz4fFtHyzxstxoguUm8-Sf_k" style="-webkit-transform: rotate(0rad); border: none; transform: rotate(0rad);" width="400" /></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span id="docs-internal-guid-c87ef2b6-16d6-183d-ef5c-d74dc3d2ef33"></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "cambria"; font-size: 14.6666666666667px; line-height: 1.38; white-space: pre-wrap;"><br /></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "cambria"; font-size: 14.6666666666667px; line-height: 1.38; white-space: pre-wrap;">I noticed that a very small amount of filings is required between the bolts for the coherer to work. Also, the performance of the coherer depends a lot on the gap between the bolts. I adjust the gap by first pushing the bolts until my multimeter (in continuity checking mode) beeps. Then, I pull the bolts out just a little until it stops beeping. That seems to be the perfect gap. Normally, the resistance between the two bolts will be very high - in megaohms. When the coherer detects electromagnetic waves, the resistance drops to 10-20 ohms. Normally the coherer will stay in this state of low resistance, and you have to tap it to decohere it. I am thinking about making an automatic tapping mechanism with an electromagnet.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "cambria"; font-size: 14.6666666666667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<h3 style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: left;">
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Spark-gap transmitter</span></h3>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<b id="docs-internal-guid-c87ef2b6-16d8-4372-0e34-4efb2795c2cd" style="font-weight: normal;"><br /></b></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">To test my coherer, I used a piezoelectric stove lighter. The electric spark created by the lighter was able to trigger the coherer, but it was not very reliable. So, I decided to build a better spark transmitter. I went to a junkyard and salvaged an ignition coil from a car. An ignition coil is a step-up transformer which converts 12V (from the car’s battery) to 20,000V-30,000V. This high voltage is sent to the spark plug to create sparks.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<b style="font-weight: normal;"><br /></b></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">There are different kinds of ignition coils. To identify the coils, you could measure the resistance on the primary and secondary coils. The primary coil should have a very low resistance in the range of 0.4 to 2 ohms, and the secondary should have high resistance in the range of 6K to 15K ohms.</span></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://www.aa1car.com/library/coil_checks.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.aa1car.com/library/coil_checks.jpg" height="207" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">source: <a href="http://www.aa1car.com/library/ignition_coils.htm">http://www.aa1car.com/library/ignition_coils.htm</a></td></tr>
</tbody></table>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">To test the coil, I connected a 9V battery to the coil’s primary. That was enough to create a spark on the secondary coil. When I told my dad about it, he shared his wisdom on how a car’s ignition system works, and said that I could improve the sparks if I add a capacitor across the contact point. In a car’s ignition system, there is a capacitor (aka condenser) across the contact breaker. This capacitor absorbs the back-EMF generated by the ignition coil, and reduces arcing on the primary side. This has two benefits. The first is that it improves the life of the contact breaker by reducing burning, and the second benefit is that it results in more intense sparks on the secondary. This is because the magnetic field collapses quicker when the capacitor absorbs the transient back-EMF generated on the primary side, and this increases the induced EMF on the secondary.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">So, I looked around in my workspace for a capacitor with a high enough voltage rating, but didn’t find any. Then, I got an idea while watching BBC’s </span><a href="http://www.bbc.co.uk/programmes/p00kjq6h" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">“Shock and Awe: The Story of Electricity”</span></a><span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> presented by Jim Al-Khalili). In this show, they described how a Dutch scientist by the name of Pieter van Musschenbroek discovered how to store electricity. Before Musschenbroek’s discovery, people could generate electricity with devices like the </span><a href="https://en.wikipedia.org/wiki/Francis_Hauksbee" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Hauksbee generator</span></a><span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, but did not know how to store it. In those days, people believed that electricity was like an invisible fluid. Using this analogy, Musschenbroek thought that if electricity is like a fluid, it should be possible to store it in a jar, just like we store water! So, he filled a jar with water, and used that to store electricity. He made what’s called a Leiden (or Leyden) jar (named after a Dutch town named </span><a href="https://en.wikipedia.org/wiki/Leiden" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Leiden</span></a><span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">). The Leyden jar was the first capacitor.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span></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;"><img alt="Cuneus_discovering_the_Leyden_jar.png" height="290" src="https://lh6.googleusercontent.com/2Bn2FneXxDU4jAYFdsm46qC77g6hXmZ6aDP5wgXUbTkp1ngriQDz6he41erhYedbrjeRm5CyMrRNymfwBZMZcUAsH2C5rOY94zyQjLyn63cqkk0inusDER26F6F-9F8nKDsw9hbf" style="-webkit-transform: rotate(0rad); border: none; margin-left: auto; margin-right: auto; transform: rotate(0rad);" width="400" /></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Musschenbroek's Leyden jar (<a href="https://en.wikipedia.org/wiki/Leyden_jar#/media/File:Cuneus_discovering_the_Leyden_jar.png" target="_blank">source</a>)</td></tr>
</tbody></table>
<span style="font-family: "cambria"; font-size: 14.6666666666667px; line-height: 1.38; white-space: pre-wrap;">I made my own Leyden jar in a bottle filled with salt water. I hammered a nail through the cap and wrapped aluminum foil on the outside. I connected this Leyden jar across my contact point. To my surprise, it actually reduced sparking on the primary side, and made the sparks on the secondary a lot more intense!</span><br />
<div>
<div>
<div>
<span id="docs-internal-guid-c87ef2b6-16dd-044f-57eb-d70517da5591"></span></div>
</div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: "cambria"; font-size: 14.6666666666667px; margin-left: 1em; margin-right: 1em; vertical-align: baseline; white-space: pre-wrap;"><img alt="leyden-jar.jpg" height="284" src="https://lh5.googleusercontent.com/Yazf6UrQRIaV7Zf_blXQBRSRJ2bPEKrLazx3jq2zlw2j50-pe4IZL8in7u3OIasJYxvoV0H0Jl8KzrNPKFXxi-3tOeBBBlX1uMcpEOI1xQWUInhqi2SpPY7RINhLXN8v21vdVWT1" style="-webkit-transform: rotate(0rad); border: none; transform: rotate(0rad);" width="320" /></span></div>
<div>
<span id="docs-internal-guid-c87ef2b6-16dd-c47e-49ae-32670ae68716"></span></div>
<div>
<span style="font-family: "cambria"; font-size: 14.6666666666667px; line-height: 1.38; white-space: pre-wrap;"><br /></span></div>
<div>
<span id="docs-internal-guid-c87ef2b6-16de-42b2-05e0-bf3e72224139"><span style="font-family: "cambria"; font-size: 14.6666666666667px; vertical-align: baseline; white-space: pre-wrap;">Later, I designed an ignition coil driver circuit using a 555 timer for continuous sparks. After a lot of trial and error, and blowing several 555s, this circuit seems to be working reliably.</span></span></div>
</div>
<div>
<span style="font-family: "cambria"; font-size: 14.6666666666667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: "cambria"; font-size: 14.6666666666667px; margin-left: 1em; margin-right: 1em; vertical-align: baseline; white-space: pre-wrap;"><img alt="ignition-coil-driver.png" height="206" src="https://lh3.googleusercontent.com/npuyk121xt1b5MwpJEUKWxPVbKMR_oN5pwni-8bq4tn66bsSjvOvEaMfeIFMNKenpEdWDc-_qHIQeH8qBMNowDREgeSoZg_mMY3HPHI7HJ_QdO5n0EQ5o683_aCGdGMAY2zSZIcO" style="-webkit-transform: rotate(0rad); border: none; transform: rotate(0rad);" width="400" /></span></div>
<div>
<span id="docs-internal-guid-c87ef2b6-16de-7df8-b28c-c326bb6f72ce"></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: "cambria"; font-size: 14.6666666666667px; margin-left: 1em; margin-right: 1em; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: "cambria"; font-size: 14.6666666666667px; margin-left: 1em; margin-right: 1em; vertical-align: baseline; white-space: pre-wrap;"><img alt="driver-circuit.JPG" height="300" src="https://lh5.googleusercontent.com/9pi8OJ1_CBmPgjuwHaKConhCpN0bSDUifOtUi8O3JvrmwkbbilsBpHAy8lT9SRsCwaz4wzDTU_qfUwShv8XBSJLQ9snXv8eNaTlMGNhXSZJLvkMgSDrhvj0Oc1KTYJ0KMPahz6xd" style="-webkit-transform: rotate(0rad); border: none; transform: rotate(0rad);" width="400" /></span></div>
<div>
<span id="docs-internal-guid-c87ef2b6-16de-ff9d-44ad-a891f1273253"></span></div>
<div>
<span style="font-family: "cambria"; font-size: 14.6666666666667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: "cambria"; font-size: 14.6666666666667px; margin-left: 1em; margin-right: 1em; vertical-align: baseline; white-space: pre-wrap;"><img alt="spark-system-1.JPG" height="300" src="https://lh4.googleusercontent.com/iWXz-P81nBLUn1mereywx8qJdP5oudHYHlsCM2vOyuGIIdnXMMwo-A1LzJz-e3N8ceXvi94VBNklCIsj-xI07B_yaACKYeaHJAfwRdtF9_WnHcTkTBHGGJjgl87AluePRhbQMSMI" style="-webkit-transform: rotate(0rad); border: none; transform: rotate(0rad);" width="400" /></span></div>
<div>
<span id="docs-internal-guid-c87ef2b6-16df-80ed-b1dc-9f50f1854eeb"></span></div>
<div>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">You could adjust the potentiometers to change the 555’s output waveform, and this also changes the quality of the sparks.</span><br />
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">I have also tried connecting two ignition coils (in reverse-parallel configuration) to increase the output voltage. Based on the length of the spark gap and the dielectric breakdown voltage of air, I estimated the voltage to be somewhere around 60,000V! Be very careful when doing these experiments. Contrary to what you may want to believe, 60kV shocks don’t exactly feel pleasant (words of experience). I got lucky. Seriously, be very careful when working with high voltages. Carelessness could be fatal. Don’t get close to the spark gap or to any antenna connected to the transmitter.</span></div>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Anyway, here’s a video of my spark transmitter and coherer:</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/cGHLA3bQ4E8/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/cGHLA3bQ4E8?feature=player_embedded" width="320"></iframe></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">This transmitter can reliably trigger the coherer from a distance. I’m now thinking of ways to extend the range. Back in the day, when spark-transmitters were actually used for communication, people realized that adding a high voltage capacitor on the coil’s secondary could increase the gap current by orders of magnitude without changing the transmitter input power. See </span><a href="http://www.arrl.org/files/file/History/History%20of%20QST%20Volume%201%20-%20Technology/Kennedy%20N4GG.pdf" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">“How Spark Transmitter’s Work”</span></a><span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> by Hal Kennedy.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /><span style="font-size: 14.6666666666667px; vertical-align: baseline;">A tuning coil and capacitor could be added to the ignition coil’s secondary to form a tuned circuit. When the capacitor is fully charged, it will discharge through the tuning coil and spark gap which will cause the capacitor and tuning coil to resonate at their resonant frequency. This will reduce the bandwidth of the electromagnetic waves created from the sparks and increase the range of the transmissions.</span></span><br />
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6666666666667px; vertical-align: baseline;"><br /></span></span></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;"><img alt="spark-transmitter.png" height="400" src="https://lh6.googleusercontent.com/EMZWMytIDTS1sU3Rzav7BjhzjdCiLF3cUeXF8eBV0cfxm-8_g6EcKo6RdptkKiYhiT8EgCJl-Wa-5y3b3F7QSJ5vUiDd0YwyQGQ5o2n3QWRSXSUqZ729WD_qcIbN_PjffGvkE-Dz" style="-webkit-transform: rotate(0rad); border: none; margin-left: auto; margin-right: auto; transform: rotate(0rad);" width="357" /></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-size: 12.8000001907349px;">source: </span><a href="http://www.arrl.org/files/file/History/History%20of%20QST%20Volume%201%20-%20Technology/Kennedy%20N4GG.pdf" style="font-size: 12.8000001907349px;" target="_blank">“How Spark Transmitters Work”</a><span style="font-size: 12.8000001907349px;"> by Hal Kennedy</span></td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-size: 14.6666666666667px; margin-left: 1em; margin-right: 1em; vertical-align: baseline;"></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "cambria"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span id="docs-internal-guid-c87ef2b6-16e5-cfd7-cd5a-c437c4922079"><span style="font-family: "cambria"; font-size: 14.6666666666667px; vertical-align: baseline; white-space: pre-wrap;">By the way, when you have high voltage at your disposal, don’t miss the opportunity to make a Jacbob’s ladder, just like Dr. Frankenstein! </span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "cambria"; font-size: 14.6666666666667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span></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;"><img alt="P1030595.JPG" height="300" src="https://lh6.googleusercontent.com/rxIAtw9hHrDD9wYTcJpHnyatsJxzygBe-F295MQ11mFFMeIU-F97Z2ci9NsFTA0fakcn4Nxu0uO8NOEyVMqupyBpd4w0XzFM0c0BAjeRoKpDBH_4aNqg-5RG9keIMl3P4xh6mWdA" style="-webkit-transform: rotate(0rad); border: none; margin-left: auto; margin-right: auto; transform: rotate(0rad);" width="400" /></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><i style="font-size: 12.8000001907349px;">“It’s alive! It’s alive!”</i><span style="font-size: 12.8000001907349px;"> - Dr. Frankenstein</span></td></tr>
</tbody></table>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: "cambria"; font-size: 14.6666666666667px; margin-left: 1em; margin-right: 1em; vertical-align: baseline; white-space: pre-wrap;"></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span id="docs-internal-guid-c87ef2b6-16e6-0ca4-bfbc-ac8d0be75566"></span></div>
</div>
</div>
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/xos2MnVxe-c" width="420"></iframe>
</div>
</div>
Ashish Derhgawenhttp://www.blogger.com/profile/16949464781799641662noreply@blogger.com5tag:blogger.com,1999:blog-8143136393464413090.post-59822374091348910642015-06-23T10:49:00.001-06:002015-06-23T10:49:30.642-06:00Motion sensing water gun Tweets photos!<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="http://cdn.instructables.com/F7X/3R4W/IATHAAXC/F7X3R4WIATHAAXC.LARGE.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://cdn.instructables.com/F7X/3R4W/IATHAAXC/F7X3R4WIATHAAXC.LARGE.jpg" height="212" width="320" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
Hello folks! I haven't updated this blog in a long time. I am in San Francisco now, working at Punch Through Design (the makers of the amazing <a href="https://punchthrough.com/bean/" target="_blank">Lightblue Bean</a>). We have a lot of nerf wars happening in our office all the time, so I decided to bring office warfare to the next level by making a motion activated water gun that also takes pictures and <a href="https://twitter.com/lightbluebean" target="_blank">posts them on Twitter</a>. I modified the water gun (a motorized Super Soaker), and connected it to the Bean. A PIR sensor is used to detect motion.<div>
<br /></div>
<div>
I have used Node-RED and Python to link the Bean to a Twitter account. The Node-RED flow runs on a computer, and wirelessly monitors the Bean's serial output. If the Bean detects motion, the computer takes a picture, and uploads it to Twitter. The Node-RED server can also monitor the Twitter account for incoming direct messages. If I send a message with the correct password, I can enable or disable the system. This way I can turn the system off before I enter the office, and turn it on after I leave. It has been driving people crazy here, so I think this project is a success! Check out the <a href="http://www.instructables.com/id/Water-squirting-twitter-enabled-intruder-alarm/?ALLSTEPS" target="_blank">tutorial on Instructables</a> (be sure to vote for it if you like it)! :)</div>
</div>
Ashish Derhgawenhttp://www.blogger.com/profile/16949464781799641662noreply@blogger.com5tag:blogger.com,1999:blog-8143136393464413090.post-44898011652262818392011-05-09T09:00:00.013-06:002011-05-09T10:24:31.527-06:00Building a computer controlled wireless robot<span style="font-family:verdana;">For a long time, I have been trying to find the cheapest and easiest way to control electronic devices wirelessly using a computer. It can open up a lot of possibilities. For example, you could build a radio controlled <a href="http://ashishrd.blogspot.com/2007/01/parallel-port-relay-for-playing-with.html">relay board</a>, and control it from your computer. You could even control the board with a "small" computer such as an Arduino (or any microcontroller for that matter). If your Arduino has an <a href="http://www.nuelectronics.com/estore/index.php?main_page=product_info&cPath=1&products_id=4">Ethernet shield</a>, you could <a href="http://sheepdogguides.com/arduino/art5serv.htm">use it as a Web server</a> and control your relay board from anywhere in the world (as long as you have access to the Internet of course). There are many things that you could do without creating a mess with wires. I am mainly interested in this because I need a computer controlled wireless robot. A little background -</span><br /><br /><span style="font-family:verdana;">I have been working on a project at the Mobile Robotics Lab of IISc (Indian Institute of Science), Bangalore, in which I have to design a vision based obstacle avoidance algorithm for robots. What does that mean? Well, I basically have to design a robot that uses nothing but a small camera to identify obstacles in its path. Since image processing and computer vision stuff is usually quite CPU intensive, it is difficult to implement this code on a small robot. Small microcontrollers can't handle that stuff. So, the solution I came up with involves a wireless camera that transmits video to a nearby "big" computer. This big computer runs all the dirty computer vision codes, identifies the obstacles, and then somehow tells the robot how to avoid them. This is where wireless communication comes in.</span><br /><br /><span style="font-family:verdana;">To create a wireless link, you could rip the guts of a cheap RC car and use its transmitter and receiver to control your robot. That's one technique. I did <a href="http://ashishrd.blogspot.com/2007/02/computer-controlled-rc-car.html">something similar</a> a few years ago . This time, I wanted to do things a little more elegantly, without destroying an RC car. I found this really inexpensive RF transmitter/receiver pair at a local electronics shop in Bangalore:</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-sKJSRnM7so0/TcfjgVpLCHI/AAAAAAAAAas/jTD6-zLsKzk/s1600/tx-rx.jpg"><img style="cursor: pointer; width: 400px; height: 300px;" src="http://2.bp.blogspot.com/-sKJSRnM7so0/TcfjgVpLCHI/AAAAAAAAAas/jTD6-zLsKzk/s400/tx-rx.jpg" alt="" id="BLOGGER_PHOTO_ID_5604698405991024754" border="0" /></a><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-zv3T9FhXMeM/TcfjvzR-jiI/AAAAAAAAAa0/zpviuWcec10/s1600/DSC09282.JPG"><img style="cursor: pointer; width: 400px; height: 300px;" src="http://3.bp.blogspot.com/-zv3T9FhXMeM/TcfjvzR-jiI/AAAAAAAAAa0/zpviuWcec10/s400/DSC09282.JPG" alt="" id="BLOGGER_PHOTO_ID_5604698671644839458" border="0" /></a><br /><br /><span style="font-family:verdana;">They cost only 200 INR (about 4 USD)...both transmitter and receiver. What a steal!</span><br /><br /><span style="font-family:verdana;">You can also find these online at Sparkfun:</span><br /><br /><span style="font-family:verdana;">Transmitter - <a href="http://www.sparkfun.com/products/8945">http://www.sparkfun.com/products/8945</a></span> <span style="font-family:verdana;"><br />Receiver - <a href="http://www.sparkfun.com/products/8948">http://www.sparkfun.com/products/8948</a></span><br /><br /><span style="font-family:verdana;">They cost a little more on Sparkfun, but they're still inexpensive. The ones on Sparkfun operate at 315 Mhz, but the ones I have, operate at 434 Mhz (like <a href="http://www.sunrom.com/rf-wireless/rf-remote-control/rf-transmitter-433-mhz-for-remote-control">this</a> one). I don't think that would make any difference in how you connect them.<br /><br /></span><span style="font-family:verdana;">To use these cheap RF modules, you could either connect them directly to your microcontroller/computer, or connect them with the help of parallel - serial encoder/decoder ICs.</span><span style="font-family:verdana;"><br /><br />I used the <a href="http://www.ipic.co.jp/Pdffiles/ht12e.pdf">HT12E</a> (parallel to serial encoder) and the <a href="http://courses.cit.cornell.edu/ee476/FinalProjects/s2008/cl457_yft2/cl457_yft2/datasheets/HT12D.pdf">HT12D</a> (serial to parallel decoder) ICs. The HT12E is a 12 bit parallel to serial encoder. Of those 12 bits, 8 bits are the address code, and the remaining 4 bits are data. To send a signal, the address bits on the transmitter and receiver should be the same. It's like a password. You can use a single RF transmitter to control different RF receivers (at the same frequency) by configuring the address bits appropriately. All receivers would have to be set to different addresses. With 8 bits, you can create a total of 256 combinations.</span><br /><br /><span style="font-family:verdana;">Here's what the serial data coming out of the encoder looks like, in an oscilloscope:</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-RAxfPHRtJvo/TcfkFEIzxMI/AAAAAAAAAa8/5Xye_lwkWpE/s1600/oscilloscope.jpg"><img style="cursor: pointer; width: 400px; height: 149px;" src="http://1.bp.blogspot.com/-RAxfPHRtJvo/TcfkFEIzxMI/AAAAAAAAAa8/5Xye_lwkWpE/s400/oscilloscope.jpg" alt="" id="BLOGGER_PHOTO_ID_5604699036947039426" border="0" /></a><br /><br /><span style="font-family:verdana;">If you look closely, you'll notice that there are 13 peaks (instead of 12). I'm not sure what the first bit is for. (Probably a parity bit?) The 8 bits coming after the first bit make the address, and the last four make the data being sent.</span> <span style="font-family:verdana;">You connect your microcontroller's (or computer's) parallel output to the 4 input channels on the encoder. With 4 bits, you can create 16 unique commands. That is enough for my purpose.</span><br /><br /><span style="font-family:verdana;">For more on how to use these ICs with the Tx/Rx, check out this excellent article - <a href="http://www.botskool.com/tutorials/electronics/general-electronics/building-rf-remote-control">http://www.botskool.com/tutorials/electronics/general-electronics/building-rf-remote-control</a></span><br /><br /><span style="font-family:verdana;">Here's a flowchart of my system:</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-vylozJVVcqA/Tcf_dXuJtEI/AAAAAAAAAbU/pdFw4VfsEGA/s1600/rf-module-flowchart.png"><img style="cursor: pointer; width: 400px; height: 279px;" src="http://4.bp.blogspot.com/-vylozJVVcqA/Tcf_dXuJtEI/AAAAAAAAAbU/pdFw4VfsEGA/s400/rf-module-flowchart.png" alt="" id="BLOGGER_PHOTO_ID_5604729141334750274" border="0" /></a><br /><br /><span style="font-family:verdana;">I've connected an Arduino to my computer which acts as an interface between the encoder and my computer. Here's the Arduino that I'm using:</span><br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-geGTbzLPe8c/TcfkZaqD0II/AAAAAAAAAbE/83XieRlS7TM/s1600/Arduino.JPG"><img style="cursor: pointer; width: 400px; height: 300px;" src="http://2.bp.blogspot.com/-geGTbzLPe8c/TcfkZaqD0II/AAAAAAAAAbE/83XieRlS7TM/s400/Arduino.JPG" alt="" id="BLOGGER_PHOTO_ID_5604699386589466754" border="0" /></a><br /><br /><span style="font-family:verdana;">It's a <a href="http://shop.moderndevice.com/products/bbb-kit">ModernDevice BBB</a> Arduino Clone that I received from my friend <a href="http://www.arunet.co.uk/tkboyd/index2.htm">Tom Boyd</a>. I've been hooked to it ever since I got it! You should definitely get an Arduino if you don't already have one. It's the perfect tool for the programmer who enjoys playing with electronics. And it's also very easy and fun to use!<br /><br />Tom has some excellent tutorials on electronics and programming on his website that keeps inspiring me! Check out some of his awesome Arduino projects - <a href="http://sheepdogguides.com/arduino/ahttoc.htm">http://sheepdogguide</a></span><a href="http://sheepdogguides.com/arduino/ahttoc.htm"><span style="font-family:verdana;">cool</span></a><span style="font-family:verdana;"><a href="http://sheepdogguides.com/arduino/ahttoc.htm">s.com/arduino/ahttoc.htm</a>.</span><br /><br /><span style="font-family:verdana;">The robot I am using is a <a href="http://www.microbric.com/p/4179707/viper-robot-kit.html">Microbric Viper</a> robot that I received from Microbric a few years ago. The Microbric Viper comes with an IR module which can be used to communicate with a computer wirelessly. Although I've used it in the <a href="http://ashishrd.blogspot.com/2007/04/self-navigating-microbric-viper-robot_25.html">past</a>, it's kind of difficult to set up because infrared communication requires line-of-sight. Moreover, the range is quite limited.</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-rs-EaZDe5q4/Tcfkmg40_5I/AAAAAAAAAbM/dXiBZU_PQjg/s1600/Viper.jpg"><img style="cursor: pointer; width: 300px; height: 400px;" src="http://4.bp.blogspot.com/-rs-EaZDe5q4/Tcfkmg40_5I/AAAAAAAAAbM/dXiBZU_PQjg/s400/Viper.jpg" alt="" id="BLOGGER_PHOTO_ID_5604699611600322450" border="0" /></a><br /><br /><span style="font-family:verdana;">I'm not going to get into the details of connecting the encoders/decoders with the RF modules because it is already covered in detail in the article I mentioned earlier. I am however, going to share some difficulties I have faced in using these RF modules.</span><br /><br /><span style="font-family:verdana;">When I was testing the receiver on a breadboard, I was powering it with an AC to DC adapter. The voltage was fine, but the decoder did not work at all. Why? When I was debugging the circuit with an oscilloscope, I realized that the signal at the encoder side was fine, with 13 distinct peaks. However, when I checked the data at the receiver side, I realized that there was some sort of noise, and the peaks were not distinct. The address bits were too close together and sometimes even merging together. Since the address bits on the decoder side did not match with this noisy data, it rejected it. I figured that this noise could be caused by radio interference noise from the AC to DC adapter. So, I removed it and powered each of them (Tx and Rx) with two AA batteries.</span><br /><br /><span style="font-family:verdana;">The other thing I noticed is that if you connect the third pin of the RF receiver (which is either marked as "Data" or "CE") to the data-IN pin of the decoder , the circuit won't work. Leave it unconnected.</span><br /><br /><span style="font-family:verdana;">I'm using a 1/4 wave monopole antenna (6.8 inches) with the RF modules. It's just a single core wire. The range I get is amazing. I think I get about 100-120 ft (through walls), and 1000+ ft outside (line-of-sight)! More than enough for my purpose. When I test it outside, it just keeps working no matter how far I go. So, I don't really know its limit yet!</span><br /><br /><span style="font-family:verdana;">The Arduino communicates with my computer through a USB to Serial cable. If I want to make the robot move forward, I would send the character '1' to the Arduino. It would recognize this as a command and forward it to the transmitter. I can send four commands to the Arduino - '1', '2', '3' and '4'. On receiving these characters, it sets the appropriate data bits on the encoder and transmits the signal.</span><br /><br />Arduino code:<br /><br /><script type="syntaxhighlighter" class="brush: csharp"><![CDATA[<br />//Digital pins 2-5 are connected to pins A8-A11 of the HT12E encoder<br /><br />//Digital pin 6 is connected to the Transmit Enable (TE) pin of HT12E<br /><br /><br /><br />int serialInput = 0;<br /><br /><br /><br />int ledPin = 13;<br /><br /><br /><br />void setup()<br /><br />{<br /><br /> Serial.begin(9600);<br /><br /> pinMode(2, OUTPUT); //connected to A8 of HT123<br /><br /> pinMode(3, OUTPUT); //connected to A9 of HT123<br /><br /> pinMode(4, OUTPUT); //connected to A10 of HT123<br /><br /> pinMode(5, OUTPUT); //connected to A11 of HT123<br /><br /> pinMode(6, OUTPUT); //connected to TE pin (Transmit Enable) of HT12E<br /><br /> pinMode(ledPin, OUTPUT);<br /><br /> <br /><br /> digitalWrite(6, HIGH); //TE pin high (disable transmit) <br /><br />}<br /><br /><br /><br />void loop()<br /><br />{<br /><br /> if (Serial.available())<br /><br /> {<br /><br /> digitalWrite(ledPin, HIGH);<br /><br /> int serialInput = Serial.read();<br /><br /> <br /><br /> switch(serialInput)<br /><br /> {<br /><br /> case '1':<br /><br /> PORTD = B00000100;<br /><br /> delay(250);<br /><br /> break;<br /><br /> <br /><br /> case '2':<br /><br /> PORTD = B00001000;<br /><br /> delay(250);<br /><br /> break;<br /><br /> <br /><br /> case '3':<br /><br /> PORTD = B00010000;<br /><br /> delay(250);<br /><br /> break;<br /><br /> <br /><br /> case '4':<br /><br /> PORTD = B00100000;<br /><br /> delay(250);<br /><br /> break; <br /><br /> }<br /><br /> <br /><br /> digitalWrite(6, HIGH); //TE pin high (disable transmit) <br /><br /> <br /><br /> digitalWrite(ledPin, LOW);<br /><br /> }<br /> <br /><br />}<br />]]></script><br /><span style="font-family:verdana;">On Windows, I use a C# application to send these commands to the Arduino. On Linux, I just use the terminal. My Arduino shows up as /dev/ttyUSB0. To send the command '1', I write...</span><br /><br /><span style="font-family:courier new;">echo -n "1" > /dev/ttyUSB0</span><br /><br /><span style="font-family:verdana;">This makes the robot move forward.</span> <span style="font-family:verdana;">For a more interactive session, you can use the screen command:</span><br /><br /><span style="font-family:courier new;">screen /dev/ttyUSB0 9600</span><br /><br /><span style="font-family:verdana;">More on this here - <a href="http://www.arduino.cc/playground/Interfacing/LinuxTTY">http://www.arduino.cc/playground/Interfacing/LinuxTTY</a></span><br /><br /><span style="font-family:verdana;">And finally, the thing you were probably waiting for...a video! -</span><br /><br /><iframe src="http://www.youtube.com/embed/XCPWYiKda0I" allowfullscreen="" width="425" frameborder="0" height="349"></iframe><br /><br /><span style="font-family:verdana;">I hope you enjoyed this post. My next step would be to put a wireless camera on this robot and test my obstacle avoidance algorithm. Wish me luck.</span><br /><br /><span style="font-family:verdana;">I hope the information I've shared helps you build your own radio controlled electronic devices and robots!</span><br /><br /><span style="font-family:verdana;">So what did you think? I'd love to hear your feedback in the section below.</span><br /><br /><span style="font-family:verdana;">Ashish</span>Ashish Derhgawenhttp://www.blogger.com/profile/16949464781799641662noreply@blogger.com136tag:blogger.com,1999:blog-8143136393464413090.post-84392420038221154912010-02-12T22:49:00.016-07:002011-05-10T02:22:18.167-06:00Homemade USB interface board using a PIC<span style="font-size:100%;"><span style="font-family:arial;">Hello folks,<br />
<br />
Here's what I've been working on for the last couple of weeks:</span> <span style="font-family:arial;"><br />
<br />
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_R7o3lst9P4U/S3Zbb5il9nI/AAAAAAAAAYg/MsThk6IqUEg/s1600-h/18f4550_board.jpg"><img style="cursor: pointer; width: 400px; height: 300px;" src="http://1.bp.blogspot.com/_R7o3lst9P4U/S3Zbb5il9nI/AAAAAAAAAYg/MsThk6IqUEg/s400/18f4550_board.jpg" alt="" id="BLOGGER_PHOTO_ID_5437634134956963442" border="0" /></a><br />
</span> <span style="font-family:arial;"><br />
<br />
This is a USB interface board I've built around a PIC 18f4550 microcontroller from Microchip. As many of you probably know, I've used my computer's parallel port to connect many things to my computer. However, most laptops don't have parallel ports these days, so I needed a way to connect things without a parallel port. This board does exactly that (and actually much, much more). I found a really nice tutorial on building this board here - <a href="http://eegeek.net/content/view/13/32/">http://eegeek.net/content/view/13/32/</a></span> <span style="font-family:arial;"><br />
<br />
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_R7o3lst9P4U/S3ZTB7oD9zI/AAAAAAAAAYY/efnit-tzCIA/s1600-h/18f4550_usb_proto_basic.png"><img style="cursor: pointer; width: 400px; height: 251px;" src="http://3.bp.blogspot.com/_R7o3lst9P4U/S3ZTB7oD9zI/AAAAAAAAAYY/efnit-tzCIA/s400/18f4550_usb_proto_basic.png" alt="" id="BLOGGER_PHOTO_ID_5437624892747151154" border="0" /></a><br />
<br />
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_R7o3lst9P4U/S3ZclhWUz8I/AAAAAAAAAYo/3Qj-rgljAbY/s1600-h/18f4550_bboard.jpg"><img style="cursor: pointer; width: 400px; height: 300px;" src="http://3.bp.blogspot.com/_R7o3lst9P4U/S3ZclhWUz8I/AAAAAAAAAYo/3Qj-rgljAbY/s400/18f4550_bboard.jpg" alt="" id="BLOGGER_PHOTO_ID_5437635399773376450" border="0" /></a><br />
<br />
You can make your C#, VB, C++ programs communicate with the chip using the open-source <a href="http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2680&dDocName=en537044">MCHPFSUSB Framework</a> from Microchip, or the Window's HID drivers. The framework comes with lots of samples to get you started.</span><br />
<br />
<span style="font-family:arial;">I've put a bootloader on the chip for the sake of convenience. With a bootloader, you don't have to take the chip off the board and put it in a separate programmer for programming. I have to sometimes re-program the chip every 10-15 minutes during development (especially when there's a hard to find bug), and the bootloader really makes it easy.<br />
<br />
No project is compete until you record a video! So here's one:</span> <span style="font-family:arial;"><br />
<br />
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/tNxBJbiav8Y&hl=en_US&fs=1&"><param name="allowFullScreen" value="true"><param name="allowscriptaccess" value="always"><embed src="http://www.youtube.com/v/tNxBJbiav8Y&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object><br />
<br />
Please excuse the background noise in the video. There was some construction work going on while I was recording this. Anyway, I'm using the board to control some LEDs, a servo, and reading the value of a potentiometer. Controlling the servo was the trickiest part because servo's are sensitive to timing. They expect to receive a pulse every 20 ms, and the duration of the pulse determines how much they will turn. The length of the pulse usually varies between 1-2 ms. Setting up the timers on the chip to work properly was a bit challenging, but I finally got it working. This sound card based oscilloscope really helped! - <a href="http://www.zeitnitz.de/Christian/scope_en">http://www.zeitnitz.de/Christian/scope_en</a>.<br />
<br />
Hope you enjoyed this post. I will be using this board in future projects. Keep checking!<br />
</span><a href="http://www.zeitnitz.de/Christian/scope_en"> </a> </span>Ashish Derhgawenhttp://www.blogger.com/profile/16949464781799641662noreply@blogger.com28tag:blogger.com,1999:blog-8143136393464413090.post-20234991996592689072010-01-28T11:42:00.022-07:002011-01-03T00:25:56.286-07:00Adding a small HD44780 LCD display to my PC<span style="font-family:arial;">I've always felt the need to have a small screen on my computer to show some "extra" information which I don't usually want on my screen all the time. By extra information I mean - news headlines, RSS feeds from my favorite blogs, weather updates, CPU usage information, new e-mail notifications, etc. So, to fulfill this humble need of mine, I bought a small (16x2 character) LCD screen for Rs.90 (approximately USD $2). Very inexpensive!:</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_R7o3lst9P4U/S2HOHCFsExI/AAAAAAAAAXg/T41rQQp5FJA/s1600-h/DSC08074.jpg"><img style="WIDTH: 400px; HEIGHT: 300px; CURSOR: pointer" id="BLOGGER_PHOTO_ID_5431849245800665874" border="0" alt="" src="http://4.bp.blogspot.com/_R7o3lst9P4U/S2HOHCFsExI/AAAAAAAAAXg/T41rQQp5FJA/s400/DSC08074.jpg" /></a><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_R7o3lst9P4U/S2HPIIGKr8I/AAAAAAAAAYA/2xEzFkB7s2A/s1600-h/DSC08143.JPG"><img style="WIDTH: 400px; HEIGHT: 300px; CURSOR: pointer" id="BLOGGER_PHOTO_ID_5431850364104781762" border="0" alt="" src="http://2.bp.blogspot.com/_R7o3lst9P4U/S2HPIIGKr8I/AAAAAAAAAYA/2xEzFkB7s2A/s400/DSC08143.JPG" /></a><br /><span style="font-family:arial;">(I've received an e-mail from <a href="http://www.sheepdogsoftware.co.uk/">TK Boyd</a>! He's the man who inspired me to connect all sorts of things to my computer!)</span><br /><br /><span style="font-family:arial;">This LCD is based on the popular Hitachi HD44780 controller. You can find lots of information about how to communicate with this LCD on the Internet. I connected it to my computer's parallel port and fixed it to my computer's case:</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_R7o3lst9P4U/S2HOp9Vlz_I/AAAAAAAAAXo/qQ2OxFHqFgg/s1600-h/DSC08103.jpg"><img style="WIDTH: 400px; HEIGHT: 300px; CURSOR: pointer" id="BLOGGER_PHOTO_ID_5431849845820608498" border="0" alt="" src="http://4.bp.blogspot.com/_R7o3lst9P4U/S2HOp9Vlz_I/AAAAAAAAAXo/qQ2OxFHqFgg/s400/DSC08103.jpg" /></a><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_R7o3lst9P4U/S2HOqLt8_II/AAAAAAAAAXw/SMh94XlzD1M/s1600-h/DSC08113.jpg"><img style="WIDTH: 400px; HEIGHT: 300px; CURSOR: pointer" id="BLOGGER_PHOTO_ID_5431849849680886914" border="0" alt="" src="http://4.bp.blogspot.com/_R7o3lst9P4U/S2HOqLt8_II/AAAAAAAAAXw/SMh94XlzD1M/s400/DSC08113.jpg" /></a><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_R7o3lst9P4U/S2HOqi5mc-I/AAAAAAAAAX4/s-fBT2rQeI8/s1600-h/DSC08146.JPG"><img style="WIDTH: 400px; HEIGHT: 300px; CURSOR: pointer" id="BLOGGER_PHOTO_ID_5431849855903757282" border="0" alt="" src="http://4.bp.blogspot.com/_R7o3lst9P4U/S2HOqi5mc-I/AAAAAAAAAX4/s-fBT2rQeI8/s400/DSC08146.JPG" /></a><br /><br /><span style="font-family:arial;">I created this panel by drilling holes into the case, and adding two switches (for the LCD and backlight), and a pot for contrast adjustment. The LCD is powered by 5V from the SMPS.</span><br /><br /><span style="font-family:arial;">Here is the pinout for the LCD:</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_R7o3lst9P4U/S2HFqb_PWrI/AAAAAAAAAWo/XfWJ6wUeNuw/s1600-h/LCD16_PINOUT_.JPG"><img style="WIDTH: 290px; HEIGHT: 400px; CURSOR: pointer" id="BLOGGER_PHOTO_ID_5431839958443711154" border="0" alt="" src="http://4.bp.blogspot.com/_R7o3lst9P4U/S2HFqb_PWrI/AAAAAAAAAWo/XfWJ6wUeNuw/s400/LCD16_PINOUT_.JPG" /></a><br /><br /><span style="font-family:arial;">DB0-DB7 is the data bus.</span><br /><br /><span style="font-family:arial;">'E' is the enable line. This is used to indicate the start of a transmission of a data byte to the LCD controller. When we start a transmission, this line is brought high. When transmission is complete, this line is brought low.</span><br /><br /><span style="font-family:arial;">'RS' is the register select line. This line indicates to the LCD controller whether the data byte is to be treated as a command or as text data to be displayed on the screen. If it is high, the data sent to the LCD displayed on the screen. If it is low, the data is treated as a command.</span><br /><br /><span style="font-family:arial;">'R/W' is the read/write line. If it is low, information can be written to the LCD controller. If it is high, data can be read from the LCD. I've kept it permanently low in my circuit.</span><br /><br /><span style="font-family:arial;">Here's a screenshot from the HD44780's datasheet (click on the image to enlarge it):</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_R7o3lst9P4U/S2HHrIhMi2I/AAAAAAAAAXA/BfnVgbROCyw/s1600-h/44780_datasheet2.JPG"><img style="WIDTH: 393px; HEIGHT: 400px; CURSOR: pointer" id="BLOGGER_PHOTO_ID_5431842169420548962" border="0" alt="" src="http://4.bp.blogspot.com/_R7o3lst9P4U/S2HHrIhMi2I/AAAAAAAAAXA/BfnVgbROCyw/s400/44780_datasheet2.JPG" /></a><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_R7o3lst9P4U/S2HIS9RAS_I/AAAAAAAAAXI/nQQbcPWSbeM/s1600-h/datasheet3.JPG"><img style="WIDTH: 400px; HEIGHT: 153px; CURSOR: pointer" id="BLOGGER_PHOTO_ID_5431842853594614770" border="0" alt="" src="http://3.bp.blogspot.com/_R7o3lst9P4U/S2HIS9RAS_I/AAAAAAAAAXI/nQQbcPWSbeM/s400/datasheet3.JPG" /></a><br /><br /><div style="TEXT-ALIGN: center"><br /></div><span style="font-family:arial;">So, this is how a typical command would be executed:</span><br /><ol style="FONT-FAMILY: arial"><li>Make 'RS' and 'R/W' low ('R/W' is always low in my circuit).<br /></li><li>Set 'E' high to indicate the start of the command.</li><li>Make DB7-DB0 equal to binary "00000001" (decimal: 1). This is the clear display command.<br /></li><li>Make 'E' low again to execute the command (which in this case would clear the display).</li></ol><span style="font-family:arial;">In code, this would look like:</span><br /><br /><script type="syntaxhighlighter" class="brush: csharp"><![CDATA[<br />//Make RS low (this is a command), and E high<br />PortAccess.Output(control, 0);<br /><br />//Set data pins on parallel port<br />PortAccess.Output(data, 1);<br /><br />//Make E low<br />PortAccess.Output(control, 1);<br /><br />//Give the LCD controller some time to process the command<br />Thread.Sleep(1);<br />]]></script><br /><span style="font-family:arial;">I'm using <a href="http://logix4u.net/Legacy_Ports/Parallel_Port/Inpout32.dll_for_Windows_98/2000/NT/XP.html">Inpout32</a> to access my parallel port. Another point I should mention here is that the 'E' pin on my LCD is connected to C0 on my parallel port and 'RS' is connected to C2. A weird thing I noticed about C0 is that you have to send "1" to it to make it low (and vice versa). This is why I'm</span> <span style="font-family:arial;">sending "1" in the last line of the the code. I have no idea why this is happening. Have any clues?</span><br /><br /><span style="font-family:arial;">To write characters on the LCD, you just have to send the ASCII code of the character to the LCD:</span><br /><br /><script type="syntaxhighlighter" class="brush: csharp"><![CDATA[<br />char char1 = 'A';<br /><br />//Make RS high (this is not a command), and E high<br />PortAccess.Output(control, 4);<br /><br />//Send the ASCII code of 'A' (= 65)<br />PortAccess.Output(data, (int)char1);<br /><br />//Make E low<br />PortAccess.Output(control, 5);<br /><br />Thread.Sleep(1);<br />]]></script><br /><span style="FONT-WEIGHT: bold;font-family:arial;" >Creating custom characters:</span><br /><span style="font-family:arial;"><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_R7o3lst9P4U/S2HPdwQR8SI/AAAAAAAAAYI/QnSr3p6fTvA/s1600-h/DSC08149.JPG"><img style="WIDTH: 400px; HEIGHT: 300px; CURSOR: pointer" id="BLOGGER_PHOTO_ID_5431850735661871394" border="0" alt="" src="http://4.bp.blogspot.com/_R7o3lst9P4U/S2HPdwQR8SI/AAAAAAAAAYI/QnSr3p6fTvA/s400/DSC08149.JPG" /></a><br /><br /><span style="font-family:arial;">Most characters on the LCD (I think there are a total of 248) are stored in what's called a CGROM. This</span> <span style="font-family:arial;">is an acronym for "Character Generator Read Only Memory". Characters inside this memory location are</span> <span style="font-family:arial;">pre-defined, and cannot be changed. So how do we create our own characters if we can't change </span><span style="font-family:arial;">anything here? Well, there's a 64-byte hunk of RAM called CGRAM in the LCD, and it is write-able! </span><span style="font-family:arial;">Characters on an LCD can be up to 8 pixels high, and 5 pixels wide. Each row consumes 1 byte of</span> <span style="font-family:arial;">memory. Since there are 8 rows, one character takes up 8 bytes. So, a total of 8 custom characters </span><span style="font-family:arial;">can be defined in 64 bytes. Here's the pixel map of a bell pattern I created:</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_R7o3lst9P4U/S2HJMZ_KIaI/AAAAAAAAAXQ/CITyWCDAi-0/s1600-h/bell.JPG"><img style="WIDTH: 332px; HEIGHT: 243px; CURSOR: pointer" id="BLOGGER_PHOTO_ID_5431843840556933538" border="0" alt="" src="http://3.bp.blogspot.com/_R7o3lst9P4U/S2HJMZ_KIaI/AAAAAAAAAXQ/CITyWCDAi-0/s400/bell.JPG" /></a><br /><br /><span style="font-family:arial;">I have written the decimal and hex values for each row. To store this custom character in the CGRAM, </span><span style="font-family:arial;">I would have to go to the CGRAM address (see the "Set CGRAM address" command in the datasheet) and</span> <span style="font-family:arial;">write these values. The address of the first byte of the first character is 64 (hex: 0x40). How in the world did </span><span style="font-family:arial;">I get that value? Well if you look at the command for setting the CGRAM address in the datasheet, </span><span style="font-family:arial;">it says we have to set DB6 to "1". The rest of the bits, DB0-DB5, determine the CGRAM address. If we</span> <span style="font-family:arial;">were to set DB0 to DB5 "0", we would be able to set the first first byte of the first character. The </span><span style="font-family:arial;">complete command would be binary "1000000" (DB6-DB0). This is equal to 64 in decimal. Similarly, the</span> <span style="font-family:arial;">address of the first bye of the second character would be 64 + 8 = 72 (remember each character </span><span style="font-family:arial;">consumes 8 bytes).</span><br /><br /><span style="font-family:arial;">Here's a code sample to draw this bell character on the LCD:<br /><br /><script type="syntaxhighlighter" class="brush: csharp"><![CDATA[<br />int[] bellBytes = { 4, 14, 14, 14, 31, 0, 4, 0 };<br /><br />//Set CGRAM address<br />PortAccess.Output(control, 0);<br />PortAccess.Output(data, 64);<br />PortAccess.Output(control, 1); Thread.Sleep(1);<br /><br />//Write character data<br />for (int i = 0; i < bellBytes.Length; i++)<br />{<br /> PortAccess.Output(control, 4); <br /> PortAccess.Output(data, bellBytes[i]);<br /> PortAccess.Output(control, 5);<br /> Thread.Sleep(1);<br />}<br /><br />//Set DDRAM address<br />PortAccess.Output(control, 0);<br />PortAccess.Output(data, 128);<br />PortAccess.Output(control, 1); Thread.Sleep(1);<br /><br />//Display custom character<br />PortAccess.Output(control, 4); <br />PortAccess.Output(data, 0);<br />PortAccess.Output(control, 5);<br />Thread.Sleep(1);<br /><br />]]></script><br /></span><br /><span style="font-family:arial;">I need to do some explaining here! Well, first we define the bytes for the bell character in an</span> <span style="font-family:arial;">array. Then we set the CGRAM address to 64 (first byte of the first custom character). Then we write</span> <span style="font-family:arial;"> the values in the array to the CGRAM in the for-loop. Notice that we don't have to set the </span><span style="font-family:arial;">CGRAM address every time we have to go to a different byte (65,66,67 etc). The LCD controller auto</span> <span style="font-family:arial;">increments the CGRAM address everytime we write a byte. </span><span style="font-family:arial;">To display this newly created character, we first have to switch back from the CGRAM to the display</span> <span style="font-family:arial;">area. We do this by setting the DDRAM address to 128 (first character of the first line). 129 would</span> <span style="font-family:arial;">be the second character, and so on. The second line starts at DDRAM address 192.</span><span style="font-family:arial;"> We display the</span> <span style="font-family:arial;">custom character by displaying ASCII code "0". ASCII codes 0 through 7 are for custom characters. </span><span style="font-family:arial;">They normally serve as control codes for marking the beginning of a serial transmission, but since</span> <span style="font-family:arial;">these have no meaning to an LCD module, the designers reserved them for CGRAM characters. It took me</span> <span style="font-family:arial;">a long time to figure that out!</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_R7o3lst9P4U/S2HJobOhqVI/AAAAAAAAAXY/MBXavQuBYLc/s1600-h/base_address.JPG"><img style="WIDTH: 228px; HEIGHT: 225px; CURSOR: pointer" id="BLOGGER_PHOTO_ID_5431844321926162770" border="0" alt="" src="http://2.bp.blogspot.com/_R7o3lst9P4U/S2HJobOhqVI/AAAAAAAAAXY/MBXavQuBYLc/s400/base_address.JPG" /></a><br /><br />I find it convenient to create custom characters on a sheet of graph paper before I begin coding:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_R7o3lst9P4U/S2HQRAoJvCI/AAAAAAAAAYQ/HBKrUf-LIcY/s1600-h/DSC08132.JPG"><img style="WIDTH: 400px; HEIGHT: 300px; CURSOR: pointer" id="BLOGGER_PHOTO_ID_5431851616230292514" border="0" alt="" src="http://1.bp.blogspot.com/_R7o3lst9P4U/S2HQRAoJvCI/AAAAAAAAAYQ/HBKrUf-LIcY/s400/DSC08132.JPG" /></a><br /><br /><span style="FONT-WEIGHT: bold;font-family:arial;" >A note on creating animations:</span><br /><br /><span style="font-family:arial;">You can create animation by rapidly printing custom characters. If you have a custom character on your LCD, and you modify it's bytes by going to the CGRAM, the character will change. In fact, all occurrences of that character will change. Here's another cool thing. You can create more frames for your animation than the eight character limit. This is because you can load new bit patterns from your computer without having to store it in the LCD's memory. Neat!</span><br /><br /><span style="font-family:arial;">This post is getting long, so I'll end my discourse here. :) My LCD project is a WIP right now. I'm still adding more features. Anyway, I hope you find this post helpful in your projects. Have fun!</span><br /></span><br /><span style="font-family:arial;"><br />Links:<br /><br /><a href="http://home.iae.nl/users/pouweha/lcd/lcd0.shtml">How to control a HD44780-based Character-LCD</a><br /><br /><a href="http://www.dinceraydin.com/lcd/custom.htm">Defining Custom Characters</a><br /><br /><a href="http://www.8051projects.net/lcd-interfacing/lcd-custom-character.php">Creating custom characters tutorial</a><br /><br /><a href="http://www.codeproject.com/KB/cs/cspplcds.aspx">CodeProject article on controlling LCDs using C#</a><br /></span><br /><strong></strong><strong></strong><strong></strong>Ashish Derhgawenhttp://www.blogger.com/profile/16949464781799641662noreply@blogger.com20tag:blogger.com,1999:blog-8143136393464413090.post-3982555418071579182009-07-27T08:59:00.013-06:002011-05-10T02:24:05.461-06:00Reed Switch Motor and Parallel Port Tachometer<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/1lB3NvehdOM&hl=en&fs=1&color1=0x2b405b&color2=0x6b8ab6"><param name="allowFullScreen" value="true"><param name="allowscriptaccess" value="always"><embed src="http://www.youtube.com/v/1lB3NvehdOM&hl=en&fs=1&color1=0x2b405b&color2=0x6b8ab6" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object><br />
<br />
Hello readers! I'm posting a project here after quite some time. After moving to Bangalore, I had slowed down. Well, now I am building stuff again so I'll be posting much more often!<br />
<br />
A few days ago, my brother <a href="http://amritd.blogspot.com/">Amrit Derhgawen</a>, cousin Anand Karpatne, and I decided to make a simple reed switch motor. My brother is a character animator at DreamWorks, but he also happens to be good with electronic things. So, after a few hours of construction and troubleshooting, he finally got the motor working. JOY!<br />
<br />
A reed switch motor consists of a rotor made up of 2 (or 4) permanent magnets. An electromagnet and reed switch are placed close to the rotor on opposite sides. I got my electromagnet by stripping a relay. When a magnet on the rotor gets close to the reed switch, the reed switch gets magnetized and allows current to pass through and turn on the electromagnet. The electromagnet pushes the magnet closest to it, and makes the rotor turn. The electromagnet is switched off when there is no magnet close to the reed switch, and this allows the rotor to spin freely from inertia. When the other magnet gets in working range of the reed switch, the electromagnet pushes again.<br />
<br />
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_R7o3lst9P4U/Sm3LeRd51-I/AAAAAAAAAWU/-hd-crgPiQk/s1600-h/reed-switch-motor.gif"><img style="cursor: pointer; width: 400px; height: 213px;" src="http://2.bp.blogspot.com/_R7o3lst9P4U/Sm3LeRd51-I/AAAAAAAAAWU/-hd-crgPiQk/s400/reed-switch-motor.gif" alt="" id="BLOGGER_PHOTO_ID_5363166452213471202" border="0" /></a><br />
<br />
After making the motor, I decided to measure it's RPM (Revolutions Per Minute) using my computer for the fun of it. So, I connected another reed switch to my computer's parallel port as shown here:<br />
<br />
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_R7o3lst9P4U/Sm3CM1bWyaI/AAAAAAAAAV8/1rqXzkFchIc/s1600-h/Connection.gif"><img style="cursor: pointer; width: 320px; height: 155px;" src="http://1.bp.blogspot.com/_R7o3lst9P4U/Sm3CM1bWyaI/AAAAAAAAAV8/1rqXzkFchIc/s320/Connection.gif" alt="" id="BLOGGER_PHOTO_ID_5363156257024166306" border="0" /></a><br />
<br />
By default, status port 7 (S7) is high on my computer. When a magnet comes close to the reed switch, S7 becomes low. I placed this reed switch very close to the motor's rotor. The software is a C# Console Application which uses <a href="http://logix4u.net/Legacy_Ports/Parallel_Port/Inpout32.dll_for_Windows_98/2000/NT/XP.html">Inpout32.dll</a> to read the parallel port. For about every 60 revolutions of the motor, it estimates its RPM.<br />
<br />
The motor usually spins at around 3000 to 4000 RPM depending on voltage. Here is a graph I generated using values from the program:<br />
<br />
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_R7o3lst9P4U/Sm3tnCtrrvI/AAAAAAAAAWc/X2ks1K2bj5k/s1600-h/motor-chart.jpg"><img style="cursor: pointer; width: 400px; height: 263px;" src="http://3.bp.blogspot.com/_R7o3lst9P4U/Sm3tnCtrrvI/AAAAAAAAAWc/X2ks1K2bj5k/s400/motor-chart.jpg" alt="" id="BLOGGER_PHOTO_ID_5363203986267287282" border="0" /></a><br />
<br />
I turned the motor off and on 3 times quickly, and also played with the voltage. You can see all this in the graph!<br />
<br />
Do watch the video to see it in action!<br />
<br />
For more information on how to make reed switch motors, check out this wonderful tutorial - <a href="http://www.simplemotor.com/rsmotor.htm">http://www.simplemotor.com/rsmotor.htm</a>.<br />
<br />
Cheers,<br />
Ashish :)Ashish Derhgawenhttp://www.blogger.com/profile/16949464781799641662noreply@blogger.com15tag:blogger.com,1999:blog-8143136393464413090.post-50834604095291531232008-07-11T22:26:00.009-06:002011-05-31T09:56:52.358-06:00A new place, a new beginning...My family has just moved from Delhi to Bangalore after a tiring 36 hour train journey. Wow..can you even believe that? That's the longest I've ever been on a train! Our movers haven't arrived yet, and our apartment is pretty much empty. There's no refrigerator, no TV, and no bed to sleep on! Well, hopefully everything should arrive within a day or two. The weather here is so much better compared to Delhi (which was very hot and humid when we left).<br />
<br />
Moving can be stressful, especially since you have to part with lots of people and friends. Thankfully, this isn't anything new to me as I've always been wandering and on the move. If I remember correctly, I've moved a total of 10 times across 2 countries (U.S. and India), and 6 cities in the 20 years of my existence in this life. I wonder what's after Bangalore! :)Ashish Derhgawenhttp://www.blogger.com/profile/16949464781799641662noreply@blogger.com22tag:blogger.com,1999:blog-8143136393464413090.post-33754457076031550952008-04-11T10:48:00.010-06:002011-05-31T09:57:33.907-06:00Coding4Fun: Webcam Based Laser Tracking for Human-Computer Interaction<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href=""><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer;" src="http://1.bp.blogspot.com/_R7o3lst9P4U/R_-ln7agHhI/AAAAAAAAAOs/LX1thQZZpkw/s200/dfjshpww_104g57b4rgc.jpg" alt="" id="BLOGGER_PHOTO_ID_5188047401136430610" border="0" /></a><br />
Here's a new Coding4Fun article I did -<a href="http://blogs.msdn.com/coding4fun/archive/2008/04/10/8377477.aspx"> </a><a href="http://blogs.msdn.com/coding4fun/archive/2008/04/10/8377477.aspx">Webcam Based Laser Tracking for Human-Computer Interaction</a>.<br />
<blockquote>In this article, we will put together a program which will allow us to move the mouse cursor on our computers with a laser pointer, and even generate mouse clicks using only a webcam for computer vision. </blockquote><br />
You can also use it for impressing your friends by drawing things on your computer with a laser.<br />
<br />
Enjoy! :)Ashish Derhgawenhttp://www.blogger.com/profile/16949464781799641662noreply@blogger.com17tag:blogger.com,1999:blog-8143136393464413090.post-4208279367337902312008-03-16T11:55:00.012-06:002011-05-31T09:57:57.005-06:00Laser Tracking with webcam for Human-Computer Interaction<object height="355" width="425"><param name="movie" value="http://www.youtube.com/v/ggsqsDXyiR0&hl=en"><param name="wmode" value="transparent"><embed src="http://www.youtube.com/v/ggsqsDXyiR0&hl=en" type="application/x-shockwave-flash" wmode="transparent" height="355" width="425"></embed></object><br />
<br />
This post should have been written two months ago, in January, but with all sorts of things keeping me busy, I just couldn't get enough time to shoot videos and write about the project. Anyway, now that I do have time (and a video), here's what the whole thing's about: While writing an email to <a href="http://www.hanselman.com/blog/">Scott Hanselman</a> on January 29th, 2007, I thought - Wouldn't it be cool if I could control my mouse cursor with a laser pointer, and even draw things with it. I had tried doing <a href="http://ashishrd.blogspot.com/2006/12/lasersketch-doodling-with-lasers.html">something similar</a> in 2006, but it had some serious speed issues. This time, after rewriting the code and introducing some neat image processing techniques, the code is much faster than before. I was surprised that I had a working prototype within 3-4 days of coding.<br />
<br />
The idea is pretty much similar to Johnny Lee's <a href="http://www.cs.cmu.edu/%7Ejohnny/projects/wii/">Wii Whiteboard</a> project, except that I'm using a webcam instead of a Nintendo Wii remote. The program uses the webcam to track a laser dot in its FOV. With a projector, you can select its projected area, and the program would map its coordinates to your screen. Then, for opening a file, you'd just have to point on the file with a laser pointer and your computer would open it for you!<br />
<br />
Oh, and by the way, while sending my next email to Scott, I didn't use a mouse for clicking the "Send" button. :)<br />
<br />
<span style="font-style: italic;">Source code and details coming soon!</span><br />
<br />
Cheers,<br />
AshishAshish Derhgawenhttp://www.blogger.com/profile/16949464781799641662noreply@blogger.com49tag:blogger.com,1999:blog-8143136393464413090.post-20821552847091011862008-02-23T08:49:00.010-07:002008-11-12T21:30:08.860-07:00Having fun with Phidgets!<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_R7o3lst9P4U/R8BWYEOReYI/AAAAAAAAAOQ/9WR0aCfw8Fk/s1600-h/Phidgts-PanTilt.jpg"><img style="cursor: pointer;" src="http://4.bp.blogspot.com/_R7o3lst9P4U/R8BWYEOReYI/AAAAAAAAAOQ/9WR0aCfw8Fk/s400/Phidgts-PanTilt.jpg" alt="" id="BLOGGER_PHOTO_ID_5170227343671785858" border="0" /></a><br /><span style="font-style: italic;">(Click image to enlarge)</span><br /><br />I've just got a <a href="http://www.trossenrobotics.com/store/p/3137-Pan-and-Tilt-Kit.aspx">Lynxmotion - Pan and Tilt Kit</a> from <a href="http://www.phidgets.com/">Phidgets</a> (thanks to Microsoft!). The kit comes with two servos, a pan/tilt assembly, a <span id="ctl40_Desc1_lblLongDescription"><a href="http://www.phidgets.com/products.php?product_id=1001">Phidgets USB 4-Servo Controller</a>, and lots of fun. :) The Phidgets controller connects to a USB port, and can control up to four servos simultaneously.<br /><br /></span><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.phidgets.com/images/1001.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px;" src="http://www.phidgets.com/images/1001.jpg" alt="" border="0" /></a>Here's a video - I'm controlling the pan/tilt of my webcam with a mouse:<br /><br /><object height="355" width="425"><param name="movie" value="http://www.youtube.com/v/gDLwBgZjkJU&rel=1"><param name="wmode" value="transparent"><embed src="http://www.youtube.com/v/gDLwBgZjkJU&rel=1" type="application/x-shockwave-flash" wmode="transparent" height="355" width="425"></embed></object><br /><br />I am really impressed by how easy it is to program and control the servos with the Phidgets controller. You don't need to have any knowledge of electronics or USB communication protocols for using it.<br /><br />If you're interested in buying one , you can find it here - <a href="http://www.trossenrobotics.com/store/p/3137-Pan-and-Tilt-Kit.aspx">http://www.trossenrobotics.com/store/p/3137-Pan-and-Tilt-Kit.aspx</a><br /><br />Cheers!Ashish Derhgawenhttp://www.blogger.com/profile/16949464781799641662noreply@blogger.com13tag:blogger.com,1999:blog-8143136393464413090.post-45689959678714849272008-02-17T00:00:00.005-07:002008-11-12T21:30:09.385-07:00New hobby - R/C airplanes!<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_R7o3lst9P4U/R72vKkOReQI/AAAAAAAAANQ/_BX71YfIfk8/s1600-h/DSC04474.JPG"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_R7o3lst9P4U/R72vKkOReQI/AAAAAAAAANQ/_BX71YfIfk8/s400/DSC04474.JPG" alt="" id="BLOGGER_PHOTO_ID_5169480543348291842" border="0" /></a>I've got a new <a href="http://www.silverlit-flyingclub.com/xtwin.htm">Silverlit X-Twin Eagle Wing</a> R/C airplane for Rs. 1700 (about $40). Having a wingspan of only 9 inches, the plane is small enough to fly in your backyard, or in an indoor hall. Out of the box, I noticed that the plane was a bit tail-heavy. However, after I taped a dime to its nose, it flew like a dream! Overall, the plane will give at least 15-20 minutes of flight on a single charge. However, since I never fly continuously for more than 5 minutes, I usually enjoy several hours of flying before it has to be charged! Speaking of charging, the plane has a lightweight LiPo power supply, which can be charged by plugging the plane to its remote. It takes approximately 15 minutes for a full charge. Thrust comes from two pager motors mounted under the upper wing. Flying the plane is very easy, but it can be quite a challenge if its windy. It's a good thing that the plane is made up of tough EPP foam - it seems almost indestructible.<br /><br />I'll try to shoot videos of the plane. However, it's a bit difficult to shoot videos and fly the airplane at the same time.....but I'll try. :)<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_R7o3lst9P4U/R72vK0OReRI/AAAAAAAAANY/Zav7E8mdzyY/s1600-h/DSC04475.JPG"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_R7o3lst9P4U/R72vK0OReRI/AAAAAAAAANY/Zav7E8mdzyY/s400/DSC04475.JPG" alt="" id="BLOGGER_PHOTO_ID_5169480547643259154" border="0" /></a>Ashish Derhgawenhttp://www.blogger.com/profile/16949464781799641662noreply@blogger.com5tag:blogger.com,1999:blog-8143136393464413090.post-37960057127485528052008-01-10T05:57:00.000-07:002008-01-11T10:35:18.570-07:00Coding4Fun: Laser Tracking Camera<object height="355" width="425"><param name="movie" value="http://www.youtube.com/v/uvUMp14blfI&rel=0&color1=0xd6d6d6&color2=0xf0f0f0&border=0"><param name="wmode" value="transparent"><embed src="http://www.youtube.com/v/uvUMp14blfI&rel=0&color1=0xd6d6d6&color2=0xf0f0f0&border=0" type="application/x-shockwave-flash" wmode="transparent" height="355" width="425"></embed></object><br /><span style="font-family:verdana;">I've finally finished creating Part 2 of my article on <a href="http://blogs.msdn.com/coding4fun/archive/2007/11/02/5848155.aspx">controlling stepper motors with a computer</a>. This time I have built a <a href="http://blogs.msdn.com/coding4fun/archive/2008/01/07/7019142.aspx">laser tracking camera panner</a> by extending Andrew Kirillov's <a href="http://www.codeproject.com/KB/audio-video/Motion_Detection.aspx">motion detection code</a> (with permission) to control the motor.<br /></span><ul style="font-weight: bold;"><li><span style="font-family:verdana;">Part 1 - <a href="http://blogs.msdn.com/coding4fun/archive/2007/11/02/5848155.aspx">Article</a></span></li><li><span style="font-family:verdana;">Part 2 - <a href="http://blogs.msdn.com/coding4fun/archive/2008/01/07/7019142.aspx">Article</a></span></li></ul><span style="font-family:verdana;">Now that I think of it, I've done lots of projects with lasers. And as a matter of fact, I'm working on another project with lasers, right now! I'll shoot some videos soon, so stay tuned. And till then, have fun building a laser tracking camera!</span><br /><br /><span style="font-family:verdana;">- Ashish</span>Ashish Derhgawenhttp://www.blogger.com/profile/16949464781799641662noreply@blogger.com5tag:blogger.com,1999:blog-8143136393464413090.post-3993833731209660642007-12-31T10:04:00.000-07:002008-11-12T21:30:09.608-07:00Happy New Year, 2008<div style="text-align: center;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_R7o3lst9P4U/R3kyt35N1aI/AAAAAAAAANI/_WTl0NKMWlo/s1600-h/newyear2008final2.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_R7o3lst9P4U/R3kyt35N1aI/AAAAAAAAANI/_WTl0NKMWlo/s400/newyear2008final2.jpg" alt="" id="BLOGGER_PHOTO_ID_5150203412554306978" border="0" /></a><span style="color: rgb(102, 102, 102);font-size:85%;" ><span style="font-style: italic;">This image was created by my brother, <a href="http://amritd.blogspot.com/">Amrit Derhgawen</a> (he's a character animator) :)</span></span><br /></div><div style="text-align: center;"><br /></div><span style="color: rgb(0, 0, 0);font-family:verdana;" >I wish all of my readers, be they regulars or new ones, a wonderful New Year with lots of whatever they like. May the year 2008 be in every aspect a better year than 2007.<br /></span><br /><span style="color: rgb(0, 0, 0);font-family:verdana;" >Have fun! See you in 2008!</span><br /><br /><span style="color: rgb(0, 0, 0);font-family:verdana;" >Best Wishes,</span><br /><span style="color: rgb(0, 0, 0);font-family:verdana;" >Ashish</span>Ashish Derhgawenhttp://www.blogger.com/profile/16949464781799641662noreply@blogger.com3tag:blogger.com,1999:blog-8143136393464413090.post-39880364522568457952007-11-27T07:24:00.000-07:002007-11-28T05:10:24.335-07:00Possibility of misuse?Here's a comment I received on my <a href="http://ashishrd.blogspot.com/2007/07/cell-phone-controlled-door-latch.html">Cell Phone Controlled Door Latch</a> post the other day:<br /><br /><p><em></em></p><blockquote><em>Anonymous said:<br /><br />Nice....wonder how many innocent people died because<br />you posted these easy<br />to follow directions for any Islamic Extremist to<br />build a command IED on your<br />site. You are obviously a very intelligent<br />person with either, no common sense<br />or no</em><em> sense of<br />responsibility.</em> </blockquote><p>I appreciate his/her concerns, and they are valid to some extent. To be honest, I was aware that my "easy to follow directions" could be followed for doing much more than just opening a door. Then why did I write about it? Well, like a coin, everything has two sides - one is the good side, and the other is the not so good side. There is already tons of information on the Internet on making bombs and weapons of mass destruction. Does this mean that the Internet should be shut-down..and people should stop sharing ideas with each other? I don't think so. If we stop sharing ideas to stop terrorists from misusing them, no one will be able to make good use of them either. Besides, this is what terrorists want..they want to create an atmosphere of insecurity, mistrust and terror. If we stop sharing our ideas to keep them from getting into the wrong hands, they will succeed in their mission. Moreoever, there are several scientists and engineers who work for these extremist groups. I'm sure that building a simple DTMF decoder wouldn't be difficult for them.</p><p>So relax, and be happy. My little door opener cannot worsen the already dire situation of our planet, let alone killing innocent people. :)</p><p>- Ashish</p>Ashish Derhgawenhttp://www.blogger.com/profile/16949464781799641662noreply@blogger.com15tag:blogger.com,1999:blog-8143136393464413090.post-61691704953488360882007-11-07T07:39:00.000-07:002008-11-12T21:30:10.037-07:00Object Tracking using Camera and Lasers<object height="355" width="425"><param name="wmode" value="transparent"><embed src="http://www.youtube.com/v/LHMiD4DAVaU" type="application/x-shockwave-flash" wmode="transparent" height="355" width="425"></embed></object><br /><br />Hey folks! Here's a little something I built about a month ago, but couldn't get enough time from college to write about it. Well, it's an object tracking camera panner which tracks any object moving in close range. Unlike my <a href="http://ashishrd.blogspot.com/2007/01/real-time-color-based-object-tracking.html">previous method</a> for object tracking, this technique will track almost any moving object, irrespective of its color, using two lasers for edge detection. Depending on which laser is focused on the object, the computer decides which direction to drive. I came up with this idea after watching a video on <a href="http://www.societyofrobots.com/robot_sumo.shtml">SoR (Society of Robots)</a> of a sumo robot, called Stampy. Stampy uses a single IR rangefinder for edge detection. Watch the video below:<br /><br /><object height="355" width="425"><param name="movie" value="http://www.youtube.com/v/vbhMuPF0Qj4"><param name="wmode" value="transparent"><embed src="http://www.youtube.com/v/vbhMuPF0Qj4" type="application/x-shockwave-flash" wmode="transparent" height="355" width="425"></embed></object><br /><br />I used lasers instead of IR rangefinders. My initial plan was to use a single laser..but then it occurred to me that I would have to shake the laser left/right continuously for tracking the trailing edge of an object. So, I decided to go with two lasers instead of one. :)<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_R7o3lst9P4U/RzILAZ5tHSI/AAAAAAAAANA/1Aynve5wmDg/s1600-h/objectTracker.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_R7o3lst9P4U/RzILAZ5tHSI/AAAAAAAAANA/1Aynve5wmDg/s320/objectTracker.jpg" alt="" id="BLOGGER_PHOTO_ID_5130175027109240098" border="0" /></a>Well, I guess I've finally put my <a href="http://ashishrd.blogspot.com/2007/09/computer-controlled-stepper-motor.html">computer controlled stepper</a><a href="http://ashishrd.blogspot.com/2007/09/computer-controlled-stepper-motor.html"> motor</a> to some use. I might be using this object tracking technique in my future projects as it's working very nicely. If you're interested in controlling stepper motors with your computer, read my <a href="http://blogs.msdn.com/coding4fun/archive/2007/11/02/5848155.aspx">new article on Coding4Fun</a>. Enjoy! :)Ashish Derhgawenhttp://www.blogger.com/profile/16949464781799641662noreply@blogger.com34tag:blogger.com,1999:blog-8143136393464413090.post-42509710293424529742007-10-12T00:05:00.000-06:002008-11-12T21:30:10.639-07:00I type a LOT...<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_R7o3lst9P4U/Rw8SHA6CVRI/AAAAAAAAAMw/qCy417PgUsA/s1600-h/myKeyboard.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_R7o3lst9P4U/Rw8SHA6CVRI/AAAAAAAAAMw/qCy417PgUsA/s400/myKeyboard.jpg" alt="" id="BLOGGER_PHOTO_ID_5120331213055350034" border="0" /></a><br />...and I type fast. That's why you can't see most of the alphabets on my keyboard. Like most of you reading this, I can touch type. People who believe in two-finger-poke typing, always complain how difficult it is to use my computer.<br /><br />You can learn a lot about letter frequencies by studying my keyboard. If you look closely, you'll notice that "P", "V", "G", "Z", "X", "V", "W", "Q" and "B" are the least commonly used letters. I compared my observations against the <a href="http://en.wikipedia.org/wiki/Letter_frequencies#Relative_frequencies_of_letters_in_the_English_language">letter frequency chart on Wikipedia</a> to check if my observations were correct..but I realized that "J" and "K" were also very rarely used. However, on my keyboard, these two letters have been wiped off completely! Why?? Well, the answer is simple..my index finger and middle finger rest on those keys when I'm not typing.<br /><br />If you click on the picture below, you'll notice some more startling facts:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_R7o3lst9P4U/Rw8XzQ6CVSI/AAAAAAAAAM4/YbZqUY6Ra1g/s1600-h/myKeyboard2.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_R7o3lst9P4U/Rw8XzQ6CVSI/AAAAAAAAAM4/YbZqUY6Ra1g/s400/myKeyboard2.jpg" alt="" id="BLOGGER_PHOTO_ID_5120337470822700322" border="0" /></a><br />I guess I use the Enter, Backspace and Delete keys a lot too. It also seems that I use the right Shift key more than the left one. Humm..I wonder if everyone does that.<br /><br />Well, it all comes down to this...I should buy a new keyboard.<br /><br /><span style="font-weight: bold; font-style: italic;"></span><blockquote><span style="font-weight: bold; font-style: italic;">UPDATE: </span><span style="font-style: italic;">I did some experiments today to check which Shift key I use more often. Here are the results:</span><br /><br /><table style="font-style: italic;" border="1" cellpadding="3" cellspacing="0"><thead><tr style="background-color: rgb(224, 224, 224);"><td>Activity</td><td>Left Shift Key<br /></td><td>Right Shift Key<br /></td></tr> </thead> <tbody> <tr><td>Writing E-mails<br /></td><td>54.3%<br /></td><td>45.6%<br /></td></tr> <tr><td>Programming (C#)<br /></td><td>66.6%<br /></td><td>33.3%<br /></td></tr> </tbody></table><br /><span style="font-style: italic;">When I'm writing e-mails, I use both of the Shift keys. However, I use the left one more while writing code. The right shift key on my keyboard is slightly smaller than the left one..and I'm pretty sure this is the reason why its entire surface has been wiped clean by my pinky.</span></blockquote><span style="font-style: italic;"></span>Ashish Derhgawenhttp://www.blogger.com/profile/16949464781799641662noreply@blogger.com13tag:blogger.com,1999:blog-8143136393464413090.post-51969104521620838422007-09-13T11:01:00.001-06:002008-11-12T21:30:11.995-07:00Computer Controlled Stepper Motor<object height="366" width="425"><param name="movie" value="http://www.youtube.com/cp/vjVQa1PpcFMi4uFm7OLxKGC5GfgwxtGaCWkfTnOC40Y="><param name="wmode" value="transparent"><embed src="http://www.youtube.com/cp/vjVQa1PpcFMi4uFm7OLxKGC5GfgwxtGaCWkfTnOC40Y=" type="application/x-shockwave-flash" wmode="transparent" height="366" width="425"></embed></object><br /><br />A few months ago, I bought a stepper motor for only Rs.75 (about USD $1.50). I had almost forgotten about that motor until I found it lying in a secluded corner of my bedroom, collecting dust the other day. I searched the internet for information on controlling stepper motors with a computer and I was surprised at how easy it was! My stepper motor has five wires, and it is a unipolar stepper motor with a step angle of 7.5 degrees.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_R7o3lst9P4U/RuufH6GWv8I/AAAAAAAAAMY/shnBCORJqg0/s1600-h/DSC04061.JPG"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_R7o3lst9P4U/RuufH6GWv8I/AAAAAAAAAMY/shnBCORJqg0/s400/DSC04061.JPG" alt="" id="BLOGGER_PHOTO_ID_5110353160385773506" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_R7o3lst9P4U/RuufIKGWv9I/AAAAAAAAAMg/QDYdZTwgHZ8/s1600-h/DSC04062.JPG"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_R7o3lst9P4U/RuufIKGWv9I/AAAAAAAAAMg/QDYdZTwgHZ8/s400/DSC04062.JPG" alt="" id="BLOGGER_PHOTO_ID_5110353164680740818" border="0" /></a><br />Here's the simple circuit I had used for controlling it:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_R7o3lst9P4U/RuufTKGWv-I/AAAAAAAAAMo/qRzU-yvUcSg/s1600-h/stepper_circuit.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_R7o3lst9P4U/RuufTKGWv-I/AAAAAAAAAMo/qRzU-yvUcSg/s400/stepper_circuit.png" alt="" id="BLOGGER_PHOTO_ID_5110353353659301858" border="0" /></a>(Note: If you can't find ULN2003, you can simply use use a single transistor for each winding as shown <a href="http://neil.fraser.name/hardware/stepper/cpu.html">here</a>.)<br /><br />As you can see in the diagram, each successive coil in the motor is connected to successive data pins on the parallel port. If the coils are not connected in the correct sequence, the motor will not rotate, but will only wiggle from side to side. Identifying the wires on the stepper motor was probably the only time consuming step. Click <a href="http://wwwhomes.doc.ic.ac.uk/%7Eih/doc/stepper/others/">here</a> for information on how to do this.<br /><br />Now, since each coil can be programatically controlled, you can experiment with different types of stepping modes. The simplest stepping mode is called Single-Stepping. In this mode, each successive coil is energized and the motor moves one full step at a time. For example, my motor will make a full step of 7.5 degrees whenever the coils are energized in the following sequence (D0 - D3 represent parallel port data pins):<br /><br /><table border="1" cellpadding="3" cellspacing="0"><thead><tr style="background-color: rgb(224, 224, 224);"><td>Step No.</td><td>D0</td><td>D1</td><td>D2</td><td>D3</td></tr> </thead> <tbody> <tr><td>1</td><td>1</td><td>0</td><td>0</td><td>0</td></tr> <tr><td>2</td><td>0</td><td>1</td><td>0</td><td>0</td></tr> <tr><td>3</td><td>0</td><td>0</td><td>1</td><td>0</td></tr> <tr><td>4</td><td>0</td><td>0</td><td>0</td><td>1</td></tr></tbody></table><br />Another interesting stepping mode is Half-Stepping. The difference between single-stepping and half-stepping is that for the same step rate, half-stepping gives you half the speed but twice the resolution of a single step. Since my motor has a step angle of 7.5 degrees, half-stepping it would result in approximately 3.75 degrees of rotation. Here's the sequence in which coils are energized for half-stepping:<br /><br /><table border="1" cellpadding="3" cellspacing="0"><thead><tr style="background-color: rgb(224, 224, 224);"><td>Step No.</td><td>D0</td><td>D1</td><td>D2</td><td>D3</td></tr> </thead> <tbody> <tr><td>1</td><td>1</td><td>0</td><td>0</td><td>0</td></tr> <tr><td>2</td><td>1</td><td>1</td><td>0</td><td>0</td></tr> <tr><td>3</td><td>0</td><td>1</td><td>0</td><td>0</td></tr> <tr><td>4</td><td>0</td><td>1</td><td>1</td><td>0</td></tr> <tr><td>5</td><td>0</td><td>0</td><td>1</td><td>0</td></tr> <tr><td>6</td><td>0</td><td>0</td><td>1</td><td>1</td></tr> <tr><td>7</td><td>0</td><td>0</td><td>0</td><td>1</td></tr> <tr><td>8</td><td>1</td><td>0</td><td>0</td><td>1</td></tr></tbody></table><br />You can achieve other types of steps by energizing the coils in different ways. For example, here's how high torque stepping works:<br /><br /><table border="1" cellpadding="3" cellspacing="0"><thead><tr style="background-color: rgb(224, 224, 224);"><td>Step No.</td><td>D0</td><td>D1</td><td>D2</td><td>D3</td></tr> </thead> <tbody> <tr><td>1</td><td>1</td><td>1</td><td>0</td><td>0</td></tr> <tr><td>2</td><td>0</td><td>1</td><td>1</td><td>0</td></tr> <tr><td>3</td><td>0</td><td>0</td><td>1</td><td>1</td></tr> <tr><td>4</td><td>1</td><td>0</td><td>0</td><td>1</td></tr></tbody></table><br />For more information on these stepping modes, read <a href="http://fsugtsr.org/magazine/issue3/divya/motor.htm">this article</a>.<br /><br />My program allows me to control the motor with the scroll wheel on my mouse and I can press the right mouse button to switch between different stepping modes. Watch the video above to see it working. I'm still thinking of ways to use this stepper motor with my projects. I guess I could use it as a camera panner. It would be better, efficient and more compact than my <a href="http://ashishrd.blogspot.com/2006/11/camera-panning-using-parallel-port.html">floppy drive camera panner</a>. My floppy drive camera panner could only rotate through an angle of 45 degrees because of mechanical limitations. This stepper motor can rotate a camera through 360+ degrees!<br /><br />Here's something interesting I found while googling - Neil Fraser's <a href="http://neil.fraser.name/hardware/etch/">"Computerized Etch A Sketch"</a>. Neil has used two computer controlled stepper motors for turning the horizontal and vertical knobs on an<a href="http://www.etch-a-sketch.com/"> Etch A Sketch</a>. His work is just amazing! I just wish he posted some videos of the device in action.Ashish Derhgawenhttp://www.blogger.com/profile/16949464781799641662noreply@blogger.com79tag:blogger.com,1999:blog-8143136393464413090.post-49232013429228787042007-08-26T11:28:00.000-06:002008-11-12T21:30:12.682-07:00Whistle (or scream) to control your computer!Hello Readers!<br /><br />It has been a long time since I wrote my last blog post. Well, I had been busy with a lot of things – like college, harmonica playing, meeting people, (and not to mention a whole host of fun, yet unproductive things I had been doing). Oh, and I was also busy reading, discussing and <span style="font-style: italic;">thinking</span> over the last Harry Potter book by J.K. Rowling. <span style="font-style: italic;">Harry Potter and the Deathly Hallows</span> is stunningly beautiful. I loved it. :)<br /><br />Well, anyway … I’m always in search for alternate ways to communicate with computers, and ever since I built a <a href="http://ashishrd.blogspot.com/2007/05/viper-ear-sound-sensor-for-microbric.html">sound sensor for my Viper robot</a>, I was thinking of ways to communicate with my computers using sound as a medium. I figured out how to use <a href="http://msdn2.microsoft.com/en-us/library/bb206261.aspx">DirectSound</a> to read the levels of my computer’s available sound capture devices thanks to a <a href="http://www.codeproject.com/cs/media/volumemeter.asp">wonderful example by Jacob Klint</a> over at <a href="http://www.codeproject.com/">CodeProject</a>. I’ve written code to count the number of times the sound level of my microphone exceeds a certain threshold for controlling a few things on my computer. Say, for example, if I whistle two times (loudly), the software would check my email. If I whistle three times, it would turn off my computer, and so on.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_R7o3lst9P4U/RtG6hE30mSI/AAAAAAAAALc/JvVrvIZLaW0/s1600-h/WhistleControl.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_R7o3lst9P4U/RtG6hE30mSI/AAAAAAAAALc/JvVrvIZLaW0/s400/WhistleControl.jpg" alt="" id="BLOGGER_PHOTO_ID_5103064930193807650" border="0" /></a><br />The drawback is that it won’t be long before everyone in your house will be irritated by your whistling! That’s why I still prefer <a href="http://ashishrd.blogspot.com/2006/12/gesture-recognition-using-webcam-and.html">laser gesture recognition</a> for controlling things. :) However, if you’re interested in seeing the code, just let me know.<br /><br />Now, I’m thinking about capturing sound from two sources and perhaps even perform <a href="http://en.wikipedia.org/wiki/Sound_localization">sound localization</a>! That would be very cool. :) Keep visiting...Ashish Derhgawenhttp://www.blogger.com/profile/16949464781799641662noreply@blogger.com18tag:blogger.com,1999:blog-8143136393464413090.post-34046062243060783362007-07-17T04:53:00.000-06:002008-11-12T21:30:13.690-07:00Cell Phone Controlled Door Latch<object type="application/x-shockwave-flash" width="460" height="345" data="http://vimeo.com/moogaloop.swf?clip_id=243080&server=vimeo.com&fullscreen=1&video_info=1"> <param name="quality" value="best" /> <param name="allowfullscreen" value="true" /> <param name="scale" value="showAll" /> <param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=243080&server=vimeo.com&fullscreen=1&video_info=1" /></object><br /><a href="http://www.vimeo.com/download/video:3096416">Download Video (1.78 MB)</a><br /><p style="font-family: verdana;" class="MsoNormal">I’ve been reading a lot on how <a href="http://en.wikipedia.org/wiki/Dual-tone_multi-frequency">DTMF (Dual Tone Multi Frequency)</a> tones work over the last couple of weeks. I’m sure you’ve noticed that when you press the keys on a standard telephone keypad, an audible ‘beep’ is generated. These beeps are actually the combination of two distinct frequencies. For example, the tone you hear when you press the number ‘9’ on a telephone, is actually a combination of a 1447 Hz and 852 Hz signal. In a telephone exchange, these signals are decoded by a computer which finally connects the dialer to the designated phone line. For example, the tone of 1447 Hz and 852 Hz will be decoded as binary ‘1001’. In this project, I have designed a simple DTMF decoder circuit which allows me to control appliances in my house from any place on Earth using a telephone.</p> <a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_R7o3lst9P4U/RpygkiU0l8I/AAAAAAAAAKk/f6HKGdZg5yU/s1600-h/dtmfChart.gif"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_R7o3lst9P4U/RpygkiU0l8I/AAAAAAAAAKk/f6HKGdZg5yU/s320/dtmfChart.gif" alt="" id="BLOGGER_PHOTO_ID_5088118228571690946" border="0" /></a><p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">I always wanted to be able to control things such as air-conditioners, lights, etc, remotely…but I never thought about putting the front door of my house under remote control until I saw this <a href="http://spritesmods.com/?art=knock2open">“knock to open”</a> door hack on <a href="http://www.hackaday.com/">Hackaday</a>. It’s a door that will unlock when the correct knock pattern is performed. After being inspired by the mechanical door opening system in that hack, I decided to do something similar to allow me to open my door with a cell phone! I mean c’mon, door locks with keys are obsolete..everyone uses them..they’re so old fashioned! They’ve been around for over 4,000 years. Yikes! It’s time for a little change.</p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">This project would have been much simpler if I had an electronic door lock…but I didn’t! They’re expensive, so I didn’t want to buy a new electronic door lock. I wanted to open the front door of my house without “seriously” modifying/replacing any door components. I thought about using a servo/stepper motor to twist the door knob on the door, but their control circuitry is slightly complicated if you’re not using a microcontroller. So, I decided to use a simple, 24VDC, “pull solenoid”. They don’t have any complicated control circuitry and you just have to supply the required voltage to make them work. I simply fastened the solenoid to the door knob with a metal wire. When the solenoid is switched on, its linear motion twists the door knob and opens the door. Positioning the solenoid properly was probably the only mechanical challenge in building this door opener because the force applied by a solenoid, is theoretically inversely proportional the square of the length of the air gap. Thus, strongest force is generated when the air gap is smallest.</p><p class="MsoNormal"><br /></p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_R7o3lst9P4U/RpzkGiU0mCI/AAAAAAAAALU/pXzP1d9bWmM/s1600-h/pict5.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_R7o3lst9P4U/RpzkGiU0mCI/AAAAAAAAALU/pXzP1d9bWmM/s400/pict5.jpg" alt="" id="BLOGGER_PHOTO_ID_5088192479966304290" border="0" /></a> <p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><br /></p><p class="MsoNormal">The second part of this project was to build a DTMF decoder circuit. I used a CM8870PI tone decoder IC for doing this. The circuit I have built is fairly simple, and can be used for controlling up to four devices. If you want to control more than four devices, <a href="http://www.members.tripod.com/electronicsworld/remotecontrolsimages/remotecontrolsckt2.html">check out this circuit</a>. I had a Nokia 1100 cell phone lying around with a hands-free accessory which was rarely used. So, I hacked its hands-free accessory and connected it to the circuit (I just cut the wires which went into the earpiece). That’s about it! To control things in the house, you just dial into the base station and the Nokia 1100 auto-answers the phone call. Each function is just a matter of pressing the appropriate number on the phone and the DTMF chip decodes it and sends output to a transistor which controls a relay. To open my door, I just dial the phone, enter the magic code and voila - <span style="font-style: italic;">Alohomora</span>! Watch the video above. :)<br /></p><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_R7o3lst9P4U/RpyhxiU0l-I/AAAAAAAAAK0/xjPVrxl1dbQ/s1600-h/cellPhoneDiagram.gif"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_R7o3lst9P4U/RpyhxiU0l-I/AAAAAAAAAK0/xjPVrxl1dbQ/s400/cellPhoneDiagram.gif" alt="" id="BLOGGER_PHOTO_ID_5088119551421618146" border="0" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_R7o3lst9P4U/RpyiMSU0l_I/AAAAAAAAAK8/PnK7gqDyyTY/s1600-h/DSC03843.JPG"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_R7o3lst9P4U/RpyiMSU0l_I/AAAAAAAAAK8/PnK7gqDyyTY/s320/DSC03843.JPG" alt="" id="BLOGGER_PHOTO_ID_5088120010983118834" border="0" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_R7o3lst9P4U/RpyiMiU0mAI/AAAAAAAAALE/e0LxwRzMxWU/s1600-h/DSC03851.JPG"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_R7o3lst9P4U/RpyiMiU0mAI/AAAAAAAAALE/e0LxwRzMxWU/s320/DSC03851.JPG" alt="" id="BLOGGER_PHOTO_ID_5088120015278086146" border="0" /></a><p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><o:p> </o:p></p><br /><p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Now I’m thinking about building a password protected door by placing a keypad outside my house which will generate DTMF tones. A circuit on the other side of the door will check the numbers entered, and if the password is correct, it will open the door. However, there’s one little snag. Any nasty programmer would just love to use a computer to generate DTMF tones and crack the password using brute force…I would. :)</p>Ashish Derhgawenhttp://www.blogger.com/profile/16949464781799641662noreply@blogger.com250tag:blogger.com,1999:blog-8143136393464413090.post-47785702455450439912007-06-11T21:14:00.000-06:002008-11-12T21:30:15.169-07:00Pong Playing Computer playing against another computer using a webcam as an eye!<embed src="http://www.vimeo.com/moogaloop.swf?clip_id=211010" quality="best" scale="exactfit" type="application/x-shockwave-flash" height="300" width="400"></embed><br /><a href="http://www.vimeo.com/download/video:18182532">Download video (5.54 MB)</a><br /><br /><span style="font-family:verdana;">Several years ago, when I was a stupid little schoolboy, I created a really fun and addictive game called Ping Pong. It was based on the classic arcade game, <a href="http://en.wikipedia.org/wiki/PONG">PONG</a>, and had some cool features like gradual speed increase, two game modes, and some neat sound effects.<br /></span><p style="font-family: verdana;" class="MsoNormal"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_R7o3lst9P4U/Rm4QFCA3_KI/AAAAAAAAAKM/sXglYeGICj8/s1600-h/pong.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_R7o3lst9P4U/Rm4QFCA3_KI/AAAAAAAAAKM/sXglYeGICj8/s320/pong.jpg" alt="" id="BLOGGER_PHOTO_ID_5075011508719058082" border="0" /></a></p><p style="font-family: verdana;" class="MsoNormal">I had almost forgotten about that game until I saw this <a href="http://www.lildumpo.com/projects/autowoodchopper/">auto wood-chopper project</a> in which a computer plays a simple game on a PSP using only a webcam to view its screen. I thought the idea was pretty good. So, I decided to make my own computer play that old pong game of mine on another computer using a webcam for vision! I fired up my code editor, and after several hours of coding and experimentation, my image recognition code started looking good. It uses edge detection to determine the boundaries of the ball and the bat in the webcam’s field of view. The area of the ball is more than the bat, so that’s how it differentiates between the two. The other steps are more or less similar to the things I did for my <a href="http://ashishrd.blogspot.com/2007/01/real-time-color-based-object-tracking.html">object tracking app</a>. Like the auto wood-chopper dude, I thought about using motors to press the keyboard keys on my laptop. However, I thought it would be overkill when I could write a simple TCP client/server program to establish communication between the two computers.<br /></p><p style="font-family: verdana;" class="MsoNormal"><o:p> </o:p></p> <p style="font-family: verdana;" class="MsoNormal"><o:p> </o:p></p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_R7o3lst9P4U/Rm4RCCA3_MI/AAAAAAAAAKc/RAU2YxKizPY/s1600-h/setup.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_R7o3lst9P4U/Rm4RCCA3_MI/AAAAAAAAAKc/RAU2YxKizPY/s320/setup.jpg" alt="" id="BLOGGER_PHOTO_ID_5075012556691078338" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_R7o3lst9P4U/Rm4RByA3_LI/AAAAAAAAAKU/sUXnFANjluY/s1600-h/UI.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_R7o3lst9P4U/Rm4RByA3_LI/AAAAAAAAAKU/sUXnFANjluY/s320/UI.jpg" alt="" id="BLOGGER_PHOTO_ID_5075012552396111026" border="0" /></a><p style="font-family: verdana;" class="MsoNormal">Be sure to watch the video above! I’d love to hear what you think. Oh and here’s a similar project in which a computer <a href="http://codeninja.de/sweeperki">plays Minesweeper on another computer using a webcam</a> – wow!</p> <p style="font-family: verdana;" class="MsoNormal"><o:p> </o:p></p> <p style="font-family: verdana;" class="MsoNormal">You can download my fun Pong game from <a href="http://www.ashsoftech.com/mygames/ping-pong.exe">here</a>. (1.20 MB)</p> <p style="font-family: verdana;" class="MsoNormal"><o:p> </o:p></p> <p style="font-family: verdana;" class="MsoNormal">This was a very exciting project. In my opinion, one of the coolest webcam based projects I’ve done so far. I entered the world of webcams after working on <a href="http://ashishrd.blogspot.com/2006/10/camcapture.html">CamCapture</a> – a project based on a Coding4Fun article by Scott Hanselman. :) Webcams are fun but I sometimes wonder why they’re called <span style="font-weight: bold;">Web</span>cams. I never use them for online video conversations! In my opinion, they should be simply called USB cameras. :)<br /></p>Ashish Derhgawenhttp://www.blogger.com/profile/16949464781799641662noreply@blogger.com38tag:blogger.com,1999:blog-8143136393464413090.post-46973265203455712352007-06-11T20:46:00.000-06:002008-11-12T21:30:15.602-07:00Opto-isolated Parallel Port Driven Relays<span style="font-family:verdana;">A few months back, I made a parallel port driven relay box for <a href="http://ashishrd.blogspot.com/2007/03/engineer-2007.html">Engineer 2007</a> with four outputs which were opto-isolated from my PC. Since I didn't have opto-isolators, I built my own by taping LED/photoresistor pairs together. It worked perfectly.</span><br /><br /><div style="text-align: center;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_R7o3lst9P4U/Rm4LpSA3_II/AAAAAAAAAJ8/3gpKf_pi3ho/s1600-h/Picture+005.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_R7o3lst9P4U/Rm4LpSA3_II/AAAAAAAAAJ8/3gpKf_pi3ho/s320/Picture+005.jpg" alt="" id="BLOGGER_PHOTO_ID_5075006633931177090" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_R7o3lst9P4U/Rm4LpiA3_JI/AAAAAAAAAKE/c-1KqpfI128/s1600-h/Picture+007.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_R7o3lst9P4U/Rm4LpiA3_JI/AAAAAAAAAKE/c-1KqpfI128/s320/Picture+007.jpg" alt="" id="BLOGGER_PHOTO_ID_5075006638226144402" border="0" /></a>(Circuit details: <a href="http://www.epanorama.net/circuits/parallel_output.html">http://www.epanorama.net/circuits/parallel_output.html</a>)<br /></div><div style="text-align: center;"><span style="font-size:85%;"><span style="font-family:verdana;"><br /></span></span></div><span style="font-family:verdana;">I also combined it with laser gesture recognition to turn four appliances on or off using a laser pointer for Engineer 2007. I guess everyone loved it. :)</span> <span style="font-family:verdana;"><br /><br />If you can make pcbs, and are interested in a simple little circuit </span> <span style="font-family:verdana;">to provide opto-isolator protection to 4 parallel port inputs, and </span> <span style="font-family:verdana;">relays on the other 4 bits, as outputs, then check the offer on....</span><br /><span style="font-family:verdana;"><br /><a href="http://www.arunet.co.uk/tkboyd/ele1pp.htm">http://www.arunet.co.uk/tkboyd/ele1pp.htm</a></span><a href="http://www.arunet.co.uk/tkboyd/ele1pp.htm"> </a><span style="font-family:verdana;"><br /><br />... which is a little way down the page, next to the Google panel, in </span> <span style="font-family:verdana;">the paragraph starting "I have a third generatino, inexpensive...".</span>Ashish Derhgawenhttp://www.blogger.com/profile/16949464781799641662noreply@blogger.com5tag:blogger.com,1999:blog-8143136393464413090.post-55650061602428662382007-05-30T23:38:00.000-06:002008-11-12T21:30:16.022-07:00Viper Ear: Sound Sensor for Microbric Viper Robot<embed src="http://www.youtube.com/v/Dmvr1PWPmcY" type="application/x-shockwave-flash" wmode="transparent" height="350" width="425"></embed><br /><br /><span style="font-family:verdana;">Hello readers!</span><o:p style="font-family: verdana;"><br /></o:p><p class="MsoNormal" style="font-family:verdana;">It’s been a long time since my last blog post. I was a bit busy and <span class="blsp-spelling-error" id="SPELLING_ERROR_0">wasn</span>’t getting time for blogging. Anyway, I did something cool and thought you people would like it. I’<span class="blsp-spelling-error" id="SPELLING_ERROR_1">ve</span> been working mostly with <span class="blsp-spelling-error" id="SPELLING_ERROR_2">webcams</span> over the last couple of months. I wanted to do something different for a little change and found sound a very interesting way of communicating with robots/computers. I created a sound sensor for my <a href="http://www.microbric.com/page.php?sId=1"><span class="blsp-spelling-error" id="SPELLING_ERROR_3">Microbric</span> Viper Robot</a> to give it the ability to respond to claps and whistles. I had to work extra hard on this project as things <span class="blsp-spelling-error" id="SPELLING_ERROR_4">weren</span>’t getting done as quickly as they usually do. The basic idea was that the sensor would send the PIC a logic 1 if the loudness of the sound coming in to the microphone exceeds a certain threshold and 0 otherwise. So, the sensor compares the microphone voltage to a reference voltage, and sends a logic 1 if the microphone output is higher (however, my signal is inverted because of the way I set up the op-amp as a comparator in my circuit). I had to experiment a lot on a breadboard before I had the circuit working perfectly. Here’s the final circuit I ended up with:</p><p class="MsoNormal" style="font-family: verdana;"><o:p><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_R7o3lst9P4U/Rl5nk4IwYKI/AAAAAAAAAJc/MyaVjrh5ceE/s1600-h/SoundSensorCircuit.JPG"><img id="BLOGGER_PHOTO_ID_5070604113707819170" style="margin: 0px auto 10px; display: block; cursor: pointer; text-align: center;" alt="" src="http://4.bp.blogspot.com/_R7o3lst9P4U/Rl5nk4IwYKI/AAAAAAAAAJc/MyaVjrh5ceE/s400/SoundSensorCircuit.JPG" border="0" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_R7o3lst9P4U/Rl5nlIIwYMI/AAAAAAAAAJs/3VjSKYbI74k/s1600-h/AcousticSensor.jpg"><img id="BLOGGER_PHOTO_ID_5070604118002786498" style="margin: 0px auto 10px; display: block; cursor: pointer; text-align: center;" alt="" src="http://1.bp.blogspot.com/_R7o3lst9P4U/Rl5nlIIwYMI/AAAAAAAAAJs/3VjSKYbI74k/s400/AcousticSensor.jpg" border="0" /></a></o:p><br />Since I <span class="blsp-spelling-error" id="SPELLING_ERROR_5">didn</span>’t have an oscilloscope at home, I turned my computer into an oscilloscope by using <a href="http://www.zeitnitz.de/Christian/Scope/Scope_en.html">PC-Oscilloscope by Christian <span class="blsp-spelling-error" id="SPELLING_ERROR_6">Zeitnitz</span></a>. This software works with a sound card. It <span class="blsp-spelling-error" id="SPELLING_ERROR_7">doesn</span>’t have a fast sampling rate, but it’s good enough for testing this circuit. <a href="http://scopeonpc.tripod.com/index.htm">Parallel port based oscilloscopes</a> are probably a little faster, but I <span class="blsp-spelling-error" id="SPELLING_ERROR_8">didn</span>’t have time to make one. In the oscilloscope, the signal from the sensor is a nice series of sharp spikes.<o:p><br /></o:p></p><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_R7o3lst9P4U/Rl5qq4IwYNI/AAAAAAAAAJ0/lBTDCjVa8QE/s1600-h/SensorOscilloscope.JPG"><img id="BLOGGER_PHOTO_ID_5070607515321917650" style="margin: 0px auto 10px; display: block; cursor: pointer; text-align: center;" alt="" src="http://4.bp.blogspot.com/_R7o3lst9P4U/Rl5qq4IwYNI/AAAAAAAAAJ0/lBTDCjVa8QE/s400/SensorOscilloscope.JPG" border="0" /></a><br /><span style="font-family:verdana;">In the video, you’ll notice that I clap several times to control the robot. The first clap I make is only for initializing the clap counting algorithm in the program. After the first clap, the robot counts the number of times I clap my hands during an interval of 2-3 seconds. For example, if I clap once (after the initializing clap), the robot either moves forward or stops, depending on its state. If I clap twice, the robot turns left. Three claps make it turn right. Sometimes, the sensor also gets triggered from motor noise. So, I have to adjust the preset in the circuit to get things working perfectly. For extra reliability, the robot moves forward slowly to keep motor noise as low as possible. I think that <span class="blsp-spelling-error" id="SPELLING_ERROR_9">programmatically</span> distinguishing between a clap and motor noise or electronically filtering it out could also be worth a try.</span><o:p><br /></o:p><p class="MsoNormal"><span style="font-family:verdana;">This was a fairly simple project, but it took much longer than usual. Well, I have some more cool ideas for sound sensors. ;) Keep visiting!</span></p>Ashish Derhgawenhttp://www.blogger.com/profile/16949464781799641662noreply@blogger.com18tag:blogger.com,1999:blog-8143136393464413090.post-64380947509325028042007-05-03T10:45:00.000-06:002008-11-12T21:30:16.888-07:00ASIMOV1<object height="350" width="425"><param name="movie" value="http://www.youtube.com/v/Sovf6UxKL5E"><param name="wmode" value="transparent"><embed src="http://www.youtube.com/v/Sovf6UxKL5E" type="application/x-shockwave-flash" wmode="transparent" height="350" width="425"></embed></object><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_R7o3lst9P4U/RjoSWG1pjgI/AAAAAAAAAJE/UCd85erI3Jg/s1600-h/complete.jpg"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://2.bp.blogspot.com/_R7o3lst9P4U/RjoSWG1pjgI/AAAAAAAAAJE/UCd85erI3Jg/s200/complete.jpg" alt="" id="BLOGGER_PHOTO_ID_5060377302306229762" border="0" /></a><a style="font-family: verdana;" href="http://www.colinkarpfinger.com/">Colin</a><span style="font-family:verdana;"> has built a <a href="http://www.colinkarpfinger.com/projects/defcon/">fully functional prototype</a> for the </span><a style="font-family: verdana;" href="http://defconbots.org/">Defcon competition</a><span style="font-family:verdana;">, ASIMOV1, using two high torque, serial port controlled servos! He’s also got a cool circle detection code working which identifies white circles against a black background and shoots them down. Trust me, you wouldn't want to go in front of that robot in a white underwear! Check out the video above. You’ll also see a video clip in which ASIMOV1 is working as a simple laser guided gun! We’ve procured sponsorship from <a href="http://www.pololu.com/">Pololu</a> and <a href="http://www.servocity.com/">ServoCity</a>. Now, its time to get a more powerful </span><s style="font-family: verdana;">shotgun</s> <span style="font-family:verdana;">airsoft gun for this autonomous robot! :)</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_R7o3lst9P4U/RjoTPW1pjiI/AAAAAAAAAJU/clf9hFRPWZA/s1600-h/april20+%2818%29.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_R7o3lst9P4U/RjoTPW1pjiI/AAAAAAAAAJU/clf9hFRPWZA/s400/april20+%2818%29.jpg" alt="" id="BLOGGER_PHOTO_ID_5060378285853740578" border="0" /></a>Ashish Derhgawenhttp://www.blogger.com/profile/16949464781799641662noreply@blogger.com3