# Digitally controlled resistance circuit - Arduino

#### dandy1

Joined Sep 30, 2017
116
Another idiot walks into the arena here so thanks for your patients, thanks for taking a look.

i am planning to build a circuit to switch between resistors in a resistance ladder and was hoping to control it via arduino board. the specified reference voltage for the circuit is 5 volts and +/-5% tolerance for the resistance. So the plan is to connect the resistors to the digital pins and switch on/off through an arduino.

I've noticed that the voltage on the digital pins is 4.81v so am i already 0.2v down and was wondering about any resistance from using the arduino?

I Tried (don't laugh here!) to read the resistance in circuit when the arduino switches but of course.................doh!

The other option i was thinking is a darlington array or a load of transistors to switch the circuit but i'm not sure about any voltage drops or internal resistances.

Joined Feb 20, 2016
4,251
Do you want the resistors to be used in an external circuit or running an D to A R2R ladder?
Your description needs to be a bit more detailed.
What are you trying to use the resistors for?
And what resistance range are you looking at?

#### dandy1

Joined Sep 30, 2017
116
quote "The control box needs to switch resistors into the circuit across the two green/white wires which formed the loop prior to being cut. This sort of circuit is known as a resistance ladder. The PCM software monitors the green/white wire circuit & when certain resistance's are detected they are interpreted as various inputs which control the feature.

and..

"The resistance ladder circuit acts as a potential divider. The PCM has an internal reference voltage of 5 volts. Current passes through an internal 320 ohm resistor prior to passing through the resistance ladder. There is also a (second) 220 nF capacitor internally within the PCM between the 320 ohm resistor and ground and this is to reduce EMC effects.

the circuit look like this
Code:
OUT---------120----------180---------300--------510---------1000---------2200-----------       C= capacitor
.............|............|...........|..........|...........|.............|.......................| S=switch
.............C............S...........S..........S...........S.............S......................|
.............|............|...........|..........|...........|.............| ......................|
IN-----------------------------------------------------------------------------------------------------
(ignore the periods)
The circuit is used for engine speed control.

Im sorry but i have no concept of a Digital to Analouge R2R ladder,

Last edited by a moderator:

Joined Feb 20, 2016
4,251
You may need to use a CMOS switch or relays to select the resistors so there is no electrical connection to the Arduino it you want to use the 5V from the controller.

I take it the "OUT" is the 5V from the controller and the "IN" is the internal 320ohm resistor the is the load.
Are you having one switch at a time operated?
This looks like a "4-20mA" type of input, although not that current range.

Do you want the Arduino to just read something and generate the signal from its own 5V supply? If so, that will be ok. If you are going to use your own resistors, go to 1% , not 5%. And the Arduino volts output voltage not being exact should be calibrated out on your program on the target controller. It is always a good idea to calibrate for each installation. But, saying that, it looks like you are just having a few steps anyway so I don't think accuracy will be a problem.

have a play with an R2R network on the Ardiono pins and feed that into the controller and see how you go.

Actually, an Arduino PWM (analogWrite) out via an R/C filter network will work ok too. have you looked at that?

Last edited:

#### dandy1

Joined Sep 30, 2017
116
the "IN" and "OUT" refer to the single wire where when cut incorporates the resistance circuit.

plase see below

qoute "With all the switches open there is a total resistance in the green/white loop of approx 4310 ohms and this corresponds to normal driving operation (the condition prior to the loop being cut). To ensure robust operation, it is recommended for all switches that a switch debounce specification is chosen as close to zero ms (milli seconds) as possible. Starting from the right of the diagram, when the key switch is closed only 2110 ohms is in the circuit and the PCM software recognizes this as the RPM mode being armed and ready for operation (Key switch closed = on, open = off). A key switch is recommended in this position. respectively. The software in the PCM responds to the change of state, so it is recommended that these 3 middle switches be non-latching push button micro switches. When going from idle to an elevated RPM the execution of the command will occur as the button is released. When going to idle the execution of the command occurs as the button is pressed. The final button (the one on the left) acts as an emergency vehicle engine stop. It is recommended that this be a red and oversize non-latching micro switch button. The execution of this command will occur as the button is pressed."

I would love to work out how to copy from a pdf!!!!!!

#### bertus

Joined Apr 5, 2008
22,120
Hello,

Did you see the links on the botton of the given page?

Bertus

Joined Feb 20, 2016
4,251
I would love to work out how to copy from a pdf!!!!!!
I use a screen capture to do that as a jpg.

here is the circuit redrawn as what I think it is..

I think the safest way to do it is to use relays from the Arduino, but leave at least the emergency off as a push button, maybe in parallel with a contact from an Arduino driven relay.
Running resistors direct from the Arduino ports would work but the actual values would need to be worked out.
If you have an Arduino driving relays, the original push buttons can stay there and just wire the relay contacts across them so you have manual and auto control.
Do you want me to draw something for you?

Last edited by a moderator:

#### dandy1

Joined Sep 30, 2017
116
thanks dendad, will have a look through that soon,

Yeah i just want the arduino to be a remote control basically and send out the desired signal through each resistor, i have measured the resistors in question and they conform within 0-2% below stated so that should be good enough.

ill hook it all up an see what happens
dont worry about drawings, as long as the arduino will be stable on the outputs thats all im concerned about, ill have to recalculate the resistors for the arduino voltage to suit the pcm. aslong as theres no internal resistace thru the arduino pins
thanks bertus, some interesting vids

Last edited:

Joined Feb 20, 2016
4,251
Ok.
But keep the emergency off as a manual as well, otherwise it can be dangerous.
You could measure the voltage in the IN pin to ground for each switch operation and have a trim pot on each Arduino output to set the resistance that way.
I'm off to bed now as it is late here. Good luck, and please let us know how it works out.