Hi Arduino forum! I have an existing switch pack from my car which I'm hoping to interface with arduino to read the position of the two push switches and two potentiometers.
I have drawn up the circuit diagram as see it after some investigation with a multimeter, and it seems as though the unit already includes pull up resistor which I think means I could plug the 4 outputs directly into arduino (a Teensy 3.2). I would be using two digital pins for the push switches, and 2 analogue pins for the pots. Does this make sense or do I need to add some conditioning?
I don't understand the point of the 5V5 feed from the car electrics to the pots and switches. What is the reason for not just connecting the switches directly to the input pins and the Teensy 0V and using the input pull up resistors, and connecting the pots to the Teensy supply and 0V?
What is the supply to the LEDs for? I suggest a buck converter.
Don't forget that car electrics are NOT 12V! They are anything between about 11V if the battery is flat up to 14V2 if charging, with possible spikes higher than that.
If I was building it from scratch I would probably have done things differently but it seems to work so I'll just tap into the IDE socket and plug it into the PCB I'm designing. I've plugged it into a power supply and it seems to hold a 5.5v supply to the switched and pots over a range of input voltage
In that case, until someone cleverer than me says otherwise, it looks fine to me. Don't use the internal pullup as you already have that in the circuit.
5 Volt Tolerance on Digital Inputs; today most new chips use 3.3V signals, but many legacy products output 5 volt digital signals. These can now be directly connected to Teensy 3.1's digital inputs. All digital pins are 5 volt tolerant on Teensy 3.2. However, the analog-only pins (A10-A14), AREF, Program and Reset are 3.3V only.
So your 5V switch outputs should be OK for the digital inputs but for the analogue inputs you need to be careful. I don't know the Teensy (not got one), are you using A10 to A14? Or are you using a different analogue input (if there are some)?
The difference is that this one switches to ground, and I want to read the position of the switches with two devices simultaneously (another Teensy using digital inputs) and a PDU system also using 5v inputs - both have pullup or pulldown input options.
My current thought is to wire them as shown which should pull the input pins on both devices high when the circuit is open and low when closed. Does this look right or do I need any other components?
Thanks!
PerryBebbington:
It says TVR on it. Do I need to be jealous???
I don't see any problem with the the wiring like that, don't use input pull up. To me 'PDU' means power distribution unit, which is a glorified extension lead for mounting inside a data cabinet. PDUs don't have digital inputs. I suspect your PDU is something entirely different, perhaps you can explain.
Something to be aware of about grounds; it matters where the connections are made. If the ground on your switches is connected to the vehicle electrics some distance from the Teensy ground then you run the risk of them being at different voltages, if only for a fraction of a second, especially in the electrically noisy environment of a vehicle. Ideally the Teensy should be grounded at the same place physically as the peripherals it is connected to.
PerryBebbington:
Something to be aware of about grounds; it matters where the connections are made. If the ground on your switches is connected to the vehicle electrics some distance from the Teensy ground then you run the risk of them being at different voltages, if only for a fraction of a second, especially in the electrically noisy environment of a vehicle. Ideally the Teensy should be grounded at the same place physically as the peripherals it is connected to.
Good advice - I'm using the IDE connector on both switch packs to tie them back to the same board as the arduinos so the ground will be the same so hopefully no issues...
The PDU system is a solid state power distribution system replacing all fuses and relays. The idea is it has 16 outputs and 16 inputs, so you can plug anything into it and sort out the logic in the software of which input activates which output under which condition. It also offers some reverse voltage protection and current clamps can be set among other things so hopefully will ensure a nicer electrical environment...