433Mhz Super-regenerative module (FS1000A,MX-JS-05V) [S081]
https://www.youtube.com/watch?v=_h1i9cnf-ic
* Specs
Emission head (2SC3357 transistor):
The actual working distance 50-100m
Operating voltage 3-12V
Operating current :10-15mA
Ways of working: AM
Transfer rate: 4KB / S
Transmit power: 10mW
External antenna: 28cm ordinary multi-core or single core line
Pinout from left ? right: (DATA, VCC, GND)
Size: 1.9CM * 1.9CM * 0.9CM
Receiver Module Technical Data:
Model: MX-05V
Working voltage: DC5V
Quiescent Current: 4MA
Receiving frequency: 433.92MHZ
Receiver sensitivity:-105DB
Size: 30 * 14 * 7mm
External antenna: 32CM single wire, wound into a spiral
* Contents
- Connect
Emission
ATA0 ----- D4
VCC ----- 5V
GND ----- GND
Receiver
VCC ----- 5V
DATA ----- D2 (data)
X
GD ----- GND
LED ----- D2
- Data Format Define
: 1=1, 1=2
- Key Code
FS1000A
#include <Wire.h>
#include <VirtualWire.h>
#include <Bounce2.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
int buttonPin = 2;
int sendPin = 4;
boolean oneTimeFlag = false;
Bounce bouncer = Bounce();
void setup() {
lcd.init(); // initialize the lcd
lcd.backlight();
lcd.print("S081-FS1000A Snd");
pinMode(buttonPin, INPUT);
digitalWrite(buttonPin, HIGH);
bouncer.attach( buttonPin );
bouncer.interval(5);
vw_setup(2000);
vw_set_tx_pin(sendPin);
Serial.begin(9600);
}
void loop() {
if ( bouncer.update() && bouncer.read() == LOW) {
if( oneTimeFlag == false) {
lcd.setCursor(0, 1);
lcd.print("ON = Send(1) ");
Serial.println("on");
sendMessage("1=1");
oneTimeFlag = true;
} else {
lcd.setCursor(0, 1);
lcd.print("OFF = Send(2)");
Serial.println("off");
sendMessage("1=2");
oneTimeFlag = false;
}
}
}
void sendMessage(char *data) {
if (strlen(data) > 0) {
int msgSize = (strlen(data) + 1);
char packetData[msgSize];
vw_send((uint8_t *)data, msgSize);
vw_wait_tx();
}
}
MX-JS-05V
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <VirtualWire.h>
#include <string.h>
LiquidCrystal_I2C lcd(0x27,20,4); // LCD2004
byte message[VW_MAX_MESSAGE_LEN];
byte messageLength = VW_MAX_MESSAGE_LEN;
int rcvPin = 2;
int ledPin = 8; // LED
void setup()
{
lcd.init(); // initialize the lcd
lcd.backlight();
lcd.print("start LCD2004");
delay(1000);
lcd.clear();
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
vw_setup(2000);
vw_set_rx_pin(rcvPin);
vw_rx_start();
}
void loop()
{
lcd.setCursor(0,0);
lcd.print("S081:MX-JS-05V Rev");
if (vw_get_message(message, &messageLength)) {
int command = processResponse((char*)message, 1);
if (command) {
switch (command) {
case 1:
lcd.setCursor(0,2);
lcd.print("Receive Value= 1 ");
digitalWrite(ledPin, HIGH);
break;
case 2:
lcd.setCursor(0,2);
lcd.print("Receive Value= 2 ");
digitalWrite(ledPin, LOW);
break;
}
}
}
}
int processResponse(char* message, int pinCode) {
char *p = message;
char *buf;
int o = 0;
int pin;
int command;
lcd.setCursor(0,1);
lcd.print("RF msg:"+String(message));
while ((buf = strtok_r(p, "=", &p)) != NULL) {
if (o == 0) {
pin = atoi(buf);
} else {
command = atoi(buf);
}
o++;
}
if (pinCode == pin && command > 0) {
return command;
} else {
return 0;
}
}
'2) Sensor > RF' 카테고리의 다른 글
NRF24L01 2.4Ghz Wireless Module (NRF24L01) [S275] (0) | 2018.01.16 |
---|---|
3DR Radio 915Mhz Telemetry Kit [S211] (0) | 2016.09.17 |
315Mhz 4Channel Remote Control Kit (PT2262/PT2272) [S054] (1) | 2016.09.17 |