Motion_sensor
The Motion sensor driver is compatible with most existing Motion and Presence sensor boards, that drive a pin low/high (or open collector) when presence is detected. It has been tested on the following sensors:
- IRTEC MS-360
- IRTEC MS-112LP
- IRTEC MS-320LP
- IRTEC MS-360LP
- Grove Seeedstudio PIR motion sensor module
- Grove Seeedstudio PIR sensor (blue)
- Sparkfun PIR motion sensor (JST)
Check the sensor specific documentation, as mentioned before all sensors from the above list should work, mind only changing the logic (pin low or high when presence is detected). The requirements to use any of the sensors are:
- Use 3.3V or 5V (in this case you need to power the sensor from the RE-Mote when connected over USB, or externally).
- Detection range mmay vary depending on the sensor, and its orientation.
The Contiki sensor library can be found at platform/zoul/dev/motion-sensor.c
, check out the most updated version in Contiki repository.
Depending on the pin logic (pin set high or low when presence), change the interrupt setting to GPIO_DETECT_RISING
if high when presence is detected, or GPIO_DETECT_FALLING
otherwise.
/* Configure interruption */
GPIO_SOFTWARE_CONTROL(MOTION_SENSOR_PORT_BASE, MOTION_SENSOR_PIN_MASK);
GPIO_SET_INPUT(MOTION_SENSOR_PORT_BASE, MOTION_SENSOR_PIN_MASK);
GPIO_DETECT_RISING(MOTION_SENSOR_PORT_BASE, MOTION_SENSOR_PIN_MASK);
GPIO_TRIGGER_SINGLE_EDGE(MOTION_SENSOR_PORT_BASE, MOTION_SENSOR_PIN_MASK);
ioc_set_over(MOTION_SENSOR_PORT, MOTION_SENSOR_PIN, IOC_OVERRIDE_DIS);
gpio_register_callback(motion_interrupt_handler, MOTION_SENSOR_PORT,
MOTION_SENSOR_PIN);
To test the Motion Sensor sensor follow the next steps
-
Grab Contiki and prepare the development setup (skip if you already have it)
-
Connect the sensor to the RE-Mote using the 3-pin cable as shown in the photo above. This is a 3-pin connector with 2.54 mm pitch spacing, if you are to connect using a different cable than the one provided, check out the RE-Mote pin-out and the connector information.
-
Compile the test example and program the RE-Mote:
cd examples/zolertia/zoul
make test-motion.upload && make login
- Get the Code
- Toolchain and tools
- Getting Started with Zolertia products
- Change to SubGHZ interface
- Program the Zolertia platforms
- Configure Eclipse (IDE)
- Firefly as a Sniffer
- Sensors