HS-KEY4A-P Four-position Analog Keypad Module

HS-KEY4A-P Four-position Analog Keypad Module

1. Introduction

A four-wire simulated independent push-button switch includes 4 four-leg push-buttons, which are protected by metal strips to protect the force condition; in the four-wire push-button switch, when a button is pressed, the circuit is conductive; when the pressure is released, the circuit is open.The force of pressure, is the action of using our hands to press buttons, turn on and off.Four push-button switches share a single analog output. The analog value output varies when different buttons are pressed, allowing for the determination of which button is pressed. The four analog switch modules contain 4 instantaneous press buttons, and the interface of this module simulates analog signals. The working principle of the simulated switch is to switch the output status of the signal according to the analog value of the input signal.The simulation switch usually has multiple input channels and one output channel, and it can select the channel to be connected to the output by controlling the input signal.We can control four buttons using an Arduino's analog port, which can greatly reduce the need for using IO interfaces.For Arduino beginners, creation is more convenient.

2. Schematic

4AP Keypad Module - HS-KEY4A-P SchematicClick to view

Module Parameters

Pin Name

description

G

GND (Negative Power Input)

V

VCC (Positive Power Input)

S

Digital Signal Pin

  • Power Supply Voltage: 3.3V / 5V

  • Connection method: PH2.0 terminal wire

  • Installation method: Fixed with four screws

4, Circuit Board Size

5 of Arduino IDE example program

Attention: If prompted with an error message about the library file during program upload, please import the library file first!
Arduino IDE Library Download and Import Tutorial:
Click to view

Example program (UNO development board):

volatile int led;
volatile int light;
volatile int vaule;

void setup(){
  Serial.begin(9600);
  led = 6;
  light = 0;
  vaule = 0;
  //ledๆŽฅD6๏ผŒๅ››ไฝๆจกๆ‹ŸๆŒ‰้”ฎๆจกๅ—ๆŽฅA0
  pinMode(A0, INPUT);
}

void loop(){
  vaule = analogRead(A0);
  Serial.println(vaule);
  analogWrite(led, light);
  if (vaule < 565 && vaule > 555) {
    //ๅ…ณ็ฏ
    light = 0;

  } else if (vaule < 640 && vaule > 630) {
    //ๅพฎไบฎ
    light = 15;
  } else if (vaule < 720 && vaule > 710) {
    //ไบฎ
    light = 100;
  } else if (vaule < 860 && vaule > 850) {
    //้žๅธธไบฎ
    light = 255;
  }

}โ€‹

6, ESP32 Python Example (for Mixly IDE/Misashi)

Choose the development board Python ESP32 [ESP32 Generic(4MB)] and upload in code mode

Attention: If prompted with an error message about the library file during program upload, please import the library file first!
Download and import tutorial for Mixly IDE ESP32 library:
Click to view

Example program (ESP32-Python):Pending update...

7, Mixly example program (graphical language)

Example program:Click to download
Attention: If prompted with an error message about the library file during program upload, please import the library file first!
Download and import tutorial of Mixly IDE Arduino library:Click to view

Example Program (ESP32 Development Board):Click to download
Attention: If prompted with an error message about the library file during program upload, please import the library file first!
Download and import tutorial for Mixly IDE ESP32 library:
Click to view

Image pending update...

8. Setting up the Test Environment

Arduino UNO Test Environment Setup

Prepare Components:

  • HELLO STEM UNO R3 DEVELOPMENT BOARD *1

  • HELLO STEM UNO R3 P EXPANSION BOARD *1

  • USB TYPE-C DATA CABLE *1

  • LED module (HS-F08P) *1

  • Four-position analog key module (HS-KEY4B-P) *1

  • PH2.0 3P terminal to DuPont wire *2 or PH2.0 3P dual-head terminal wire *2

Circuit wiring diagram:

ESP32 Test Environment Setup

Prepare Components:Pending update...

Circuit wiring diagram:Pending update...

9, Video tutorial

Video tutorial:Click to view

10, Test results

Arduino UNO test results:

ESP32 Test Results:

Pending update...