โมดูลไร้สายย่านความถี่ 433Mhz มีทั้งตัวรับและส่ง ราคาถูก เป็นโมดูล RF Module ย่านความถี่ 433 MHz เป็นชุด ที่มีโมดูล transmitter module และโมดูล receiver module ทำงานแบบ One Way มีระยะการทำงานอยู่ประมาณ 40 เมตร (In Door) และ ประมาณ 100 เมตร (Out Door)
การ Wiring
หลักการต่อวงจรตามรูปเลย
วิธีต่อทดสอบของทางร้านทางร้านใช้ arduino uno r3 กับ arduino pro mini ในการทดสอบโมดูล RF433 Mhz
moduleฝั่งส่ง จะถูกต่อกับบอร์ด arduino uno r3
ATAD ต่อ PIN10
GND ต่อ GND
VCC ต่อ VCC
moduleฝั่งรับ จะถูกต่อกับบอร์ด arduino pro mini
DATA ต่อ PIN2
GND ต่อ GND
VCC ต่อ VCC
โปรแกรมฝั่งส่ง
/*
Example for different sending methods
http://code.google.com/p/rc-switch/
*/
#include
RCSwitch mySwitch = RCSwitch();
void setup() {
Serial.begin(9600);
// Transmitter is connected to Arduino Pin #10
mySwitch.enableTransmit(10);
// Optional set pulse length.
// mySwitch.setPulseLength(320);
// Optional set protocol (default is 1, will work for most outlets)
// mySwitch.setProtocol(2);
// Optional set number of transmission repetitions.
// mySwitch.setRepeatTransmit(15);
}
void loop() {
/* Same switch as above, but using decimal code */
mySwitch.send(5393, 24);
delay(1000);
mySwitch.send(5396, 24);
delay(1000);
}
โปรแกรมฝั่งรับ
/*
Simple example for receiving
http://code.google.com/p/rc-switch/
*/
#include
RCSwitch mySwitch = RCSwitch();
void setup() {
Serial.begin(9600);
mySwitch.enableReceive(0); // Receiver on inerrupt 0 => that is pin #2
}
void loop() {
if (mySwitch.available()) {
int value = mySwitch.getReceivedValue();
if (value == 0) {
Serial.print("Unknown encoding");
} else {
Serial.print("Received ");
Serial.print( mySwitch.getReceivedValue() );
Serial.print(" / ");
Serial.print( mySwitch.getReceivedBitlength() );
Serial.print("bit ");
Serial.print("Protocol: ");
Serial.println( mySwitch.getReceivedProtocol() );
}
mySwitch.resetAvailable();
}
}
ผลการทำงาน
วีดีโอการใช้งาน
ขอบคุณครับ ที่แวะมาอุดหนุนทางร้าน