Automotive switching project

Good evening fellow Arduino-ers, Arduino-ists?

This is my first ever foray into the world of microcontrollers or electronics so I am come cap in hand looking for guidance on my first project.

I have recently bough the Arduino starter kit and the Dummies book which I have read cover to cover and have used to do some of the projects.

Armed with this freshly learnt knowledge I am now embarking on my first project.

I have decided to split this project into 2 parts to help me understand the hardware and the software side better so this thread post will be for me to get assistance on the hardware side of things which I can then control using the Arduino sketch.

And so to the chase...

Aims and Objectives

I have a device in my car which I wish to use my Arduino to control its ON/OFF state.

Basics:

  • Device to be controlled is IGN battery voltage (12-14V), draws 70mA when on and "at rest" which rises to 700mA when ACTIVE.
  • Controlled device should be on when IGN is turned on, but can be turned ON/OFF anytime thereafter.
  • There are 2 push to close buttons on the steering wheel that I wish to use to turn the device off and on.
  • I propose to use my Arduino to detect the change in voltage on two separate wires as each button is pressed. Each wire has a constant 5V which drops depending on the button pressed (each push button has a resistance)
  • There are other switches on the steering wheel that also affect the voltage on these two wires, however each button changes the voltage to a specific value, all different.
  • The two buttons affect as follows:

ON button - drops steady state voltage from 5V to 4V, has a resistance of 1982-2063 ohms, thus current of 1mA - 2mA
OFF button - drops steady state voltage from 5V to 3V, has a resistance of 708-737 ohms, thus current of 4mA - 6mA

The OFF button will almost always turn the device OFF when it is in its alert state and thus drawing 700mA at 12-14V.

I have formulated an idea of using an NPN transistor to switch the GND side of the controlled device and I put together a circuit diagram as follows:

So switch 1 and 2 will drop the inputted voltage to the Arduino from 5V both, to 3V and 4V when the buttons are pressed. I think I know how to detect that voltage using the software (analogRead 3V=613, 4V=818) and that software part comes after I have settled on the hardware to control the device. I appreciate this may not be the correct way of doing this however given the Arduino outputs 5V when asked, I thought that that predictable output could be assumed to be a constant value with which to switch my controlled device.

So onto my plethora of questions..!

Q. I believe an NPN transistor should be happy switching the controlled device by affecting the GND but what one would I need for this?

Q. Several sources I have read suggest placing a resistor in series from the Arduino to the transistor Base pin, but what should that be given the current draw of the controlled device?

Q. For simplicity and finesse I may opt to use the same 12v input for both the Arduino and the controlled device effectively using the Arduino as a switched power supply that the device "plugs into." Will that affect the circuit design in any specific way?

Please critique my logic and circuit idea if they aren't sound, I'm here to learn! I'm open to suggestions on how to control that GND except for a mechanical relay. I just don't want a big box like that messing up what could be a very small and neat solution.

Many thanks for taking the time to look and comment, it is genuinely very much appreciated.

  1. Yes, but it's simpler to design for a MOSFET. The base current of the transistor needs to be designed (as per your second question) and there's a few other considerations. MOSFETS have almost zero resistance when on and they're pretty difficult to destroy accidentally once they're wired into a circuit.

Look for "logic level" n-channel MOSFET.

  1. Yes it is necessary. But the book on transistor design is a lot bigger than this forum post.

A MOSFET also should have a resistor but it's nothing to do with the function of the transistor, more to protect the Arduino output from current surges. A low value like 220 ohms is good but zero ohms (a wire) will work too. It is also a good idea to add a high value resistor like 10K between the gate and ground to ensure the transistor is off during the fraction of a second that the Arduino takes to reset and start up, when all the Arduino outputs are uncontrolled.

  1. Sounds good so far. No real change to your proposed circuit.

Outstanding reply good buddy!

Great food for thought for me to work on over the next few weeks.

Mucho thanks.

Funnily enough I'd be reading some other online resources and had stumbled upon the idea of using this little fella.

http://www.hobbytronics.co.uk/st95n2lh5-n-mosfet

This should suffice I presume?

Yes, seems a good choice. Fully "on" at 4volts or more.
Do what MorganS told you.
220ohm between Arduino pin and mosfet gate.
10k from Arduino pin to ground (or from gate to ground).

Always connect the gate last.
Mosfets are ESD sensitive devices.
Leo..

Thanks Leo.

Looking at the MOSFET idea, this is normally open such that I will need to apply the 5v from the Arduino to power my controlled device, correct?

The device is meant to be ON at all times but turned OFF very infrequently only when it alerts.

Would it not be more electrically efficient to use a normally closed component such that I apply voltage from the Ard to turn the device off?

I know this is called a depletion mode device and whilst the item I posted about above doesnt state what it is, I assume it is an always on "enhancement mode" device as it seems 99% of them are.

Can I still use this MOSFET to achieve this even if it is normally open?

A mosfet is a voltage device.
It does not use any gate current to stay "on" or "off".
5volt (or more) at the gate turns the "switch" on, and 0volt turns the "switch" off.

If you want the mosfet "normally on", you could add a second (small) transistor.
10k from gate to +12volt, collector to gate, emitter to source/ground, 10k resistor from base to Arduino pin.
The gate is now "normally high", and the small NPN transistor has to actively pull the gate to ground to turn the mosfet off.

Maybe I should read your post a bit better, to get a full understanding of what you want.
Some things are not fully clear.
Leo..