Business technology background with digital elements and modern interface
Modular Electronics,Citizen Electronics,Electronic Theory Blog - ramplights.com

Bluetooth-based Beacon technology pure dry goods tailored to their own exclusive Beacon

We don't currently have a Beacon in the form of AltBeacon, but we do have several Bluetooth development boards on hand. These boards are smart, Bluetooth-enabled microcontrollers (MCUs) that come with a built-in Bluetooth protocol stack. Since they offer a wide range of peripheral interfaces and pins, development boards are commonly used for prototyping products. The firmware can be directly flashed onto the board or even integrated into the final product for demonstration or testing purposes. I decided to build an AltBeacon application using the development boards I have, and then test it with the Android Museum Guide app. I'm using the Bluegiga DKBluetooth Low Energy Development Kit and the Intel Edison Development Board. The Bluegiga board is programmed using BGScript, a simple scripting language provided by Bluegiga. On the other hand, the Intel Edison runs Linux and supports multiple programming languages. I prefer using Node.js along with the JavaScript framework, as it allows me to easily find suitable Smart Bluetooth libraries or feature packs. **Turning Bluegiga into AltBeacon** BGScript is easy to understand and comes with a rich set of features from the Bluegiga framework. Creating a Bluegiga application involves writing a script file and other project configuration files using a text editor. With the software update tool from the Bluegiga SDK, you can directly burn the compiled firmware onto the development board via USB. The scripts include variable and array declarations, as well as event handler callback functions. Callbacks play a crucial role in the programming model, as calling standard Bluegiga functions triggers the corresponding callback. Similarly, the framework can also invoke event handlers based on external events. Implementing a Beacon on any platform requires working with the Generic Access Profile (GAP), which involves setting up the broadcast packet content and configuring the broadcasting parameters. The elements of the Bluegiga AltBeacon implementation are as follows: Start with variable declaration. ![Figure 1 – Array declaration](http://i.bosscdn.com/blog/o4/YB/AF/qqCHiAVWZGAAAY0lzDozE112.jpg) Figure 11 – Array declaration The broadcast settings can be configured in the Bluegiga standard event handler "system_boot," which is called when the board powers up or resets. I first set up an array containing the Flags field. This field consists of several bits, each indicating support for Bluetooth Smart and/or Bluetooth BR/EDR. The data fields included in the broadcast packet are known as ADV data types, which are clearly defined in Part A of the Bluetooth Core Specification Addendum. The standard structure for these data types includes a single-byte length field (not including the byte itself) and a single-byte data type field. Data type values are defined in the GAP numbering document. Here is the initial part of the code: ![Figure 2 – Define flags broadcast type in the system_boot event handler](http://i.bosscdn.com/blog/o4/YB/AF/qqCHuAP7VmAABHsfbcUts591.jpg) Figure 12 – Define flags broadcast type in the system_boot event handler In my previous article, I introduced the AltBeacon format and explained the data encoded in the GAP manufacturer-specific data field. I filled the last 20 bytes of the same array accordingly. ![Figure 3 – Defining AltBeacon Data in Manufacturer-Specific Data Fields](http://i.bosscdn.com/blog/o4/YB/AF/qqCH2AROx4AAB-k4KLpLk338.jpg) Figure 13 – Defining AltBeacon Data in Manufacturer-Specific Data Fields Next, I set the name for the Beacon device, which will appear in the scan results returned by the Central device (mainly smartphones). Its value is another broadcast type, so I configured it separately. As shown, the local name is set to "AltBeacon." ![Figure 4 – Creating a local name for the scan response](http://i.bosscdn.com/blog/o4/YB/AF/qqCH6AcxHEAABPy7GRegw232.jpg) Figure 14 – Creating a local name for the scan response Configuring the broadcast parameters involves calling some of Bluegiga's features and arrays. ![Figure 5 – Configuring GAP Broadcast](http://i.bosscdn.com/blog/o4/YB/AF/qqCH-APyZVAABtgPOu20k071.jpg) Figure 15 - Configuring GAP Broadcast With this setup, my custom AltBeacon on Bluegiga is ready. ![Figure 6 – AltBeacon on DKBLE](http://i.bosscdn.com/blog/o4/YB/AF/qqCIGANIBsAABg9CajyLo821.jpg) Figure 16 – AltBeacon on DKBLE Another option: AltBeacon on Intel Edison Node.js is designed with modularity in mind, offering a wide range of modules. For Node.js, modules are similar to libraries. The "Bleno" module provides many functions for applications acting as Bluetooth GAP peripherals, such as defining and implementing GATT profiles. It's open source and was created by Sandeep Mistry. He also created the Noble module, which is used for creating applications in GAP Central Mode. Both Bleno and Noble are available on GitHub. Although Bleno's standard distribution does not support AltBeacon, it does support iBeacon. So, I forked the Noble repository and modified Bleno to generate a GAP broadcast in the form of AltBeacon. Let me walk you through the process. I added new features to the standard bleno.js source file and then initiated the broadcast based on a set of predefined parameters in the Node.js application. The new feature code looks like this: ![Figure 7 – New features in bleno/lib/bleno.js](http://i.bosscdn.com/blog/o4/YB/AF/qqCIKAWX1OAACPi-RdNzU607.jpg) Figure 17 – New features in bleno/lib/bleno.js This code essentially fills the necessary AltBeacon data into the buffer and then calls other functions added to the Linuxbindings.js source file. Bleno works with the BlueZ Bluetooth protocol stack on Linux. When performing actions on a Linux-based platform, Bleno's functionality is ultimately mapped to calls for BlueZ functionality. I made some changes to the Linux-related part of Bleno to support AltBeacon. ![Figure 8 – New features in bleno/lib/linux/bindings.js](http://i.bosscdn.com/blog/o4/YB/AF/qqCIOAEx7MAAAuTORhcpc003.jpg) Figure 18 – New features in bleno/lib/linux/bindings.js ![Figure 9 – New features in bleno/lib/linux/hci-ble.js](http://i.bosscdn.com/blog/o4/YB/AF/qqCIWAH7e-AAC6CIlPPfM183.jpg) Figure 19 – New features in bleno/lib/linux/hci-ble.js These features prepare a buffer similar to the one on the Bluegiga development board, containing all the necessary broadcast data, and then pass it through the Bleno API layer to the BlueZ Host Controller Interface (HCI). **AltBeacon Node.js App** After modifying Bleno to support AltBeacon, the next step is to create a Node.js application using the new Bleno module and start broadcasting using the AltBeacon format. The entire application consists of just seven lines of code, as shown below. ![Figure 10 – AltBeacon node.js application](http://i.bosscdn.com/blog/o4/YB/AF/qqCIaAJv_-AABEDfEI4gQ520.jpg) Figure 20 – AltBeacon node.js application To run the AltBeacon app, I used Putty to establish a terminal session with the Intel Edison via SSH or telnet and then ran `node app.js` from the command line. ![Figure 11 – Putty establishes a terminal dialogue](http://i.bosscdn.com/blog/o4/YB/AF/qqCIeAB1Y4AADcRgIcUK4618.jpg) Figure 21 – Putty establishes a terminal dialogue

HDG And Painted Radiator

Hdg And Painted Radiator,Weather Proof Hdg And Painted Radiator,Weather Proof Hdg Radiator With Coating,Leak Free Hdg And Painted Radiator

Shenyang Tiantong Electricity Co., Ltd. , https://www.ttradiator.com