Introduction: Arduino, Ten Turn Precision Potentiometer and MAX7219 Interface


The ten turn rotary wire wound potentiometer and turns-counting dial is used for custom panel design. The precision potentiometer is connected with the Arduino ADC. Software will read the ADC value, displayed on the connected MAX7219 seven segment display, also prints via the serial port for further analysis.

Parts and components

Arduino Uno board = 1 No

10K Ohm Ten Turn Rotary Wire Wound Resistor = 1 No

Turns-Counting dial = 1 No

MAX7219 Seven Segment Display Module = 1 No

Step 1: Schematic

The multi turn potentiometer is a three terminal resistor with rotating contact that forms an adjustable voltage divider, which is connected to the ADC analog pin of the Arduino for measuring the divided voltage.

The high precision rotary potentiometer is used for position measurements. It can also be used be used for controlling the audio, video and system parameters values, precisely.

The potentiometer variable terminal is connected to the analog IO pin (A0) of Arduino.

The adjustable terminal of potentiometer, varies between 0 Volt to 5 Volt.

The MAX7219 display module provides a 3-wire serial (SPI) interface to drive 7-segment LED displays (common-cathode type) up to 8 digits.

The on-chip includes a BCD decoder, multiplex scan circuitry, segment and digit drivers, and an 8×8 static RAM to store the digit values.

The DIN, LOAD and CLOCK pins of MAX7219 is connected with 7,5 and 6 digital IO pins of Arduino.

Step 2: Software

The Arduino LedControl library is used for displaying digits on MAX7219.

Arduino Uno provides 10 bit ADC.

Software will read the ADC at every one second interval and scales to the 0.0 to 10.00 range.

The scaled value, will be displayed on MAX7219 and printed on serial port for every change in count.

//Demonstrates the use of MAX7219 and 10 Turn Potentiometer

// The Arduino circuit connection for 7219: // MAX7219 DIN pin to digital pin 7 // MAX7219 LOAD pin to digital pin 5 // MAX7219 CLOCK pin to digital pin 6

// The Arduino circuit connection for 10 Turn Potiometer // Center pin of Potentiometer to Analog pin A0

// Name:- M.Pugazhendi // Date:- 18thAug2016 // Version:- V0.1 // e-mail:-

//Serial debug #define SERIAL_DEBUG

//Potentio meter to Analog IO pin #define ADC1 A0

//MAX7219 digital IO Pins #define DIN 7 #define CLOCK 6 #define LOAD 5

#include <LedControl.h>

// inputs: DIN pin, CLK pin, LOAD pin. number of chips LedControl mydisplay = LedControl(DIN,CLOCK,LOAD,1);

unsigned int val = 0;

void setup() { mydisplay.shutdown(0, false); // turns on display mydisplay.setIntensity(0, 15); // 15 = brightest mydisplay.setDigit(0, 0, 9, false); mydisplay.setDigit(0, 1, 8, false); mydisplay.setDigit(0, 2, 7, false); mydisplay.setDigit(0, 3, 6, false); mydisplay.setDigit(0, 4, 5, true); mydisplay.setDigit(0, 5, 4, false); mydisplay.setDigit(0, 6, 3, false); mydisplay.setDigit(0, 7, 2, false); #ifdef SERIAL_DEBUG Serial.begin(9600); Serial.print("Ten turn potetiometer Test"); #endif

//2 Second delay delay(2000); } unsigned int num,one,ten,hundred=0; void loop() { // read the Ten turn potentiometer input pin val = analogRead(ADC1);

float converted = fmap(val, 0, 1023, 0.0, 10.00); #ifdef SERIAL_DEBUG Serial.println(converted); #endif //Clear display mydisplay.clearDisplay(0); //Display the ADC value on MAX7219 if(converted>=0.0 && converted<=9.99) // for printing decimal values { num = converted * 100; one=num%10; ten=(num/10)%10; hundred=(num/100)%10; mydisplay.setDigit(0,0,(byte)one,0); // mydisplay.setDigit(addr , digits , value , dp); mydisplay.setDigit(0,1,(byte)ten,0); mydisplay.setDigit(0,2,(byte)hundred,1); }

//1000mS delay delay(1000); }

//Float interpolation function, for mapping the ADC reading//Float interpolation function, for mapping the ADC reading float fmap(float x, float in_min, float in_max, float out_min, float out_max) { return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; }

Step 3: Conclusion

The project is successfully completed with Arduino UNO, Ten turn potentiometer and Max7219 Seven segment display module.

The ADC value read by Arduino, after scaling to 0 to 10.0 scale is send to the serial port, and the screen log is given below.

The scaled ADC value, which is displayed at MAX7219, is same as turns-counting dial indication.