tag:blogger.com,1999:blog-8734493376971688872024-03-13T02:37:53.206+00:00Hmm... There's An IdeaHacks, Mods, Programming, Breaking, Fixing, Electronics, Arduino. You name it...Unknownnoreply@blogger.comBlogger8125tag:blogger.com,1999:blog-873449337697168887.post-34037278166756572082009-09-01T17:06:00.009+01:002010-03-15T23:21:11.555+00:00IMAP PUSH GMail Python Script (for Mac, but easily changable)<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_hBgprBskTTw/Sp_bHhoh-OI/AAAAAAAAAn0/YUoUGd2xKBA/s1600-h/code.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 238px;" src="http://1.bp.blogspot.com/_hBgprBskTTw/Sp_bHhoh-OI/AAAAAAAAAn0/YUoUGd2xKBA/s400/code.png" alt="" id="BLOGGER_PHOTO_ID_5377257402437597410" border="0" /></a><br />So, you need a python script to do something when you get an email (from GMail, for example, but other services that support IMAP4 will work as well). I came across <a href="http://blog.hokkertjes.nl/2009/03/11/python-imap-idle-with-imaplib2/">this</a> post when finding out how to do this. It pointed me in the right direction; I didn't have to do much initial thinking/goggling.<br /><br />A quick explanation as to how the script works:<br /><ol><li>Connect using IMAP to <span style="font-style: italic;">imap.gmail.com</span></li><li>Send login credentials (encrypted with SSL, don't worry)<br /></li><li>Select 'INBOX'</li><li>Send IDLE command and wait for mail...<br /></li><li>When a message gets to Google's servers, they terminate the IDLE connection. This then signals to our script that a message has been received (or we've timed out)</li><li>The script then checks to see if there is new, unseen mail, and, if so, uses <span style="font-style: italic;">growlnotify</span> to let us know the sender and the subject. (This is the bit that can be replaced to do whatever you want it to do. You can get the message body if you want, times, dates, etc... and do whatever with it)</li><li>IDLE command is sent again (i.e. back to 4.)</li></ol>Instead of a <a href="http://growl.info/">growl</a> notification, you could use <a href="http://pyserial.sourceforge.net/">pySerial</a> to send something to an <a href="http://arduino.cc/">Arduino</a> and light something, spin something, etc... Feel free to change the code and do whatever to it.<br /><br />There are two bits of code you'll need: <a href="http://www.cs.usyd.edu.au/%7Epiers/python/imaplib.html">imaplib2.py</a> and my <a href="http://sites.google.com/site/hmmtheresanidea/files/IMAPPush.py?attredirects=0">IMAPPush.py</a><br /><br />I hosted my <a href="http://sites.google.com/site/hmmtheresanidea/files/IMAPPush.py?attredirects=0">IMAPPush.py</a> on Google Sites because I couldn't host it here. All you need to do is put the files in the same directory, cd to said directory and execute:<br /><br /><span style="font-style: italic;">python IMAPPush.py USERNAME [PASSWORD]</span><br /><br />The PASSWORD is not required -- you'll be prompted for it if it is omitted.<br /><br />To find out more about IMAP IDLE, see it's RFC (RFC 2177) <a href="http://www.faqs.org/rfcs/rfc2177.html">here</a>.<br /><br />There's no point me explaining how the code works here; if you want to understand how the code works, I've put a lot of comments in the code. That's the best place for explaining the code, after all.<br /><br />Here are the links to the code again:<br /><ol><li><a href="http://sites.google.com/site/hmmtheresanidea/files/IMAPPush.py?attredirects=0">http://sites.google.com/site/hmmtheresanidea/files/IMAPPush.py?attredirects=0</a></li><li><a href="http://www.cs.usyd.edu.au/%7Epiers/python/imaplib.html">http://www.cs.usyd.edu.au/%7Epiers/python/imaplib.html</a></li></ol>Any comments, suggestions, etc... please let me know below. Thanks for reading!<br /><br /><span style="font-weight: bold;">UPDATE:</span> links fixed, and code is now licensed.Unknownnoreply@blogger.com47tag:blogger.com,1999:blog-873449337697168887.post-58963302245042702082008-10-30T17:04:00.010+00:002008-10-30T20:57:56.826+00:00Start Media Center on a Particular ChannelI was wandering the other day: how is it possible to start Windows Media Center, in fullscreen mode, on a particular channel (BBC News 24), instead of having to go through the menu system, say, in the morning <a href="http://hmmtheresanidea.blogspot.com/2008/09/wake-up-light-alarm-clock-triggered.html">when my light turns</a> on? (except this time it'll be my computer that switches it on, not the alarm clock)<br /><br />I started googling for command line Media Center (ehshell.exe) operators/switches and quickly came across <a href="http://www.merawindows.com/Forums/tabid/324/forumid/18/threadid/11908/scope/posts/Default.aspx">this</a> page.<br /><br />This bit of script (in a batch file) will start Media Center, maximised, on the last channel that was being watched:<br /><span style="font-size:85%;"><br /></span><span style="font-style: italic;font-size:85%;" >start /MAX %systemroot%\ehome\ehshell.exe /homepage:VideoFullscreen.xml </span><br />(all one line)<br /><br />There were no parameters that could be passed to the .exe that would specify what channel was going to be displayed. The fact that Media Center remembered the last channel suggested it had to be stored somewhere. I had a look in the <span style="font-style: italic;">ehome</span> directory to see if there was anything in any files there that changed when the channel changed, all to no avail. The next stop was the registry.<br /><br />Under <span style="font-style: italic;">HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\</span> the key <span style="font-style: italic;">Media Center</span> can be found, and within that, <span style="font-style: italic;">Settings</span>, within that, <span style="font-style: italic;">VideoSettings</span>. Now, in this key you'll find a string (REG_SZ) called <span style="font-style: italic;">_tvChannel</span>, this string contains the last/current channel you were/are on (<span style="font-style: italic;">_tvChannelPrev</span> contains the one before that); change it, then when Media Center starts, and you navigate to <span style="font-style: italic;">Live TV</span>, it starts on that channel.<br /><br />Channel 80, in the UK (freeview), is BBC News 24. Just change the 80 to whatever channel you want. There are two ways I've combined the above to make it easier; the first involves a batch script and a .reg file:<br /><br /><span style="font-style: italic;">tvChannel.reg</span> ...<br /><br /><span style="font-size:85%;"><span style="font-style: italic;">Windows Registry Editor Version 5.00<br /></span><span style="font-style: italic;">[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Media Center\Settings\VideoSettings]<br /></span><span style="font-style: italic;">"_tvChannel"="80"</span></span><br /><br /><span style="font-style: italic;">startNews.bat</span> ...<br /><br /><span style="font-size:85%;"><span style="font-style: italic;">@echo off<br /></span><span style="font-style: italic;">echo Ammending entry in registry...<br /></span><span style="font-style: italic;">regedit /s tvChannel.reg<br /></span><span style="font-style: italic;">echo Starting Media Center at channel set in .reg file...<br /></span><span style="font-style: italic;">start /MAX %systemroot%\ehome\ehshell.exe /homepage:VideoFullscreen.xml<br /></span><span style="font-style: italic;">exit</span></span><br /><br />Running <span style="font-style: italic;">startNews.bat</span> will start Media Center at the channel specified in <span style="font-style: italic;">tvChannel.reg</span>. This, however, isn't very flexible; files need to be manually edited if a different channel is required. A python script would be better, one which outputed the channel, passed as a command line argument, to a .reg file. which was then called. Please keep in mind this is a quick script, i'm sure it could be quite heavily optimised, but it does what it needs to do. Here is is:<br /><span style="font-size:100%;"><br /></span><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_hBgprBskTTw/SQoHLSNuT-I/AAAAAAAAAck/zWmantjqE_Q/s1600-h/code.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 447px; height: 218px;" src="http://4.bp.blogspot.com/_hBgprBskTTw/SQoHLSNuT-I/AAAAAAAAAck/zWmantjqE_Q/s400/code.png" alt="" id="BLOGGER_PHOTO_ID_5263027004985200610" border="0" /></a><br />Sorry about the image, blogger/blogspot strips out the tabs (as well as, disgusting as they are, spaces instead of tabs). The same could be achieved with a more advanced batch script, but, to me, a python script seemed much easier. I saved this python script as <span style="font-style: italic;">channelLaunch.py</span> so when I use it, the command is:<br /><br /><span style="font-size:85%;"><span style="font-style: italic;">python channelLaunch.py 80</span></span><br /><br />That's it! Hope it can be of some use to someone.<br /><br />Thanks<br /><br />ChrisUnknownnoreply@blogger.com3tag:blogger.com,1999:blog-873449337697168887.post-69206758788709759212008-09-19T19:15:00.017+01:002008-09-23T19:19:45.144+01:00Wake Up Light - Alarm Clock Triggered Light BulbI was thinking to myself the other day how much easier I find getting up in the mornings when it's light outside. I continued to contemplate how similar the light level from a low-power light bulb was. My mental conclusion was: 'meh, fairly'. Now, how do I make a light bulb turn on when I want to wake up? Here's where my previous post, <a href="http://hmmtheresanidea.blogspot.com/2008/09/triac-mains-switching.html">Triac Mains Switching</a>, comes into play. Here is the schematic again:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_hBgprBskTTw/SNZ4xmX8spI/AAAAAAAAAU4/f_VsfQZPs9g/s1600-h/mainsSwitch.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_hBgprBskTTw/SNZ4xmX8spI/AAAAAAAAAU4/f_VsfQZPs9g/s400/mainsSwitch.png" alt="" id="BLOGGER_PHOTO_ID_5248515209256809106" border="0" /></a><br />When I want myself to wake up, I make my alarm clock turn it's radio on. So, after taking my alarm clock apart and probing numerous soldered contacts, which looked like they could provide low-voltage DC power to the radio circuit, I found one (relative to ground) which was at approximately 6V when the radio was on, and 0.5V when it was off. This was great news, 6V is just slightly larger than the logic 'high' for the Arduino Decimilla. With a simple voltage divider, and the equation Vout = (Vin * Rb) / (Ra + Rb),it would be trivial to bring that voltage down to a suitable logic-triggering level; I probably don't even need to.<br /><br /><div style="text-align: center;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_hBgprBskTTw/SNPwweJB8iI/AAAAAAAAAUY/H88Jvm641Tc/s1600-h/clockSource.png"><img style="cursor: pointer;" src="http://4.bp.blogspot.com/_hBgprBskTTw/SNPwweJB8iI/AAAAAAAAAUY/H88Jvm641Tc/s400/clockSource.png" alt="" id="BLOGGER_PHOTO_ID_5247802706332086818" border="0" /></a><br /></div><br />I have used fairly high-valued resistors to ensure very little current is drawn from the clock's circuitry; that way there's little chance of damaging the clock.<br /><br />Now I have a low-current, 5V(ish) supply, capable of triggering an Arduino digital pin. I also have a circuit which allows the Arduino to turn 240V mains devices on and off.<br /><br />Can you see where this is going?<br /><br />With the two circuits joined together, it is possible to turn the light bulb on when the radio turns on. Mission Completed!<br /><br /><div style="text-align: center;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_hBgprBskTTw/SNkk7GRNWvI/AAAAAAAAAVA/TvfLOaYm3Fc/s1600-h/DSCF1406.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_hBgprBskTTw/SNkk7GRNWvI/AAAAAAAAAVA/TvfLOaYm3Fc/s400/DSCF1406.jpg" alt="" id="BLOGGER_PHOTO_ID_5249267438390696690" border="0" /></a><span style="font-size:85%;">Simple set-up (without voltage divider)<br /></span></div><br /><span style="font-size:100%;">Arduino Code Listing:</span><br /><br /><span style="font-style: italic;font-size:85%;" >byte bulbPin = 12;<br />byte radioPin = 8;<br /><br />void setup(){<br />pinMode(bulbPin, OUTPUT);<br />pinMode(radioPin, INPUT);<br />}<br />void loop(){<br /> if (digitalRead(radioPin)){<br /> digitalWrite(bulbPin, HIGH);<br /> for (int i=0; i<5; i++){<br /> delay(60000);<br /> }<br /> digitalWrite(bulbPin, LOW);<br /> }<br />}<span style="font-size:85%;"><span style="font-size:100%;"><br /><br /></span></span></span><span style="font-size:100%;">This code will leave the light on for 5 minutes after the alarm has been turned off. If the delay wasn't required, neither would be the Arduino.<br /><br />A video of it in action:<br /><br /><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dwBw-vHNuOIJtWGh_7b7sZYIGC2h1l_d5R6o6Ff4fXqHE1oNgqC9hnGcFezUwDUmL6aEUTW06ag3pxhHWCeBQ' class='b-hbp-video b-uploaded' frameborder='0'></iframe><br /><br />Admittedly, this light bulb is quite bright; I'm going to get a 20W pearl bulb soon.<br /><br />Possible additions:<br /><br />- Serial communication for triggering, eg:<br />- e-mail received<br />- Web based (switch on a website) (with serial-to-Ethernet module possibly)<br /><br />- Light level (LDR triggering)<br /><br />- Triggered by a break in laser beam across the entrance to the room, hmm...<br /><br />Words of warning: Mains electricity is very dangerous; do not do anything like this if you're not sure what your doing. I did a fair amount of research before building my circuit. The components in this circuit can become damaged from transient voltage spikes so I'd advise against using inductive loads with this circuit - the triacs may fuse open (or worse!). Stick with resistive loads!<br /><br />Have fun,<br /><br />Comments/Suggestions greatly appreciated...<br /><br />Chris</span>Unknownnoreply@blogger.com6tag:blogger.com,1999:blog-873449337697168887.post-26232458830457945732008-09-19T18:04:00.014+01:002008-09-23T19:15:58.675+01:00Triac Mains SwitchingMains switching is something I've always wandered about; relays always seemed like the way to do things, but what if you don't have a device that can supply enough current to throw the switch, or what if space is quite a limiting factor?<br /><br />I looked into triacs to solve my problem, and, with my new found knowledge, I set about creating the circuit detailed below:<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_hBgprBskTTw/SNZrCk7uKuI/AAAAAAAAAUw/_haPDLiLG00/s1600-h/mainsSwitch.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_hBgprBskTTw/SNZrCk7uKuI/AAAAAAAAAUw/_haPDLiLG00/s400/mainsSwitch.png" alt="" id="BLOGGER_PHOTO_ID_5248500107764968162" border="0" /></a>The MOC3020M is a triac optoisolator - basically, it's a light-sensitive triac with a small light source in one component. Pins 1 and 2 are used to turn the light source on and off, which in turn allows the internal traic (pins 4 and 6) to conduct. This internal triac is used to trigger another traic; one which is capable of dealing with larger currents. Mine, the 2N6073A, could handle 4A if heat-sunk properly. But, I've kept it well away from that with a 2.2A circuit breaker.<br /><br />There's a fair amount of information on the Internet about how traics work, so I won't put any here; take a look if you're interested. Basically, the triac will conduct (through the main terminals) as long as there is a voltage/current on the 'gate'. It stops conducting, after the gate voltage/current has been removed, as soon as the voltage/current over the main terminals crosses zero.<br /><br />I decided to put my circuit in a small plastic box to keep it safe and out of the way. I also attached a trailing socket so I could use it for more than one project, easily. The earth wire isn't connected in my circuit (except to the trailing socket) since the box is plastic. For the control cable, I decided to use a length of telephone cable (which normally has RJ11 connectors on the end) using just 2 of the strands - leaving room for expansion.<br /><br />The mains device can be triggered 'on' by applying 5V to pin 1 of the triac optoisolator. My intention was to have the circuit triggered by my Arduino, opening a world of possibilities.<br /><br /><br /><div style="text-align: center;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_hBgprBskTTw/SNkrWI1x8iI/AAAAAAAAAVI/8_5StMWbE8Y/s1600-h/DSCF1399.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_hBgprBskTTw/SNkrWI1x8iI/AAAAAAAAAVI/8_5StMWbE8Y/s400/DSCF1399.jpg" alt="" id="BLOGGER_PHOTO_ID_5249274500007195170" border="0" /></a><span style="font-size:85%;">The Main Circuit</span><br /><br /></div><div style="text-align: center;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_hBgprBskTTw/SNkrWzBz1tI/AAAAAAAAAVQ/V3kECePoTfQ/s1600-h/DSCF1397.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_hBgprBskTTw/SNkrWzBz1tI/AAAAAAAAAVQ/V3kECePoTfQ/s400/DSCF1397.jpg" alt="" id="BLOGGER_PHOTO_ID_5249274511331940050" border="0" /></a><span style="font-size:85%;">The plug, triac circuit and trailing socket<br /></span></div><br />One thing I have noticed with my circuit is that when certain devices at home are turned on, but the triacs are off, the connected device (to the trailing socket) gets a bit of power for a fraction of a second. The traic miss-fires for a tiny period of time due to the magnitude of dv/dt - the change in voltage per small unit of time. These values are discussed on the triac's datasheet. If this becomes an issue, I'll have to design a snubber circuit to dampen the effect and solder it in (hence the large space to the left of the board).<br /><br /><span style="font-size:100%;">Words of warning: Mains electricity is very dangerous; do not do anything like this if you're not sure what your doing. I did a fair amount of research before building my circuit. The components in this circuit can become damaged from transient voltage spikes so I'd advise against using inductive loads with this circuit - the triacs may fuse open (or worse!). Stick with resistive loads!<br /><br /></span>Unknownnoreply@blogger.com11tag:blogger.com,1999:blog-873449337697168887.post-32847188375726313352008-08-25T17:25:00.001+01:002008-10-09T19:40:19.798+01:00Simple Soduku SolverHere is some quick code for a simple Sudoku solver.<br /><br />This python script will not work for a Sudoku puzzle where guessing is required; that functionality has not yet been worked in - but it will be.<br /><br />The Puzzle is solved logically by working out what each cell of the grid could be, based on the well known rules of Sudoku. If there is only one possibility for a cell, you know that that has got to be the value. This process is repeated, after each modification has been made, until the grid is complete.<br /><br />I tested it using <a href="http://www.websudoku.com/">http://www.websudoku.com</a>, and it could solve any of the 'easy' puzzles. It could not get any higher than 'medium'.<br /><br />The Python Script:<br /><br /><span style="font-style: italic;font-size:85%;" >import time<br /><br />##defs##<br /><br />#find possibilities for rows<br />def rowPoss(row):<br />output = []<br />for i in range(9):<br /> if not (i+1) in rows[row]:<br /> output.append(i+1)<br />return output<br /><br />#############################################<br /><br />#find possibilitites for columns<br />def colPoss(col):<br />output = []<br />column = []<br />for i in range(9):<br /> column.append(rows[i][col])<br />for i in range(9):<br /> if not (i+1) in column:<br /> output.append(i+1)<br />return output<br /><br />#############################################<br /><br />#find possibilities for each square<br />def squarePoss(square):<br /><br />###########<br />#000#111#222#<br />#000#111#222#<br />#000#111#222#<br />###########<br />#333#444#555#<br />#333#444#555#<br />#333#444#555#<br />###########<br />#666#777#888#<br />#666#777#888#<br />#666#777#888#<br />###########<br /><br />#set/get square values<br />temp = []<br />temp.append(rows[(square / 3)*3][(square % 3)*3])<br />temp.append(rows[(square / 3)*3][1+(square % 3)*3])<br />temp.append(rows[(square / 3)*3][2+(square % 3)*3])<br />temp.append(rows[1+(square / 3)*3][(square % 3)*3])<br />temp.append(rows[1+(square / 3)*3][1+(square % 3)*3])<br />temp.append(rows[1+(square / 3)*3][2+(square % 3)*3])<br />temp.append(rows[2+(square / 3)*3][(square % 3)*3])<br />temp.append(rows[2+(square / 3)*3][1+(square % 3)*3])<br />temp.append(rows[2+(square / 3)*3][2+(square % 3)*3])<br /><br />#return a list of possible values<br />output = []<br />for i in range(9):<br /> if not (i+1) in temp:<br /> output.append(i+1)<br />return output<br /><br />#############################################<br /> <br />#find all of the possibilities for a particular cell<br />def cellPoss(row, col):<br />output = []<br />for i in range(9):<br /> if ((i+1) in rp[row]) and ((i+1) in cp[col]) and ((i+1) in sp[((row/3)*3)+(col/3)]):<br /> output.append(i+1)<br />if len(output) == 1:<br /> return output[0]<br />else:<br /> return output<br /><br />#############################################<br /><br />#rows<br />r0 = [9,1,0,7,0,0,0,0,5]<br />r1 = [5,0,0,0,0,0,0,7,0]<br />r2 = [6,0,0,3,0,8,0,0,0]<br />r3 = [0,3,6,0,9,0,8,0,0]<br />r4 = [0,0,5,8,6,7,1,0,0]<br />r5 = [0,0,7,0,3,0,5,4,0]<br />r6 = [0,0,0,1,0,3,0,0,8]<br />r7 = [0,8,0,0,0,0,0,0,2]<br />r8 = [3,0,0,0,0,9,0,5,1]<br /><br />rows = [r0,r1,r2,r3,r4,r5,r6,r7,r8]<br /><br />#######################################<br />#OR, for user input - uncomment<br />#enter values row by row - just [ENTER] for blank<br /><br />for i in range(9):<br />for j in range(9):<br /> s = raw_input('::')<br /> if s == '':<br /> rows[i][j] = 0<br /> else:<br /> rows[i][j] = int(s)<br /><br />########################################<br /><br />cellPossibilities = rows<br />#now find each cell's possibilities<br />#cellPossibilities[row][column]<br /><br />#get start time<br />startTime = time.time()<br /><br />solved = 0<br />solvedPrev = -1<br /><br />while solved < 81:<br /><br /> rp = []<br /> for row in range(9):<br /> rp.append(rowPoss(row))<br /><br /> cp = []<br /> for column in range(9):<br /> cp.append(colPoss(column)) <br /><br /> sp = []<br /> for square in range(9):<br /> sp.append(squarePoss(square))<br /> <br /> for row in range(9):<br /> for col in range(9):<br /> if (cellPossibilities[row][col] == 0) or (type(cellPossibilities[row][col]) == list):<br /> cellPossibilities[row][col] = cellPoss(row, col)<br /><br /> solvedPrev = solved <br /> solved = 0<br /> for i in range(9):<br /> for j in range(9):<br /> if type(cellPossibilities[i][j]) == int:<br /> solved += 1<br /><br /> if solved == solvedPrev:<br /> print 'too difficult - guessing required'<br /> solved = 81 #'trick it' into finishing<br /><br /> <br />for i in range(9):<br /> print cellPossibilities[i]<br /><br />print 'It took ', round((time.time()-startTime), 3), ' seconds'<br /><span style="font-size:100%;"><br /><br /><br /></span></span><span style="font-size:85%;"><span style="font-size:100%;">Improvements coming soon...<br /><br />Thanks for reading,<br /><br /><br />Chris<br /><br />EDIT: Appologies for the above code, the indentations seem to have been removed.</span></span><span style="font-style: italic;font-size:85%;" ><span style="font-size:100%;"><br /></span></span>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-873449337697168887.post-36405330562468362072008-07-12T15:20:00.000+01:002008-07-18T19:05:32.880+01:00Regulated Electronics Power Supply - Old Computer's PSUI came across <a href="http://www.instructables.com/id/Converting-a-computer-ATX-power-supply-to-a-really/">this</a> post on <span class="blsp-spelling-error" id="SPELLING_ERROR_0">Instructables</span> a while ago. I am so glad I made my own; It has been an invaluable resource for many projects I've done recently. It is really quite simple to build, and a good project for a few of those <span class="blsp-spelling-error" id="SPELLING_ERROR_1">scavanged</span> parts many of us have lying around.<br /><br />The parts I managed to <span class="blsp-spelling-error" id="SPELLING_ERROR_2">scavange</span> are:<br /><ul><li>An old (<span class="blsp-spelling-error" id="SPELLING_ERROR_3">ish</span>) <span class="blsp-spelling-error" id="SPELLING_ERROR_4">SPST</span> 240V switch for mains-powered devices</li><li>An LED from the camera I took apart recently (for the <a href="http://hmmtheresanidea.blogspot.com/2008/05/fairly-high-speed-photography.html">high speed photography</a>)<br /></li><li>A potentiometer (variable resistor) that used to be the volume control for a pair of speakers</li><li>Wire for the leads from a piece of mains cable that was lying around<br /></li></ul>Sadly, there were some parts i needed to buy:<br /><ul><li>8 - 4mm test lead sockets (as there known by <span class="blsp-spelling-error" id="SPELLING_ERROR_5">Maplin</span>)</li><li>A variable <span class="blsp-spelling-error" id="SPELLING_ERROR_6">volatage</span> regulator (I got a negative one by accident - that didn't really matter though)</li><li>4 - 4mm test lead jacks</li><li>4 - small insulated crocodile clips<br /></li></ul>Buying these parts individually, as I did from <span class="blsp-spelling-error" id="SPELLING_ERROR_7">Maplin</span>, was a little costly: about £10 for the lot.<br /><br />The other common components that were needed, but I already had, were:<br /><ul><li>capacitors (for the voltage regulator - smooth the output)</li><li>resistors (for the LED - protection from a current that would kill the diode)<br /></li></ul>There's not much point posting schematics for this one, you just solder and insulate the wires that would normally exit the <span class="blsp-spelling-error" id="SPELLING_ERROR_8">PSU</span> in a big bunch, after finding out what voltage they carry, to the test lead sockets. The switch connections are simple: connect one side of the switch to the 'PS-ON' wire (which, in my case, was green) and the other side to ground (black wire). The LED connections were also easy: connect the anode of the LED to the resistor, with the other end of the resistor connected to a 3v3 line (dependant on LED), and the cathode of the LED to ground.<br /><br />The voltage regulator circuit <span class="blsp-spelling-error" id="SPELLING_ERROR_9">scematic</span> will be available in its <span class="blsp-spelling-error" id="SPELLING_ERROR_10">datasheet</span>. This will be able to give information much more specific than I can. One thing I would suggest, if you have a single-rotation linear potentiometer like I do, is that you don't use +12V and -12V as the input and ground reference connections to give you a greater output range. With one rotation, it can be <span class="blsp-spelling-error" id="SPELLING_ERROR_11">dificult</span> to set the voltage accurately since the slightest movement will cause quite a large jump in the output voltage. What I did (effectively - mine was a -<span class="blsp-spelling-error" id="SPELLING_ERROR_12">ve</span> V.R. though) was to input +12V, with 0V as the ground connection. This gave me an output of about +1V - +11V relative to ground (0V). So, for a voltage between +1V and +11V, the output would be taken relative to ground (0V). For a voltage in the range +13V - +23V, you simply take the output voltage relative to the -12V connection. This will become clearer when you look at the regulator's <span class="blsp-spelling-error" id="SPELLING_ERROR_13">datasheet</span>. For those of you who cannot wait, here is a quick diagram:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_hBgprBskTTw/SIDadClGYEI/AAAAAAAAAUA/PAqTZDzau9o/s1600-h/VRSchematic.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_hBgprBskTTw/SIDadClGYEI/AAAAAAAAAUA/PAqTZDzau9o/s400/VRSchematic.png" alt="" id="BLOGGER_PHOTO_ID_5224415760193314882" border="0" /></a><br />All this leaves me to do now is post some pictures:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_hBgprBskTTw/SHi92ZujATI/AAAAAAAAAS4/3z2knVyuUVM/s1600-h/1.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_hBgprBskTTw/SHi92ZujATI/AAAAAAAAAS4/3z2knVyuUVM/s400/1.jpg" alt="" id="BLOGGER_PHOTO_ID_5222132510252794162" border="0" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_hBgprBskTTw/SHi92u5n8UI/AAAAAAAAATA/hVDU4NEypQM/s1600-h/2.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_hBgprBskTTw/SHi92u5n8UI/AAAAAAAAATA/hVDU4NEypQM/s400/2.jpg" alt="" id="BLOGGER_PHOTO_ID_5222132515936399682" border="0" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_hBgprBskTTw/SHi93Ja_zOI/AAAAAAAAATI/f0z9lp82oUM/s1600-h/3.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_hBgprBskTTw/SHi93Ja_zOI/AAAAAAAAATI/f0z9lp82oUM/s400/3.jpg" alt="" id="BLOGGER_PHOTO_ID_5222132523055697122" border="0" /></a>I am glad I made this power supply for all my electronics projects, using batteries was getting a little tyring when what needs to be done should be quite quick; especially when you're one battery short and it's raining outside!<br /><br />Thanks for reading,<br /><br />ChrisUnknownnoreply@blogger.com1tag:blogger.com,1999:blog-873449337697168887.post-8311602205640003032008-06-22T19:27:00.001+01:002008-10-06T20:56:28.429+01:00Capacitance Measurer v1.0Question: is measurer a real word? - google doesn't think so.<br /><br />I, like many people I'm sure, find certain capacitor markings a little cryptic. So, with the help of my Arduino Decimilla, I set about building a device to measure the capacitance of a selected capacitor.<br /><br />First, a little of the theory behind its operation:<br /><br />Capacitors charge and discharge at certain 'speeds' based on the series resistance and its total capacitance. Skipping all of the semi-complicated maths, the time it takes for a capacitor to reach 63.2% of full charge is known as 1 RC time constant. The RC time constant is simply the product of the series resistance and the capacitance of the capacitor - R * C.<br /><br />Example:<br />100uF capacitor in series with a 10K resistor will take 1 second to reach 63.2% of full charge, then another 1 second to charge up to 63.2% of the remaining capacitance and so on... Effectively, it will reach full charge (or as near as makes no difference) but theoretically it wont.<br /><br />With this knowledge, I may be able to time how long it took for the capacitor to reach 63.2% charge, or, since they are proportional, 63.2% of the arduino's voltage level. However, I don't know how to implement a timer in the arduino language. I stuck with the 63.2% level but it didn't have any physical (as in physics) relevance from then on. I had to rely on the fact that the value given by the Arduino will be proportional to the actual time constant (although no connection was made) and therefore the capacitance (fixed resistance). I knew that as the capacitance increased, so would the value output by the arduino.<br /><br />Here is the schematic I have produced for my circuit:<br /><br /><div style="text-align: center;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_hBgprBskTTw/SGExBAey3II/AAAAAAAAASo/ryeXrRCsFpM/s1600-h/scematic.png"><img style="cursor: pointer;" src="http://2.bp.blogspot.com/_hBgprBskTTw/SGExBAey3II/AAAAAAAAASo/ryeXrRCsFpM/s400/scematic.png" alt="" id="BLOGGER_PHOTO_ID_5215503736850537602" border="0" /></a><br /></div><br />NOTE: Sorry, I've just noticed I missed out 3 of the PWM pins on the Arduino. I'll get round to sorting that soon.<br /><br />The switch 'S1' is used to start the measurement. 'S2' is used to manually ground the capacitor, just to make sure. The diodes were for my peace of mind (protecting the arduino) - they may not be needed. The transistor is used to ground the capacitor before and after a reading. You may want to put a resistor in series with the transistor's collector or something to limit the current, thinking about, I probably should have. The resistors 'R1' and 'R4' were calculated to take into account my maximum and minimum capacitance values and my maximum acceptable time to make the reading (20 seconds).<br /><br />Now, here's the code:<br /><blockquote><br />int firstRCV = 646; //(2^16)-1 * 63.2% (for first time constant)<br />unsigned int timerCount = 0; //incremented to get *RCTC's below<br />int checkPin = 0; //analog pin for checking the voltage level<br />int microFaradPin = 7; //pin used for readings between 1uF and 1000uF<br />int picoFaradPin = 6; //pin used for readings between 1pF and 1uF<br />int beginPin = 9; //switch pin to start reading<br />int groundingPin = 10; //set HIGH to ground the capacitor<br />int uRCTC = 0; //uF RC Time Consant<br />int pRCTC = 0; //pF RC Time Constant<br />int uConstant = 26; //divide uRCTC by this to get capacitance (in uF)<br />int pConstant = 2100; //divide pRCTC by this to get capacitance (in pF)<br />unsigned int capacitanceEstimation;//variable used to temporarily hold the capacitance estimate<br />long capEstLong;<br />char units;<br /><br />void setup(){<br />pinMode(checkPin, INPUT);<br />pinMode(microFaradPin, OUTPUT);<br />pinMode(picoFaradPin, OUTPUT);<br />pinMode(beginPin, INPUT);<br />pinMode(groundingPin, OUTPUT);<br />digitalWrite(microFaradPin, LOW);<br />digitalWrite(picoFaradPin, LOW);<br />digitalWrite(groundingPin, HIGH);<br /><br />Serial.begin(9600);<br />Serial.println("============================================================");<br />Serial.println(" Welcome to : Capacitance Meter 1.0");<br />Serial.println("============================================================");<br />}<br /><br />void loop(){<br /><br />if (digitalRead(beginPin) == HIGH){<br /><br />capEstLong = 0;<br /><br />//microFarad run-through<br /><br />digitalWrite(microFaradPin, LOW); //ground the capacitor<br />Serial.println("INITIALISING...");<br />digitalWrite(groundingPin, HIGH);<br />delay(1000); //wait a second to make sure<br />digitalWrite(groundingPin, LOW); <br />Serial.println("CHECKING RANGE 1uF - 2200uF... (This may take a minute)");<br />digitalWrite(microFaradPin, HIGH); //set uF pin high to charge capacitor<br /><br />uRCTC = get_uRCTC(); //function to get the number of time periods until the 63.2% level is reached<br /><br />digitalWrite(microFaradPin, LOW); //set the pin low again<br />digitalWrite(groundingPin, HIGH);<br /><br />//Serial.print("400us periods : "); //un-comment to get the integer values<br />//Serial.println(uRCTC, DEC); //un-comment to get the integer values<br /><br />//capacitance estimation<br />capacitanceEstimation = uRCTC / uConstant; //get the actual capacitance value using the gradient of the graph plotted<br />capEstLong = (long)capacitanceEstimation;<br /><br />//units for the capacitance; micro for now, but if in pico range, it will change to 'p'<br />units = 117;<br /><br />//should we use the mega resistance to get a value for a picoFarad capacitor?<br />//if it is 0, the capacitance is less than 1uF (integer part of number)<br />if (capacitanceEstimation == 0){<br /><br />//picoFarad run-through<br />units = 112;<br />Serial.println("NOT IN RANGE 1uF - 2200uF");<br />digitalWrite(picoFaradPin, LOW); <br />digitalWrite(groundingPin, HIGH);<br />delay(1000); <br />digitalWrite(groundingPin, LOW); <br />Serial.println("CHECKING RANGE 1pF - 1uF... (This may take a minute)");<br />digitalWrite(picoFaradPin, HIGH);<br /><br />pRCTC = get_pRCTC();<br /><br />digitalWrite(picoFaradPin, LOW); //set the pin low again<br />digitalWrite(groundingPin, HIGH);<br /><br />//Serial.println(pRCTC, DEC); //un-comment to get the integer values<br /><br />//capacitance estimation<br />if (pRCTC > 5){<br /> capEstLong = ((long)pRCTC * 10000) / (long)pConstant;<br /> if (capEstLong > 1000){capEstLong = (capEstLong / 100) * 100;}<br /> if (capEstLong > 10000){capEstLong = (capEstLong / 1000) * 1000;}<br /> if (capEstLong > 100000){capEstLong = (capEstLong / 10000) * 10000;}<br /> if (capEstLong > 1000000){capEstLong = (capEstLong / 100000) * 100000;}<br /> if (capEstLong > 10000000){capEstLong = (capEstLong / 1000000) * 1000000;}<br />}<br />}<br /><br />Serial.print("Capacitance Estimation : ");<br />if (capEstLong > 0){<br />Serial.print(capEstLong, DEC);<br />Serial.print(units, BYTE);<br />Serial.println("F");<br />} else {<br />Serial.println("NA (possibly too small)");<br />}<br /><br />Serial.println("============================================================");<br /><br /><br />} //if - beginPin is HIGH<br /><br />} //loop<br /><br />int get_uRCTC(){<br />timerCount = 0;<br />while (analogRead(checkPin) <= firstRCV) { delayMicroseconds(400); timerCount++; } return timerCount; } int get_pRCTC() { timerCount = 0; while (analogRead(checkPin) <= firstRCV) { timerCount++; } return timerCount; }</blockquote><br />If you decide to make one, you'll need to change some of the constants (but actually variables in the code) according to the integer values given by the Arduino. The code above worked for me in a breadboard, but, resistances may vary with the components you use. I admit, the code is not the nicest I've seen, but, for a personal proof of concept it's fine for me.<br /><br />I calibrated my sensor by plotting a graph using capacitors with known values and the integer thrown out by the code to the serial port. (un-comment some lines in the code to get the integer value). Here is one of my graphs, it's pointless showing both:<br /><br /><div style="text-align: center;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_hBgprBskTTw/SGE5mOIvX_I/AAAAAAAAASw/jNSSaSSkKVo/s1600-h/untitled.bmp"><img style="cursor: pointer;" src="http://3.bp.blogspot.com/_hBgprBskTTw/SGE5mOIvX_I/AAAAAAAAASw/jNSSaSSkKVo/s400/untitled.bmp" alt="" id="BLOGGER_PHOTO_ID_5215513172264312818" border="0" /></a><br /></div><br />There were some points further up the line, but they seem to have mystically disappeared. If you get you spreadsheet application to show the equation of a linear trend line, you can get the gradient of the line. By dividing the integer value from the arduino by the gradient of the line, you get the supposed capacitance. This is where the 'constants' in the code come from.<br /><br />Overall, this was quite a fun project to do, as well as aiding my learning - both physics/electronics and arduino programming. And, surprisingly, it was fairly accurate in the 1uF to 2200uF range - usually within 1uF or 2uF of the capacitors markings at the higher end, and dead on in the lower end. Considering the tolerance of the capacitors, this doesn't seem too bad! Not quite so accurate in the lower capacitance range though - usually within 300pF of the stated capacitance at the top end, much closer at the lower end.<br /><br />Hope that was worth posting, Thanks for reading.<br /><br />Any comments/suggestions greatly appreciated.<br /><br />Chris<br /><br />P.S. If anyone knows how to implement a timer in the arduino language, even on the AVR side of things, I'd love to know.Unknownnoreply@blogger.com11tag:blogger.com,1999:blog-873449337697168887.post-13169946392842835602008-05-21T12:42:00.000+01:002008-06-22T19:30:14.603+01:00Fairly High Speed Photography<span style=";font-family:georgia;font-size:85%;" >Well, this is my first post, so sorry if it's a bit bad.<br /><br /></span><span style="font-size:85%;">I came across <a href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1208117338">this</a> post on the <a href="http://arduino.cc/"><span class="blsp-spelling-error" id="SPELLING_ERROR_0">Arduino</span></a> forums the other day, so, naturally, i thought i would give it a go.<br /><br />I found an old 35mm <span class="blsp-spelling-corrected" id="SPELLING_ERROR_1">camera</span> lying around at home, and thought I could put it to good use. After about half an hour of trying to find the blooming screws and get it open, I managed to get to the flash circuitry. It was quite simple really, it came out as one small circuit board with a few wires hanging out - two of them obviously for the power, and one to fire the flash. As it turned out, touching this third wire to the positive side of the battery made the flash fire. This is quite easy to do by simply using a transistor.<br /><br />Here is the complete schematic:</span><br /><span style="font-size:85%;"><br /></span><div style="text-align: center;"><span style="font-size:85%;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_hBgprBskTTw/SDQPw7_XkiI/AAAAAAAAARY/2MnWLxGCtLs/s1600-h/schematic.png"><img style="cursor: pointer;" src="http://1.bp.blogspot.com/_hBgprBskTTw/SDQPw7_XkiI/AAAAAAAAARY/2MnWLxGCtLs/s320/schematic.png" alt="" id="BLOGGER_PHOTO_ID_5202800802931380770" border="0" /></a></span><span style="font-size:85%;"><br /></span></div><span style="font-size:85%;"><br />By putting the base of the <span class="blsp-spelling-error" id="SPELLING_ERROR_2">NPN</span> transistor at 5V relative to its emitter, the purple (flash trigger) wire 'goes high' causing the flash to fire. This is <span class="blsp-spelling-corrected" id="SPELLING_ERROR_3">accomplished</span> with the following quick code:<br /><br /></span><span style="font-style: italic;font-size:85%;" ># variable declarations<br />int <span class="blsp-spelling-error" id="SPELLING_ERROR_4">buttonIn</span> = 0;<br />int wait = 0;<br /></span><br /><span style="font-style: italic;font-size:85%;" ># pins<br />int <span class="blsp-spelling-error" id="SPELLING_ERROR_5">flashPin</span> = 12;<br />int <span class="blsp-spelling-error" id="SPELLING_ERROR_6">switchPin</span> = 7;<br />int <span class="blsp-spelling-error" id="SPELLING_ERROR_7">delayPin</span> = 0;<br /><br /><br />void setup(){<br /><span class="blsp-spelling-error" id="SPELLING_ERROR_8">pinMode</span>(<span class="blsp-spelling-error" id="SPELLING_ERROR_9">flashPin</span>, OUTPUT);<br /><span class="blsp-spelling-error" id="SPELLING_ERROR_10">pinMode</span>(<span class="blsp-spelling-error" id="SPELLING_ERROR_11">switchPin</span>, INPUT);<br /><span class="blsp-spelling-error" id="SPELLING_ERROR_12">pinMode</span>(<span class="blsp-spelling-error" id="SPELLING_ERROR_13">delayPin</span>, INPUT);<br />Serial.begin(9600);<br />}<br /></span><br /><span style="font-style: italic;font-size:85%;" >void loop(){<br /><span class="blsp-spelling-error" id="SPELLING_ERROR_14">buttonIn</span> = <span class="blsp-spelling-error" id="SPELLING_ERROR_15">digitalRead</span>(<span class="blsp-spelling-error" id="SPELLING_ERROR_16">switchPin</span>);<br /><br />if (<span class="blsp-spelling-error" id="SPELLING_ERROR_17">buttonIn</span> == 1){<br />delay(wait);<br />flash();<br />Serial.<span class="blsp-spelling-error" id="SPELLING_ERROR_18">println</span>("Picture Taken");<br />Serial.<span class="blsp-spelling-error" id="SPELLING_ERROR_19">println</span>("Recharging Capacitor");<br />delay(2000);<br />Serial.<span class="blsp-spelling-error" id="SPELLING_ERROR_20">println</span>("Capacitor Recharged");<br />delay(500);<br />}<br /><br />wait = <span class="blsp-spelling-error" id="SPELLING_ERROR_21">analogRead</span>(<span class="blsp-spelling-error" id="SPELLING_ERROR_22">delayPin</span>);</span><br /><span style="font-style: italic;font-size:85%;" ><br />Serial.<span class="blsp-spelling-error" id="SPELLING_ERROR_23">println</span>(wait, DEC);<br />}<br /><br />#fire the flash<br />void flash(){<br /><span class="blsp-spelling-error" id="SPELLING_ERROR_24">digitalWrite</span>(<span class="blsp-spelling-error" id="SPELLING_ERROR_25">flashPin</span>, HIGH);<br />delay(100);<br /><span class="blsp-spelling-error" id="SPELLING_ERROR_26">digitalWrite</span>(<span class="blsp-spelling-error" id="SPELLING_ERROR_27">flashPin</span>, LOW);</span><br /><span style="font-style: italic;font-size:85%;" >}<br /><br /></span><span style=";font-family:georgia;font-size:85%;" ><span style=";font-family:arial;font-size:100%;" ><span style="font-family:georgia;"><span style="font-size:100%;">As you may have noticed, from the schematic and the code, i have added a potentiometer into the circuit so i could delay the flash's firing to allow the splashes and whatnot to develop.<br /><br />Here's the 'equipment' relating to the above <span class="blsp-spelling-corrected" id="SPELLING_ERROR_28">schematic</span>:</span><br /></span></span></span><br /><div style="text-align: center;"><span style="font-size:85%;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_hBgprBskTTw/SDQSVb_XkjI/AAAAAAAAARg/mow9vSETZa8/s1600-h/DSCF0966.jpg"><img style="cursor: pointer;" src="http://3.bp.blogspot.com/_hBgprBskTTw/SDQSVb_XkjI/AAAAAAAAARg/mow9vSETZa8/s320/DSCF0966.jpg" alt="" id="BLOGGER_PHOTO_ID_5202803629019861554" border="0" /></a></span><span style="font-size:85%;"><br /></span><span style=";font-family:georgia;font-size:85%;" ><span style=";font-family:arial;font-size:100%;" ><span style="font-family:georgia;">The <span class="blsp-spelling-error" id="SPELLING_ERROR_29">Arduino</span>, breadboard and flash circuit.<br /><br /></span></span></span></div><span style=";font-family:georgia;font-size:85%;" ><span style=";font-family:arial;font-size:100%;" ><span style="font-family:georgia;"><br /></span></span></span><div style="text-align: center;"><span style="font-size:85%;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_hBgprBskTTw/SDQSVr_XkkI/AAAAAAAAARo/VawKRlbFxag/s1600-h/DSCF0967.jpg"><img style="cursor: pointer;" src="http://4.bp.blogspot.com/_hBgprBskTTw/SDQSVr_XkkI/AAAAAAAAARo/VawKRlbFxag/s320/DSCF0967.jpg" alt="" id="BLOGGER_PHOTO_ID_5202803633314828866" border="0" /></a></span><span style="font-size:85%;"><br /></span></div><div style="text-align: center;"><span style="font-size:85%;">The contact switch I made using 2 <span class="blsp-spelling-error" id="SPELLING_ERROR_30">CD's</span> and a micro-switch from an old video player.<br /><br /></span><div style="text-align: left;"><span style="font-size:85%;">To take the pictures, all you have to do is:<br /></span><ol><li><span style="font-size:85%;">Set your camera to a low ISO sensitivity (ISO100) and a slow shutter speed (4")<br /></span></li><li><span style="font-size:85%;">Get the camera focused on the switch (or <span class="blsp-spelling-corrected" id="SPELLING_ERROR_31">whatever</span> you've sat on it)</span></li><li><span style="font-size:85%;">Turn out the lights</span></li><li><span style="font-size:85%;">Press the camera's trigger</span></li><li><span style="font-size:85%;">Drop the object, whatever it is, onto the contact switch before the shutter closes making sure the switch closes.<br /></span></li></ol><span style="font-size:85%;">Here are some of my results:<br /><br /></span></div></div><div style="text-align: center;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_hBgprBskTTw/SDQzJb_XklI/AAAAAAAAARw/oClHBxGwvTg/s1600-h/DSCF0907.jpg"><img style="cursor: pointer;" src="http://3.bp.blogspot.com/_hBgprBskTTw/SDQzJb_XklI/AAAAAAAAARw/oClHBxGwvTg/s320/DSCF0907.jpg" alt="" id="BLOGGER_PHOTO_ID_5202839706745147986" border="0" /></a><br />A 'rich tea' biscuit breaking as it hits the<br />ice-cream tub lid covering the contact sensor<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_hBgprBskTTw/SDQzK7_XkmI/AAAAAAAAAR4/aFTs-pjw3-8/s1600-h/DSCF0938.jpg"><img style="cursor: pointer;" src="http://1.bp.blogspot.com/_hBgprBskTTw/SDQzK7_XkmI/AAAAAAAAAR4/aFTs-pjw3-8/s320/DSCF0938.jpg" alt="" id="BLOGGER_PHOTO_ID_5202839732514951778" border="0" /></a><br />A small scrubbing brush being dropped in a tub of water<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_hBgprBskTTw/SDQzLr_XkpI/AAAAAAAAASQ/DqGzjiMDD0A/s1600-h/DSCF0965.jpg"><img style="cursor: pointer;" src="http://4.bp.blogspot.com/_hBgprBskTTw/SDQzLr_XkpI/AAAAAAAAASQ/DqGzjiMDD0A/s320/DSCF0965.jpg" alt="" id="BLOGGER_PHOTO_ID_5202839745399853714" border="0" /></a><br />A coloured bulb just hitting the water<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_hBgprBskTTw/SDQzLb_XkoI/AAAAAAAAASI/5OuCn76hBNY/s1600-h/DSCF0959.jpg"><img style="cursor: pointer;" src="http://3.bp.blogspot.com/_hBgprBskTTw/SDQzLb_XkoI/AAAAAAAAASI/5OuCn76hBNY/s320/DSCF0959.jpg" alt="" id="BLOGGER_PHOTO_ID_5202839741104886402" border="0" /></a><br />Another coloured bulb hitting the water at a diagonal<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_hBgprBskTTw/SDQzLL_XknI/AAAAAAAAASA/WT05HvQgizY/s1600-h/DSCF0951.jpg"><img style="cursor: pointer;" src="http://2.bp.blogspot.com/_hBgprBskTTw/SDQzLL_XknI/AAAAAAAAASA/WT05HvQgizY/s320/DSCF0951.jpg" alt="" id="BLOGGER_PHOTO_ID_5202839736809919090" border="0" /></a><br />A really nice <span class="blsp-spelling-corrected" id="SPELLING_ERROR_32">splash</span> as the bulb hits the water<br /><br /><div style="text-align: left;">Improvements:<br /><br />As mentioned in the link at the top of the post, a microphone would be an <span class="blsp-spelling-corrected" id="SPELLING_ERROR_33">excellent</span> way of doing this, so if anyone has any pointers...<br /><br />I could also try doing it with a laser, there's an idea.<br /><br />Any comments/suggestions greatly appreciated.<br /><br />Chris<br /><br /><br /></div></div>Unknownnoreply@blogger.com0