Can't find common ground for Arduino - Page 1
Forum section: electronics / beginners

author: ztanb
author_rank: Newbie
timestamp: March 29, 2018, 02:35:06 am
content: Hello!I am trying to interface an Arduino Uno with button controls on a small electric vehicle dashboard so I can control it remotely.The car runs on a 24V battery. I have access to pin connectors that connect the dash and the rest vehicle systems. I have been disconnecting wires one at a time and seeing what stops working to try to determine which wires carry which signals. The PCB's are covered in an opaque goop, so i'm having trouble determining which is power, ground, or signal. However I was able to determine that many are simple switches that pull up the wire 24V when activated. That is, my multi-meter reads 24V with the leads on the disconnected wire leads when the button is pressed.I figured I could use a transistor as a switch to activate these simple controls, with the Arduino controlling the transistor gate. The transistor drain would be connected to another pin that I measured at 24V relative to the battery negative terminal, and the source would go to the pin connector. The attached picture is a rough sketch of this idea. I know this can theoretically work because shorting my selected power wire to the pins do in fact activate the controls.The problem is I cannot get the Arduino pin outs to turn on the transistors. I think my issue is where I am connecting the Arduino ground pin to achieve common ground so that the transistor is biased correctly. I first tried connecting the Arduino ground to the negative terminal of the battery, but that didn't work. It does work if I connect Arduino ground to the transistor source, but that is silly because the 24V signal will feed back into the Arduino ground, and I don't really know what consequences that has. Where can I try to connect the Arduino ground? Why might the battery ground not be sufficient?I appreciate any insight on my problem, or other ideas on how to hijack these signals!Thank you!

author: SirAlucard
author_rank: Regular Contributor
timestamp: March 29, 2018, 03:43:27 am
content: I would think that you can connect ground to any metal part of the vehicle. As all vehicles are made similarly, the ground or negative terminal of your battery gets connected directly to the chassis of your vehicle. So anywhere that is metal you can actually connect your negative/ground pin and be connected to ground. However if your buttons are being brought high when pressed, this could prove more difficult as you'd definitely not want to feed an arduino 24v.

author: sleemanj
author_rank: Super Contributor
timestamp: March 29, 2018, 03:57:07 am
content: Relays, use relays.Unless you intend to be operating these "switches" at some high frequency.

author: ztanb
author_rank: Newbie
timestamp: March 29, 2018, 04:55:00 am
content: I should add that the Arduino is also plugged into a laptop. So the USB is powering the Arduino, but i'm trying to create a common ground with a different battery system. Could that be messing with my results?

author: Nusa
author_rank: Super Contributor
timestamp: March 29, 2018, 05:35:39 am
content: We don't know enough about the vehicle system. Side-step all of that trouble with relays or opto-isolators.

author: mikerj
author_rank: Super Contributor
timestamp: March 29, 2018, 11:21:39 am
content: You are showing an N-channel MOSFET in your circuit, with the drain connected to 24v. In order to switch this on, you need more than 24v on the gate which the Arduino can not possibly supply without additional circuitry.A more sensible scheme would be to use a P channel MOSET with a pull-up on it's gate, and get the Arduino to pull the gate low via another transistor (bipolar or mosfet) to switch the MOSFET on. Beware of Vgs limits, you will need a potential divider or zener clamp to limit the gate voltage. Obviously the Arduino and the car would have to share the same ground.

author: ztanb
author_rank: Newbie
timestamp: March 29, 2018, 02:28:36 pm
content: Wait, this is a good beginner moment for me. What does the drain-gate voltage have to do with turning the N-channel MOSFET transistor on? I thought it was just a threshold voltage between the gate and source.

author: Buriedcode
author_rank: Super Contributor
timestamp: March 29, 2018, 08:32:46 pm
content: That is indeed the case (voltage between gate and source). But at what voltage is the source? Say you hook up an N channel MOSFET as you have (drain connected to +V) and "A" is your source, possibly pulled to ground. You apply say 12V to the gate. What voltage is the source now? If the MOSFET is fully on it should be close to the voltage of the drain, but that takes the source higher than the gate (which is at 12V) so it can't be on at all.A P-channel requires a negative voltage between gate and source - so in this instance the source is connected to V+, with the drain to whatever is being switched. If you pull the gate to 0V then the gate-source voltage is... -24V. Thats quite high and should be limited with say a zener diode. This is why generally P channel MOSFETS are used as "high side" switches, whilst N channel's are for "Low side". Because in both cases the source is connected to a fixed voltage (either +V for P channels, or 0V for N channels) you can turn them on/off via the gate.N channel MOSFETS *can* be used as a "high side" switch, but often only when a higher gate drive voltage is available, either in the system, or generated (via a boost converter) specifically for driving the gates. In your case you would need ~36V on the gate to fully turn on the MOSFET.tl:dr use relays.

author: ztanb
author_rank: Newbie
timestamp: March 30, 2018, 12:09:45 am
content: Thank you! These ideas lead me to look into high side switches which lead me to a solution with PNP and NPN transistors. I also decided to grab a 24V arduino I/O shield to make this all easier.