# Voltage controlled resistor (emulated resistor)

#### VuTran

Joined Jan 17, 2020
9
Hi,
My vehicle is E-motorbike, battery 60V, already have the DC-DC 60V-12V (120W) for power supply to circuit, i want to make coulomb counter and give the signal to speedometer to show the battery level. I bought speedometer, it has function to show fuel level, due to their user manual, i need to connect 1 dedicated pin (as i measure, it is 5V) to fuel gauge (8-98 ohm). 8 ohm: full fuel, 98 ohm: run out of fuel. i now want to design circuit can control the fuel display of speedometer by PWM (5V). i did test the fuel pin, connected the fuel pin to different resistors and the result in the table below.
 Resistor (ohm) Current (mA) level (5 bars is full) 10 44.3 5 20 40.6 4 30 37.8 4 40 35.14 3 50 32.8 3 60 30.8 2 70 29.13 1 80 27.53 1 blinking 100 24.85 0 blinking

i am searching some solution and choose the VCR (voltage controlled resistor). i did not understand all the solution thoughtfully so that i cant choose which solution and design schematic.
1st : use VCR2N ic
2nd: use IC LM13700
3rd: use schematic below

Can anyone give me some instruction ?

#### Alec_t

Joined Sep 17, 2013
10,924
Welcome to AAC!
Based on that table I think all you want, rather than an accurately emulated resistor, is a simple DC voltage going from 0V to 2.5V as your battery drops from 'full' to 'empty'.

#### Sensacell

Joined Jun 19, 2012
2,567
Thinking "voltage-controlled resistor" makes things complicated.

You need a voltage-controlled current sink circuit.

Use a "rail-to-rail" type opamp, it needs to work close to ground.

#### ronsimpson

Joined Oct 7, 2019
453
You also need to know what battery voltage = full to empty.
5,4,3,2,1,1,0 = voltages ???

#### ebeowulf17

Joined Aug 12, 2014
3,179
Hi,
My vehicle is E-motorbike, battery 60V, already have the DC-DC 60V-12V (120W) for power supply to circuit, i want to make coulomb counter and give the signal to speedometer to show the battery level. I bought speedometer, it has function to show fuel level, due to their user manual, i need to connect 1 dedicated pin (as i measure, it is 5V) to fuel gauge (8-98 ohm). 8 ohm: full fuel, 98 ohm: run out of fuel. i now want to design circuit can control the fuel display of speedometer by PWM (5V). i did test the fuel pin, connected the fuel pin to different resistors and the result in the table below.
 Resistor (ohm) Current (mA) level (5 bars is full) 10 44.3 5 20 40.6 4 30 37.8 4 40 35.14 3 50 32.8 3 60 30.8 2 70 29.13 1 80 27.53 1 blinking 100 24.85 0 blinking
i am searching some solution and choose the VCR (voltage controlled resistor). i did not understand all the solution thoughtfully so that i cant choose which solution and design schematic.

1st : use VCR2N ic
2nd: use IC LM13700
3rd: use schematic below
View attachment 197048
Can anyone give me some instruction ?
Based on your measurements, it looks like that pin is connected to the 5V supply through a 100ohm resistor. When you add an external resistor, that creates a voltage divider and the speedometer reads the resulting voltage.

So, you can think in terms of building a programmable current sink, or you can measure the voltage at the pin with various resistances (repeat your current test, but check voltage too) and then make a circuit to drive the pin to the desired voltage for each charge level.

#### ci139

Joined Jul 11, 2016
1,199

#### VuTran

Joined Jan 17, 2020
9
Thank you all, i just go back to work after Tet Holiday. I am really appreciate all your suggestions.
I tried the solution as Alec_t said, connect to simple DC voltage 0-2.5V and the result is: it did not work.

#### VuTran

Joined Jan 17, 2020
9
You also need to know what battery voltage = full to empty.
5,4,3,2,1,1,0 = voltages ???
i measure the current overtime by hall sensor, the full battery is 2000Ah, the signal give to speedometer 100% battery will be 5

#### ci139

Joined Jul 11, 2016
1,199
the battery is empty when it reaches the critical (unloaded) terminal voltage -- is the voltage below what the battery chemistry starts degrading
if you want the correct reading you need a micro-controller or otherwise a smart circuit that can estimate the unloaded battery voltage

if you manage this - the story is not over because the battery voltage also depends on temperature
(that in turn is affected by the intensity . . . the current flow rate out of it)

other than that the bus (connections) that lead out of cells may degrade (get more narrow) over time (applies to lead acid) ← so this seemingly adds to the internal resistance . . .
(the option here for the TRUE internal resistance estimation is to estimate(guess) the average "connection" resistance for the useful battery life . . .)

BUT - again - the important information here is the (unloaded) battery voltage(T) . . . how to get it on running system

https://batteryuniversity.com/learn/article/discharging_at_high_and_low_temperatures
https://batteryuniversity.com/learn/article/charging_at_high_and_low_temperatures
http://rincon-mora.gatech.edu/publicat/jrnls/tec05_batt_mdl.pdf
https://www.nrel.gov/docs/fy01osti/28716.pdf
https://deepblue.lib.umich.edu/handle/2027.42/134041
http://s2i.bordeaux.free.fr/Espace Terminale/Ressources/Projet/ProjetASI/9. Accurate circuit model for predicting the performance of lead-aci.pdf
. . .

Last edited:

#### VuTran

Joined Jan 17, 2020
9
the battery is empty when it reaches the critical (unloaded) terminal voltage -- is the voltage below what the battery chemistry starts degrading
if you want the correct reading you need a micro-controller or otherwise a smart circuit that can estimate the unloaded battery voltage

if you manage this - the story is not over because the battery voltage also depends on temperature
(that in turn is affected by the intensity . . . the current flow rate out of it)

other than that the bus (connections) that lead out of cells may degrade (get more narrow) over time (applies to lead acid) ← so this seemingly adds to the internal resistance . . .
(the option here for the TRUE internal resistance estimation is to estimate(guess) the average "connection" resistance for the useful battery life . . .)

BUT - again - the important information here is the (unloaded) battery voltage(T) . . . how to get it on running system
Thank you for your advise. I can know more about voltage of battery. But maybe you misunderstand the circuit, i used hall sensor to sense current going through the power cable (power supply to all electrical part in the bike) over time, the micro-controller will process that and generate signal (maybe PWM proportional to % of AmpeHour) to control the VCR or VCC(voltage controlled current). i did not read the voltage of battery because as you said it is not correct

#### VuTran

Joined Jan 17, 2020
9
Thinking "voltage-controlled resistor" makes things complicated.

You need a voltage-controlled current sink circuit.
View attachment 197051

Use a "rail-to-rail" type opamp, it needs to work close to ground.
i dont understand this sentences "Use a "rail-to-rail" type opamp, it needs to work close to ground". Can you explain more detail.
basically it needs 1 op-amp and 1 mosfet. and calculate I=Vcontrol/Rsense (choose Rsense to fit to Vcontrol and current sink which speedometer need). But i dont know how to choose op-apm and mosfet to fit to my circuit because there are limited IC in my city. Can i replace lt1492 to some general purpose op-amp like lm358 (opa277 is high precious op-apm but it quite expensive and not available in shop)

#### Alec_t

Joined Sep 17, 2013
10,924
I tried the solution as Alec_t said, connect to simple DC voltage 0-2.5V and the result is: it did not work.
What was your test setup for that? The voltage source would need to have a relatively low impedance (less than the 100 Ohm which, as ebeowolf said in post #5, seems to be connected between the sense input and the +5V supply rail of your speedo.
The low impedance is necessary to allow some 50mA current to flow through that 100 Ohm resistor. So the voltage source I mentioned is also the current sink that has already been suggested.

Last edited:

#### VuTran

Joined Jan 17, 2020
9
oh i see, can you suggest any other Op-amp to create that current sink. Because in the shop in my city they dont have opa277(177), lt1492

#### Alec_t

Joined Sep 17, 2013
10,924
The LM358, plus an outboard transistor, should do the job.

#### VuTran

Joined Jan 17, 2020
9
i just build that, it did not work
i disconnect the speedmeter. i check the circuit only, i dont understand why the voltage between output of op-amp and GND always = 7.7 (voltage supply for LM358= 9.0)

#### ericgibbs

Joined Jan 29, 2010
9,575
hi V,
That circuit will not work as you have drawn it, the feedback loop is grounded. [ -inp]
Where did you find the circuit.?
E

#### Alec_t

Joined Sep 17, 2013
10,924
Try this :-

#### ebeowulf17

Joined Aug 12, 2014
3,179
i just build that, it did not workView attachment 198331
i disconnect the speedmeter. i check the circuit only, i dont understand why the voltage between output of op-amp and GND always = 7.7 (voltage supply for LM358= 9.0)
As @ericgibbs pointed out, your feedback loop is grounded, which defeats the feedback entirely. Also, your capacitor is huge! Here's a modified copy of your schematic, in case it's easier to see the differences the way you originally had it laid out:

#### VuTran

Joined Jan 17, 2020
9
you guys are right, the negative input is ground, how stupid , sorry for my mistake. it worked fucking good now with the voltage control from 0 (empty)- about 440 mV(full).
i wonder how can i increase of voltage control then i just replaced R 10ohm to R100ohm, but the speedometer always show fuel empty. Could you guys suggest anything
Thank you so much

#### ebeowulf17

Joined Aug 12, 2014
3,179
you guys are right, the negative input is ground, how stupid , sorry for my mistake. it worked good now with the voltage control from 0 (empty)- about 440 mV(full).
i wonder how can i increase of voltage control then i just replaced R 10ohm to R100ohm, but the speedometer always show fuel empty. Could you guys suggest anything
Thank you so much
No need to apologize on the grounding thing. We all make mistakes. It's part of learning.

As for changing voltage levels, look back at your table of test results in the first post. If you want the indicator to show full, the most resistance you can have in the circuit is 10ohm.

I'm not sure why you need to, but if you want to increase the control voltage for any given display level, you could put a resistive voltage divider between your voltage source and the op amp input.

Last edited by a moderator: