How to invert grounded sensor resistance to voltage?

Hi,

Trying to figure out hov ti invert a negative signal for arduino.

The sensor is fuel level 0-90 ohm against ground.

Have tried with resistor to 5v and against it, but it cant handle any current.

Have you got any more specs or a datasheet for the sensor?

If it's a variable resistance sensor, you need a 2nd resistor to make a [u]voltage divider[/u].

If you simply need to invert the logic, do that in software.

If you have a negative voltage, you can make an inverting amplifier with an op-amp.

90ohm is quite low. Quite a bit of current in a normal "0-5volt out" voltage divider. You could use a 330ohm resistor between +5volt and sensor. And read the analogue value with 1.1volt Aref. No need to invert. That can be easilly done in software. Leo..

The sensor is fuel level 0-90 ohm against ground

This doesn't make sense. Can you explain further. In order for any current to flow through the resistor there has to be a voltage source. Is it positive or negative ? Can you draw a schematic and post a photo of it ?

Judging from this expression ;

against ground

can we assume you have little experience with electronics ? (that expression is never used in electronics) I'm sure you know what you mean but I don't .

It is a fuel sensor on a car. the sensor itself is goes to ground, and have one wire out with 0-90 ohms.

I have tried with Voltage divider with up to 330 ohms and 5 volts, but the sensor dont seem to handle the current.

Is there another way with less current?

raschemmel: This doesn't make sense. Can you explain further. In order for any current to flow through the resistor there has to be a voltage source. Is it positive or negative ? Can you draw a schematic and post a photo of it ?

Judging from this expression ;can we assume you have little experience with electronics ? (that expression is never used in electronics) I'm sure you know what you mean but I don't .

No, its just my English that sucks.

ruud1: No, its just my English that sucks.

Sounds like a good reason to provide a schematic!

Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png or pdf?

Thankyou ....Tom.... :)

R2 is my sensor. 0 to 90 ohms. 0 at full tank and 90 at empty. Just need a voltage out for the arduino, but R2 cant handle much current.

|500x259

Hi,

Trying to figure out hov ti invert a negative signal for arduino.

Do you mean a signal that is low for a full tank and high for a low tank?
Not a negative voltage?

How do you know it can’t handle any current, tank senders are usually wire wound.

What value is Vin?

Tom… :slight_smile:

TomGeorge: Hi,

Do you mean a signal that is low for a full tank and high for a low tank? Not a negative voltage?

How do you know it can't handle any current, tank senders are usually wire wound.

What value is Vin?

Tom...... :)

The signal can go any way, thats just mapping the stepper in arduino. My Vin is 5v and have tested with R1 up to 330 ohms. That should give a signal up to around 0 to 1 volt. But it comes out higher, and not variable. When I measure the sensor unconnected it shows right, but connected it shows wery much.

Thinking a op-amp could do it, but havent found any way to do it

Are you sure the sensor wire isn't connected to anything else ? (is this an automotive sensor ?)

ruud1: The signal can go any way, thats just mapping the stepper in arduino. My Vin is 5v and have tested with R1 up to 330 ohms. That should give a signal up to around 0 to 1 volt. But it comes out higher, and not variable. When I measure the sensor unconnected it shows right, but connected it shows wery much.

Thinking a op-amp could do it, but havent found any way to do it

please, try to give more information. Where is it connected when you measure it "connected" ? Is it to an arduino pin ? if yes, which one ? etc.... give as much information as you can, this is the best way to get a useful help. we need a schematic, not a part of it ;)

Check out question 21 here.

dlloyd: Check out question 21 here.

Looks exactly like my cirquit. I did not understand the current mirror yet, but might be the solution.

alnath:
please, try to give more information. Where is it connected when you measure it “connected” ? Is it to an arduino pin ? if yes, which one ? etc… give as much information as you can, this is the best way to get a useful help.
we need a schematic, not a part of it :wink:

The schematic is exactly like the picture with Vout goes to analog (A0) and the R1 is 330 ohm.
It is a aftermarket fuel cell and sensor that sits in my racecar. I have built a complete Dash with a arduino and steppers.

I have tested it on bench now, with potmeters instead of fuel sensor. I preset them on 45 ohms (half tank) and one of them(biggest) shows right but the others goes to full. So it is a current problem.

Here is the code for two steppers and a sevensegment display, everything works great exept the tank A0

#include <SwitecX25.h>

#include <SoftwareSerial.h>
#define STEPS (800)

// Define some steppers and the pins the will use
SwitecX25 motor1(280,6,7,8,9);
SwitecX25 motor2(280,2,3,4,5);







float fval = 0.0;
int val = 0;
int ftemp = 0;
unsigned long duration;  

SoftwareSerial Serial7Segment(11, 10); //RX pin, TX pin
#define APOSTROPHE  5
#define COLON       4
#define DECIMAL4    3
#define DECIMAL3    2
#define DECIMAL2    1
#define DECIMAL1    0

long millisTimer;
byte seconds = 0;
byte minutes = 0;
byte hours = 0;
boolean amTime = true;
boolean colonOn = false;

char tempString[100]; //Used for sprintf


static int nextPos = 0;










void setup() 
{  
motor1.zero();
motor2.zero();
 
pinMode(12, INPUT);

  Serial.begin(9600);
  Serial.println("OpenSegment Example Code");

  Serial7Segment.begin(9600); //Talk to the Serial7Segment at 9600 bps
  Serial7Segment.write('v'); //Reset the display - this forces the cursor to return to the beginning of the display
  delay(3000);
 
}

void loop() 
{
 static int nextPos = 0; //only moves when you call update
 duration = pulseIn(12, HIGH);
 int temp = (map(duration, 1660, 5200, 0, 280));
 int tank =  (map(analogRead(A0), 0, 250, 0, 280));
   
if (temp <=50)motor1.setPosition(0);
else motor1.setPosition(temp);
motor1.update();
   
 
   motor2.setPosition(tank);
              

   motor2.updateBlocking();
   
  
  
 //Serial.println(tank);
  Serial.println(analogRead(A0));
  //delay(100);
  
float fval = (map(analogRead(A1), 0, 1023, 355, 1023) / 1023.0) * 22.5;
  val = fval*100;
  
  
 
  colonOn = true; 
      Serial7Segment.write(0x77);  // Decimal, colon, apostrophe control command
      Serial7Segment.write( (1<<APOSTROPHE) | (1<<COLON) | (1<<DECIMAL2) ); // Turns on colon, apostrophoe, and far-right decimal
  
  char tempString[4]; //Used for sprintf
  sprintf(tempString, "%4d", val); //Convert deciSecond into a string that is right adjusted
 
  Serial7Segment.print(tempString); //Send serial string out the soft serial port to the S7S

  delay(10);
}

Voltage divider R1 = 330 ohms R2 = 90 ohms (tank empty for the sensor) Let Vin = 5V Vout = 5 V x 90/(90+330) = 0.6V For Vcc = 5 V AnalogRead (0.6) = 1.07 V V / 0.00488 V (4.88 mV per count) = 220 counts.

(NOT 250 as in your Map statement of your code.)

ruud1: Looks exactly like my cirquit. I did not understand the current mirror yet, but might be the solution.

330ohm or current source. Same difference if you want 0-1volt out. You have to push the same current through the sensor to get that 0-1volt. A current mirror is just a bit more lineair than a 330ohm resistor. Leo..

Hi, Have you put the sensor into the car, connected it to the fuel gauge and measured the voltage across the sensor for full and empty with respect to gnd.

Leave the arduino and 330r resistor out of circuit. What are those voltages?

Tom..... :)