Arduino and potentiometer based rotation sensor

 Some Arduino-based projects, such as projects with electric motors or some kind of rotating elements, need to know the current position of the shaft. This is fairly easy to do with an inexpensive, potentiometer-based rotary encoder.


Arduino and potentiometer based rotation sensor

The SENZ001 Rotation Sensor is an Arduino compatible analog rotation sensor. It is based on a multi-turn precision potentiometer. It can rotate 10 turns. If the sensor enters a supply voltage of 5 V, then 5000 mV will be divided into 3600 parts (10 turns).


Arduino and potentiometer based rotation sensor

When you adjust the rotation by 3 degrees, then the voltage will change by 2 mV. This way you can accurately achieve the tension effect with minor adjustments. At the same time, it is quite simple to connect it to the Arduino. Here is its pinout:


Arduino and potentiometer based rotation sensor

As part of this project, which demonstrates the interaction between Arduino and the SENZ001 rotation sensor, we will read data from this sensor and indicate it using an LED. The connection diagram is as follows:


Arduino and potentiometer based rotation sensor

The Arduino code is shown below:



const int analogInPin = A0;
const int analogOutPin = 9;
int sensorValue = 0;
int outputValue = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
sensorValue = analogRead(analogInPin);
outputValue = map(sensorValue, 0, 1023, 0, 255);
analogWrite(analogOutPin, outputValue);
Serial.print("sensor = ");
Serial.print(sensorValue);
Serial.print("\t output = ");
Serial.println(outputValue);
delay(20);
}

Previous Post Next Post

Contact Form