<?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>imsolidstate &#187; Alternator</title>
	<atom:link href="http://www.imsolidstate.com/archives/tag/alternator/feed" rel="self" type="application/rss+xml" />
	<link>http://www.imsolidstate.com</link>
	<description>Always improving things...</description>
	<lastBuildDate>Mon, 30 Aug 2010 17:54:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How much electric current does a truck really use?</title>
		<link>http://www.imsolidstate.com/archives/9</link>
		<comments>http://www.imsolidstate.com/archives/9#comments</comments>
		<pubDate>Tue, 25 Aug 2009 03:08:41 +0000</pubDate>
		<dc:creator>imsolidstate</dc:creator>
				<category><![CDATA[6.0L Ford Super Duty]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[6.0]]></category>
		<category><![CDATA[Alternator]]></category>
		<category><![CDATA[ATMega]]></category>
		<category><![CDATA[AVR]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Current sense]]></category>
		<category><![CDATA[Powerstroke]]></category>

		<guid isPermaLink="false">http://www.imsolidstate.com/?p=9</guid>
		<description><![CDATA[So, a while back my truck was getting slow to start. I checked the battery voltage with the truck running, and it was only 11 volts or something. I started the troubleshooting process by replacing the alternator with one from the local parts store, but it didn&#8217;t fix the problem. I changed both batteries. Still [...]]]></description>
			<content:encoded><![CDATA[<p>So, a while back my truck was getting slow to start. I checked the battery voltage with the truck running, and it was only 11 volts or something. I started the troubleshooting process by replacing the alternator with one from the local parts store, but it didn&#8217;t fix the problem. I changed both batteries. Still didn&#8217;t fix the problem. So I did some diagnostics with an ammeter and a voltmeter and figured out that my brand-new alternator was bad. I took it back to the parts store, where they gave me another one. I had them test it, and it failed on their bench tester. So did the next one. They finally gave me my money back and I bought one from Ford. It worked just fine.</p>
<p>While I was looking for alternators, I found some high output models. This sounds cool, but do you really need it? I pull a trailer pretty regularly, and I imagined that the trailer lights and brakes would be a pretty good additional load on the electrical system. I had also read that people buying these &#8220;high output&#8221; alternators had been disappointed with their actual output, so I thought it might be good to find out.</p>
<p>I wasn&#8217;t sure how dirty the output of the alternator would be, or how quickly the output might fluctuate which ruled out the use of an inductive current clamp. So I looked around and found a hall-effect current sensor from Allegro Microsystems. The manufacturer&#8217;s part number is <a href="http://www.allegromicro.com/en/Products/Part_Numbers/0758/0758.pdf">ACS758KCB-150B-PFF-T</a>. This sensor has a maximum current rating of 150 Amps, and outputs a linear 0-5V signal proportional to the current that passes through the device. It&#8217;s fast enough to record transients and will faithfully reproduce both AC and DC currents. The output of the sensor was fed to an Atmel ATMega8, which did ADC duties and sent the data out it&#8217;s UART to a MAX232 level converter. I just picked up the data stream with hyperterminal on my laptop. Excel let me manipulate the raw data and make some pretty graphs. I made the circuit with my CNC machine. Here&#8217;s what it looks like.</p>
<p><img class="alignnone size-large wp-image-6" title="Current sense PCB" src="http://www.imsolidstate.com/wp-content/uploads/2009/08/CurrentSense-1024x768.jpg" alt="CurrentSense" width="614" height="461" /></p>
<p>The output of the alternator was alot cleaner than I had expected. I thought there would be more of a rectified three phase look due to the phases generated inside the alternator. This picture of the scope shows the trace of the output of the sensor at idle.</p>
<p><img class="size-large wp-image-5" title="OScope trace" src="http://www.imsolidstate.com/wp-content/uploads/2009/08/OScope-1024x768.jpg" alt="Oscilloscope Display" width="614" height="461" /></p>
<p>Here is a graph of the data from an engine start up. The Y-axis values are actual current draw in Amps. Time is shown on the X-axis, but the numbers represent the conversion events of the ADC, which happen at approximately 15Hz. This equates to about 40 seconds. The noise is real as far as I can tell. I didn&#8217;t use a ground plane, but the trace from the sensor output to the Mega&#8217;s ADC input is only about a quarter of an inch. I added a large filter capacitor to the sensor&#8217;s output and the waveform didn&#8217;t change at all.</p>
<p><img class="alignnone size-full wp-image-7" title="StartUp current" src="http://www.imsolidstate.com/wp-content/uploads/2009/08/StartUp.jpg" alt="StartUp" width="620" height="428" /></p>
<p>Then I took the truck for about a ten minute drive. I had the lights on, but not the radio or anything extra.</p>
<p><img class="alignnone size-full wp-image-8" title="Driving test current" src="http://www.imsolidstate.com/wp-content/uploads/2009/08/DrivingTest.jpg" alt="DrivingTest" width="604" height="417" /></p>
<p>It&#8217;s interesting to note how much power the transmission consumes when it&#8217;s in gear. The first plot is idling in park, the second plot again shows the truck idling in park at the end of the plot. It&#8217;s a clear 20 Amp drop from when the truck was in drive.</p>
<p>I hooked up my horse trailer, but even with all the lights on and everything it only shifted the curve up 10 Amps. The trailer brakes (which I thought would be a significant load) didn&#8217;t even show up. I&#8217;m still curious about this, as the trailer brake control wiring is usually about 10-12 guage, which is almost the same gauge wire the alternator output has to connect it to the battery. Why bother to wire trailer brake wiring with wire that has an ampacity of 100 Amps or so if it only uses a few amps? There must be more to the story.</p>
<p>Here is the schematic. Sorry it&#8217;s not all labelled but I didn&#8217;t expect to be posting it at the time. Right click and open the image to view full size.</p>
<p><img class="alignnone size-full wp-image-345" title="Schematic" src="http://www.imsolidstate.com/wp-content/uploads/2009/08/Schematic1.jpg" alt="Schematic" width="641" height="194" /></p>
<p>And here&#8217;s the layout.</p>
<p><img class="alignnone size-full wp-image-346" title="Layout" src="http://www.imsolidstate.com/wp-content/uploads/2009/08/Layout.jpg" alt="Layout" width="599" height="481" /></p>
<p>I neglected to add a header for ISP. I was in a hurry to get it done and forgot. The target supply voltage in this application is 11-14V, but supply voltage could be extended to +45V with the appropriate version of the 7805.</p>
<p>Here&#8217;s the source code for the Mega8. Compiles with AVR Studio and AVR GCC. It&#8217;s a timer-driven interrupt, that starts an ADC conversion of the sensor output and then sends the result to the UART. It uses standard 9600 8N1. The result is left-adjusted so it&#8217;s only 8 bit. If you don&#8217;t need both positive and negative current measurements, then it would be best to remove the offset of the sensor and use the internal 2.5V ADC reference for better accuracy. The decimal to BCD routine at the end is something I figured out so I can just do a file capture in hyperterminal and import it directly into Excel.   <span id="more-9"></span></p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<pre>#include &lt;avr/io.h&gt;
#include &lt;avr/interrupt.h&gt;

#define F_CPU 8000000

#define USART_BAUDRATE 9600
#define BAUD_PRESCALE (((F_CPU / (USART_BAUDRATE * 16UL))) - 1)

void main(void)
{

UCSRB |= (1 &lt;&lt; RXEN) | (1 &lt;&lt; TXEN);  // Turn on the UART
UCSRC |= (1 &lt;&lt; URSEL) | (1 &lt;&lt; UCSZ0) | (1 &lt;&lt; UCSZ1);  // Use standard 8N1
UBRRL = BAUD_PRESCALE; 	       // Load lower 8-bits of the baud rate value
                               // into the low byte of the UBRR register
UBRRH = (BAUD_PRESCALE &gt;&gt; 8);  // Load upper 8-bits of the baud rate value
                               // into the high byte of the UBRR register

TIMSK |= (1 &lt;&lt; TOIE1);	       // Enable Timer1 overflow interrupt
TCCR1B |= (1 &lt;&lt; CS11);	       // Turn on Timer1, CLK/8 prescale

ADMUX |= (1 &lt;&lt; REFS0);	       // Select VCC reference
ADMUX |= (1 &lt;&lt; ADLAR); 	       // Left adjust ADC result
ADCSRA |= (1 &lt;&lt; ADEN) | (1 &lt;&lt; ADIE);    // Turn on ADC and enable
                                        // conversion complete interrupt
ADCSRA |= (1 &lt;&lt; ADPS1) | (1 &lt;&lt; ADPS2);	// ADC prescale of CLK/64

sei();

while(1); {}

}

ISR(TIMER1_OVF_vect)
{

ADCSRA |= (1 &lt;&lt; ADSC);	       // Start ADC conversion

}

ISR(ADC_vect)
{
unsigned long VOLTAGE = ((((ADCH/10)+((ADCH/100)*6))*16)+(ADCH%10));

unsigned int ONES = 0x00;
unsigned int TENS = 0x00;
unsigned int HUND = 0x00;

if((VOLTAGE &amp; 0x0800) == 0x0800) HUND |= 0x08; else HUND &amp;= ~0x08;
if((VOLTAGE &amp; 0x0400) == 0x0400) HUND |= 0x04; else HUND &amp;= ~0x04;
if((VOLTAGE &amp; 0x0200) == 0x0200) HUND |= 0x02; else HUND &amp;= ~0x02;
if((VOLTAGE &amp; 0x0100) == 0x0100) HUND |= 0x01; else HUND &amp;= ~0x01;

if((VOLTAGE &amp; 0x0080) == 0x0080) TENS |= 0x08; else TENS &amp;= ~0x08;
if((VOLTAGE &amp; 0x0040) == 0x0040) TENS |= 0x04; else TENS &amp;= ~0x04;
if((VOLTAGE &amp; 0x0020) == 0x0020) TENS |= 0x02; else TENS &amp;= ~0x02;
if((VOLTAGE &amp; 0x0010) == 0x0010) TENS |= 0x01; else TENS &amp;= ~0x01;

if((VOLTAGE &amp; 0x0008) == 0x0008) ONES |= 0x08; else ONES &amp;= ~0x08;
if((VOLTAGE &amp; 0x0004) == 0x0004) ONES |= 0x04; else ONES &amp;= ~0x04;
if((VOLTAGE &amp; 0x0002) == 0x0002) ONES |= 0x02; else ONES &amp;= ~0x02;
if((VOLTAGE &amp; 0x0001) == 0x0001) ONES |= 0x01; else ONES &amp;= ~0x01;

ONES |= 0x30;
TENS |= 0x30;
HUND |= 0x30;

UDR = HUND;				// Send the ADC results to the UART
while ((UCSRA &amp; (1 &lt;&lt; UDRE)) == 0) {}; 	// Wait for UDR to clear
UDR = TENS;
while ((UCSRA &amp; (1 &lt;&lt; UDRE)) == 0) {};
UDR = ONES;
while ((UCSRA &amp; (1 &lt;&lt; UDRE)) == 0) {};
UDR = 0x0D;				// Send new line
while ((UCSRA &amp; (1 &lt;&lt; UDRE)) == 0) {};
UDR = 0x0A;

}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.imsolidstate.com/archives/9/feed</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
	</channel>
</rss>
