The BleuIO is a Bluetooth low energy USB dongle that can create new BLE 5.0 applications in the fastest and easiest way.
The BleuIO so far has been supporting the USB Serial Port Profile (SPP).
A new firmware has been released to allow the use of USB Human Interface Device Profile (HID).
The USB HID is usually available in the operating system without the need of external drivers. The makes less dependency in developing BLE applications.
Choose your desired firmware for BleuIO by using built in bootloader and select between USB profiles:
Serial Port Profile (SPP)
Human Interface Device Profile (HID)
HID Introduction
HID (Human Interface Device) defines a class of peripheral devices enables people to input data or interact directly with the computer, such as a mouse, keyboard, or joystick. The HID specification is a part of the USB standard, thus USB mice and other USB user input devices are HID compliant.
The host and the device are two entities in the HID protocol. The device is the entity that directly interacts with humans, such as a keyboard, mouse and BleuIO. The host communicates with the device and receives input data from the device in messages with 64 bytes size.
HID devices must meet a few general requirements that are imposed to keep the HID interface standardized and efficient.
Demo application
Bluetooth Special Interest Group (SIG) defines a HID profile that specifies how a device can support HID services over the Bluetooth LE protocol stack using the Generic Attribute Profile.
This example implementation shows how BleuIO can be used with the USB HID profile. The application allows to send BleuIO AT commands and displays the response on the screen.
Bluetooth Low Energy (BLE) is a low power wireless technology used to connect devices. It is a popular communication method, especially in the Internet of Things era. Several devices around the house have a built-in Bluetooth transceiver, and most of them provide useful capabilities to automate jobs. This technology is widely used in the healthcare, fitness, beacons, security, and home entertainment industries. For that reason, it is really interesting to create a desktop application using C# that access BLE device data around the house.
In this example, we will create a simple C# windows form application to get real-time HibouAir environmental data using BleuIO.
This script can be used to connect and view other BLE devices data.
Let’s start
First, let’s create a new project in visual studio and select C# windows form application from the list.
Choose a suitable name for your project.
Once the project is created, we will see a blank form screen where we will add buttons and labels to communicate with BleuIO graphically.
The application will connect to the BleuIO dongle to its given COM port from the script. You can change the port easily by going to line number 18. We will have a disconnect button to disconnect BleuIO from the COM port.
The button Scan for HibouAir devices will look for nearby HibouAir devices and store them in an Array. The Combobox (dropdown item) next to it will load the stored device from where we can select a device to get its data.
The Get data button will show the real-time environmental data of this device.
The form will look like this.
The .cs file associated to this will have the following code.
Source code is available at https://github.com/smart-sensor-devices-ab/bluetooth_realtimedata_csharp
As you can notice, I wrote COM18 to connect to the serial port because the BleuIO device on my computer is connected to COM18. You can check your COM port from the device manager. Let’s run the project and click on scan for HibouAir devices.
Bluetooth low energy technology offers a suitable way of connecting smart devices. The term IoT or Internet of Things brings new technologies to transform and make the world in the era of connectivity. The IoT says that everything is connected, and Bluetooth has made it much easier to work. One central device can initiate and maintain connections with multiple Bluetooth Low Energy peripherals devices.
The BleuIO is a Bluetooth low energy solution that can create new BLE 5.0 applications fastest and easiest way. Using this BleuIO’s multi-connection feature, we can easily connect to multiple BLE devices and transfer data between them.
This article will explain how to use BleuIO’s multi-connection features, connect to multiple BLE devices and transfer data between them. We will use three BleuIO dongles for this project: one central and two peripheral. The central dongle will connect to peripheral and send data simultaneously.
We will create a simple python script that will help us do the task.
import serial
import time
import string
import random
target_dongle_mac_address = (
"[0]40:48:FD:E5:2D:AF" # Change this to the 1st peripheral's mac address.
)
target_dongle_mac_address2 = (
"[0]40:48:FD:E5:2D:B5" # Change this to the 2nd peripheral's mac address.
)
your_com_port = "COM7" # Change this to the com port your dongle is connected to.
connecting_to_dongle = True
trying_to_connect = False
trying_to_connect2 = False
def id_generator(size=10, chars=string.ascii_uppercase + string.digits):
return ''.join(random.choice(chars) for _ in range(size))
print("Connecting to dongle...")
# Trying to connect to dongle until connected. Make sure the port and baudrate is the same as your dongle.
# You can check in the device manager to see what port then right-click and choose properties then the Port Settings
# tab to see the other settings
while connecting_to_dongle:
try:
console = serial.Serial(
port=your_com_port,
baudrate=57600,
parity="N",
stopbits=1,
bytesize=8,
timeout=0,
)
if console.is_open.__bool__():
connecting_to_dongle = False
except:
print("Dongle not connected. Please reconnect Dongle.")
time.sleep(5)
print("Connected to Dongle.")
connected = "0"
connected2 = "0"
while 1 and console.is_open.__bool__():
console.write(str.encode("AT+DUAL"))
console.write("\r".encode())
time.sleep(0.1)
print("Putting dongle in Dual role and trying to connect to other dongle.")
while connected == "0":
time.sleep(0.5)
if not trying_to_connect:
console.write(str.encode("AT+GAPCONNECT="))
console.write(str.encode(target_dongle_mac_address))
console.write("\r".encode())
trying_to_connect = True
dongle_output2 = console.read(console.in_waiting)
time.sleep(2)
print("Trying to connect to Peripheral 1...")
if not dongle_output2.isspace():
if dongle_output2.decode().__contains__("\r\nCONNECTED."):
connected = "1"
print("Connected to 1st device!")
time.sleep(5)
if dongle_output2.decode().__contains__("\r\nDISCONNECTED."):
connected = "0"
print("Disconnected!")
trying_to_connect = False
dongle_output2 = " "
while connected2 == "0":
time.sleep(0.5)
if not trying_to_connect2:
console.write(str.encode("AT+GAPCONNECT="))
console.write(str.encode(target_dongle_mac_address2))
console.write("\r".encode())
trying_to_connect2 = True
dongle_output2 = console.read(console.in_waiting)
time.sleep(2)
print("Trying to connect to Peripheral 2...")
if not dongle_output2.isspace():
if dongle_output2.decode().__contains__("\r\nCONNECTED."):
connected2 = "1"
print("Connected to 2nd device!")
time.sleep(5)
if dongle_output2.decode().__contains__("\r\nDISCONNECTED."):
connected2 = "0"
print("Disconnected!")
trying_to_connect2 = False
dongle_output2 = " "
while connected == "1" and connected2 =="1":
dongle_output3 = console.read(console.in_waiting)
delay=10
close_time=time.time()+delay
i=0
while True:
myConIndex = ('0000' if i%2 == 0 else '0001')
console.write(str.encode("AT+TARGETCONN="))
console.write(str.encode(myConIndex))
console.write("\r".encode())
console.write(str.encode("AT+SPSSEND="))
console.write(str.encode(id_generator()+'-'+myConIndex))
console.write("\r".encode())
time.sleep(0.2)
i+=1
if time.time()>close_time:
break
console.write(str.encode("AT+SPSSEND=[DONE]\r"))
time.sleep(0.2)
print("Sending complete!\r\n")
print("Exiting script...")
exit()
This script will be used for the central BleuIO dongle. We need to find the port number of each dongle and the peripheral mac address.
Step 2:
Connect three BleuIO dongles on your PC. You can do the process on three different PC or Raspberry Pi.
I have connected both the central and the peripheral to one PC for this project.
After connecting the dongles, open device manager (windows) to find ports of each dongle.
On my PC, I have the BleuIO dongles connected on ports 7,8 and 18.
Let’s make COM7 the central , COM8 and COM18 as peripheral.
Now open the scripts and set the ports number on line 12.
We also need to know the peripheral dongles mac address.
To do that, we can simply advertise the dongle using AT+ADVSTART command .
Go to https://bleuio.com/web_terminal.html
Click on connect to BleuIO dongle
Select your port for peripheral
Type AT+ADVSTART
Do the same process for the other peripheral dongle.
Now both the peripheral dongle is advertising. We can do a gap scan from central to find their mac address.
Go to https://bleuio.com/web_terminal.html
Click on connect to BleuIO dongle
Select your port for central
Type AT+DUAL (This will put the dongle in dual role)
Type AT+GAPSCAN
Now look for the dongle called BleuIO.
Update the script with the peripheral mac address (line 6,9)
Step 3 :
Now lets run the script.
Go to the script folder and type python py_serial_transfer.py
It will connect to both the peripheral dongles and send data randomly.
You will see the responses on the web terminal screen.
Please follow the video to get better understanding.
Smart Sensor Devices has earned the KC certification for its Bluetooth Low Energy USB dongle BleuIO, allowing it to be sold in South Korea.
As a global company, it is important that Smart Sensor Devices can serve customers around the globe. Any information communication equipment manufactured or imported for sale in South Korea must have KC certification. These products must have the KC logo and product certification number printed on the product. The certification ensures an electronic device is safe and meets all electromagnetic compatibility and radio frequency requirements.
“The KC certification is a big step for BleuIO as Smart Sensor Devices continues to expand our reach to other countries,” said Axel Hammar, Founder & CEO, Smart Sensor Devices. “This certification will allow us to work with South Korean companies and provide them with a more transparent and efficient supply chain.”
About BleuIO
This BleuIO is a Bluetooth low energy USB dongle that can create a new BLE 5.0 application fastest and easiest way. Just use the AT Commands available on the device. Details about the AT commands can be found on the getting started guide, which will help anyone make a fast peripheral or central application (or both) without developing a single line of embedded code.
It is a fully integrated solution, providing MCU and Bluetooth radio in one chip, based on Dialog Semiconductor latest Bluetooth chip, DA14683. The FLASH based device permits field or boot upgradable, while the application is stored on FLASH memory. Custom settings can also be stored on FLASH memory or OTP for higher integrity. It supports Windows 10, Linux and macOS, Arduino and STM32.
Smart Sensor Devices is a Swedish company working globally with the latest IoT solutions. We are located in Stockholm, the hottest hub for IoT inventions. Get in contact with us today and explore how you can become part of it! Our long-term experience in IoT devices and systems is crucial for giving your business the most for your investments, improving Time To Market, and lowering your risk.
Bluetooth Low Energy (BLE) is a low power wireless technology used for connecting devices with each other. It is a popular communication method especially in the era of Internet of Things. Several devices around the house have a build-in buetooth transceiver and most of them provide really useful capabilitites to automate jobs. For that reason it is really interesting to create desktop application using C# that connects to the devices around the house and manage them.
In this example we are going to create a simple C# windows form application to communicate with BleuIO using SerialPort. This script can be used to create Bluetooth Low Energy application using C# with BleuIO.
Let’s start
As a first step lets create a new project in visual studio and select C# windows form application from the list.
Choose a suitable name for your project.
Once the project is created, we will see a blank form screen where we will add buttons and labels to communicate with BleuIO graphically.
We will have buttons that connects and disconnects from BleuIO. An input field that takes AT commands from the user and sends it to BleuIO using SerialPort. And a text area will display the response from BleuIO to the screen.
The form will look like this
The .cs file associated to this will have the following code.
Source code is available at https://github.com/smart-sensor-devices-ab/bluetooth_low_energy_csharp_WFA.git
using System;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
SerialPort mySerialPort = new SerialPort("COM18", 57600, Parity.None, 8, StopBits.One);
public Form1()
{
InitializeComponent();
mySerialPort.DataReceived += new SerialDataReceivedEventHandler(mySerialPort_DataReceived);
mySerialPort.Open();
}
private void button1_Click(object sender, EventArgs e)
{
lbl_test.Text = "Connected";
}
//print response from the dongle
private void mySerialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
SerialPort sp = (SerialPort)sender;
string s = sp.ReadExisting();
output_data.Invoke(new EventHandler(delegate { output_data.Text += s + "\r\n"; }));
//lbl_output.Invoke(this.myDelegate, new Object[] { s });
}
private void tb_cmd_TextChanged(object sender, EventArgs e)
{
}
private void submit_cmd_Click(object sender, EventArgs e)
{
output_data.Text = "";
byte[] bytes = Encoding.UTF8.GetBytes(tb_cmd.Text);
var inputByte = new byte[] { 13 };
bytes = bytes.Concat(inputByte).ToArray();
mySerialPort.Write(bytes, 0, bytes.Length);
}
private void btn_disconnect_Click(object sender, EventArgs e)
{
mySerialPort.Close();
Environment.Exit(0);
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void btn_stop_Click(object sender, EventArgs e)
{
byte[] bytes = Encoding.UTF8.GetBytes("\u0003");
var inputByte = new byte[] { 13 };
bytes = bytes.Concat(inputByte).ToArray();
mySerialPort.Write(bytes, 0, bytes.Length);
}
private void output_data_TextChanged(object sender, EventArgs e)
{
}
private void pictureBox1_Click(object sender, EventArgs e)
{
}
}
}
As you can notice I wrote COM18 to connect to serial port because BleuIO device on my computer is connected to COM18.
You can check your COM port from device manager.
Lets run the project and click on connect button.
Once we are connected to BleuIO, we will be able to write AT commands using the input filed.
List of AT commands are available at https://www.bleuio.com/getting_started/docs/commands/
There is a stop button that write control+c to dongle and cancels current execution.
Bluetooth Low Energy (BLE) is a low power wireless technology used for connecting devices with each other. It is a popular communication method especially in the era of Internet of Things. Several devices around the house have a build-in buetooth transceiver and most of them provide really useful capabilitites to automate jobs. For that reason it is really interesting to be able to create a main-device (like a PC) which will have an application that connects to the devices around the house and manage them.
In this example we are going to create a simple C# console application to communicate with BleuIO using SerialPort. This script can be used to create Bluetooth Low Energy application using C# with BleuIO.
Let’s start
As a first step lets create a new project in visual studio and select C# console application from the list.
Choose a suitable name for your project and paste the following code to Program.cs file.