2 ms·
For low power communications I'd consider a 433 MHz module. Many places sell them. Here's one from Sparkfun [1]. To receive, you can buy corresponding modules
by tzs 5y ago
For low power communications I'd consider a 433 MHz module. Many places sell them. Here's one from Sparkfun [1].
To receive, you can buy corresponding modules but I wouldn't bother with that. Get an RTL-SDR dongle for whatever computer you want to process the data on (an RPi is great for this if you don't want to keep your desktop on all the time to do it), and use the program rtl_433.
The 433 MHz transmitter module simply sends a 433ish MHz continuous signal when its data input pin is high and does not send when the input pin is low. You encode your message into a series of pulses of the transmitter.
For example, for a project I'm doing using one of these transmitter modules I've currently got it on an Arduino for testing. Here's the Arduino code to send a message.
#define CYCLE 1000
#define W_0 600
#define W_1 400
#define INTRO_1 1500
#define INTRO_0 1500
void send_message(char * bp, int n)
{
digitalWrite(RADIO, HIGH);
delayMicroseconds(INTRO_1);
digitalWrite(RADIO, LOW);
delayMicroseconds(INTRO_0);
while (n-- > 0) {
int b = *bp++ & 0xff;
int m = 0x80;
while (m != 0) {
int w = (b & m) ? W_1 : W_0;
digitalWrite(RADIO, HIGH);
delayMicroseconds(w);
digitalWrite(RADIO, LOW);
delayMicroseconds(CYCLE-w);
m >>= 1;
}
}
}
That sends a message starting with a 1.5 ms pulse and a 1.5 ms gap, and then n bytes of data where a 1 is a 400 usec pulse followed by a 600 usec gap, and a 0 is a 600 usec pulse followed by a 400 usec gap, so 1000 bits per second after the 3 ms prefix. (The actual timing is a little longer, because of overhead).
My current test messages all start with "TZS", are 12 bytes long, and the last 2 bytes are a counter that simply increments every time I press a button. Adding this to an rtl_433 config file makes rtl_433 recognize those messages and print the count:
decoder {
name = TEST,
modulation = OOK_PWM,
short = 424,
long = 624,
reset = 1500,
sync = 1528,
bits = 96,
match = {24}0x849083,
get = count:@80:{16},
}
rtl_433 can then do a variety of things with the message, including saving to a file, sending to an MQTT server, sending to syslog, and sending to an Influx DB.
[1] https://www.sparkfun.com/products/10534 https://www.sparkfun.com/products/10534