The reference to 37 sensors and actuators has been widely circulated on the Internet. In fact, there must be more than 37 sensor modules compatible with Arduino. In view of the fact that I have accumulated some sensor and actuator modules on hand, according to the concept of practice to get true knowledge (must be done), for the purpose of learning and communication, I am going to try a series of experiments one by one, regardless of success (the program goes through) or not, They will be recorded - small progress or unsolvable problems, hoping to inspire others.
[Arduino] 168 kinds of sensor module series experiments (data code + simulation programming + graphic programming)
Experiment 155: 2262/2272 four-way wireless remote control kit M4 non-locking receiving board four-button wireless remote control transmitting module
1. List of hardware required for four-digit wireless remote control and receiving module experiments
Arduino Uno development board X1
0.96 inch OLED display X1
Several DuPont lines (9 lines are prepared)
Four wireless remote control and receiving module X1
High level trigger active buzzer module X1
IIC/I2C 1602 LCD LCD module X1
LED light emitting diode (green, blue) X2
High level trigger single 5V relay module X1
Four high-level trigger 5V relay module X1
Proto Shield prototype expansion board (with mini breadboard) X1
2. Software platforms required for sensor module experiments
Code programming Arduino IDE (version 1.8.19),
simulation programming Linkboy (version V4.6.3),
graphics programming Mind+ (version V1.7.0 RC2.0)
and learning by playing (online platform https ://ide.codepku.com/?type=Arduino)
3. Experimental wiring diagram
Several experiments of four-bit wireless remote controller and receiving module
1. Program 1: Print four remote control key values through the serial port
(1) Arduino reference open source code
/*
【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验一百五十五:2262/2272四路无线遥控套件 M4非锁接收板 四键无线遥控器发射模块
程序一:串口打印四个遥控键值
*/
//定义M4非锁接收板的5个引脚
int D0 = 3;
int D1 = 4;
int D2 = 5;
int D3 = 6;
int VT = 7;
void setup() {
Serial.begin(9600);//初始化串口
Serial.println("四位无线遥控器及接收模块准备就绪");
pinMode(VT, INPUT);//设置5个引脚均为输入
pinMode(D0, INPUT);
pinMode(D1, INPUT);
pinMode(D2, INPUT);
pinMode(D3, INPUT);
}
void loop() {
if (digitalRead(VT)) {
//读取引脚状态
Serial.print("有效传输 ");//串口打印
if (digitalRead(D2)) {
Serial.print(" ");
Serial.println("按下了一个A键");
}
if (digitalRead(D0)) {
Serial.print(" ");
Serial.println("按下了一个B键");
}
if (digitalRead(D3)) {
Serial.print(" ");
Serial.println("按下了一个C键");
}
if (digitalRead(D1)) {
Serial.print(" ");
Serial.println("按下了一个D键");
}
}
delay(200); //延时200毫秒
}
(2) The return status of the experimental serial port
(3) Experimental scene diagram
Procedure 2: Press and release the wireless remote control
(1) Experimental open source simulation programming (Linkboy V4.63)
(2) Experimental scene diagram
Procedure 3: Remotely control RGB and green LED lights in four colors
(1) Arduino reference open source code
/*
【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验一百五十五:2262/2272四路无线遥控套件 M4非锁接收板 四键无线遥控器发射模块
程序三:遥控控制RGB及绿色四种颜色的LED灯
*/
//定义PT2272接收模块的管脚
int D0, D2, D3, D1, VT; //变量 D1 D2 D3 D4 VT 用于获取从数字 PIN 读取的值
void setup() {
pinMode(2, INPUT); // 设置数字 PIN 2 3 4 5 6 作为输入
pinMode(3, INPUT);
pinMode(4, INPUT);
pinMode(5, INPUT);
pinMode(6, INPUT);
pinMode(7, OUTPUT); // 设置数字 PIN 7 8 9 10 13 作为输出
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(13, OUTPUT);
}
void loop() {
VT = digitalRead(2); // 读取数字 PIN 2 3 4 5 6 并将其存储在变量 VT D1 D2 D3 D4
D1 = digitalRead(3);
D2 = digitalRead(4);
D3 = digitalRead(5);
D0 = digitalRead(6);
if (VT == HIGH) {
//如果 VT 为 5V 或 HIGH,让 Digital PIN 13 为 5V(HIGH)
digitalWrite(13, HIGH);
} else {
//如果 VT 不等于 5V(HIGH) 让 Digital PIN 13 为 0V(LOW)
digitalWrite(13, LOW);
}
if (D1 == HIGH) {
digitalWrite(7, HIGH);
} else {
digitalWrite(7, LOW);
}
if (D2 == HIGH) {
digitalWrite(8, HIGH);
} else {
digitalWrite(8, LOW);
}
if (D3 == HIGH) {
digitalWrite(9, HIGH);
} else {
digitalWrite(9, LOW);
}
if (D0 == HIGH) {
digitalWrite(10, HIGH);
} else {
digitalWrite(10, LOW);
}
}
(2) Experimental scene diagram
Procedure 4: Wireless remote control headlight automatic timing on and off (controlled by relay)
(1) Experimental open source simulation programming (Linkboy V4.63)
(2) Experimental scene diagram
Program 5: Use relays to control 220V household lights (four relays)
(1) Schematic diagram of experimental wiring
(2) Arduino reference open source code
/*
【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验一百五十五:2262/2272四路无线遥控套件 M4非锁接收板 四键无线遥控器发射模块
程序五:使用继电器控制220V家用电灯(四位继电器)
*/
//定义输入引脚
#define in1 3
#define in2 4
#define in3 5
#define in4 6
//定义继电器引脚
#define relay1 8
#define relay2 9
#define relay3 10
#define relay4 11
void setup() {
Serial.begin(9600);
pinMode(relay1, OUTPUT);//设置连接继电器引脚为输出
pinMode(relay2, OUTPUT);
pinMode(relay3, OUTPUT);
pinMode(relay4, OUTPUT);
digitalWrite(relay1,LOW);//下拉继电器引脚为为低电平
digitalWrite(relay2,LOW);
digitalWrite(relay3,LOW);
digitalWrite(relay4,LOW);
}
void loop() {
if (digitalRead(in1) == HIGH) {
while (digitalRead(in1) == HIGH) {
delay(10);
}
Serial.println("1");
digitalWrite(relay1,!digitalRead(relay1));
}
else if (digitalRead(in2) == HIGH) {
while (digitalRead(in2) == HIGH) {
delay(10);
}
Serial.println("21");
digitalWrite(relay2,!digitalRead(relay2));
}
else if (digitalRead(in3) == HIGH) {
while (digitalRead(in3) == HIGH) {
delay(10);
}
Serial.println("3");
digitalWrite(relay3,!digitalRead(relay3));
}
else if (digitalRead(in4) == HIGH) {
while (digitalRead(in4) == HIGH) {
delay(10);
}
Serial.println("4");
digitalWrite(relay4,!digitalRead(relay4));
}
}
(3) The return status of the experimental serial port
(4) Experimental scene diagram
PT2262 is a remote control encoder paired with PT2272 using CMOS technology. It encodes data and translates address pins into a suitable serially encoded waveform for RF or IR modulation. The PT2262 has up to 12 tri-state address pin bits to provide up to 531,441 (or 312) address codes; thereby, greatly reducing any code conflicts and the possibility of unauthorized code scanning. The internal functional block diagram is as follows.
Related technical information
https://datasheet.lcsc.com/szlcsc/PT2262_C16390.pdf
PT2272 is a remote control decoder paired with PT2262 using CMOS technology. It has 12-bit tri-state address pins providing up to 531,441 (or 312) address codes; thereby greatly reducing any code conflicts and the possibility of unauthorized code scanning. The PT2272 has a variety of options to suit each application need: variable number of data output pins, latch or momentary output types. The internal functional block diagram is as follows.
Related technical information
http://www.princeton.com.tw/Portals/0/Product/PT2272.pdf