• Enter email to sit in the first row

BBMagic MOTION Bluetooth Smart PIR sensor

BBMagic MOTION is ultra low power PIR sensor with Bluetooth Low Energy (BLE) – Bluetooth Smart. It can be powered from little coin battery only.
Passive Infra Red (PIR) technology allows detecting radiation from all objects with temperature above absolute zero.

BBMagic MOTION range

BBMagic MOTION functions

  • PIR motion detection ; angle: 120 degree ; range: 4-5m
  • Light level measurement – pads for 10k photoresistor – values range: 0 to 255
  • Two ADC 0 to 1,8V channels with 1mV resolution
  • Battery monitoring by continuous supply voltage measurement
  • Motion detection LED indication – pin 2 configurable
  • Communication: encrypted and digital signed Bluetooth Smart messages

How to do objects detection using BBMagic MOTION

Raspberry Pi zero W and Raspberry Pi 3 can receive data from BBMagic modules using bbmagic_lib library. You can get it from Download section.
Its very easy:

Make some helpful variables and buffer for data
unsigned char bbm_buf[100] ;
int len, ret ;

Open communication
ret = bbm_bt_open(0) ;
if(ret) exit(1) ;

Check if data has been received
len = bbm_bt_read(bbm_buf) ;
If so start processing
if(len > 0)
printf(" OBJECT DETECTED !!") ;

Library header file (bbmagic_lib.h) defines types of data sending by BBMagic MOTION

bbm_buf[BBMAGIC_DEVICE_TYPE] module type ; here is BBMAGIC_M_MOTION
bbm_buf[BBM_MOTION_FLAGS] most significant bit is motion detection flag – BBM_MOTION_ALERT_MASK
bbm_buf[BBM_MOTION_V_SUP] supply voltage ; divide this value by 71 (BBMAGIC_VCC_DIVIDER) to have power supply voltage in volts
bbm_buf[BBM_MOTION_CHIP_TEMP] BBMagic chip temperature in Celsius (U2 encoded) – After callibration this value can be interpreted as low accuracy ambient temperature
bbm_buf[BBM_MOTION_LIGHT] light level ; from 0 to 255
bbm_buf[BBM_MOTION_ADC_1_MSB] bbm_buf[BBM_MOTION_ADC_1_LSB] voltage level on ADC_1 input in mV
bbm_buf[BBM_MOTION_ADC_2_MSB] bbm_buf[BBM_MOTION_ADC_2_LSB] voltage level on ADC_2 input in mV
bbm_buf[BBM_MOTION_WORKTIME_0] amount of time from module power up – in seconds ; byte 0 – LSB
bbm_buf[BBM_MOTION_WORKTIME_1] amount of time from module power up – in seconds ; byte 1
bbm_buf[BBM_MOTION_WORKTIME_2] amount of time from module power up – in seconds ; byte 2
bbm_buf[BBM_MOTION_WORKTIME_3] amount of time from module power up – in seconds ; byte 3 – MSB
bbm_buf[BBM_MOTION_FIRM_0] module firmware version LSB
bbm_buf[BBM_MOTION_FIRM_1] module firmware version MSB
bbm_buf[BBMAGIC_DEVICE_ADDR_0] module address byte 0 – LSB
bbm_buf[BBMAGIC_DEVICE_ADDR_1] module address byte 1
bbm_buf[BBMAGIC_DEVICE_ADDR_2] module address byte 2
bbm_buf[BBMAGIC_DEVICE_ADDR_3] module address byte 3
bbm_buf[BBMAGIC_DEVICE_ADDR_4] module address byte 4
bbm_buf[BBMAGIC_DEVICE_ADDR_5] module address byte 5 – MSB
bbm_buf[BBMAGIC_DEVICE_RSSI] radio signal strength indicator in dBm
Get source code of bbm_scanner application from Download section and learn how to receive and process data from all BBMagic modules !!

bbm_scanner app


BBMagic MOTION pinout

Pin number Description
1,8,20,22,23,24 GND – power and signal ground
2 Configuration of object detection indication:

  • to GND: Red onboard LED indicates object detection by short flash
  • unconnected: Red onboard LED is off. Object detection indication pulses are generated on pin 6. It is possible to connect alternative LED with series resistor to pins 5 and 6. Default resistor value should be about 4k7

Consider that switching LED indication on causes more power need.

5-6 Pads for alternative LED with series resistor. Pad 6 – LED anode with resistor, Pad 5 – LED cathode
7,21 Supply voltage 2,7V – 3,3V
21,22 Pads for CR2032 battery holder: 21 (+) i 22 (-)
7,8,9 Pads for voltage regulator if you decide to power BBMagic MOTION this way. Its identical like BBMagic METEO described here: Power it easy: BBMagic METEO Bluetooth Low Energy module
10 Supply voltage input for voltage regulator. Its identical like BBMagic METEO described here: Power it easy: BBMagic METEO Bluetooth Low Energy module
11,12 10k photoresistor pads
13,14 Inputs of analog to digital converter ADC_1 and ADC_2. Available voltage range: 0V-1,8V ; Resolution: 1mV
18,19 Tx and Rx UART lines. Available voltage range: 0V-5V

How does BBMagic MOTION work?

When object appears in its field of view BBMagic MOTION sends message immediately via Bluetooth Low Energy radio link.
Then there is no object detection through 10 seconds after which detection starts again.

Wireless communication

  • Bluetooth Low Energy also called as Bluetooth Smart
  • Transferring data is encrypted and signed with AES-128
  • You can collect and process data with Raspberry Pi, Arduino, etc.
  • Direct communication with Raspberry Pi Zero W and Raspberry Pi 3 (both have Bluetooth Low Energy onboard chip)
  • Library for easy programming


  • 3V CR2032 battery – onboard pads for battery holder: 21 (+) and 22 (-)
  • 2 x 1,5V AA or AAA batteries – onboard pins for wires soldering: 7 (+) and 8 (-)
  • any source you want within 2,7V to 3,3V – connect to pins 7 (+) and 8 (-)
  • with voltage regulator – connect ‘+’ to 10, and ‘-‘ to 22, 23 or 24. Onboard pads 7,8,9 for TO-92 voltage regulator (ex. L78L33, TS2950CT-3.3, LP2950CZ-3.3RAG, MCP1702-3302E, LM2936Z-3.3, LT1121CZ-3.3). Learn more about voltage reg here: Power it easy: BBMagic METEO Bluetooth Low Energy module
Tagged , , , . Bookmark the permalink.

Comments are closed.