Mini Angle Unit Potentiometer Inside

Regular price $1.99
Order now to ship today
Description

ANGLE is a rotary switch Unit,simply having a 10K potentiometer inside. This unit can be used for Continuous singal control, such as volume, brightness, or motor speed.

A potentiometer is a manually adjustable, variable resistor with three terminals. Two terminals are connected to a resistive element, the third terminal is connected to an adjustable wiper. The position of the wiper determines the output voltage. The out voltage is captured and converted by AD on ESP32 on portB.

In M5Stack product system, Normally the Grove color indicates the type of communications.

  • Black: Single BUS (AD ,DA ,GPIO)
  • Red: I2C
  • Blue:Uart
  • White: Others(depends)

The Unit's Grove interface is black, indicating an analog interface that needs to be connected to the M5Core's GROVE B interface.

Product Features

  • Output voltage range: 0 ~ 2500mV
  • Program Platform: Arduino, UIFlow(Blockly, Python)
  • Two Lego-compatible holes

Kit includes

  • 1x ANGLE unit
  • 1x GROVE Cable
Learn

Example

1. Arduino IDE

The code below is incomplete. To get the complete code, please click here.

Example function: Display the digital value converted from the Unit output voltage (0 ~ 4095)

#include <M5Stack.h>
// select the input pin for the potentiometer
int sensorPin = 36;
// last variable to store the value coming from the sensor
int last_sensorValue = 0;
// current variable to store the value coming from the sensor
int cur_sensorValue = 0;

void setup() {
  M5.begin();
  pinMode(sensorPin, INPUT);
  M5.Lcd.setTextSize(2);
  M5.Lcd.setCursor(0, 0);
  M5.Lcd.print("the value of ANGLE: ");
}

void loop() {
  // read the value from the sensor:
  cur_sensorValue = analogRead(sensorPin);
  M5.Lcd.setCursor(0, 25);
  if(abs(cur_sensorValue - last_sensorValue) > 10){//debaunce
    M5.Lcd.fillRect(0, 25, 100, 25, BLACK);
    M5.Lcd.print(cur_sensorValue);
    last_sensorValue = cur_sensorValue;
  }
  delay(50);
}

2. UIFlow

If you want the complete code, please click here.

 

More information

Schematic

PinMap

M5Core(GROVE B) GPIO36 GPIO26 5V GND
ANGLE Unit Sensor Pin / 5V GND
Click to edit the product in Ali Orders.
Note: only show for shop owner