BBMagic DIMMER is a wireless AC phase regulation module with Bluetooth Low Energy (BLE), Bluetooth Smart communication.
BBMagic DIMMER functions
- Driving 230VAC power devices by phase regulation
- Automatic turn on for 15 minutes after modules power up ; pin 17 configurable
- Supply voltage monitoring
- Light level measurement ; pads for 10k photoresistor ; values range from 0 to 255
- ADC input with range from 0 to 1,8V ; 1mV resolution
- Chip temperature measurement
- LED radio transmission indication – pin 2 configurable
- Communication: encrypted and digital signed Bluetooth Smart messages
- Easy to use Raspberry Pi 3 or zero W programming interface – bbmagic_lib from version 2.0
Pinout
Pin number | Description |
---|---|
1,8,20,22,23,24 | GND – power and signal ground |
2 | Configuration of the radio transmission indication:
|
3 | DIMM OUT – output for triac driving |
6 | ZERO CROSS DET – input for AC voltage zero cross detection |
7,21 | Supply voltage from 1,8V to 3,6V |
7,8,9 | Pads for voltage regulator if you want to power BBMagic RELAY 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 (Reverse polarity protected). Its identical like BBMagic METEO described here: Power it easy: BBMagic METEO Bluetooth Low Energy module |
11,12 | 10k photoresistor pads |
13 | Input of analog to digital converter ADC_1. Available voltage range: 0V-1,8V ; Resolution: 1mV |
15,16 | Pads for alternative LED with series resistor. Pad 15 – LED anode with resistor, Pad 16 – LED cathode |
17 | Configuration input START CONF
|
18,19 | Tx and Rx UART lines. Available voltage range: 0V-5V |
How does BBMagic DIMMER work
If pin 17 (START CONF) is connected to GND or to pin 16 then after modules power up it turns on driving device for 15 minutes.
BBmagic DIMMER sends ‘ALIVE’ messages every 60 seconds.
When it receives demand message drives CHANNEL_0..CHANNEL_2 outputs and immediately sends ‘ALIVE’ message to confirm that job is done.
Whats in ‘ALIVE’ message?
Library header file (bbmagic_lib.h) defines types of data sending by BBMagic DIMMER like below.
bbm_buf[BBMAGIC_DEVICE_TYPE] | module type ; there is BBMAGIC_M_DIMMER in this particular case |
bbm_buf[BBM_DIMMER_V_SUP] | modules supply voltage ; divide this value by 71 (BBMAGIC_VCC_DIVIDER) to have power supply in volts |
bbm_buf[BBMAGIC_DIMMER_ADV_TIME] | next ‘ALIVE’ message from BBMagic DIMMER will arrive after this period of time ; multiply it by two to get time in seconds |
bbm_buf[BBM_DIMMER_CHIP_TEMP] | modules chip temperature in Celsius (U2 encoded). After callibration this measurement can be interpreted as low accuracy ambient temperature |
bbm_buf[BBM_DIMMER_LIGHT] | light level ; from 0 to 255 |
bbm_buf[BBM_DIMMER_VAL] | current DIMM OUT output setting ; range from 0 to 100 |
bbm_buf[BBM_DIMMER_ADC_1_MSB] i bbm_buf[BBM_DIMMER_ADC_1_LSB] | voltage level on ADC_1 input in mV |
bbm_buf[BBM_DIMMER_WORKTIME_0] | amount of time from modules power up – in seconds ; byte 0 – LSB |
bbm_buf[BBM_DIMMER_WORKTIME_1] | amount of time from modules power up – in seconds ; byte 1 |
bbm_buf[BBM_DIMMER_WORKTIME_2] | amount of time from modules power up – in seconds ; byte 2 |
bbm_buf[BBM_DIMMER_WORKTIME_3] | amount of time from modules power up – in seconds ; byte 3 – MSB |
bbm_buf[BBM_DIMMER_FIRM_0] | modules firmware version LSB |
bbm_buf[BBM_DIMMER_FIRM_1] | modules firmware version MSB |
bbm_buf[BBMAGIC_DEVICE_ADDR_0] | modules address byte 0 – LSB |
bbm_buf[BBMAGIC_DEVICE_ADDR_1] | modules address byte 1 |
bbm_buf[BBMAGIC_DEVICE_ADDR_2] | modules address byte 2 |
bbm_buf[BBMAGIC_DEVICE_ADDR_3] | modules address byte 3 |
bbm_buf[BBMAGIC_DEVICE_ADDR_4] | modules address byte 4 |
bbm_buf[BBMAGIC_DEVICE_ADDR_5] | modules address byte 5 – MSB |
bbm_buf[BBMAGIC_DEVICE_RSSI] | radio signal strength indicator (RSSI) in dBm |
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)
- Linux library for easy programming from version bbmagic_lib from version 2.0
Powering
BBMagic DIMMER needs about 12mA of current. You can power it:
- from 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
To set BBMagic DIMMER
You only need to know device address and key. Then add your module to actors database:
bbm_dimmer_add("my_dimmer", "AB2D7366A5CB", "2DFDA5070CD284A107A24F7e53572A7B38") ;
…and use lib function ‘bbm_dimmer_set’:
bbm_dimmer_set("my_dimmer",50) ;
DIMM OUT will be set to 50% of full power.