Go Down

Topic: Filtering analog inputs (Read 104 times) previous topic - next topic

rickerman

Hi,

I am working on a custom dash project for a motorcycle engine, this will show the current rpm of the engine and the current gear on 2 separate neopixel strips.

I am using the gear position sensor that is connected to the engine. It is a rotary potentiometer and is supplied with 5V (From the engine electrics) and has 2 output wires. One is a neutral indicator that is either 12V or 0V, depeding on whether the engine is in neutral or not. The other output is a variable voltage between 0V and 5V that changes depending on which gear is selected. This is the wire I am trying to read with the Arduino.

Here is the very simple circuit that I was using to interface the sensor with the arduino.



The Arduino is getting powered from the 12V electrics on the bike, it goes via a LM2596S switching regulator, this is set to step down the voltage to 5V and is connected to the Arduino 5V pin. I am also powering the Neopixel strips from the buck converter.

Everything is working fine, I can see that each gear has a unique voltage range that it fits into, until I run the engine, then I get values that could be in the other bands, I believe it is getting affected by EMI from the ignition coils.

Is there anything I can add in order to filter out these spikes? I am thinking that the reference 5V is getting affected, causing the analogRead to be out, or the voltage coming is is getting changed by the EMI, or both.

Regards,

MarkT

#1
Mar 18, 2018, 04:31 pm Last Edit: Mar 18, 2018, 04:33 pm by MarkT
Replace the zener with a 100nF capacitor. (As close to the Arduino as possible).

The zener isn't needed anyway (since the 10k resistor limits the current nicely if the input
were to be too high a voltage).  The capacitor will filter out lots of EMI, acting as a low-pass filter.
You might need a higher value capacitor if the interference is still a problem, and more shielding
of the Arduino itself might be needed, but I'd try 100nF or so to start with.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

tinman13kup

Also mind where you run the wires. Keep them away from the ignition circuits as best as you can.
Tom
It's not a hobby if you're not having fun doing it. Step back and breathe

ted

I will kept the zener, arduino doesn't like voltages above 5V, use shielded wires for sensor, if you still have problem put your toys in to metal box.

Go Up