ATMega168 Tachometer help using LM2907 chip

Thread Starter

StealthRT

Joined Mar 20, 2009
303
Hey all, this is my first post! YAY! I am trying to make a tach that i can read the cars RPM's. I am only looking for the chip to see what the RPM's are and not display it out to the user. I've draw up how i think it should be hooked up but I'm still now 100% sure. On the PDF it has 15v being used for the VCC, however i will be using 5v so i need to figure out how to change the resistors and such to accommodate this change.

I will be using the LM2907 chip and tapping into the tach wire from the ECU of the car. I'm looking at it as if the RPM's are 50+ then the car is started. Anything lower then the car must be off. I'm checking because i will be remote starting the car and need to know when the stop cranking it.


http://www.national.com/ds/LM/LM2907.pdf (Page 8)

Any help would be great! :)

David
 
Last edited:

bertus

Joined Apr 5, 2008
22,270
Hello,

In the datasheet is given that the powersupply must be between 6 and 24 Volts.
I do not know if the circuit will accept 5 Volts as a powersupply.

Greetings,
Bertus

PS I do not answer PM's, it will break the open spirit of the forum.
 

thatoneguy

Joined Feb 19, 2009
6,359
Is this for a specific vehicle where you have access to a verified tachometer signal?

Many newer vehicles use a serial data bus such as CAN to move the information about engine condition between the different control units in a late model vehicle, rather than "wire per signal" method. The protocol isn't always the same.

A universal engine running detector - no interfacing needed, involves a tap at the the alternator, measuring the frequency and amplitude to determine if the engine is running, and roughly how fast.

If you have access to a known analog signal source for the tachometer alone, then the solution above may work, but "Tach to ECU wire" input may not have the expected signal, depending on vehicle make/model/year.
 

Thread Starter

StealthRT

Joined Mar 20, 2009
303
Is this for a specific vehicle where you have access to a verified tachometer signal?

Many newer vehicles use a serial data bus such as CAN to move the information about engine condition between the different control units in a late model vehicle, rather than "wire per signal" method. The protocol isn't always the same.

A universal engine running detector - no interfacing needed, involves a tap at the the alternator, measuring the frequency and amplitude to determine if the engine is running, and roughly how fast.

If you have access to a known analog signal source for the tachometer alone, then the solution above may work, but "Tach to ECU wire" input may not have the expected signal, depending on vehicle make/model/year.
I'm looking to do this for cars in the 2004 or older range. I'm testing it with a 1992 Ford Ranger. Isn't tach singles in AC?

David
 

SgtWookie

Joined Jul 17, 2007
22,230
The schematic drawing you made first has the problem of the +5v supply (which is too low, as has already been pointed out), but you've also connected the output (pin 5) directly to +5v. This would cause a near-immediate death of the IC due to the large current that would flow into it as soon as the RPM came up.

Instead, I suggest that pin 5 be connected to +5v via a 1k Ohm or larger resistor. Your uC can monitor pin 5; when it goes low, the RPM is high enough.

The tach output is dependent not only on the RPM, but the number of cylinders. A 4-cylinder engine will have half the number of pulses per RPM as an 8-cylinder engine.

Since most auto engines are based on the Otto 4-stroke cycle, a 4-cylinder tachometer will output 2 pulses per revolution, a 6-cylinder 3 pulses/rev, and an 8 cylinder 4 pulses/rev. However, I'll suggest that an engine running condition would be if the RPM exceeds 400.
So, for a 4-cylinder engine, Fin would be 800, 6-cylinder, 1200, 8-cylinder, 1600.

The diagram on page 8 omits how to calculate the value of the cap to the right of R. I'll make "a guess" that a range of 10nF to 100nF may work OK. 10nF may make the circuit respond more quickly than the 100nF.

If C=0.1uF, then an R of 6.2k should be pretty close for a 4-cylinder engine like the Ranger has.

For a 6-cylinder, use 4.3k. For an 8-cylinder, use 3.6k.

[eta]
If you used an LM2917 instead, then you could omit C1, and replace the 78L10 regulator with a resistor of around 560 Ohms.
 

Attachments

Last edited:

Thread Starter

StealthRT

Joined Mar 20, 2009
303
SgtWookie: Thanks very much for your reply!

The Ranger is a V6.

I was thinking that 5v on the VCC to power the chip would produce no more than 5v output. That's why i supplied that much in the beginning.

So Pin 5 is OUTPUT that should be connected to the atmega168 chip input pin? I thought pin 4 was for output?

In your schema you have pin 4 as ground? And what does RUN\ mean in it? Does that mean the wire going to the atmega168 chip input pin?

Thanks! :)

David
 

thatoneguy

Joined Feb 19, 2009
6,359
The schematic which Sarge supplied will output a logical 0/low when the engine is running.

The reason VCC is 10V is IC's are often destroyed by having an input higher than their supply. The tach pulse is vehicle voltage (12-13.8V), so he is using a rather large current limiting/voltage drop resistor between that and the 2907. On the output, +5V is supplied to the open collector/emitter output to give logic levels for a uC to read.

The output is an open collector/open emitter, either pins 4 or 5 can be used for output. The output voltage is determined entirely on what is supplied to pin 5.

--ETA: Page 11 of the datasheet shows a few examples, both inverting (running = low) and non-inverting (running=high)
 
Last edited:

SgtWookie

Joined Jul 17, 2007
22,230
The Ranger is a V6.
OK, then you'll need to use a 4.3k resistor for R5.

I was thinking that 5v on the VCC to power the chip would produce no more than 5v output. That's why i supplied that much in the beginning.
I see. Well, the chip needs a minimum of 6v to operate; 5v wouldn't be within specifications and probably would not work.

So Pin 5 is OUTPUT that should be connected to the atmega168 chip input pin? I thought pin 4 was for output?
Look at the lower schematic on page 8 of the datasheet; that's what I went by. Pin 4 is the emitter of the output transistor. Pin 5 is the collector. You want a "switch" to indicate when engine RPM exceeds a threshold value. The upper schematic is for a tachometer.

In your schema you have pin 4 as ground?
Yes, the emitter of the output transistor.
And what does RUN\ mean in it?
That means when pin 5 is at a logic low level, the engine is running. The backslash "\" means the same as a boolean NOT bar over the top of a signal name.
I suppose I could've called it NOTRUNNING, but that's a bit wordy. ;)
Does that mean the wire going to the atmega168 chip input pin?
Yes. R3 is the pull-up resistor for pin 5; when the output is ON, the IC's sink current will be about 5mA. You could increase R3 to 4.7k if you wanted.

Since the upper side of R3 is connected to 5v, the output of the IC can only be between 0v and 5v.
 

Thread Starter

StealthRT

Joined Mar 20, 2009
303
Alrighty, let me see if i understand all this before i use my awesome drawing skills.

Well one question before i do that. Shouldn't i be using the Tach diagram if i want to get the RPM readings? Don't know what a "speed switch" is or does but ill put my faith in you since you've done this before :)

Ok:
PIN 1: Goes to the ECU Tach wire
PIN 2: .1uf to ground
PIN 3: 4.3k to ground / .1uf to ground
PIN 4: to ground
PIN 5: 1k to ATMega168 analog input pin
PIN 6/7/8: 12v+ (1uf to ground) to the 78L10 -> .33uf -> then everything else as in the schema.

And so, with all that said and done the atmega168 chip should read 0v when the engine is running and 1v+ when its not? Am i correct on that? I'd rather have it the other way, 1v+ when running and 0v when not running (im picky i guess) :)

David
 

SgtWookie

Joined Jul 17, 2007
22,230
Well one question before i do that. Shouldn't i be using the Tach diagram if i want to get the RPM readings? Don't know what a "speed switch" is or does but ill put my faith in you since you've done this before :)
If you wanted actual RPM readings, you could sample the TACH input signal with the MCU, and count the positive-going transitions vs the clock speed.

All you've indicated so far is that you want to know when the engine is operating past a certain RPM. Normal idle speeds are between 600 and 750 RPM, so 400 RPM is a reasonable threshold.
Ok:
PIN 1: Goes to the ECU Tach wire (I have it going through a 10k resistor to limit current, in case the voltage exceeds the uC's limits.)
PIN 5: 1k to ATMega168 analog input pin (No, 1k pullup to 5v, also pin 5 connects directly to the analog or digital input pin.)
PIN 6/7/8: 12v+ (1uf to ground) to the 78L10 -> .33uf -> then everything else as in the schema.
No, pin 6 goes to the output of the 78L10.
Pin 7 is connected to two 4.7k resistors; one goes to the 78L10 output (+10v), the other to ground.
Pin 8 is connected to ground.


And so, with all that said and done the atmega168 chip should read 0v when the engine is running and 1v+ when its not? Am i correct on that?
No, it'll read near 0v when the engine is running, and 5v when it is not running. It's a logic-level signal.

I'd rather have it the other way, 1v+ when running and 0v when not running (im picky i guess) :)
Just invert the logic in the program.
If you really want the signal inverted at the cost of a higher parts count, you could add another NPN transistor; it's base connected to pin 5, emitter to ground, and another 1k resistor to +5v.
 
Last edited:

SgtWookie

Joined Jul 17, 2007
22,230
Pin 5 connects directly to the ATMega analog input pin.
The 1k resistor gets connected from pin 5 to +5v.

As you have it connected now, the ATMega analog pin will stay at 0v.
 
Last edited:

Thread Starter

StealthRT

Joined Mar 20, 2009
303
Yeah, sorry its a .1uf. Kinda looks like a 2 though, huh? :p

I'm trying to make this compatible for a 4, 6, and 8 cylinder car. Since R5 had to change to 4.7k for the 6-cylinder, what could i put in its place that would work with all three types? (4,6, and 8). Or is that not possible?

I know i could probably put a slider-switch that connects each of the three resistors to that one pin depending on which one on the slider was selected but it would be nice to do it without having to do that (though it wouldn't be the end of the world if it had to be done like that.):)

David
 

SgtWookie

Joined Jul 17, 2007
22,230
Yeah, sorry its a .1uf. Kinda looks like a 2 though, huh? :p
Yes, it did - that's why I mentioned it. Glad you had it right.

I'm trying to make this compatible for a 4, 6, and 8 cylinder car. Since R5 had to change to 4.7k for the 6-cylinder, what could i put in its place that would work with all three types? (4,6, and 8). Or is that not possible?
Resistors are cheap; about a penny each, or even less in quantity.

Adding a selector switch or potentiometer would greatly increase cost and decrease reliability. Replacing just 1 resistor is not a bad thing; much more difficult to replace an engine vs replacing a resistor.

I know i could probably put a slider-switch that connects each of the three resistors to that one pin depending on which one on the slider was selected but it would be nice to do it without having to do that (though it wouldn't be the end of the world if it had to be done like that.):)
If that's what you want, be my guest. But most vehicles on the market nowadays have only 4 or 6 cylinder engines. If your idea fails due to bad switches, your product will get horrific amounts of bad press.
 

Thread Starter

StealthRT

Joined Mar 20, 2009
303
Very true, SgtWookie. I'll keep the switch thing in mind but a guess having a 4-cylinder / 6-cylinder and 8-cylinder version isn't that bad of an idea.

If you could take a moment and check my parts list and see if i am getting the correct resistors/regulator/capacitors that would be awesome :)

- Radial Aluminum Electrolytic Capacitors - 105 Degree 0.1uF 50V 105c 3x5 20% 1LS http://mouser.com/Search/ProductDetail.aspx?qs=sGAEpiMZZMsCnlYck6hSqMc450CoEpn7Ws688o8COks=

- Radial Aluminum Electrolytic Capacitors - 105 Degree 0.33uF 50V 105c 3x5 20% 1LS http://mouser.com/Search/ProductDetail.aspx?qs=sGAEpiMZZMsCnlYck6hSqAYZV4duj9ZemYfS37DAJPA=

- 1/4W 5% Carbon Film Resistors 4.3Kohms 0.05 http://mouser.com/Search/ProductDetail.aspx?qs=sGAEpiMZZMtlubZbdhIBIHv6Mbf5ugslLp2D5x%2b5W1w=

- 1/4W 5% Carbon Film Resistors 1Kohms 0.05 http://mouser.com/Search/ProductDetail.aspx?qs=sGAEpiMZZMsCQIGbZVRXMAbiv8drm45/fMcoTYvG5Yk=

- 1/4W 5% Carbon Film Resistors 10Kohms 0.05 http://mouser.com/Search/ProductDetail.aspx?qs=sGAEpiMZZMsCQIGbZVRXMH7BQmTqpOZNnfZ9MyT3tpo=

- 1/4W 5% Carbon Film Resistors 4.7Kohms 0.05 http://mouser.com/Search/ProductDetail.aspx?qs=sGAEpiMZZMsCQIGbZVRXMAIPMDh7cubrZPD3aHAk%2bUE=

David
 

Thread Starter

StealthRT

Joined Mar 20, 2009
303
Could i use a 100v 0.1uF/ 0.33uF Radial Aluminum Electrolytic Capacitors? I just like how they look compared to the ugly poly or metal poly film caps. Yeah, weird i know but i like my designs to be nice looking as well :) I can not find any 100v Radial Aluminum Electrolytic Capacitors with a 5%, only a 20%.

Also, for the 78L10, can i use a Linear Regulators 3-Terminal 1A Positive http://mouser.com/Search/ProductDetail.aspx?qs=sGAEpiMZZMug9GoBKXZ751BfzUgeFmob5/lLRB8uI9Q=
in its place? (seems to be higher quality and we both know how "noisy" the volts can be in the car.)

David
 

SgtWookie

Joined Jul 17, 2007
22,230
Actually, I've revised the schematic. Go with the LM2917N-8 instead; then you won't need the regulator at all. Digikey stocks them for $2.11:
http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=LM2917N-8-ND

If you use those "cool looking" electrolytic caps, you'll just cause the board to be a lot larger for no really good reason. Besides, you won't be able to use a polarized electrolytic for the TACH input signal; electrolytics will promptly self-destruct if you apply improper polarity across them.

New schematic:


Note that C1 has been eliminated, and a resistor has been added between +14v and C2; BATT and GND wire pads were added, and a cap was added to the TACH signal path. I misread the datasheet before; for the LM2907/LM2917, the signal needs to stay between 0v and V+; for LM2907-8 and LM2917-8, the signal can go below ground.

Board layout:


What a finished board might look like (without the silkscreen text):
 

Attachments

Last edited:
Top