Noob questions. Need to activate 12v switch from a variable 0-5v input.

Hi everyone!

I'm new to this micro controller thing and I have a project I'd like a clean solution for. I've been repairing automotive ECUs and circuits for years but soldering and replacing components isn't enough for what I want to do. Any help or any advice to point me in the right direction would be appreciated.

The Problem:
I have a switch that is normally open (it needs a 12v signal to close the circuit circuit never goes over 3 amps)
The switch must close when the output source of a sensor reaches a set voltage output (this sensor outputs 0-5v) I need to be able to choose which voltage it activates the switch at based on different applications.

I have a have a ground, 5v power, 12v power, the 0-5v signal wire all to work with on the application.

My brainstorming so far:
So far I know I will need a Mosfet to activate the switch, and a micro controller to receive the input and activate the Mosfet. I don't know which board would be recommended that is easy for a beginner like me. I hate buying things twice which is why I'm asking for help before taking a shot in the dark and buying something more/less effective than what I need.

Other thoughts:
-Should I use the mosfet to activate a relay or will a good mosfet handle this?
-Must be reliable
-as small as possible

Thanks for helping a noob!

You said 3 amps? A mosfet with a good heat sink will work, no relay required.
Which board? If you want to prototipe then Arduino Uno is the choise number one. If you want a final profuct then use arduino pro mini 5V

Thanks! I was looking at the mosfet with a heatsink I have used them in several other applications with no issues. This is my first time doing anything with programmable hardware. I am searching through this forum and several others learning the coding. I was looking at the mini 5v it looked like it would do what I needed.

I think this code should work well

var readSensor=A0;//analog pin to read sensor value
 
var closeSwitch=12;//pin to close switch

void setup (
pinMode(readSensor,INPUT);
pinMode(closeSwitch,OUTPUT);
)


void loop(
var sensorVal = analogRead(readSensor);//read the value from the sensor
if (sensorVal > 1000)//if the sensor value is above threshold, then close switch
{
digitalWrite(closeSwitch, HIGH)
}
)

but remember that an arduino can output a Max. of 5V so i guess u can build a voltage doubler or use a smaller trigger

Hi,
What do you want the output to do when the input drops below the threshold?

You can add a potentiometer as another analog input to set your threshold point, so you can select different responses.

What is your input sensor?

Tom.... :slight_smile:

a switch is something you move manually, like a power window switch.
a relay has a coil in it like a flasher or some such.

it sounds like you are looking at some sensor that changes voltage for some reason and you want to have an adjustable trip point for that.

You can create a simple circuit that will turn on a relay and use a potentiometer to output either high or low to turn a relay on or off.

if you have an arduino for other things, then great. but almost all the parts you would use can be used without the arduino. a friend does care repairs and he made a batch at one time. it was designed to use the signal and add a few volts, or take away a few volts for use when a sensor output was too weak or too strong.

best thing is that it would be all 12 volts.

edit the sensor outputs a 'high frequency' pulse based on speed
I received some mis-information from a technician at the dealer. After reading a service manual it looks like this sensor out puts a PWM type signal.

My car was modified to allow reprogramming of the computer for performance modifications. The change of computer made the reverse lockout not function. A lot of people use an ignition on source to turn on the reverse lockout and a relay attached to the brake pedal switch to turn it off. This is not a solution I am happy with since I track my car, when entering a corner I am often on the brake and throttle simultaneously downshifting and rev matching these conditions would open the reverse lockout during a shifting situation which is opening me to the possibility of a forward gear to reverse misshift, not something I would easily do but I would like the comfort of the switch working. I'd like it to function like the OEM circuit and shut off over 9mph and not have to be a constant though of applying brake to go into reverse.

I have a 'countershaft speed sensor' on my manual transmission and I need to activate the 'reverse lockout' switch when the countershaft sensor outputs frequency corresponding to the car moving over a certain mile per hour. The programming will have to allow me to trigger the mosfet 'on' when the countershaft sensor displays frequency over a threshold point. The sensor outputs no pule at 0mph and increases output as speed increases the manufacturer doesn't list a signal vs/ speed table for any models and I'd like to be able to use the same circuit no matter what gearing or tire size changes I make. I haven't had the opportunity to yet but I will back probe the sensor and see what kind it outputs at low speeds. When the speed sensor outputs below the threshold the mosfet needs to be at 0v output as well to open the switch.

now it is starting to make sense !

if mph is over X , activate reverse_lockout
if mph is 0, de-activate

you can also display pulse rate. that way, you can change tires and gears and then run to a known speed and crate your own tables or set the threshold. the display is simple.

to simplify it a bit, your pulse is the process variable.
the threshold you pick is your setpoint value.

you can display both and even have an indicator light go on when that point is reached.

this is still very basic electronics, you can convert a pulse into a voltage for a comparator and use a pot to set the threshold.

still more fun to add all the arduino stuff and do software.