GPIO INPUT with Negative wire.

Hi @realdashdev,

I am currently digitizing the analog dashboard signals using Arduino board. Some of the analog signals in the car are switched by positive wire, while some are with negative. So I PULLUP or PULLDOWN the pin on Arduino to get the input.

However, on the RP4 Linux, I dont see the GPIO pins that are HIGH by default (pins 1-8).

is there a way I can get GPIO input using the negative wire from the car?

To my understanding, no. The continuity must be in between GPIO pins.

Thanks @realdashdev,

What am thinking is to use a pullup resistor and connect it to 3.3V. then when a negative wire with less resistance will be connected, the voltage will drop on the pin.

But with that, the values in Realdash will still be inverted. Is there a way to invert the GPIO values in RealDash?

Yes, for digital inputs the internal pullup is used for more stability, and to get button presses read 0 (up), 1 (down) the values are inverted. That is typically what users need for their buttons to read, so I can’t invert that.

If you really need an inverted value, you can use trigger system and use a dummy variable to write inverted value into.

Hi @realdashdev,

Thanks for the hint to use trigger system. That’s actually what I was doing already, but seem to have a problem, I cant seem to wrap my head around.

To give you a context of the model:

  1. In my car, the Door Ajar is switched using the negative wire.
  2. I have wired GPIO 40 to a 3.3v using a resistor.
  3. I have created two Triggers and two Actions, for GPIO HIGH/LOW cases, and storing the inverted value in Dummy 40.
  4. I have added two text gauges: #1 for the Dummy 40 state, and #2 for the GPIO 40 state. At this point all works well, the Dummy 40 is inverted, and whenever I connect the negative wire to the pin, the Dummy becomes 1, and falls back to being 0 when disconnected.
  5. Error? - However when I go to Inputs and Values, and set the Door Ajar to be read from Dummy 40, nothing happens with that door ajar light.

Anything I am doing wrong?

Update 1 - I’ve noticed that the behavior of the Text Gauges is slightly different when switching values. The GPIO Gauge changes value instantly, while the Dummy Gauge changes the value in transition (0.0 to 1.0 goes through all decimal numbers), in a “dial-up” / “dial-down” behavior.

Update 2 - I’ve changed the variable placeholder from Dummy ## to a vacant GPIO, and that seems to have fixed the issue. However, that cuts the number of GPIOs available quite drastically. Anything else can be done?

So the solution was to make physical PULL-UP resistors.

  1. Connected the pins to 3.3v via a resistor.
  2. Then had to create Triggers, to set the values and reset them, and assign action.
  3. The key, however, was to use Action with the “set value based on trigger status” type, so that you don’t have to create two triggers for each pin (one for HIGH and one for LOW). With that, the on-off status will be applied automatically.

I hope this will help others.