Reducing the voltage of a low frequency signal

I am trying to read a square wave that takes on a range of 50hz to 150hz. Using my oscope I found the signal to high at 6v and low at 0v. I found out the hard way that the arduino pin 8 can only handle that signal for about 10 seconds before the pin is fried. (should have measured first...)

Anyway, How can I lower this signal to an appropriate level without changing the signal frequency or muddying it up?

I was thinking simple voltage divider, should I use high or low value resistors? For example, should I use 1-ohm and 5-ohm or 100kohm and 500kohm (math may be off on this...) or something in between or does it matter?

Application details:

The car sensor outputs a 6v square wave. The ECU of my car reads it directly. I am making a display that reads the hz signal (by splicing into it) and converts it etc... to display a numerical value based on the signal frequency. It is imperative that the original signal be unmolested as an unreliable signal would cause the car to run poorly at best, lean out and fry a cylinder at worst. Arduino can only reliably read up to 5v, so I would like to lower the signal voltage.

The ecu has a 10k pull up resistor I believe on this input. I can tolerate a 1-2% change in signal, but I would prefer not to.

Yes, simple voltage divider Vout = Vin * R2/(R1 + R2). 5V = 6V*5K/(R1+5K) 5VR1 + 5V5K = 6V5K 5VR1 = 6V5K - 5V5K R1 = (6V5K - 5V5K)/5V = (30000 - 25000)/5 = 1000 or 1K. Load on the 6V line = 6V/6000 = 1mA

Or, use the 6V to drive a logic level N-channel MOSFET connected to digital input with 1K pullup resistor. 6V goes high, digital pin goes low, 6V goes low, digital pin goes high (so, an inverter). Load on the 6V line = uAs, next to nothing.

Hi Gslenk.

As the frequencies you are interested in are fairly low, you can get away with using a simple voltage divider.

You will need to make sure that the current into the Arduino pin is well below the 40 mA maximum, and you will need to confirm the output impedance of your signal source. If it is too high then it will affect both the amplitude and the shape of your divided output, and your divider may load it significantly.

Check some of the examples for your Arduino for values of input resistors, you will find that values in the 10k range are ok.

Note too that the value returned by the analogRead() function depends on the level of the AREF pin. If you want good accuracy, then scale to that value rather than assuming 5 V.

Let us know how you go.

Pogo.

Here is a “datasheet”. I could not find any real data sheets. I doubt this thing outputs any real ‘load’ to be concerned about.

“You will need to make sure that the current into the Arduino pin is well below the 40 mA maximum, and you will need to confirm the output impedance of your signal source. If it is too high then it will affect both the amplitude and the shape of your divided output, and your divider may load it significantly.”

^^^^Pogo, I will need that in english. Sorry, it is just a level up from what I can comprehend :disappointed_relieved:

Amplitude is not a problem. (as long as it reads). Shape may be a problem if it is significant.

When you reference analogRead() I assume you are talking about me investigating the pullup resistors of the arduino? I could care less about the signal voltage, as long as the frequency is clear and accurate.

It sounds like I can just go for it. It was reading fine before without a voltage divider, just fried the 8-pin on the arduino after a short time.

Pogo: You will need to make sure that the current into the Arduino pin is well below the 40 mA maximum.

Arduino inputs are high impedance, and draw negligible current. (unless you exceed the maximum input voltage.)

Yes, just 1uA. If you exceed VCC by > 0.5V, the input protection diode clamps kick in, and if >1mA is allowed, can blow the diodes. And then other stuff! Leading to a very hot chip generally.
Same for signals < 0.5 below Gnd.

Pogo:
make sure that the current into the Arduino pin is well below the 40 mA maximum,

No.
As CrossRoads already mentioned, <1mA.
40mA is the max short term source or sink current of an output pin.
Leo…

Voltage divider works like a charm. I used 1k and 3k resistors so that I am working with .75 of the signal peak voltage, at 4.5v (from 6v) to be safe. It works absolutely flawlessly (accurately). Thanks!

Gslenk: Voltage divider works like a charm. I used 1k and 3k resistors so that I am working with .75 of the signal peak voltage, at 4.5v (from 6v) to be safe. It works absolutely flawlessly (accurately). Thanks!

You may need to be careful not to remove the power supply from your Arduino while the signal continues from the sensor. Hopefully your 1kΩ resistor and the protection diode within the chip would give adequate protection anyway.

Are you powering your Arduino to avoid damage from spikes? See this post.

It will never intentionally have the power supply removed before the signal is removed. They are both connected to the ignition power of the car. Ignition on, both on, ignition off, both off.

This is the power supply for the arduino itself: http://www.ebay.com/itm/DC-DC-Converter-Super-Mini-Step-Down-Module-Adjustable-3V-5V-16V-for-RC-Plane-/400895531717?pt=LH_DefaultDomain_0&hash=item5d573c5ac5

Gslenk:
This is the power supply for the arduino itself:
http://www.ebay.com/itm/DC-DC-Converter-Super-Mini-Step-Down-Module-Adjustable-3V-5V-16V-for-RC-Plane-/400895531717?pt=LH_DefaultDomain_0&hash=item5d573c5ac5

That’s good. I see it’s rated up to 23 volts; I guess spikes could go higher but I don’t know.

I expect it’s drawing only very little current. If so, I suggest a resistor in series with the supply (from the car battery to DC/DC converter) that drops roughly 1 volt followed by a 15 volt zener diode across the supply (the right way round!). The zener diode should also protect against reverse voltage spikes. Use a reasonable size zener such as 5 Watts.