Level shifting DC signal - Page 1
Forum section: electronics / beginners

author: BillyJ
author_rank: Contributor
timestamp: June 26, 2013, 06:39:57 pm
content: I'm in the middle of a project in which I'm making a digital, open source, dashboard for my motorcycle.After probing the current dash connections i have come across a problem.The tachometer on the bike gives off a varying dc voltage between 5 and 6 (ish) volts.I need to get this to 0-5v for my Arduino so it can read ADC and make sense of the signal.My thoughts are to:dc-dc converter down to 0-1v, and then opamp amplify it by 5 to 0-5v?What do you guys think?Thanks,Billy

author: c4757p
author_rank: Super Contributor
timestamp: June 26, 2013, 06:47:07 pm
content: A single op amp stage configured to subtract 5V and amplify by 5 will do. Look up the different types of summing amplifier.DC-DC converters are for power.

author: Dave
author_rank: Super Contributor
timestamp: June 26, 2013, 07:09:10 pm
content: Why even bother with an ADC? Just use a comparator and feed your controller with a digital signal.

author: c4757p
author_rank: Super Contributor
timestamp: June 26, 2013, 07:10:59 pm
content: What if he wants more than 1 bit resolution...?

author: BillyJ
author_rank: Contributor
timestamp: June 26, 2013, 07:11:57 pm
content: Quote from: Dave on June 26, 2013, 07:09:10 pmOK this sounds good. But wouldn't that just give me a high or low out. I want a varying voltage, i just want it to be between 0v - 5v, not 5v - 6vAlso with the summing amplifier, could you lead me a bit more in the right direction. I've done very little on op-amps. (How would i get it to drop off the 5v. I can easily get it to amplify 5 times though.)

author: c4757p
author_rank: Super Contributor
timestamp: June 26, 2013, 07:16:51 pm
content: Alternately, use an inverting amplifier, but invert around 5V instead of ground, with 5x gain. You can do that with no additional power rails if you use an op amp with rail to rail input and output. The signal will be inverted, which you can correct in software.

author: BillyJ
author_rank: Contributor
timestamp: June 26, 2013, 07:20:32 pm
content: I don't fully understand.So GND becomes +5vRf/Rin = 5

author: c4757p
author_rank: Super Contributor
timestamp: June 26, 2013, 07:21:57 pm
content: Precisely. Again, you must use an op amp that allows rail-to-rail input and output, or this won't work.Think of it in terms of this op amp behavior: it "tries" to make both inputs equal. If + is 5V, then - will be 5V as well. That will apply (x-5) across Rin, and to keep - equal to 5V, the op amp will have to put 5-5(x-5) on its output (Ohm's law and the fact that the current through both resistors is equal).Rail to rail means it can go very close to its power supply voltages. Hopefully someone else can suggest a good one, because I don't use R-R much and refuse to navigate DigiKey on my phone...

author: BillyJ
author_rank: Contributor
timestamp: June 26, 2013, 07:25:15 pm
content: I got lucky with the last post, but i have no idea now?What is rail-rail input and output?

author: Dave
author_rank: Super Contributor
timestamp: June 26, 2013, 07:31:59 pm
content: Ha, I just assumed he wanted to measure the frequency of the tachometer or speedometer signal. My bad.Ah, I see you beat me to it, I was putting together a simulation in multisim for the exact same thing.Both graphs have zeros at -3 div and are set to 1V/div. The top graph is the input signal, the bottom graph is the output.

author: c4757p
author_rank: Super Contributor
timestamp: June 26, 2013, 07:34:38 pm
content: Remember that LM358 is not rail to rail, so the waveform output would be very distorted if you tried running on just the existing +5V supply. Anyone know any good R-R op amps?

author: BillyJ
author_rank: Contributor
timestamp: June 26, 2013, 07:37:17 pm
content: You guys are incredible pros.Can i just double check this:non-inverting input(+) = 5vRf/Rin = 5 (i.e. 50k/10k)Power rails are going to be +5v and -5vAlso if rails are going to be + and - 5, is there a regulator that will take +12v and give me -5v?

author: Rufus
author_rank: Super Contributor
timestamp: June 26, 2013, 07:46:26 pm
content: Quote from: BillyJ on June 26, 2013, 06:39:57 pmI think the chances of a tachometer signal on a vehicle being a dc level between 5 and 6 volts are microscopic. When you say probing so you mean looked at them with a multimeter?

author: BillyJ
author_rank: Contributor
timestamp: June 26, 2013, 07:48:00 pm
content: Yes, from what i could see with the analog meter i had available. The voltage with smoothly go between 5 and 6v when the tacho went up.Could this be false readings from PWM maybe?

author: Rufus
author_rank: Super Contributor
timestamp: June 26, 2013, 07:57:07 pm
content: Quote from: BillyJ on June 26, 2013, 07:48:00 pmMost likely some form of pulse per rev. The average dc level shifting with revs might just be the battery voltage shifting.

author: c4757p
author_rank: Super Contributor
timestamp: June 26, 2013, 07:58:07 pm
content: Good point.

author: BillyJ
author_rank: Contributor
timestamp: June 26, 2013, 08:00:04 pm
content: Hmm, do you by any chance know how common digital tachos are fed.Or how i measure PWM, I have one of those small pocket oscilloscopes(Have access to).

author: BillyJ
author_rank: Contributor
timestamp: June 26, 2013, 08:06:31 pm
content: Well when revved, the bike went from 5V to 6V relative to the engine speed.This could be the on board charger kicking in (Probably is) but is there an easy way to measure pulse width modulation?

author: c4757p
author_rank: Super Contributor
timestamp: June 26, 2013, 09:05:11 pm
content: With an oscilloscope? Just divide the duration of the "high" period by the entire period of the waveform. Many oscilloscopes can measure it for you.With a microcontroller? Get the signal down to a level that can go into a digital input on the MCU (or the comparator - can't remember how fast the comparator is on one of those, I never use it) and count the time between edges.

author: cthree
author_rank: Frequent Contributor
timestamp: June 27, 2013, 05:10:04 am
content: What's wrong with a simple voltage divider? Two 470 ohm resistors will drop your 5-6V to 2.5-3.0V What is the lowest valid voltage you expect to read on the ADC? Choose the resistor size based on how much current your ADC pin can sink.Tachs use pulses from a position sensor on the crank. Speedos use pulses from a sensor in the transmission output shaft (after the gearbox). You'll need to adjust for the final drive ratio and tire diameter using math. Use a counter/timer to count the pulses within a specific time frame. What microcontroller are you using? The datasheet will have a section on how to use the counter/timer function. The ATmega328 for example has both 8 and 16 bit counter/timers.I don't know how the ECU is delivering this to your dash so I'm not sure what else to tell you.

author: Paul Price
author_rank: Super Contributor
timestamp: June 27, 2013, 10:13:09 am
content: "The tachometer on the bike gives off a varying dc voltage between 5 and 6 (ish) volts.I need to get this to 0-5v for my Arduino so it can read ADC and make sense of the signal.My thoughts are to:"I think you are all barking up a tree.Why would a tach output range between 5 and 6 volts?As anyone reasoned thatthe original measurement of the tach output levels was wrong.What if a pulldown resistor to ground or a resistor pullup to the +12 battery was needed or it was a kinda 20mA serial loop interface?

author: amyk
author_rank: Super Contributor
timestamp: June 27, 2013, 11:33:43 am
content: If you can get access to an oscilloscope, you should use one to see what the signal looks like.