I need to "read" the state of a push button connected between +12V and GND using an arduino.
I made a simplyfied scheme. I can access switch terminals only (and the arduino side as well). As I can see, is a Pullup configurations and i'm not sure i can connect it directly to arduino digital pin.
Yes I can but i don't know how if it would change in any way the pushbutton logic (i mean, the button is somewhere connected to the car "computer" and is used by the car to select one of the gears (DNR).
I dont have any other info.
The oly thing i know is that Voltage between the pin and ground is 12V and current is 1.25mA (thus the 9,6KOhm equivalent resistor). The pushbutton simply shortcircuits pin to ground (so the scheme i posted).
I would use 18K for the upper resistor and 10k for the lower, the junction voltage will be about 4.3V and the 18k will protect the input pin from 12V in case of a circuit fault, the 12V - (ground) must be connected to Arduino - (GND).
A reliable/regulated 5volt supply (7805) must be connected to the 5volt pin,
not to the V-in pin, which need 6volt minimum.
The question mark in post#1 could be a (1N4148/1N4004) diode, with cathode (ring) connected to the switch. With internal pull up of the pin enabled with pinMode(pin, INPUT_PULLUP);
Leo..
First the regulator: I'm using a linear regulator. The arduino stuff, with rf24L01+, will be part of a party of three iot objects and wants c.a. 100mA (75 measured as peak) even considering peaks . This project will be boxed and i'm concerned about getting too hot. So i moved to a 7808 to have (14-8)*100=600mW (the car battry can deliver up to 14 volts) and use the internal regulator to dissipate the remaining (8-5)*100=300mW. Is that wise? Or i can just use a 7805 to do the dirty job? Or maybe i should move to a buck converter (but i read they make a lot of noise and i'm not sure if it will interfere with my RF)? And can I use ceramic capacoitors or i must use electrolitics ones for the regulator? (I supposed 220nF on input and 100nF on output)
Second part:
As you can see i want also act as the pushbutton using arduino pin, so i put a NPN 2N2222 (or a SS8050?) transistor, with a 96K resistor on the base, connected to another pin.
Is that correct?
My idea is to raise the pin level when i want to shortcircuit pushbutton pins by means of the tansistor saturation so that Collector and Emitter are "shorted".
Thank you in advance for all the help
P. S.
What are you all using to draw this very nice schemes?
I was just providing a more "durable" circuit to go in the question-mark on your original diagram to protect against voltages which might occur in an automotive environment and set the threshold level at half of 12 V rather than 1.8 V with the single diode.