2

This might be a super easy question to answer. I ordered an Arduino Uno anyways for the sole purpose to understand this. Would not mind getting a jump on things before it's here.

I would like to setup the Arduino Uno to be used as a gear indicator for GM transmissions (specifically right now the GM 4l60e). Below is how it currently tells the computer/cluster what gear it's in.

This uses a range switch. Basically it's a combination of 4 wires that are grounded (low) in a specific order, the computer reads it, and displays what gear the transmission is in. There are 4 signal wires - Signal A,B,C, and P. Below is how the range switch signals it:

Park    - A=low,  B=open, C=open, P=low
Reverse - A=low,  B=low,  C=open, P=open
Neutral - A=open, B=low,  C=open, P=low
OverDrv - A=open, B=low,  C=low,  P=open
Drive 3 - A=low,  B=low,  C=low,  P=low
Drive 2 - A=low,  B=open, C=low,  P=open
Drive 1 - A=open, B=open, C=low,  P=low

I am wondering what would be the best way to go about this? The Arduino would be powered on by ignition. Display would be an LED (9-12V) output from the Arduino to each gear on a floor mount shifter. Total of 7 LEDs.

Hopefully this is easy to understand what I am trying to do. Thanks!

  • Could you clarify what you want the output to be - is it 7 single LEDs, so exactly one will be on at once? Or perhaps you're not asking about the output - just how to read the input..? – Mark Smith Jan 10 '18 at 20:07
  • Yup, sorry about that. 7 single, different LED's representing a gear would be the output. The main question being is it possible for the Arduino to intake 4 wires that could be ground or open at any instance and take that info and make an output to power an LED representing the combination (listed above). – Cody R Jan 10 '18 at 20:30
1

First of all, Arduino is a 5V device, as such to drive the 9-12V LED you will need to use one or more transistors (depending on the LEDs type, number and connection, in series or in parallel).

Also, powering the Arduino from a 9-12V is not the best option: Arduino Uno has an onboard voltage regulator, but goes up to 9V maximum and, unless you go for the original one or a reputable manufacturer (Arduino is an open source project) I wouldn't go above 6V, because non-reputable manufacturers tend to use lower specs devices, like regulators which can get too hot when powered with high voltage: consider that the regulator will have to dissipate any excess energy into heat.

Said that, and knowing nothing more than what you said about the transmission you are describing, I assume the status open stands for open collector, meaning that it is not going to draw any current, so the following circuit is what you should use:

schematic

simulate this circuit – Schematic created using CircuitLab

The diagram assumes you are using digital pins 5 to 8 of your Arduino in INPUT mode and the Arduino GND is at the same voltage level as the transmission: this might be a big assumption, depending on how you power your Arduino (not from a battery pack, to be clear).

When node A is in open state, the voltage on Arduino pin 5 will be 5V, or HIGH as Arduino reports it. When node A is in low state then the voltage on Arduino pin 5 will be 0V, or LOW in Arduino lingo.

Resistors from R1 to R4 are there to limit current drawn when the gearbox is in state low.

UPDATE: I'm assuming the gearbox shares the same ground and operates at 5V,a s the Arduino does. If that's not he case and the gearbox operates at an higher voltage or does not share the same ground, the circuit will not work and you risk damaging the Arduino and/or the gearbox.

You can find a simulation of the above circuit where you can play with the different pins here.

The same occurs for the other pins, so your code will have to scan the 4 pins for their state and update your display accordingly, like:

#define PIN_A 5
#define PIN_B 6
#define PIN_C 7
#define PIN_P 8

void setup() {
  pinMode(PIN_A, INPUT);
  pinMode(PIN_B, INPUT);
  pinMode(PIN_C, INPUT);
  pinMode(PIN_P, INPUT);
}

#define PARK 0;
#define DRIVE_1 1;
#define DRIVE_2 2;
#define DRIVE_3 3;
#define OVER_DRIVE 4;
#define REVERSE 5;
#define NEUTRAL 99;
#define UNDEFINED 255;

unsigned int gear = UNDEFINED;
void loop() {
    bool A = digitalRead(PIN_A);
    bool B = digitalRead(PIN_B);
    bool C = digitalRead(PIN_C);
    bool P = digitalRead(PIN_P);

    if (!A && B && C && !P) {
      // Park - A=low, B=open, C=open, P=low
      gear = PARK;
    } else if (!A && !B && C && P) {
      // Reverse - A=low, B=low, C=open, P=open
      gear = REVERSE;
    } else if (A && !B && C && !P) {
      // Neutral - A=open, B=low, C=open, P=low
      gear = NEUTRAL;
    } else if (A && !B && !C && P) {
      // OverDrv - A=open, B=low, C=low, P=open
      gear = OVER_DRIVE;
    } else if (!A && !B && !C && !P) {
      // Drive 3 - A=low, B=low, C=low, P=low
      gear = DRIVE_3;
    } else if (!A && B && !C && P) {
      // Drive 2 - A=low, B=open, C=low, P=open
      gear = DRIVE_2;
    } else if (A && B && !C && !P) {
      // Drive 1 - A=open, B=open, C=low, P=low
      gear = DRIVE_1;
    } else {
      // none of the above
      gear = UNDEFINED;
    }
    // update your display here
}

Please note the above code is NOT the most efficient, but I believe it's easier to read and understand than a version using bitwise operations to identify the possible combinations.

| improve this answer | |
  • Awesome, this really helps! Power source can be changed. The ECU in the vehicle that this is going to be tested in has plenty of 5v references. So if that would be better I can do that. But this really helps. Kudos! I will jump right on it when it gets here and see what we get, thanks again! – Cody R Jan 10 '18 at 21:14
  • Please consider my update and also consider the fact the gearbox and the Arduino must have a common ground for this circuit to work. – Roberto Lo Giacco Jan 10 '18 at 21:24
  • 1
    Also consider there are more robust solutions than what I've here described and I would NOT advice to use the circuit I've diagrammed above unless you have double checked the gearbox and it's current draw capabilities. Personally I would opto isolate all interactions diagrammed above between the gearbox and the Arduino: voltage spikes are not uncommon in a vehicle electronics. – Roberto Lo Giacco Jan 10 '18 at 21:27
  • 1
    @Roberto Lo Giacco - Could he use INPUT_PULLUP instead of INPUT in pinMode() to eliminate the need for external resistors? – VE7JRO Jan 10 '18 at 22:14
  • 3
    I wouldn't go above 6V - actually 7.3V would be about the minimum. There is circuitry to switch between the power jack input and the USB input. It is based on a comparator which compares double 3.3V (there is a voltage divider) from the 3.3V regulator to Vin, after the protection diode. So 6V is too low for it to switch to using the power jack. You would need 6.6V plus the voltage drop over the diode, so really 7.3V would be about the minimum. Possibly with no USB input it would take whatever it got, but still ... – Nick Gammon Jan 10 '18 at 22:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.