Read the gnd power from the arduino to get the status of gnd whether it is on or off

Hi friends, do you have any suggestions for my project, I made a code to read the gnd signal whether it is on or off but I am not sure if this is accurate or not, this project is actually a manual motorcycle tester with an LED but I want to make it digital by taking power from the led gnd on or off because what functions to turn on the led is the gnd power.

This is the code I made.

const int gndPin = A0; 

void setup() {
  Serial.begin(9600);
  pinMode(gndPin, INPUT);
}

void loop() {
  int gndStatus = digitalRead(gndPin);

  if (gndStatus == HIGH) {
    Serial.println("signal GND true");
  } else {
    Serial.println("signalGND false");
  }

  delay(100); 
}

Sorry, but I don't see how GND can be on or off. You can measure the voltage between GND and a power source. Is that what you are trying to do ?

Can you please explain what you want to do and how the Arduino is supplies with power in more detail

1 Like

I did not make a voltage meter, I will explain a little, I have a manual tester of the ckp sensor on the motorcycle, so the sensor issues a signal gnd off and on which turns on the LED but now I want to take the gnd to the LED to the Arduino to be digitized and displayed on the LCD, I hope you understand my explanation.

digitalRead() will return HIGH or LOW depending whether the difference between the Arduino GND and one of its pins is greater or less than a certain voltage

How does that fit the concept of your project ?

1 Like

Is the signal that you are trying to read the output of the crankshaft position sensor?

If so , I think that it is confusing to call it GND.

I would call the motorcycle frame GND, but for any other signal use a different name.
In your code you are checking for this signal being HIGH or LOW. If it really is GND, then it can't go HIGH.

1 Like

Yes, because the sensor controls the gnd power on or off at the sensor output.

because that's the only way to make the manual tool digital because the sensor only releases power off and on at GND not VCC.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.