Create project Need help?
Aubinais

Remote Bluetooth Low Energy

Status: Proposal
1324
3
votes
June 26, 2016
telecommande.png

During the year 2015, I presented the Bluetooth Low Energy projects (Thermometer, Power switch ...) and a series of articles around a BOB Bluetooth Low Energy Module LAIRD BL600 in Elektor Magazine. This small module has a cousin, BL620, which has a Bluetooth Low Energy firmware master and allows the exchange of data between these two modules: the BL620 module and up to four slave modules.
Programming in SmartBASIC, we will use commands largely developed in previous articles. I propose in this article to implement the BL620 as remote control of the power switch. We will need a BL620, a 12V battery and a small step-down circuit, the LTC2313.
           
L’électronique :
 
The LTC2313 is a small step-down circuit requiring a self and a voltage divider to set the output voltage of about 3 volts. We arrive at a consumption of our assembly in Sleep mode less than 15uA.
The BL620 works around the SmartBASIC and his ARM Corte that had the opportunity to present in 2015. The program is simple so we did not need additional microcontroller and almost nothing around. So we will add:
- A port of 12 pins for programming the module by the UwTerminal software.
- A button to reset the module
- Two buttons, one to turn on and the other to turn off our power switch.
- A two-color LED (it will show the status of the order and if necessary the connection error)

As you can see, the BL620 is good enough to add only buttons and LED.
                      
The program :
a) The Switch Scan
At the launch of the remote control by a RESET (RESET button or connect the battery) and pressing the buttons 0 and button 1, the BL620 module will scan all Bluetooth Low Energy devices and search by name identification the name of our power switch: JA_SWITCH. If one is found, the MacAddres is stored in the EEPROM of the BL620 NVRECORDSET function. Our module is then ready for remote control of our power switch.
b) the connection and sending the order
We will use all the power SmartBASIC using event management which we described in one of the articles. As you can see in the diagram, events for not using advanced step in sending the order 0 or 1: the BL620 is then waiting for the press of a button, waiting for the connection, waiting the writing of Charateristic, waiting the disconnection and SLEEP mode we await the end of timers 6 and 7. It will be sure to close the UART port of our module to reduce its consumption for 5μA.
The hardest part is finding the appropriate handlers to the event that is triggered. In the literature, searching function, it is often the name of the Handler. Then simply copy the code from the libraries (files. Slib) in our program. To avoid conflicts between our handlers and those of the library, we rename ours by MyHandler ... All of our remote startup lasts less than a second, which is very fast. Having saved the module EEPROM MacAddres avoids the SCAN process that can be long. This is why we were doing the scan in our sector switch separately.
           
Conclusion
Using events, we have seen a complete diagram of a sending order of our remote at the power switch. You can then change our BL620 program to control the RGB lamp for example as described in Elektor.
 
Read the full post
Show less
Schematics
Other

Loading comments...