Wireless Motion Sensor

motion-sensor-spectrum.JPG
Wireless stuff is fun! If you look at the picture above, the thing to the right, clamped to a vice, is a motion sensor (PIR sensor) that has a small addition on it's back. That addition is a small PCB that I designed, milled and soldered recently, with an ATmega microcontroller and a cheap radio-module on it. The thing to the left is a spectrum analyzer showing that the device is indeed sending radio signals. In the background you can also see a radio-controlled RGB light controller, but that's a story for a later time.

motion-sensor-back-detail.JPG
On the back of this interesting piece of electronics, you can see the microcontroller (ATmega88), the 8MHz crystal, a button, two LEDs and the programming and power headers. You can also see the elaborately soldered voltage regulator. I didn't have the a voltage regulator in the footprint I had designed the board for ( I thought I ordered them in the last Mouser order...), so I had to improvise. The circuit board itself was made at my University with the LPKF S63 circuit mill that we have there.

motion-sensor-inside.JPG

The radio module is soldered on the PCB on the side that sits behind the motion sensor. Other than a couple of pullup resistors and bypass caps, the only other things on this side of the board are the pin headers that connect to the motion sensor.

The radio module is a model I've used before a couple of times. It's model name is RFM12B and the version installed here operates in the 868MHz ISM band. The interface between the microcontroller and the radio module is SPI and I'm using a library made by some kind people in Germany.

motion-sensor-receiver.JPG

Like I said, I've used the same radio modules before. For example, I've used them when designing and making the board pictured above. It has a similiar radio module and an usb-capable atmega32u4 microcontroller on the bottom. It works as the receiver in my simple test.

Whenever the motion sensor detects motion, a message is sent over the radio. The receiver gets the message and relays it over a virtual serial connection over USB to a computer, where it is displayed. A similiar message is sent when the motion ceases.

motion-sensor-display.JPG

And here is the output on my laptop, after some testing, "Movement" indicating the detection of movement, and "gone" indicating the lack of movement. It seems to work, excellent.

But what's the point of all of this? Frankly, I'm not really sure yet. Some sort of home automation, probably. For example, remember that RGB light controller I casually mentioned in the beginning of this post? That light controller board uses the same radio modules...