Fuel sender/grounding/motorcycle analog read problem

Hi guys

In a bit of a conundrum here with my Arduino setup. I'm trying to get readings from my fuel tank sender on my motorcycle.

Here's the setup:

  • Two wires going to sender, one connected to +5V from Arduino, the other wire to A0 (with similarly sized resistor to ground from A0 — A0 is the analog input for the Arduino)
  • One of the wires is grounded inside the tank to the steel of the tank, then another wire is bolted to the tank on the outside and continues back to A0.

Problem: When I supply ground and power to the Arduino through the motorcycle (how I'm going to power it), it seems like the voltage is just all bleeding to ground and nothing is getting back to the Arduino to measure.

When I have the Arduino connected through USB to my PC, it works perfectly.

I'm wondering if there's a way to still power the Arduino through the motorcycle but not have the ground connected directly to the bike? Sort of like a USB from a laptop, without using a separate battery?

Kinda at a loss here since it's one of my first protects and don't even know if it's possible.

Ground is the end of the line for electrical circuits so the way you have it wired you have 2 separate circuits that are not connected to each other.

You need to connect it as a "voltage divider" here is a good link: Voltage divider tutorial

Pay attention to the Reading resistive sensors section to learn how to connect your fuel level sensor.

Two wires going to sender, one connected to +5V from Arduino, the other wire to A0 (with similarly sized resistor to ground from A0 – A0 is the analog input for the Arduino)
One of the wires is grounded inside the tank to the steel of the tank, then another wire is bolted to the tank on the outside and continues back to A0.

Since the sender is grounded and you can’t change that, the other resistor in your voltage divider should NOT be grounded, it should go to +5V or +12V.

And, the sender should NOT be connected directly to any voltage. One terminal should be grounded and the other terminal should go to A0.

The other resistor is the “top” of the voltage divider and the “bottom resistor” is the sender.

similarly sized resistor

If you connect to 12V and the resistors are identical you’ll get 6V (or more) and you can damage your Arduino. If you connect to 5V you won’t get the full 0-5V range (which may be OK).

DVDdoug:
Since the sender is grounded and you can't change that, the other resistor in your voltage divider should NOT be grounded, it should go to +5V or +12V.

And, the sender should NOT be connected directly to any voltage. One terminal should be grounded and the other terminal should go to A0.

The other resistor is the "top" of the voltage divider and the "bottom resistor" is the sender.
If you connect to 12V and the resistors are identical you'll get 6V (or more) and you can damage your Arduino. If you connect to 5V you won't get the full 0-5V range (which may be OK).

Hi Doug

Thanks for your help. You're the first one to come up with the idea of not connecting the sender directly to voltage.

EDIT: Another user on reddit posted a similar answer, so I hooked it up tonight and voila! Works perfectly! Thanks so much for your help.