1

Did anyone work with a Raspberry Pi in a an automotive project ?

I am working on creating a dashboard for a motorcycle and it is making me crazy!

when configuring a GPIO pin as an interrupt it detects many pulses if the engine is running ! There is no problem with the other GPIO pins that they are not configured as an interrupt they work as expected!

But for the speed I am working with NJK-5002C sensor which is an NPN sensor , if it detects something the output will be connected to the GND. So I am configuring a pin as a pull Up GPIO and as an interruption to use it for this sensor.

It has been a while that I am facing this problem, I though it is because of the sensor but it is not. so to locate the problem I just started by testing the Raspberry Pi in this environment without even connecting the sensor and without connecting any thing to any GPIO. I just connected my Raspberry pi to the official power supply so the raspberry is totally isolated from the engine's battery, I configured a pin as a pull up and an interrupt so it contains an internal pull up resistor and when I run the engine it detects nothing but if I just connect any type of wire to this GPIO and add simply a 10Kohm external pull up resistor without even connecting the output of the sensor to the GPIO. the wire acts like an antennae and detects all that noise coming from the engine and the alternator. I tried also with the coaxial cable and same thing ! So when my raspberry has a pin configured as an interrupt and it is just connected to an external pull up resistor and nothing else it is detecting noise!

enter image description here

For the software I am working with the WiringPi library so when configuring the pin I am using the wiringPiISR. I though that maybe the problem comes from this library which is not official so I tried the same thing with the Arduino and even the Arduino detected this noise.

Please if anyone worked with a Raspberry Pi on such a project tell me what should I do It's been a while that I am facing this problem !

1
  • Comments are not for extended discussion; this conversation has been moved to chat.
    – goldilocks
    Jun 26 at 14:38
2

Any GPIO which is not connected to a voltage will float between high and low.

You need to give the GPIO a fixed voltage by supplying a pull to 3V3 or a pull to ground.

The weak internal pulls (about 50kohm) can easily be overcome by noise.

Try adding an external pull of around 5kohm or lower until the GPIO is stable in your environment.

5
  • 1
    actually when I don't add the external pull up to the GPIO it didn't detect noise as the GPIO is a configured as a Pull UP so has an internal pull up resistor. but when adding an external 10Kohm pull up resistor it detects noise ! It is because of the wiring that are acting like antennae and I didn't find any solution for this
    – mina
    Jun 25 at 9:12
  • 1
    @mina is everything properly grounded together?
    – Swedgin
    Jun 25 at 9:37
  • 1
    to locate the problem, I am just powering the Pi with the official supply power, I didn't even connect the output of the sensor or any thing to the GPIO of the Pi , the pi is just connected to the official power supply, a micro HDMI and a USB for the screen and nothing else, nothing is connected to any GPIO. when running the engine nothing will be detected but just by adding simply an external pull up it starts detecting noise :(
    – mina
    Jun 25 at 9:42
  • 1
    @mina You need to edit all clarifications into your original question. I am confused by a seemingly contradictory set of symptoms.
    – joan
    Jun 25 at 10:23
  • 1
    I just edited my post sorry for my english, hope it is clear now. It has been like 2 months that I am facing this problem. this is my post on electrical engineering forum electronics.electronics.stackexchange.com/questions/571035/… First I though it is because of how I was doing the conditioning of my sensor but when starting to locate the problem i found out that the GPIO is detecting noise even if the sensor if not connected ! just having a wire that connectes a pull up from the GPIO to 3.3v causes problem
    – mina
    Jun 25 at 11:30
1

In my younger years (long before microprocessors) I spent some time working on automotive electronics. This is a HOSTILE environment - motorcycles are an order of magnitude worse.

It is possible BUT is somewhat a specialist field. You NEED an isolated supply, extensive shielding, all inputs should ideally be galvanically isolated and any connections need filtering and should be low impedance (internal pullups are a joke). All wiring needs careful consideration to routing, and single point earthing is mandatory.

This is not specific to the Pi. Just look at the dedicated electronics in most cars for examples.

2
  • 1
    for my dashboard I developed a Qt application. the complete system reads the signal from all the sensors and output the result on a GUI application on the screen. When the engine is running the signal that are coming from light, Gear, fuel level and are connected to the GPIO pins that are not configured as interrupt works normally only the one GPIO that is configured as an interrupt is causing the problem and it is detecting noise. This seems so weird to me ! why is the problem comes only when configuring the pin as interrupt
    – mina
    Jun 25 at 11:51
  • There is nothing special about an interrupt. It is triggered by the same level change as would be detected by a GPIO read. The only difference is that the response to level changes is nearly instantaneous. It is simple to filter the response to level changes in software for an input, but not an interrupt. The problem remains one of interference and elimination this is the only solution.
    – Milliways
    Jun 27 at 1:45

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.