Decoding Analysis and Simulation of 315Mhz and 433Mhz Wireless Remote Control Signals
[Copy link]
This post was last edited by Jacktang on 2019-11-14 23:07
summary
Some time ago, while learning radio, I learned that Arduino was a good choice for me after Raspberry Pi as a technical geek with immature skills. So I spent 200 yuan to buy 3 Arduino development boards (2*nano&1*uno) and other sensors, and at the same time saw the 315M super regeneration module. Because those who play radio know that 315M is the most commonly used signal frequency for car remote controls, anti-theft gates, road and bridge systems, etc., so I placed an order without hesitation. Then there are today's results. Freebuf also has many such articles. I have mastered many methods for decoding 315 and 433 (in fact, using SDR is a good choice). I have also studied and cracked the rolling code. This article has detailed steps and clear ideas. I hope it will be useful to everyone. Those who are familiar with Arduino and 315 modules can go directly to the third step.
Keywords: 315M super regenerative module, arduino.
Introduction: 315MHz remote control is widely used. By learning and understanding its principle and practical operation, you can learn to prevent your car from being stolen while having unlimited fun, and you can develop a safer remote lock device yourself. In the process of doing this project, I deeply realized that the insecurity of the 315M remote control system is a serious problem, which is mainly manifested in the simple decoding, simple transmission conditions and easy copying of the 315 remote control system. The following is some of the superficial knowledge I got in this study and research, which is described in detail here.
The following is the principle framework of this study:
Block diagram description: The receiving end receives the signal, which is decoded by the Arduino microcontroller and sent to the mobile phone via Bluetooth. The decoded information is displayed on the mobile phone's Bluetooth serial port monitor (decoding process); the mobile phone sends a 24-bit remote control code to the microcontroller, and the microcontroller sends the 24-bit remote control code through the transmitter. The remote control analog receiving end is decoded by the receiving end PT2272 chip and then fed back to the LED signal light. The analog receiving end is directly powered by the microcontroller, and the signal sent by the transmitter can also be directly received by other remote control receiving ends to achieve other purposes.
1. Introduction to basic knowledge:
1. Arduino Introduction:
Arduino is a convenient, flexible and easy-to-use open source electronic prototyping platform, including hardware (various types of Arduino boards) and software (Arduino IDE). It was first developed by a European development team in the winter of 2005. Its members include Massimo Banzi, David Cuartielles, Tom Igoe, Gianluca Martino, David Mellis and Nicholas Zambetti.
It is built on the open source simple I/O interface board and has a Processing/Wiring development environment that uses languages like Java and C. It consists of two main parts: the hardware part is the Arduino circuit board that can be used to make circuit connections; the other is the Arduino IDE, the program development environment in your computer. You just need to write program code in the IDE, upload the program to the Arduino circuit board, and the program will tell the Arduino circuit board what to do.
Arduino can sense the environment through various sensors, and can feedback and influence the environment by controlling lights, motors and other devices. The microcontroller on the board can be programmed using the Arduino programming language, compiled into a binary file, and burned into the microcontroller. Arduino programming is achieved using the Arduino programming language (based on Wiring) and the Arduino development environment (based on Processing). Arduino-based projects can include only Arduino, or Arduino and other software running on a PC, which communicate with each other (such as Flash, Processing, MaxMSP). (From Baidu Encyclopedia)
2. Hardware Introduction:
1. Arduino development board
Arduino is the most popular single-chip microcomputer development board in the open source hardware industry, technology geeks, and students. Its programming language uses C language, and it is not as complicated as the programming language of C51 single-chip microcomputer, so it is undoubtedly the best choice for single-chip microcomputer beginners. In order to simplify the experimental process and shorten the development time, this topic chooses the simple but powerful Arduino single-chip microcomputer development board. There are many hardware platforms for Arduino development boards. The common Arduinos are as follows:
(1) Arduino UNO (Arduino board used in this article) (2) Arduino NANO
2. As shown in the figure, the 315M module is divided into the transmitting end (right) and the receiving end (left).
3. Remote controller and receiver for simulation
Transmitter module PT2262
Receiver module PT2272
4. Serial port Bluetooth module
The serial port Bluetooth module directly uses the Bluetooth device to connect and transmits the received ASCII code to the microcontroller in the form of serial port data. The microcontroller processes the data and makes fixed feedback. The default name of the HC-06 Bluetooth serial port module is "HC-06", and the default connection password is "0000". The mobile phone can directly connect and communicate with the mobile phone using APP such as Bluetooth debugging assistant. The Arduino microcontroller can directly communicate with the computer through the serial port, but in order to demonstrate the operation at any time, it is more convenient to use the mobile phone for direct communication. The actual picture of HC-06 is as follows:
3. Decoding and Simulation
1. Connection diagram:
Description of the physical picture: In the upper left corner is the Bluetooth module HC-06 for mobile phone connection control, on the left is the 315 receiving decoder board and the remote control, the decoder board is powered by Arduino, and 5 LED signal lights are connected for reception demonstration, in the middle are the transmitter and receiver of the 315M super regenerative module, and on the right is the Arduino UNO development board.
2. Schematic diagram of the connection between the transmitter and receiver of the 315M super regenerative module
3. Description of simulation test results:
The serial port sends A, B, C, D to control the sending of a single 24-bit remote control binary code to achieve the flashing of LED numbers A, B, C, D;
The serial port sends a, b, c, d to control the continuous sending of 24-bit remote control binary code to make LED numbers A, B, C, D always on.
Send any command except the above through the serial port to turn off the LED.
4. Decoding Verification and Source Code
1. Decoding verification
When you press the A button on the remote control
●The remote control code obtained by the mobile phone serial port monitor is
"010101010101010100001100"
●The remote control code displayed by the professional decoder is as shown below. It is actually a 24-bit code (I initially thought that the last bit was a redundant bit caused by the decoder design problem, and it can be replayed without the last bit, but later in my study, I found that many decoding methods retain the last bit. The actual signal waveform does not have a high level of the last bit, so the 25th bit should be "0". I still have doubts about this issue, and I hope you can help explain it)
●Logic analyzer analysis results
Based on the comparison of the above three sets of data, it is verified that there is no problem with the microcontroller decoding.
2. The Arduino source code is as follows:
/*The examples used in this work include the RCSwitch library file for signal decoding and encoding transmission*/
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
void setup() {
Serial.begin(9600);
//Serial print command help information
Serial.print("HELP:A-flash the lamp A\n B-flash the lamp B\n C-flash the lamp C\n D-flash the lamp D\n");
Serial.print(" a-open the lamp A\n b-open the lamp B\n c-open the lamp C\n d-open the lamp D\n\n");
mySwitch.enableReceive(1);
mySwitch.enableTransmit(10);}2
void loop()
{
if (mySwitch.available())
{
output(mySwitch.getReceivedValue(),mySwitch.getReceivedBitlength(), mySwitch.getReceivedDelay(),mySwitch.getReceivedRawdata(),mySwitch.getReceivedProtocol());
mySwitch.resetAvailable();
}
/* Same switch as above, but using binary code */
if(Serial.available()>0) //If there is data coming in from the serial port
{ delay(10); //Delay 50, multiple commands can be sent at one time
char M=Serial.read(); //Read one character at a time, which is ASCII code
if(M=='A')
{
Serial.print("Thecommand is A\n");
mySwitch.send("010101010101010100001100"); //Remote control - A
Serial.print(" OK!!! The LED A has been DONE\n");
}
if(M=='a')
{
Serial.print("The command is a\n");
Serial.print(" OK!!! TheLED A has hlod ON\n");
while(Serial.available()<=0)
{
mySwitch.send("010101010101010100001100"); //Remote control - press and hold A
}
}
if(M=='B')
{
Serial.print("Thecommand is B\n");
mySwitch.send("010101010101010111000000"); //Remote control - B
Serial.print(" OK!!! The LED B has been DONE\n");
}
if(M=='b')
{
Serial.print("The command is b\n");
Serial.print(" OK!!! The LED B has hlod ON\n");
while(Serial.available()<=0)
{
mySwitch.send("010101010101010111000000"); //Remote control - Press and hold B
}
}
if(M=='C')
{
Serial.print("Thecommand is C\n");
mySwitch.send("010101010101010100000011"); //Remote control - C
Serial.print(" OK!!! The LED C has been DONE\n");
}
if(M=='c')
{
Serial.print("The command is c\n");
Serial.print(" OK!!! TheLED C has hlod ON\n");
while(Serial.available()<=0)
{
mySwitch.send("010101010101010100000011"); //Remote control - press and hold C
}
}
if(M=='D')
{
Serial.print("Thecommand is D\n");
mySwitch.send("010101010101010100110000"); //Remote control - D
Serial.print(" OK!!! The LED D has been DONE\n");
}
if(M=='d')
{
Serial.print("The command is d\n");
Serial.print(" OK!!! TheLED D has hlod ON\n");
while(Serial.available()<=0)
{
mySwitch.send("010101010101010100110000"); //Remote control - press and hold D
}
}
}
}
In the whole process, a car remote control code decoder is used for the convenience of research, so as to verify the correctness of the decoding in this experiment.
References:
[1] Steven F. Barrett. The Authoritative Guide to Advanced Arduino Development. 2, Machinery Industry Press: Pan Xinlei, 2014
[2] Online information
|