<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>www.jhodges.co.uk &#187; Arduino</title>
	<atom:link href="http://jhodges.co.uk/category/arduino/feed/" rel="self" type="application/rss+xml" />
	<link>http://jhodges.co.uk</link>
	<description>I ain&#039;t not never done nothing to nobody and there ain&#039;t not no way none of that couldn&#039;t not never have happened. See?</description>
	<lastBuildDate>Tue, 08 Jun 2010 20:34:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Remote control car speedometer V2</title>
		<link>http://jhodges.co.uk/remote-control-car-speedometer-v2/</link>
		<comments>http://jhodges.co.uk/remote-control-car-speedometer-v2/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 13:59:59 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Electronics]]></category>

		<guid isPermaLink="false">http://www.jhodges.co.uk/?p=196</guid>
		<description><![CDATA[After my semi successful prototype of my remote control car speedometer project using a reed switch, I&#8217;m back with version 2, this time using a hall effect sensor.
 The same principle applies as before, there is a magnet on the wheel that passes the sensor each revolution allowing the speed to be calculated. However the [...]]]></description>
			<content:encoded><![CDATA[<p>After my semi successful prototype of my <a href="/remote-control-car-speedometer/">remote control car speedometer project using a reed switch</a>, I&#8217;m back with version 2, this time using a hall effect sensor.</p>
<p><span id="more-196"></span> The same principle applies as before, there is a magnet on the wheel that passes the sensor each revolution allowing the speed to be calculated. However the hall affect sensor is quite different from a reed switch. The reed switch is either on or off depending on whether it&#8217;s been activated by a magnetic field. The hall effect sensor gives an analogue output measuring the strength and polarity of a magnetic field. This required a rewrite of the software, including a calibration function, and I also added some goodies while I was there.</p>
<p>I used my <a href="/stripboard-arduino-sd-card/">strip board Arduino SD card writer</a> for the main board for this project. I designed it with this project in mind so it already has three connectors to allow the hall effect sensor to be connected.</p>
<p>Calibration only needs to be done once, unless any of the hardware is changed or replace, and is performed by holding down the button whilst powering up the device. The magnet must be away from the sensor during this process. This takes a reading and stores the value to the ATmegas EEPROM. This is our baseline value, and as the wheel rotates and the magnet passes the sensor the current reading will stray from this baseline value, and we log the milliseconds taken since the last rotation to the memory card. There is a bit more maths and logic involved to try and reduce false readings, but I won&#8217;t go into details here.</p>
<p>If the card is not present or failed to initialise the LED will flash constantly signifying a problem. Once the system is initialised the LED will flash once every time the magnet passes the sensor, and will also be logging this information to the card.</p>
<p>Before the card is removed the button must be held down until the LED is constantly lit, this flushes (writes) any data that has not yet been written to the card, much like un-mounting/ejecting your USB stick or memory cards before removing them from the computer.</p>
<p>The other goodies I mentioned is a race and driver selector. Pressing the button will mark the end of the current race and the beginning of the next race. The number of times the button is pressed in succession indicates which driver will be racing next. When reading the data into the computer this allows the data to be split into separate graphs for each race and they can also labelled with who was racing. An example follows of the results of me testing this functionality&#8230;</p>
<style>
	table.racestats{
		border:1px solid #000;
	}
	table.racestats th{
		background:#444;
		color:#fff;
		padding:2 5 2 5;
	}
	table.racestats td{
		text-align:right;
		background:#ccc;
		padding:2 5 2 5;</p>
<p>	}
</style>
<table class="racestats">
<tr>
<th>Race #</th>
<th>Driver #</th>
<th>Race Time (Secs)</th>
<th>Top Speed (MPH)</th>
<th>Avg Speed (MPH)</th>
</tr>
<tr>
<td>1</td>
<td>1</td>
<td>5.80</td>
<td>4.89</td>
<td>4.47</td>
</tr>
<tr>
<td>2</td>
<td>2</td>
<td>12.16</td>
<td>7.21</td>
<td>5.49</td>
</tr>
<tr>
<td>3</td>
<td>3</td>
<td>11.61</td>
<td>4.82</td>
<td>3.14</td>
</tr>
<tr>
<td>4</td>
<td>1</td>
<td>3.23</td>
<td>4.09</td>
<td>3.77</td>
</tr>
</table>
<p>The graphs have been omitted, but this data table would be accompanied by four graphs, one for each race.</p>
<p>Time for a road test&#8230;.</p>
<p><img src="/media/speedo2/car.jpg" alt="car with speedo" /></p>
<p>I mounted the device to the car, wired it up and power it on, and it initialised fine. I had a spin up and down the road and came back, pressed the button to start a new race with another driver number and had another spin, I did this several times with various different driver numbers and then flushed the buffer to the card. I took the card out and put it in my computer expecting to see quite a few different race graphs. I was only shown two races and graphs, one looked a complete mess and the other didn&#8217;t really have much data on it at all. Here is the messy graph&#8230;</p>
<p><img src="/media/speedo2/graph1.png" alt="graph" /></p>
<p>Not a lot of use, and I&#8217;m fairly sure it wasn&#8217;t doing 700 mph. After a bit of an investigation I found the cause was electromagnetic interference from the car&#8217;s motor or speed controller interfering with the readings from the sensor, also possibly interfering with the data being written to the card. I tried mounting the board in a grounded tin but that did not seem to help much. What seem to help most was moving the board away from the cars electronics and also twisting the hall effect sensors output signal wire with the ground wire. I also shortened the wires as much as possible.</p>
<p>Finally I got a sensible graph of me doing top speed, and here it is&#8230;</p>
<p><img src="/media/speedo2/graph2.png" alt="graph" /></p>
<p>The points that look like they&#8217;re in the wrong place, being much lower than the points around them are because a reading is missed every time a sector is written to the SD card. I&#8217;m sure this anomaly can probably be hidden in the software somehow, but are not overly concerned with this at the moment.</p>
<p>Still a fair bit of work to do, but a definite improvement on the first version which was unable to measure my top speed.  Occasionally I seem to get no, or random data on the card and also my average speed calculation is far from accurate, but all things that I think have relatively easy solutions.</p>
<p>I guess I need to find some other drivers now and we can do some time trials and compare results <img src='http://jhodges.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://jhodges.co.uk/remote-control-car-speedometer-v2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stripboard Arduino &amp; SD Card</title>
		<link>http://jhodges.co.uk/stripboard-arduino-sd-card/</link>
		<comments>http://jhodges.co.uk/stripboard-arduino-sd-card/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 18:52:21 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Electronics]]></category>

		<guid isPermaLink="false">http://www.jhodges.co.uk/?p=183</guid>
		<description><![CDATA[I love my Arduino development board and have done some interesting experiments with it, and now I am at the stage of wanting to make some of my circuits a bit more independent and permanent, mainly so I can continue to use development board for tinkering with while leaving my other projects in a working [...]]]></description>
			<content:encoded><![CDATA[<p>I love my Arduino development board and have done some interesting experiments with it, and now I am at the stage of wanting to make some of my circuits a bit more independent and permanent, mainly so I can continue to use development board for tinkering with while leaving my other projects in a working state. The mind, body and soul of the Arduino is the ATmega168 chip, which contains all the memory, processor, analogue to digital converters and pretty much everything else. As these chips can be picked up for only a couple of pounds I thought I would have a go at making a stand alone unit to log data to an SD card&#8230;</p>
<p><span id="more-183"></span>I have made an SD card module for my Arduino before, so this is really about getting the ATmega chip powered up and running and interfacing to the module, for more information about the SD card project and the software involved see my <a href="http://www.jhodges.co.uk/sd-card-and-arduino/">SD card and Arduino</a> post.</p>
<p><img src="/media/stripboard-arduino/front1.jpg" alt="" /><img src="/media/stripboard-arduino/back1.jpg" alt="" /></p>
<p>At this stage it is pretty generic, all that it consists of is a power supply (5 V regulator, protective diode and resettable fuse, and a couple of smoothing capacitors), a 16 MHz crystal with two capacitors, and  the ATmega168 chip whith a 10 KΩ pull up resistor on the reset pin, I chose not to have a reset button but this could easily be added. This seems quite a nice layout and could be a good starting point for many different projects. Most of the chips Digital I/O pins are accessible, and so are all of the analogue input pins.</p>
<p>One thing the development board does give you is a USB port, allowing easy programming of the chip. To programme this chip I simply pop the chip out of its socket and place it back in the development board, upload the programme and then pop the chip back into my board.</p>
<p><img src="/media/stripboard-arduino/front2.jpg" alt="" /><img src="/media/stripboard-arduino/back2.jpg" alt="" /></p>
<p>Here I have added a pushbutton and LED with 330 Ω resistor to digital I/O pin zero and one respectively.  You pretty much always need some sort of input and output, these were very useful during debugging, and essential for communication between the running programme and the user. The pushbutton does not need a pull up resistor as the ATmega168 has internal pull up resistors that can and will be enabled in my code.  I have also added three connectors to allow external access to ground and 5 V, and also analogue input zero.</p>
<p><img src="/media/stripboard-arduino/front3.jpg" alt="" /><img src="/media/stripboard-arduino/back3.jpg" alt="" /></p>
<p>This next stage shows the connector to mount my SD card socket onto. It is actually half a chip socket that I have cut up, bent the pins slightly and tinned. There are also three voltage dividers used to drop the 5 V output logic from the ATmega down to the 3.3 V required for the SD card.</p>
<p>I ran into a bit of a problem at this point, in my haste to build this circuit and as I had also made an SD card module for my Arduino before I didn&#8217;t test this part when building the prototype. This was a big mistake! What I had done was used the same voltage divider method to drop the 5 V supply voltage down to 3.3 V to supply the SD card, however it turns out that this is not a good thing to do, it is fine for the logic but not the supply. The voltage isn&#8217;t particularly stable, as when the internal resistance of the card changes it upsets the ratio of the resistance in the divider.</p>
<p>After muttering some obscenities and returning to the prototyping board I found a 22 µF or greater capacitor across ground and 3.3 V helped slightly, allowing the MMC library to initialise, but failing at the second hurdle now with the microfat library failing to initialise.  I somehow needed a very stable 3.3 V supply. I didn&#8217;t really really want another voltage regulator on my circuit, then I remembered our good old friend the zener diode! Using a 3.3 V reverse biased zener as the lower side of the voltage divider and a smaller resistor above (47 Ω) I was able to achieve a steady voltage, and the card initialised perfectly.</p>
<p><img src="/media/stripboard-arduino/front4.jpg" alt="" /> <a href="/media/stripboard-arduino/schematic.gif"><img src="/media/stripboard-arduino/schematic-thumb.gif" alt="" /></a></p>
<p>So here it is now with the card holder and card attached, all working and tested. It is probably a bit hard to follow the wiring from the photographs, so I have also included schematic. This is a nice compact but minimal package, with a lot of the input pins available for reading data and a card to log that data to. I can imagine many uses for this, and there is even a little bit of space on the board for a fewer additional components should they be required.</p>
]]></content:encoded>
			<wfw:commentRss>http://jhodges.co.uk/stripboard-arduino-sd-card/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Laser Show Prototype</title>
		<link>http://jhodges.co.uk/laser-show-prototype/</link>
		<comments>http://jhodges.co.uk/laser-show-prototype/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 23:01:09 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Electronics]]></category>

		<guid isPermaLink="false">http://www.jhodges.co.uk/?p=162</guid>
		<description><![CDATA[I&#8217;ve recently acquired a laser pen, and of course, instantly dismantled it! I bypassed the push button and soldered on a couple of wines replacing the batteries, allowing it to be powered and controlled by the Arduino.

I wanted it to wobble about in a random fashion, so I mounted it on a spring and attached [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently acquired a laser pen, and of course, instantly dismantled it! I bypassed the push button and soldered on a couple of wines replacing the batteries, allowing it to be powered and controlled by the Arduino.</p>
<p><span id="more-162"></span><object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/hI21BXg7zJw&#038;hl=en&#038;fs=1&#038;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/hI21BXg7zJw&#038;hl=en&#038;fs=1&#038;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></p>
<p>I wanted it to wobble about in a random fashion, so I mounted it on a spring and attached the spring to a motor.  I powered up both the laser and the motor and let the show begin! It wasn&#8217;t bad for the initial test, but before long it seemed to get into a repetitive loop drawing just a figure of eight or other mundane but curvy shapes.</p>
<p>To add some extra randomness to it I programmed the Arduino to randomly turn on and off the motor, which seemed to do the job quite nicely and is shown in the video above. It does not look as good on video as it does in real life, this is due to limitations caused by the relatively slow frame rate of the camera. Oh how I wish I could justify buying a high speed camera <img src='http://jhodges.co.uk/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>The next step will be to make it a bit smoother, hopefully quieter, and get it displaying on a wall outside during the night. Stay tuned to see how that goes!</p>
]]></content:encoded>
			<wfw:commentRss>http://jhodges.co.uk/laser-show-prototype/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Transistor h-bridge VS driver IC chip (L293D)</title>
		<link>http://jhodges.co.uk/transistor-h-bridge-vs-driver-ic-chip-l293d/</link>
		<comments>http://jhodges.co.uk/transistor-h-bridge-vs-driver-ic-chip-l293d/#comments</comments>
		<pubDate>Sat, 07 Mar 2009 11:24:06 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Electronics]]></category>

		<guid isPermaLink="false">http://www.jhodges.co.uk/?p=153</guid>
		<description><![CDATA[As mentioned in an earlier post, I suggested the motor driver IC would be preferable over four transistors and lots of wire due to it&#8217;s small and neat package! However I have just realised something that may sway me in the other direction&#8230;
 I was running my Arduino on battery, trying to prototype a simple [...]]]></description>
			<content:encoded><![CDATA[<p>As mentioned in an earlier post, I suggested the motor driver IC would be preferable over four transistors and lots of wire due to it&#8217;s small and neat package! However I have just realised something that may sway me in the other direction&#8230;</p>
<p><span id="more-153"></span> I was running my Arduino on battery, trying to prototype a simple vehicle, and after being distracted for some time came back to find a very flat battery, even though none of the motors were doing anything.</p>
<p>After recharging the battery, the first thing I did was grab my multimeter and measure how much current my circuit was drawing whilst in its idle state. It came in at about 45mA, and considering my battery only has a capacity of 170mAh, this gives an idle battery life of about 3.5 hours.</p>
<p>To reduce this current drain slightly, I found that by disabling the h-bridge that I was not using, by pulling the enable pin low, I could save on 15mA.  As this is a dual h-bridge, if I disabled the other one I could save on another 15mA, but as this was the one I was using I had to wire that enable pin to an output of the Arduino, so it could enable it as and when it needed it.</p>
<p>This got the overall quiescent current down to about 15mA, which gives a much better battery life of about 11 hours, however I wondered how this would compare to my <a href="http://www.jhodges.co.uk/hall-effect-controlled-cdrom-draw/">transistor h-bridge.</a></p>
<p>So for a quick test I rebuilt my transistor h-bridge, and measured the current drawn whilst it was doing nothing, and it barely registered, good enough to call 0mA.</p>
<p>So for battery-powered applications, the transistors may be preferable. I have looked at a couple of other motor driver chips, and they all seem to use a small quiescent supply current, one I saw used about half that of this chip.</p>
]]></content:encoded>
			<wfw:commentRss>http://jhodges.co.uk/transistor-h-bridge-vs-driver-ic-chip-l293d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hall Effect and Motor Driver Interference</title>
		<link>http://jhodges.co.uk/hall-effect-and-motor-driver-interference/</link>
		<comments>http://jhodges.co.uk/hall-effect-and-motor-driver-interference/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 16:30:00 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Electronics]]></category>

		<guid isPermaLink="false">http://www.jhodges.co.uk/?p=130</guid>
		<description><![CDATA[My motor driver IC (L293D) arrived the other day, and before I put it to real use I thought I would just have a quick go at driving two motors at once&#8230;
I still had my hall effect controlled CD-ROM draw set up so I thought I would replace the four transistor h-bridge with the new [...]]]></description>
			<content:encoded><![CDATA[<p>My motor driver IC (L293D) arrived the other day, and before I put it to real use I thought I would just have a quick go at driving two motors at once&#8230;</p>
<p><span id="more-130"></span>I still had my <a href="http://www.jhodges.co.uk/hall-effect-controlled-cdrom-draw/">hall effect controlled CD-ROM draw</a> set up so I thought I would replace the four transistor h-bridge with the new chip, and be able to drive another motor at the same time. This second motor also came from a CD-ROM drive where I also found a two-way switch used to detect whether the draw was open or closed, I glued a bit of plastic to one of the cogs and attached the switch so that it would be activated by the piece of plastic allowing me to detect which way the motor was turning. I intended to change the direction of the motor when this happened to make it go back and forth.</p>
<p>The driving of the motors worked perfectly, however the fluctuating supply voltage caused by the starting and stopping of the motors interfered with the hall effect sensor.</p>
<p><object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/e2jrZ87pnp4&#038;hl=en&#038;fs=1&#038;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/e2jrZ87pnp4&#038;hl=en&#038;fs=1&#038;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></p>
<p>I am fairly interested in solving this problem, but there are other things I want to be doing at the moment and I have dismantled the project. I did briefly try connecting the supply voltage directly to an analogue input, so I could detect a drop in the voltage and use this to compensate for the change in the hall effect input voltage, but this did not work. I also tried using  various capacities to smooth the supply, but again no luck as I think the fluctuations last for too long.</p>
<p>I am sure there will be a time when I run into this situation again but until then I am not going to worry, but feel free to propose a solution or make any suggestions and I may well give it a go.</p>
]]></content:encoded>
			<wfw:commentRss>http://jhodges.co.uk/hall-effect-and-motor-driver-interference/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hall effect controlled CDROM draw</title>
		<link>http://jhodges.co.uk/hall-effect-controlled-cdrom-draw/</link>
		<comments>http://jhodges.co.uk/hall-effect-controlled-cdrom-draw/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 22:35:11 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Electronics]]></category>

		<guid isPermaLink="false">http://map.jhodges.co.uk/?p=14</guid>
		<description><![CDATA[The next thing I wanted to try doing with my Aruino was driving some motors. I have got loads of old CD/DVD drives that I don&#8217;t use any more and thought this would be an ideal source of motors.
The motor on its own worked reasonably well connected straight between an output pin and ground, however [...]]]></description>
			<content:encoded><![CDATA[<p>The next thing I wanted to try doing with my Aruino was driving some motors. I have got loads of old CD/DVD drives that I don&#8217;t use any more and thought this would be an ideal source of motors.</p>
<p>The motor on its own worked reasonably well connected straight between an output pin and ground, however it wasn&#8217;t particularly powerful as the output pin can only source a limited current, and I could also only turn it in one direction, without physically swapping the cables over. After a bit of research and discovered what was required to control the DC motor in both directions, and this is called a h-bridge.</p>
<p><span id="more-14"></span>I found this <a class="postlink" href="http://www.solarbotics.net/library/circuits/driver_4varHbridge.html">this schematic</a> for a basic h-bridge made from 4 transistors. The instructions seemed pretty specific as to what transistors to use, and also showed the use of 2 NPN and 2 PNP type transistors in the diagram. I can&#8217;t remember the difference between NPN and PNP, but I will be looking it up shortly, however I assumed the difference was big enough to require the use of both types to build an h-bridge.</p>
<p>I only had a few NPN transistors (BC109&#8217;s &amp; BC107&#8217;s) available and decided to see if it would work using them, and it did, with very pleasing results. So it seems I got lucky, or it doesn&#8217;t really matter what sort of transistors you use! Please let me know if you know either way <img title="Wink" src="http://www.jhodges.co.uk/images/smilies/icon_e_wink.gif" alt=";)" /></p>
<p>An h-bridge is also available in IC form, surprisingly known as a motor driver or steper motor driver. I have ordered a L293D driver chip, that can either drive a single stepper motor, or act as a dual h-bridge and drive two DC motors.</p>
<p>Next I needed an input to use to decide when and in which direction to turn the motor, I decided to try out one of my new hall effect sensors and make the tray move in or out to maintain a set distance between the sensor and a magnet. The wiring of this was relatively simple, and is shown below. The Arduino code is slightly more complicated, and quite a mess at the moment to be honest, but it works. As always just give me a shout if you want to see a code behind it, hopefully I will have tidied it up a bit by then!</p>
<p><object width="480" height="385" data="http://www.youtube.com/v/OUhKRvlmrzk&amp;hl=en&amp;fs=1&amp;rel=0" type="application/x-shockwave-flash"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/OUhKRvlmrzk&amp;hl=en&amp;fs=1&amp;rel=0" /><param name="allowfullscreen" value="true" /></object> <img src="http://www.jhodges.co.uk/media/transistor-h-bridge/transistor-h-bridge.jpg" alt="Image" /></p>
<p><span style="font-weight: bold;">NOTE:</span> I think I am probably missing some <a class="postlink" href="http://en.wikipedia.org/wiki/Flyback_diode">flyback diodes</a> from this circuit, but I am unsure as to where exactly to fit them, and haven&#8217;t really given it much thought as nothing has blown up! (Not yet anyway!)</p>
<p>&#8212; EDIT &#8212;</p>
<div style="float: left; margin-right: 10px;"><img src="http://www.jhodges.co.uk/media/transistor-h-bridge/transistor-h-bridge-with-diodes.jpg" alt="Image" /></div>
<p>Right, <a class="postlink" href="http://www.dprg.org/tutorials/1998-04a/">this article</a> shows where the diodes should go, and also looks like an excellent introduction to h-bridges. I believe most driver IC chips would have the flyback diodes built in, so again the preferred solution should you have one to hand.</p>
<p>Here is the latest circuit with diodes included.</p>
]]></content:encoded>
			<wfw:commentRss>http://jhodges.co.uk/hall-effect-controlled-cdrom-draw/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remote control car speedometer</title>
		<link>http://jhodges.co.uk/remote-control-car-speedometer/</link>
		<comments>http://jhodges.co.uk/remote-control-car-speedometer/#comments</comments>
		<pubDate>Mon, 09 Feb 2009 21:37:19 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Electronics]]></category>

		<guid isPermaLink="false">http://map.jhodges.co.uk/?p=11</guid>
		<description><![CDATA[For my next project, and this is one I have been wanting to do for while, I will be makeing a speedometer for my remote control car.
&#8220;What good is that?&#8221; I hear you say, &#8220;how are you going to read the speed when it&#8217;s going past you at 30 miles per hour!?&#8221;
Well I intend to [...]]]></description>
			<content:encoded><![CDATA[<p>For my next project, and this is one I have been wanting to do for while, I will be makeing a speedometer for my remote control car.</p>
<p>&#8220;What good is that?&#8221; I hear you say, &#8220;how are you going to read the speed when it&#8217;s going past you at 30 miles per hour!?&#8221;</p>
<p><span id="more-11"></span>Well I intend to log the speed to a SD card, so that it can be reviewed on a computer by the means of some pretty graphs and statistics. A display could be added to the car to show the maximum speed achieved or something, but I&#8217;m going to concentrate on logging to card to begin with.</p>
<p>My first thought was GPS, this would allow a top-down route to be plotted on a map, and also allow speeds to be calculated. The problem with this is that GPS has a resolution of about 10 metres, which means any stops, starts, curves and turns within 10 metres wouldn&#8217;t be picked up and speed calculation won&#8217;t be very accurate.</p>
<p>My second thought was to make a localised GPS using three or more transmitters around the race area to allow a receiver on the car to triangulate its position. This would also allow plotting of the route on a map. Although this doesn&#8217;t seem impossible it may be quite complicated and seemingly expensive. I will put this on the back burner and will hopefully revisit it soon.</p>
<p>My third thought (okay it was my first, but I skipped it to think about the other two methods) is to simply measure how fast one of the wheels turns round. As the car is a rear wheel drive I decided to use one of the front wheels as this would give a better indication of speed rather than measuring how fast I can burn rubber! I thought a reed switch and magnet would probably do the trick.</p>
<p><img src="http://www.jhodges.co.uk/media/speedo/speedo_wheel.jpg" alt="Image" /></p>
<p>So there it is, a magnet mounted to the inside of the wheel, and a reed switch inside that big blob of blue tack. I connected the reed switch to the Arduino development board and also plugged in my SD card reader/writer that <a href="http://www.jhodges.co.uk/sd-card-and-arduino/">I made earlier</a>. I was originally going to get the Arduino to do all the calculations and work out the speed to log to the memory card, but then I decided I would just log the milliseconds to the card each time the reed switch was activated.</p>
<p>My first test was just spinning the wheel by hand to see if it was all working, and this is the data I got back (after a bit of processing)</p>
<p><img src="http://www.jhodges.co.uk/media/speedo/speedo_graph-1.png" alt="Image" /></p>
<p>Beautiful <img src='http://jhodges.co.uk/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Probably not very well calibrated yet, I did measure the diameter of the wheel and do my best to get the calculations accurate, and this should be good enough for testing. Once I have a finished product I will calibrate more accurately.</p>
<p>Right then, time to get the show on the road, literally. I managed to get the Arduino, SD card writer, and prototyping board with an indicaor LED and start stop button on to the car, as well as a 9v battery, which I soon removed as I wired the Arduino straight to the car&#8217;s battery.</p>
<p><img src="http://www.jhodges.co.uk/media/speedo/speedo_car.jpg" alt="Image" /></p>
<p>I drove around slowly in circles to begin with, everything seemed okay and nothing fell off so I thought I would knock it up a notch, I did flat out straight up the road, paused briefly and turned round, then did flat out straight back down the road. Then I went and did a few laps around a little triangle of trees at the end of the road. Here are the results&#8230;</p>
<p><img src="http://www.jhodges.co.uk/media/speedo/speedo_graph-2.png" alt="Image" /></p>
<p>All looks promising at first glance, but wait a minute, we never seem to get above 25 MPH, in fact those two peaks in the graph between 55 and 85 seconds where I went flat out up and down the road should be up somewhere between 30 and 40 MPH. On <a class="postlink" href="http://www.jhodges.co.uk/media/speedo/speedo_graph-2-big.png">closer inspection</a> it looks like above 25 MPH the reed switch fails to register every revolution of the wheel. I thought to begin with that at higher speeds the magnet might go past the reed switch too fast to activate it, but if this was the case you wouldn&#8217;t see any readings at all when I was above 25 MPH. It actually looks like the magnet has been passed to recently to be able to trigger the switch again, rather than is going past too fast to trigger it at all.</p>
<p>Perhaps some residual charge/field in the switch hasn&#8217;t depleted and is stopping it activating every other revolution at high speeds. Perhaps a lower or higher pull up resistor would help, or maybe pulling down would be better. I am just clutching at straws here, can you tell?</p>
<p>What I have discovered now is something called a hall effect sensor, which measures magnetic field and will give an analogue output rather than a simple on or off that the reed switch does. Also there is no moving parts and I think it is much more sensitive and probably reacts a lot quicker. Unfortunately I can&#8217;t source these from my local electronic shop and I&#8217;m having to place an order for them along with some other bits and bobs so it might take me a little while to get my order together.</p>
<p>I think this was quite a successful prototype and have great expectations for the hall effect sensors. I will be sure to post how that goes when I get them&#8230;. <a href="/remote-control-car-speedometer-v2/">And here it is!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://jhodges.co.uk/remote-control-car-speedometer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SD card and Arduino</title>
		<link>http://jhodges.co.uk/sd-card-and-arduino/</link>
		<comments>http://jhodges.co.uk/sd-card-and-arduino/#comments</comments>
		<pubDate>Thu, 05 Feb 2009 20:23:50 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://map.jhodges.co.uk/?p=8</guid>
		<description><![CDATA[So, I have not long had my Arduino development board, my first project was to try and get it to log data to an SD card. This will be essential for a few future projects I have in mind. The internal EEPROM is only 512bytes, so not particularly useful for logging large amounts of data.
I [...]]]></description>
			<content:encoded><![CDATA[<p>So, I have not long had my Arduino development board, my first project was to try and get it to log data to an SD card. This will be essential for a few future projects I have in mind. The internal EEPROM is only 512bytes, so not particularly useful for logging large amounts of data.</p>
<p><span id="more-8"></span>I found the pin outs to the SD card <a href="http://pinouts.ru/Memory/sdcard_pinout.shtml">here</a>, and a good schematic, along with the required libraries on <a href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1206874649/8">this thread</a>.</p>
<p>I could not get the raw read and write library to work, along with many others on the above thread. It looked like it was working, but after a reset there was no sign of the data on the card, So I tried the other library that was posted on that thread, uFat, which actually sounded much better as it allowed reading and writing to a file on the fat file system, which then could be read in my laptop or any computer with a card reader. This worked straight away, so I was happy to get my soldering iron out and wire it up permanently&#8230;</p>
<p><img src="http://www.jhodges.co.uk/media/arduino-sd/sd1.jpg" alt="Image" /></p>
<p>There is not much to it, the pins practically wire straight from the SD card into the Arduino, however the SD card runs on 3.3v and the outputs from the Arduino are 5v, not a problem with a few resisters 5v can be dropped down to 3.3v. I got the card slot out of an old card reader, attached pins to it from the headers of an old motherboard, and the strip board I just had laying around with junk soldered to it which I just removed.</p>
<p>Another quick test and something didn&#8217;t seem quite right, it would only work once between reset, so I got my multimeter and checked all my connections, everything seemed fine, I gave a bit of a scrape between the strips of the strip board and tried again, this time it worked perfectly. I guess there must have been a strand of wire or solder where there shouldn&#8217;t have!</p>
<p>Time to hide that ugly strip board, and soldering&#8230;</p>
<p><img src="http://www.jhodges.co.uk/media/arduino-sd/sd2.jpg" alt="Image" /></p>
<p>And there it is, a nice little module that I can plug in whenever I need it <img src='http://jhodges.co.uk/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://jhodges.co.uk/sd-card-and-arduino/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
