From blwiki
Jump to: navigation, search


NewPot - Smart potentiometer

Replace a multi-turn pot with a rotary encoder.



  • Microprocessor controlled
  • Extender ISP Connector
  • Starts at off when powered up
  • PEC12R-4120F-S0012 Rotary Encoder
    • 12 or 20-positions per turn
    • Encoder's Pushbutton switch resets Micrprocessor
  • MCP4151 Digital potentiometer
  • Double sided PCB
    • PCB mounts on the back of the Rotary Encoder
    • Digital Pot is on the side of the board that the Rotary Encoder is installed to
    • Microprocessor is on the other side of the board
  • Power Supply - 1.8V to 5.5V range


  • Card must be powered from the H1 ISP connector (other pins can float)
  • The voltage on the pot pins has to be within the range of the power supply voltages.

Rotary Encoder Specifications

  • Rotary Shaft Length: Approx. 12mm
  • Shaft Full Length: Approx. 20mm
  • Shaft Diameter: Approx. 6mm
  • Size (L x W): Approx. 15 x 12mm
  • Output: 2-bit gray code
  • Closed Circuit Resistance: 3 ohms maximums
  • Max. Rating: 10 mA at 5 VDC
  • Operating Temperature Range: 30 to 70 degrees celsius
  • Storage Temperature Range: 40 to 85 degrees celsius
  • 12 or 20 clicks per turn


Obscure Factoids

  • These kinds of rotary encoders are really incremental encoders
  • Incremental encoders have pins which are normally open.
  • Turning an incremental encoder results in four state changes
  • The order of the state changes shows the direction of the rotatiojn
  • If you are counting every state change you are counting 4 times per click
  • Counting four times per click results in a quick rate of change

Digitalization of turns

  • If you want 256 counts (8 bits) of data, then a 20 click per turn rotary encoder would result in more than 12 rotations for full scale
    • 12 clicks per turn and 8 bits is 22 turns
    • Formula is NumberOfRotations = 2^NumberOfBits / clicks/turn




In System Programming (ISP) Connector

  • Pins 1-6 are the ISP connections


Cable is a 1:1 cable between 1x6 and 2x3 connectors.

Pot Connector


Arduino Code

const int EncoderA = 0;    // Encoder pins
const int EncoderB = 1;
const int MOSI = 2;        // SPI-POT pins
const int SCK = 3;
const int CS = 4;

External Links