Problem at digital input pin using auto 12v power
Moderators: adafruit_support_bill, adafruit

Problem at digital input pin using auto 12v power

by usafmx on Mon Mar 04, 2013 10:45 am

Support,I have built a device reading signals from an automotive crank sensor (hall sensor) that gives a square wave i use as a digital input. the signal travels up a shielded wire to the digital pin 2. it works beautifully when powered by the USB while testing it and monitoring the serial writing on my laptop. when I unplug and try to run it with the 2.1mm plug i built to power it from the vehicle fuse box, it apparently sends a signal out from the arduino down to the crank sensor confusing the vehicle computer on what position the engine is and stalls the vehicle!
Is the power from the 12v possibly creating a feedback that overrides the assignment of that pin as an INPUT?

one of the solutions i am considering is wiring a diode to block any outbound signals, but am concerned the input will still be effected by this...

i really don't want to fall back on 9v battery packs to power this project...do you have any insight to why this is and what i can do to remedy it?
Thanks!!

Kit makeup: Arduino UNO R3
Data logger shield
Accelerometer (ADXL335) attached to shield running 5v on analog side
vehicle crank sensor feeding digital pin 2 input
usafmx
 
Posts: 4
Joined: Sat Dec 10, 2011 3:05 pm
Location: Florida

Re: Problem at digital input pin using auto 12v power

by adafruit_support_bill on Mon Mar 04, 2013 12:07 pm

12v by itself would not do that. But if there is noise such as from from the ignition system, it could couple into the arduino and propagate down the line to the sensor.

There are chokes designed to prevent ignition noise from coupling into car audio systems, One of those might help.
User avatar
adafruit_support_bill
 
Posts: 31070
Joined: Sat Feb 07, 2009 10:11 am

Re: Problem at digital input pin using auto 12v power

by ModemJunki on Mon Mar 04, 2013 1:52 pm

Automotive power is notoriously dirty. I used to have an '84 Ford Fiesta with no tachometer, I learned I could shift based on the noise coming from the speaker.

You can build your own choke, google "alternator whine" or "ignition filter". Here is one for a high-power radio rig:

http://www.worldwidedx.com/home-brew/31492-building-simple-alternator-whine-ignition-filter.html

You can also buy these in more reasonable sizes for $5-$10, normally auto parts places sell them for stereo installation. Sometimes it's easier to buy cheap than to build dear.

Don't forget the basics in 12v automotive power: check your grounds! Is the Arduino grounded to the chassis (not just by the negative power wire).

Can you use a diode to protect the sensor from the noise?
ModemJunki
 
Posts: 25
Joined: Sun Feb 17, 2013 11:52 pm

Re: Problem at digital input pin using auto 12v power

by usafmx on Tue Mar 05, 2013 12:56 pm

Thanks for both inputs!
I attempted to use a passive noise filter gotten at a car stereo shop (looked like a square transformer...not sure how many loops). negative results. I may not have rigged it correctly (hard to know as no data sheet available). I am considering installing a toroid passive filter with a capacitor to ground set-up very similar to the homebrew project you shared. you are right those parts are easier to find and i have several toroid rings in my junk box from PC power-supplies.

before i go to the trouble, my next step is actually to source the power closer to the battery or a less noisy tap from the accessory selections.

I'm currently making do with a 6x 1.5v AA battery pack...works lovely except for having to change batteries.

ModemJunki, regarding grounding of the Arduino...isn't the board grounded via the negative of the power plug?
In earlier tests i was running a chassis ground to the digital ground to ensure the crank sensor (hall effect square wave) had a negative/0-state to compare to. in the end i wired that digital ground across to the ground on the power/analog side of the board. it worked perfectly...when powered by laptop USB.
What is the rational for grounding the Arduino to the chassis?? To manage the noise? where should i connect the chassis ground on the Arduino?

my birthday is today...maybe i will treat myself to a long overdue, low-cost oscilloscope and signal generator (with spousal permission of course) 8)
usafmx
 
Posts: 4
Joined: Sat Dec 10, 2011 3:05 pm
Location: Florida

Re: Problem at digital input pin using auto 12v power

by usafmx on Tue Mar 05, 2013 1:05 pm

Forgot to discuss ModemJunki's suggestion to use a diode to block the noise propagation back to the sensor/ignition computer. That suggestion is the same one my 17yr old son proposed...great minds think alike.
It would work well to keep the vehicle from stalling, but i am concerned for what else the noisy power is creating with regard to the board operations and the sensor readings (both analog and digital).
Diode step is a few steps down the checklist.

Love the excellent help in this forum. cheers!
usafmx
 
Posts: 4
Joined: Sat Dec 10, 2011 3:05 pm
Location: Florida

Re: Problem at digital input pin using auto 12v power

by ModemJunki on Tue Mar 05, 2013 2:29 pm

usafmx wrote:Thanks for both inputs!
I attempted to use a passive noise filter gotten at a car stereo shop (looked like a square transformer...not sure how many loops). negative results. I may not have rigged it correctly (hard to know as no data sheet available).

Usually three legs - one to 12V+, one to feed power to the radio <errr - device>, one to the common ground (usually black). Normally they are just a tiny plastic box with capacitor and transformer inside.

usafmx wrote:ModemJunki, regarding grounding of the Arduino...isn't the board grounded via the negative of the power plug?
...
What is the rational for grounding the Arduino to the chassis?? To manage the noise? where should i connect the chassis ground on the Arduino?

Adding grounds to the <device> gives it cleaner power. This is partly old wives tales (go to ebay and search for "ground kit" in or similar in automotive) but partly based on good practice installing car audio and radio. Sometimes improving the grounds elsewhere (ignition system, charging system) fixes interference problems.

I would tie the Arduino ground bus to the physically nearest place on the car body and only run the 12v+ line to it. Maybe even use a shielded cable for the power and connect the shield to ground.

Or - try powering it with a 5v adapter (generic USB cellphone charger). Worth a try!

I think it's better to first try and clean up the power than to use the diode as a quick fix, though I do think the diode should be in the design (but I don't know electronics at that level, so I don't know what could/will happen to your Hall signal!). I know that over at http://www.the12volt.com/ there would be scolding for not diode protecting your car from your <device>.

I have a vested interest in this topic - I will be putting an Arduino in my car in when the weather warms up, and I'm still thinking of ways to integrate more functions into my idea (but I have more ideas than time). My vehicle has full electronic cabin controls and all the buttons simply momentary to ground so any control is fair game. Adafruit has a lovely current sensor I could possibly use to count pulses from the long-range locking function.....

usafmx wrote:my birthday is today...maybe i will treat myself to a long overdue, low-cost oscilloscope and signal generator (with spousal permission of course) 8)

Happy birthday!
ModemJunki
 
Posts: 25
Joined: Sun Feb 17, 2013 11:52 pm

Re: Problem at digital input pin using auto 12v power

by ModemJunki on Mon Mar 11, 2013 2:26 pm

A tip in another thread about using a MOV might help!

http://forums.adafruit.com/viewtopic.php?f=8&t=37806&start=0
ModemJunki
 
Posts: 25
Joined: Sun Feb 17, 2013 11:52 pm