• Enter email to sit in the first row

BBMagic MAGNETO where wires dont go


BBMagic MAGNETO
BBMagic MAGNETO is a wireless, ultra low power, BBMagic module with Bluetooth Low Energy (BLE) communication.
If near magnetic field appears or disappears BBMagic MAGNETO detects the change with dry reed switch and sends an information about it. Additionally the madule can measure light level and two analog signals and even read four digital pin state.
BBMagic MAGNETO reed swtiches

How to receive data from BBMagic MAGNETO?

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.

Learn how to write application for BBMagic MAGNETO
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)
if(bbm_buf[BBMAGIC_DEVICE_TYPE] == BBMAGIC_M_MAGNETO)
{
if(bbm_buf[BBM_MAGNETO_FLAGS] & BBM_MAGNETO_MAGNET_MASK)
printf("DOORS ARE CLOSED") ;
else printf("DOORS ARE OPEN") ;
}

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

bbm_buf[BBMAGIC_DEVICE_TYPE] module type ; BBMAGIC_M_MAGNETO in this particular case
bbm_buf[BBM_MAGNETO_FLAGS] flags: magnetic field detection BBM_MAGNETO_MAGNET_MASK (most significant bit) ; digital inputs (IN_0 to IN_3) state – four lower bits
bbm_buf[BBM_MAGNETO_V_SUP] supply voltage ; divide this value by 71 (BBMAGIC_VCC_DIVIDER) to have power supply voltage in volts
bbm_buf[BBM_MAGNETO_ADV_TIME] next message from BBMagic MAGNETO will arrive after this period of time ; multiply it by two to get time in seconds
bbm_buf[BBM_MAGNETO_CHIP_TEMP] BBMagic chip temperature in Celsius (U2 encoded) – can be interpreted as ambient temperature with low 3*C accuracy
bbm_buf[BBM_MAGNETO_LIGHT] light level ; from 0 to 255
bbm_buf[BBM_MAGNETO_ADC_1_MSB] bbm_buf[BBM_MAGNETO_ADC_1_LSB] voltage level on ADC_1 input in mV
bbm_buf[BBM_MAGNETO_ADC_2_MSB] bbm_buf[BBM_MAGNETO_ADC_2_LSB] voltage level on ADC_2 input in mV
bbm_buf[BBM_MAGNETO_WORKTIME_0] amount of time from module power up – in seconds ; byte 0 – LSB
bbm_buf[BBM_MAGNETO_WORKTIME_1] amount of time from module power up – in seconds ; byte 1
bbm_buf[BBM_MAGNETO_WORKTIME_2] amount of time from module power up – in seconds ; byte 2
bbm_buf[BBM_MAGNETO_WORKTIME_3] amount of time from module power up – in seconds ; byte 3 – MSB
bbm_buf[BBM_MAGNETO_FIRM_0] module firmware version LSB
bbm_buf[BBM_MAGNETO_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

Pinout

BBMagic MAGNETO pinout

Pin number Description
1,8,20,22,23,24 GND – power and signal ground
2 Connect to GND to turn on Bluetooth transmission LED indication
3-6 GND active digital inputs sampling every time Bluetooth transmission starts
7,21 Supply voltage 1,8V – 3,6V
21,22 Pads for CR2032 battery holder: 21 (+) i 22 (-)
7,8,9 Pads for voltage regulator if you decide to power BBMagic MAGNETO 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
24,25 Reed switch pads – first option
23,25 Reed switch pads – second option

How BBMagic MAGNETO works?

Every time magnetic field appears or disappears near the BBMagic reed switch it sends information through Bluetooth Smart radio link.
If there is no magnetic field change BBMagic MAGNETO sends ‘ALIVE’ message. ‘ALIVE’ messages sending period can be configured at module startup – read below how can you do that.

BBMagic MAGNETO modes of operation

Mode ‘ALIVE’ message period
1 30 seconds
2 60 seconds
3 3 minutes
4 5 minutes

How to set/change working mode

  • turn off the power of the module
  • push configuration button
  • turn on BBMagic power holding the button pressed
  • hold the button pressed while LED flashing: 1 flash – work mode = 1, 2 flashes – work mode = 2, etc.
  • release the button
  • LED turns off for about 2 seconds and then flashes few times, depending on configured work mode: 1 flash – configured mode = 1, 2 flashes – configured mode = 2, etc.

Every time you turn BBMagic MAGNETO power on onboard LED flashes:

  • 1 time – the module works mode is 1 – ‘ALIVE’ message period is 30 seconds
  • 2 times – the module work mode is 2 – ‘ALIVE’ message period is 1 minute
  • 3 times – the module work mode is 3 – ‘ALIVE’ message period is 3 minutes
  • 4 times – the module work mode is 4 – ‘ALIVE’ message period is 5 minutes

Additional BBMagic MAGNETO functions

  • Light level measurement – with 10k photoresistor – value range: 0 to 255
  • Two ADC channels with range from 0 to 1,8V
  • Four GND-active digital inputs – pulled up to power supply 10ms before sampling
  • Battery monitoring – continuous supply voltage measurement
  • Chip temperature measurement – After callibration can be interpreted as low accuracy ambient temperature
  • Data transfer LED indication – pin 2 configurable

Wireless Bluetooth Smart

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

Powering

  • 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 (-)
  • 2 x 1,2V NiCd or NiMH rechargeables – onboard pins for wires soldering: 7 (+) and 8 (-)
  • any source you want within 1,8V to 3,6V – 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.