Nano ESP32 BLE Scanner

by 陳亮 in Circuits > Wireless

59678 Views, 101 Favorites, 0 Comments

Nano ESP32 BLE Scanner

IMG_1163.jpg

This instructables show how to use ESP32 to make wireless BLE signal scanner, all scanned data will send to the HTTP server via WiFi.

Why BLE Scanner?

Nano ESP32 BLE Scanner.jpg

BLE (Bluetooth Low Energy) signal is very common for current digital device, mobile phone, wrist band, iBeacon, assets tag. This signal not only help you pair up the devices, it also can report the device status, such as battery level, heart rate, motion (walking, running, falling), temperature, panic button, anti-loss ... etc.

It is a valuable big data for location tracking if we can collect the BLE signal at certain number of position.

In long run, the BLE scanner should fix in selected position. However, selecting a right place require trial and error. A tiny wireless BLE scanner is handy to help you check where is the right place.

Preparation

IMG_1141.jpg
serial_decouple_ESP32_bb.png

ESP32 board

I am using ESP-WROOM-32 board this time.

A Tiny Container

Any small container should be ok, I have some tiny TicTac box in hand and it just fit an ESP32 board in it, what a coincidence!

Lipo Battery

ESP32 peak current is around 250 mA. For not drawing over 1C current at anytime, Lipo Battery should over 250 mAh capacity. 852025 is the maximum size that can fit into the Tictac box and it claim it have 300 mAh, it's good enough.

Power Regulator Circuit

A 3.3 V LDO regulator, some capacitors, I have some HT7333A regulator, 22 uf and 100 uf capacitor in hand

Others

A 10k Ohm SMD resistor for pull up EN pin, a small piece of multi purpose PCB, a power switch, some coated wires, 7 pins header

ESP32 Dev Dock

In program process, it also require a ESP32 Development Dock, you may find how to make it in my previous instructables:

https://www.instructables.com/id/Battery-Powered-E...

Trim the PCB

IMG_1142.jpg

Measure the dimension of your tiny container and trim the PCB to fit into it.

Soldering Pin Header

IMG_1143.jpg

Let's start soldering work from the 7 pins header and PCB.

Soldering Power Circuit

IMG_1144.jpg
IMG_1145.jpg
IMG_1146.jpg
IMG_1147.jpg
IMG_1148.jpg

Here is the connection summary:

LDO Vin  -> Vcc pin header(1) -> power switch -> Lipo V+, Charge pin header(7)LDO GND  -> GND pin header(2), capacitors V- pins, ESP32 GNDLDO Vout -> capacitors V+ pins, ESP32 Vcc

Soldering Pull Up Resistor

IMG_1150.jpg

It is the most difficult soldering work in this project, the pin width in ESP32 board is only 1.27 mm. Fortunately, Vcc and EN pin is nearby, it can direct soldering resistor between both pin without wire.

ESP32 Vcc pin -> 10k Ohm resistor -> ESP32 EN pin

Soldering Program Pins

IMG_1151.jpg

Here are the connection summary:

Tx pin header(3)      -> ESP32 Tx pinRx pin header(4)      -> ESP32 Rx pinProgram pin header(5) -> ESP32 GPIO 0 pinRST pin header(6)     -> ESP32 EN pin

Cleaning Up the TicTac Box

IMG_1149.jpg
  • Eat all sweets
  • Remove the stickers

Squeeze Into the Box

IMG_1152.jpg
IMG_1153.jpg
IMG_1154.jpg
IMG_1155.jpg
IMG_1156.jpg
IMG_1157.jpg

Squeeze all component into the TicTac box, be careful don't tear off any wires.

Prepare Software

2018-07-20_143926.png
2018-07-20_144042.png

Arduino IDE

Download and install Arduino IDE if not yet:

https://www.arduino.cc/en/Main/Software

arduino-esp32

Install hardware support for ESP32

Detailed instructions for installation in popular operating systems.

For Linux: https://www.arduino.cc/en/Guide/Linux (see also the Arduino playground page https://www.arduino.cc/en/Guide/Linux

For macOS X: https://www.arduino.cc/en/Guide/Linux

For Windows: https://www.arduino.cc/en/Guide/Linux

Ref.: https://github.com/espressif/arduino-esp32/compar...

Program the ESP32

2018-07-20_144053 (2).png
IMG_1158.jpg
IMG_1159.jpg
IMG_1160.jpg
#define WIFI_SSID "YOURAPSSID"#define WIFI_PASSWORD "YOURAPPASSWORD"#define POST_URL "http://YOURSERVERNAMEORIP:3000/"
  • Select Board: Any ESP32 board
  • Select Partition: No OTA / Minimal SPIFFS
  • Upload

Receive Data

IMG_1161.jpg

If you are not yet have any HTTP server to receive the POST data, you may try to use this simple Node.js program: https://github.com/moononournation/post_data_rece...

Here are the sample data received:

Tue Mar 20 2018 08:44:41 GMT+0000 (UTC): [{  "Address": "6e:3d:f0:a0:00:36",  "Rssi": -65,  "ManufacturerData": "4c0010050b1047f0b3" }, {  "Address": "f8:04:2e:bc:51:97",  "Rssi": -94,  "ManufacturerData": "75004204018020f8042ebc5197fa042ebc519601000000000000" }, {  "Address": "0c:07:4a:fa:60:dd",  "Rssi": -96,  "ManufacturerData": "4c0009060304c0a80105" }]

Power Measurement

IMG_1196.jpg
IMG_1197.jpg
2B90309A-168B-410B-A176-45535B0E1D55.jpeg
5DAAFE28-28AF-4FF7-AA31-C053D66C7A59.jpeg
316ABAC0-D41E-443D-9AA2-FB5E0C764CAA.jpeg

The program scan BLE signal for 30 seconds, then deep sleep 300 seconds and then scan again. For each loop, it consume around 3.9 mWh.

Theoretically, it can run: (I will update the testing result later on my Twitter)

300 mAh Lipo / 3.9 mWh @ 330 seconds= [(300 mA * 3.3 V) mWh / 3.9 mWh * 330] seconds~83769 seconds~23 hours

2018-04-08 Update:

I have changed to use XC6503D331 LDO regulator and made 2 measurements:

Round 1: 12:43:28 - 16:42:10 (~20 hours) 210 BLE scan POST received

Round 2: 10:04:01 - 05:36:47 (~19.5 hours) 208 BLE scan POST received

Happy Scanning!

IMG_1162.jpg

It time to find a place to setup you BLE tracking network!