How to control a resistor (or a potentiometer) using Arduino

Many times I asked myself how to control my simple noise-electronic-circuits by a computer. Most of these instruments are hacked toys or small circuits on which i can either switch on and off an effect or change one by the use of a potentiometer.

potientiometers in circuitbent toy

and it would be great to have them played by a midi-clocked software or to create fancy high speed effects on the potis/resistors, which no human fingers could ever do.

So what we need is an Digital to Potentiometer/Resistor device.

arduino_resistor_control

The Arduino board suits perfect for that! because it already has several Digital-to-Analog inputs and outputs and vice-versa. There is many tutorials out there, but I couldnt find what i wanted.

So how can we use the Arduino’s outputs to control a resistor?

The answer is pretty simple: we can use one of the PWD analog outputs to control an LED, which is situated next to a photoresistor.

LED photoresistor pair

The picture shows such an example. its generally better though to put it inside a opaque casing, tape or some shrinkable wire, but to show it here i have ommited the case.

Remember to put a resistor in series with the LED to keep it alive. Of course some tuning needs to be done, by choosing the right LED/photoresistor pair . There are really bright LEDs or cheap ones and the photoresistors have different ranges and finally also the distance and the casing are crucial.

Using any software to control the Arduino PWD output we can dimm the LED and thus we can now change the resistivity of the photoresistor.

I used PureData to control the arduino outputs. and made a simple patch to oscillate the resistivity of the photoresistor.

pd patch to oscillate the resistivity


finally i used the resistor in a very simple circuit using a CMOS chip (40106). by a resistor and a capacitor a square wafe oscillator can be built, where the resistance controls the pitch/frequency.

40106

2 Responses to “How to control a resistor (or a potentiometer) using Arduino”


  1. 1 MikMo

    Ahh yes, the good ol’ optocoupler.

    For a “real” computerinterfced bent toy, complete with sequencer software take a look at my site here: http://mikmo.dk/cbinterfacemain.html

    MikMo

  2. 2 TeZ

    cool idea.

    another way:
    http://www.arduino.cc/en/Tutorial/SPIDigitalPot

    cheers~
    : : :

Leave a Reply