5V
5V
2mA
0 to 300
1% or better
0-5V (linearly proportional to angular displacement)
10k
3-pin (VCC, GND, OUT)
25mm x 15mm
10g
Applications
The CJMCU-103 Rotary Angle Sensor Potentiometer Module is suitable for a wide range of applications, including |
Robotics and automation systems
Industrial control and monitoring systems
Consumer electronics, such as audio equipment and gaming controllers
Medical devices and equipment
Aerospace and defense systems
Conclusion
The CJMCU-103 Rotary Angle Sensor Potentiometer Module is a high-quality and versatile IoT component designed to provide precise and reliable angular displacement measurements. Its compact design, low power consumption, and simple interface make it an ideal solution for a wide range of applications.
CJMCU-103 Rotary Angle Sensor Potentiometer Module Documentation
Overview
The CJMCU-103 Rotary Angle Sensor Potentiometer Module is a digital potentiometer module designed to measure angular displacement or rotation. It is commonly used in a wide range of applications, including robotics, automation, and IoT projects. This module features a rotary potentiometer with a 0-360 measurement range, making it suitable for detecting and tracking rotational movements.
Pinouts and Connections
The CJMCU-103 module has the following pins:
VCC: Power supply (operating voltage: 3.3V to 5V)
GND: Ground
OUT: Analog output signal (0-5V)
CW: Clockwise rotation detection pin (active low)
CCW: Counterclockwise rotation detection pin (active low)
Code Examples
### Example 1: Reading Angular Displacement with Arduino
This example demonstrates how to use the CJMCU-103 module with an Arduino board to read the angular displacement of the rotary potentiometer.
```arduino
const int potPin = A0; // Connect OUT pin to Arduino analog input A0
void setup() {
Serial.begin(9600);
}
void loop() {
int reading = analogRead(potPin);
float voltage = reading 5.0 / 1023.0;
float angle = voltage 360.0 / 5.0;
Serial.print("Angle: ");
Serial.print(angle);
Serial.println(" degrees");
delay(50);
}
```
### Example 2: Detecting Rotation Direction with Raspberry Pi (Python)
This example shows how to use the CJMCU-103 module with a Raspberry Pi to detect the direction of rotation (clockwise or counterclockwise).
```python
import RPi.GPIO as GPIO
import time
# Set up GPIO mode
GPIO.setmode(GPIO.BCM)
# Set up CW and CCW pins as inputs
GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_UP) # CW pin
GPIO.setup(23, GPIO.IN, pull_up_down=GPIO.PUD_UP) # CCW pin
while True:
cw_state = GPIO.input(17)
ccw_state = GPIO.input(23)
if cw_state == 0:
print("Rotating clockwise...")
elif ccw_state == 0:
print("Rotating counterclockwise...")
else:
print("No rotation detected.")
time.sleep(0.1)
```
### Example 3: Mapping Angular Displacement to Servo Motor Position (ESP32 with C++)
This example demonstrates how to use the CJMCU-103 module with an ESP32 board to control a servo motor based on the angular displacement of the rotary potentiometer.
```cpp
#include <WiFi.h>
#include <Servo.h>
Servo myServo; // Create a servo object
const int potPin = 32; // Connect OUT pin to ESP32 GPIO 32
void setup() {
Serial.begin(115200);
myServo.attach(13); // Attach servo to ESP32 GPIO 13
}
void loop() {
int reading = analogRead(potPin);
float voltage = reading 5.0 / 4095.0;
float angle = voltage 360.0 / 5.0;
int servoPosition = map(angle, 0, 360, 0, 180);
myServo.write(servoPosition);
delay(50);
}
```
Note: In this example, we use the `map()` function to convert the angular displacement (0-360) to a servo position (0-180).
Remember to adjust the pin connections and voltage levels according to your specific setup and requirements.