Tacho signal 12v to 5v ?

Im trying to make my arduino read engine speed. Ive written the code using interrupts, only problem is the hardware side.

I want to get the signal from my exisiting tacho signal used to drive my tacho in the dash. The signal is a 12v squarewave signal, I need to convert this to a 5v squarewave signal, but im not sure on how to do this, I tryed using a resister divider circuit, but then my dash tacho didnt work (i guess the resisters were eating up too much of the signal?).

So im wanting to know what other ways I can use, I thought of running a wire to the coil and trying the resister divider, but I would rather keep it all in the gauge cluster since there is already a signal there I could use.

Ok, so I had an idea, could I use the tach signal to trigger a transistor, and use the transistor to turn on/off an 5v source that would then trigger the arduino interrupt?

Ok, so I had an idea, could I use the tach signal to trigger a transistor, and use the transistor to turn on/off an 5v source that would then trigger the arduino interrupt?

I'm looking to do the same thing and I think this is the route I'll be taking.

I tryed using a resister divider circuit, but then my dash tacho didnt work (i guess the resisters were eating up too much of the signal?).

What value resistors did you use?

A common emitter circuit should work (see pic), but i'd still be worried about loading the signal like the resistor divider.

http://en.wikipedia.org/wiki/Common_emitter

Rc in the diagram can be one of the internal pull-ups in the AVR chip. I would start with a resistor from your tacho signal to the base of about 100k and see if it works. Any general purpose NPN transistor will do - maybe the 2n2222 or bc108.

Failing that, something with a very high input impedance, like a FET or an op-amp / comparator might be the way to go.

Mike

I didnt have a 100k ohm resistor so I joined a bunch together to make 95k ohm. For the transistor I used a BC337 (pulled it off a old circuit board) Its a general purpose NPN transistor (data sheet http://www.datasheetcatalog.org/datasheet/fairchild/BC337.pdf)

Im not sure what you mean when you say RC can be the arduinos internal pullup resistor. This is how I think it should go, but im not sure.

Also Im not sure where to connect the arduino input pin. Would I connect it to Vout? I thought if I connect it to Vout it would always be getting 5v.

But If I connect it to the emitter, it would get 5v when the transistor is conducting, and 0v when not conducting?

Or am I missing somthing.

Yes, you would connect the arduino input pin to Vout. The emitter is connected to ground, so connecting the arduino pin to the emitter is connecting it to ground.

When the transistor is conducting, Vout is taken low by the transistor. When the transistor is not conducting, Vout is taken high by the resistor Rc.

The 100k value I suggested wasn't critical, so 95k will do as well. Actually, it may be too high. What I'm concerned about is that from your original post you said that a resistor divider stopped the tacho working. I chose a fiarly high value there so that it didn't load the tacho. To text this - could you connect your 95k resistor between the tacho signal and ground? If that stops the tacho working we need to think about a different circuit altogether.

Can you tell us what value resistors you used in the resistor divider? I'm still surprised you need more than a resistor divider and it could be that the tacho circuit is such that putting a transistor in won't fix it.

As for the pull-ups. The input pins on the AVR have a resistor which can be enabled. If you enable that resistor in your code, you won't need to use the resistor, Rc, shown in the picture. Probably easiest to just ignore it and use the external resistor.

HTH

Mike

Im not sure what values I used, I just got a bunch of resistors and fiddled with them till I got 5vish from a 12v source ( I used a computer PSU to test it)

What value should I use for RC? 220ohms~ish?

I set it up, and tryed using a 220ohm resistor for RC, but it didnt work. The tach worked, but I has a solid 5v at Vout.

Do I need to use a higher value for RC?

With a 200 ohm Rc, Ic (collector current) will be 20 mA. BC337 beta is min 100, so you need at least 200 uA drive into the base to switch this device on. Usually use 2x to 10x base drive to ensure the transistor goes into saturation, ie. 400uA to 2 mA. With 12V input, 100k ohm on the base will only give you 110 uA (assuming Vbe of 0.7V).

ie. you don't have enough base drive to switch the transistor on. You will need to either increase Rc (and reduce the collector current requirements), or decrease the base resistor. To get 2 mA of base drive, use around 5.6k ohm on the base resistor. This may load your tach too much though.

Or alternatively, use 22k ohm on the base resistor (for 500 uA drive), and 820 ohms for Rc (gives 5 mA Ic).

Thanks for your input.

I tryed a 22k on the base, and 820 ohms for RC. But it didnt work, although that could be a problem with my code, I need to pull my gauge cluster out again and check with my multimeter and see what happening.

Or I might try your other method first, with the 5.6khom base resistor.

FYI, this question was answered about 4 or five months ago- have a poke through the archives using Google search.

D

I did find some post of people asking how to measure engine rpm, but no one replyed with how to do it.

I guess ill just keep fiddling with it until I get it to work. For somthing I thought would be so easy, its starting to become a pain in the ass!

Check your transistor circuit operation first. Ground the input and observe 5V on the output, then put +12V on the input and you should see 0V on the output (as this circuit is inverting).

Im not sure what values I used, I just got a bunch of resistors and fiddled with them till I got 5vish from a 12v source ( I used a computer PSU to test it)

Well if you ended up with too low a value, it might load the tacho and stop it working.

What value should I use for RC? 220ohms~ish?

220Ohms is too low - you need something like 10k.

Have you tried the other things I suggested. There is no point trying to get the transistor circuit working if the base resistor still loads the tacho circuit. You need to check it out first.

Connect your 100k from the tacho signal to ground and make sure the tacho still works.

If it does, try it with about 47k resistor.

This is important.

Regards,

Mike

With a 200 ohm Rc, Ic (collector current) will be 20 mA. BC337 beta is min 100, so you need at least 200 uA drive into the base to switch this device on. Usually use 2x to 10x base drive to ensure the transistor goes into saturation, ie. 400uA to 2 mA. With 12V input, 100k ohm on the base will only give you 110 uA (assuming Vbe of 0.7V).

ie. you don’t have enough base drive to switch the transistor on. You will need to either increase Rc (and reduce the collector current requirements), or decrease the base resistor. To get 2 mA of base drive, use around 5.6k ohm on the base resistor. This may load your tach too much though.

Or alternatively, use 22k ohm on the base resistor (for 500 uA drive), and 820 ohms for Rc (gives 5 mA Ic).

This is a good post.

My concern was that too low a base resistor would be loading the tacho circuit.

Try 22k from the tacho circuit to ground and make sure the tach still works, then add in the transistor.

Im not sure what values I used, I just got a bunch of resistors and fiddled with them till I got 5vish from a 12v source ( I used a computer PSU to test it)

Well if you ended up with too low a value, it might load the tacho and stop it working.

What value should I use for RC? 220ohms~ish?

220Ohms is too low - you need something like 10k.

Have you tried the other things I suggested. There is no point trying to get the transistor circuit working if the base resistor still loads the tacho circuit. You need to check it out first.

Connect your 100k from the tacho signal to ground and make sure the tacho still works.

If it does, try it with about 47k resistor.

This is important.

Regards,

Mike

95k from tach to ground - tach still worked.

59k from tach to ground - tach still worked.

22k - loads the circuit, tach dosent work

20k loads the circuit and the tach dosent work.

40k, tach works fine.

It would of also helped if I was testing the right signal :/ Seems somewhere I got messed up and started testing the wrong signal ;)

Ok, I used a 40k base resistor, and 820ohm RC. Tested it, and I get 5v with base not connected. With base connected to 12v, i get around 20mv, I take it that this isnt enough to trigger the arduino interrupt?

Will test with arduino shortly.

i get around 20mv, I take it that this isnt enough to trigger the arduino interrupt?

Anything TTL low will trigger the interrupt (as long as you have the interrupt mode set to CHANGE or FALLING), ie. anything under 800 mV will do it.

You should be fine with this config.

Hi,

Just wondering, why don't you just use a voltage divider?

-Z-

I tryed a voltage divider, but I didnt really know what I was doing and it stopped the tach from working.