How To Create Ble-wifi Range Extender For T-skin

About the project

We wanted to increase the communication range of the Tactigon Skin so we could use it over longer distances than BLE can offer.

Project info

Difficulty: Moderate

Platforms: AdafruitNodeMCURaspberry Pi

Estimated time: 1 hour

License: GNU General Public License, version 3 or later (GPL3+)

Items used in this project

Hardware components

Tiny Breadboard Tiny Breadboard x 1
Breakout Kit for Raspberry Pi Model A+&B+&2 Breakout Kit for Raspberry Pi Model A+&B+&2 x 1
Raspberry Pi 3 Model B Raspberry Pi 3 Model B x 1
Tactigon Skin Tactigon Skin x 1

Software apps and online services

Arduino IDE Arduino IDE

Story

Introduction

Hello! We made this project to extend the range of communication of the Tactigon Skin (also T-Skin) to use it over longer distances that the ones that Bluetooth Low Energy can offer. To achieve this goal, we used the UDP protocol over Wi-Fi to send data from the Tactigon Skin to a PC, using a Raspberry Pi Zero W. Wi-Fi capabilities for the Tactigon Skin have been added by using a NodeMCU with a BLE module.

Hardware Architecture

Lots of devices are connected here, so a little picture can help:

Because the Tactigon Skin does not have Wi-Fi onboard we had to use a NodeMCU with a BLE module to relay data to the Raspberry Pi Zero W. The UDP packets are sent over a private network hosted by the RPi, which is configured as an access point, so that there’s no need to use public networks.

To configure the access point follow this link: Configure Access Point Mode

Software Architecture

Now that we know how all nodes are connected, we can examine how each one works.

BLE to UDP node

BLE to UDP node

The T-Skin gather information about its sensors (gyroscope, accelerometers, etc.) and create a packet that will be sent to the NodeMCU via BLE.

Here you can see how the T-Skin gathers the data:

T_QUAT qMeter;
T_QData qData;
  
qData = qMeter.getQs();
roll = radToDegree(qData.roll - rollZero);
pitch = radToDegree(qData.pitch - pitchZero);
yaw = radToDegree(qData.yaw - yawZero);

First we declare qMeter and qData, objects based on the T_QUAT and T_QData class. This will contain all the quaternions data from the gyroscope, then we read the actual data with qMeter.getQs(). Now we can separate the roll, pitch and yaw values and store them into the respective variables.

After that the received data are relayed to the Raspberry Pi Zero W using the UDP protocol.

WiFiUDP Udp;
unsigned int UDP_Port = 5000;
char* UDP_IP = "192.168.4.1";
char PacketBuffer[1024];
  
Udp.beginPacket(UDP_IP, UDP_Port);
Udp.write(PacketBuffer);
Udp.endPacket();

Every time an entire data packet is received we begin creating a packet for the UDP communication, specifying the IP address and the port of the receiver. Then we write on the communication line the data and close the packet sending procedure.

Note that in case of a connection failure the NodeMCU is configured in order to try to reconnect as soon as possible.

UDP to VCOM

In this setup the Raspberry Pi Zero is configured as a Gadget Device, allowing it to be identified by a PC as a Serial Port device. To configure the device follow this link: Serial Gadget Mode Configuration

Once the UDP packets are received, an always running Python script takes that data and forwards it to the Virtual Serial Port of the Pi. On the PC, opening a serial monitor to the corresponding COM allows you to see the data that have been gathered by the T-Skin at the beginning of the communication chain.

Here's an example:

Conclusions

With this project we reached our goal to use the Tactigon Skin over longer distances. Performance wise the range have been increased from 3 ~ 4 meters with BLE only to a staggering 40+ meters with the use of Wi-Fi communication.

The main limitations with this implementation are the actual maximum range of the Raspberry Pi Zero W Wi-Fi antenna and the overcrowdedness of the 2.4 Ghz spectrum. The second problem could be avoided, if necessary, with the use of alternative LPWAN protocols such as LoRa and SigFox.

This communication range extender can be used to enable so many projects using the T-skin, breaking the barrier of distances. Some example might include remote control a robot in situations like bomb disposal and search and rescue missions.

Code

RPi_Tactigon_Extender.py

This code will automatically run at bootup on the Raspberry Pi Zero W.

BLEtoUDP.ino

This code is flashed onto the NodeMCU.

Credits

Photo of The Tactigon

The Tactigon

The Tactigon is a brand of Next Industries Milano. Next Industries is a born of a passion to develop devices and sensors fit for Iot Technology. Our team is made of incredible experts in movement detection for big structural monitoring systems, software development and wearable device.

   

Leave your feedback...