Working on a doorbell receiver in C
I want to receive an email whenever someone rings the doorbell. To do this, I’m using an RTL-SDR USB dongle from Nooelec hooked up a to Pi.
My doorbell sends a signal 3 times in pulse width modulation on every press. The signal doesn’t change and it’s unique. Good start!
Carrier signal:
Steps
- Balance the signal by removing the DC bias. Use averaging.
Abs()
all values in the signal. I want everything on one side of the X-axis for later on.- Smooth out the amplitude ripples. Use even more averaging for this.
Demodulated:
Output using a test file:
The C program is straightforward. Each pulse/gap has a duration. Just keep track of the current duration of the pulse/gap and progress or reset if the duration is wrong. To do this I iterate through the below array where each element is the next bit of the doorbell signal.
ook_modulation protocol[] = {
short_pulse,
sync_gap,
long_pulse,
long_gap,
short_pulse,
long_gap,
short_pulse,
short_gap,
long_pulse,
short_gap,
long_pulse,
short_gap,
long_pulse,
short_gap,
long_pulse,
short_gap,
long_pulse,
long_gap,
...
}