BLE with WiFi and FreeRTOS on Raspberry Pi Pico-W

The Raspberry Pi Pico RP2040 is a very versatile microcontroller. It is not the least expensive or the most powerful microcontroller, but it is one which is available and has an excellent software and tool ecosystem.

This article shows how to use the Raspberry Pi Pico-W with BLE and optional WiFi, running with FreeRTOS.

Continue reading

Using Python to Store Data from many BLE Devices

BLE (Bluetooth Low Energy) sensor devices like the Hexiwear are great, but they cannot store a large amount of data. For a research project I have to collect data from many BLE devices for later processing. What I’m using is a Python script running on the Raspberry Pi which collects the data and stores it on a file:

Raspberry Pi with Python controlling a set of Hexiwear BLE Devices

Raspberry Pi with Python controlling a set of Hexiwear BLE Devices

Continue reading

Building the NXP BLE Stack with Open Source GNU and Eclipse Tools

One of the biggest road blocks (beside of closed source) using the BLE (Bluetooth Low Energy) stack from NXP is that it requires expensive tools to compile and build the stack. The good news is that I have now the NXP BLE stack for the Mikroelektronika Hexiwear ported to Eclipse and GNU gcc build tools for ARM 🙂

NXP BLE Stack in Eclipse

NXP BLE Stack in Eclipse

Continue reading

Using Python, Gatttool and Bluetooth Low Energy with Hexiwear

Now I can use the data on the Hexiwear over BLE with the gatttool (see “Tutorial: Hexiwear Bluetooth Low Energy Packet Sniffing with Wireshark” and “Tutorial: BLE Pairing the Raspberry Pi 3 Model B with Hexiwear“). This article is taking things a step further and uses a Python script on Linux to access the sensor data on the BLE device:

Accessing Hexiwear Sensor Data with Python

Accessing Hexiwear Sensor Data with Python

Continue reading

Tutorial: Hexiwear Bluetooth Low Energy Packet Sniffing with Wireshark

For a university reasearch project I try to pair the Raspberry Pi 3 with a Mikroelektronika Hexiwear using BLE (Bluetooth Low Energy). Most of things worked after a lot of trial and error, but at a certain point I was stuck trying to write to send data from the Raspy to the BLE device.The Hexiwear BLE protocol description is very thin, so I ended up using a BLE sniffer to reverse engineer the protocol with Wireshark.

Sniffing BLE Packets between Raspy and Hexiwear

Hardware setup between Raspy and Hexiwear

Continue reading

Tutorial: BLE Pairing the Raspberry Pi 3 Model B with Hexiwear

The Hexiwear (see “Hexiwear: Teardown of the Hackable ‘Do-Anything’ Device“) is a small and portable sensor node with built-in BLE (Bluetooth Low Energy) transceiver. In a research project we try to use multiple Hexiwear in a classroom environment and to collect sensor data on a Raspberry Pi. The Raspberry Pi 3 Model B running Linux has an on-board BLE transceiver too, so why not binding them (wirelessly) together?

Raspberry Pi 3 connected with Hexiwear over BLE

Raspberry Pi 3 connected with Hexiwear over BLE

Well, things seemed easy at the beginning, and as always, there are many things to learn on a journey like this…

Continue reading

Flashing and Restoring the Hexiwear Firmware

The Hexiwear device is a great and versatile device with two microcontrollers on it. Developing firmware on a Hexiwear means changing what was originally on it. And sometimes it happens that I’m not sure if the changes are for good. Or that I accidentally destroyed the firmware on the NXP Kinetis KW40 BLE microcontroller :-(. So I had to find a way to restore the original firmware, and this is what this post is about.

Restoring the Hexiwear Firmware with a Segger J-Link

Restoring the Hexiwear Firmware with a Segger J-Link

Continue reading

How to Add Bluetooth Low Energy (BLE) Connection to ARM Cortex-M

In many of my embedded projects I’m using successfully the Nordic Semiconductor nRF24L01+ (see “Tutorial: Nordic Semiconductor nRF24L01+ with the Freescale FRDM-K64F Board“) and the HC-06 Bluetooth transceivers (see “Getting Bluetooth Working with JY-MCU BT_BOARD V1.06“) for wireless communication. However, the nRF24L01+ is using a proprietary protocol, and the HC-06 does not work with Apple products (it does very well with Android devices). To close that gap I decided to add Bluetooth Low Energy (BLE, or Bluetooth 4.x). So this post is about how to add Bluetooth Low Energy (BLE) to NXP (formerly Freescale) Kinetis devices:

BLE Enabled Kinetis

BLE Enabled Kinetis

Continue reading