Files
BluettiBLE/QUICK_START.md
T
2026-06-04 21:35:07 +10:00

93 lines
2.4 KiB
Markdown

# BluettiBLE — Quick Start
Get a Bluetti power station reporting to an ESP32 in a few minutes.
## 1. Find your device's BLE name
Install a BLE scanner on your phone (nRF Connect or LightBlue) and scan. Your
Bluetti advertises a name that starts with the model, for example:
- `AC3001234567890`
- `AC200M1234567890`
- `EB3A1234567890`
Copy the **full** advertised name — that string is how the library finds the unit
(there is no pairing and no encryption key to enter).
## 2. Install the library
PlatformIO (`platformio.ini`):
```ini
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
lib_deps =
https://gitea.sh3d.com.au/Sh3d/BluettiBLE.git
```
Or copy this folder into `lib/` (PlatformIO) or `libraries/` (Arduino IDE).
## 3. Minimal sketch
```cpp
#include <Arduino.h>
#include "BluettiBLE.h"
BluettiBLE bluetti;
void onData(const BluettiDevice* dev) {
Serial.printf("%s SoC %u%% AC out %u W DC out %u W\n",
dev->data.model, dev->data.totalBatteryPercent,
dev->data.acOutputPower, dev->data.dcOutputPower);
}
void setup() {
Serial.begin(115200);
bluetti.begin();
bluetti.setCallback(onData);
bluetti.addDevice("My Bluetti", "AC3001234567890", BLUETTI_AC300); // <- your name + model
}
void loop() {
bluetti.loop();
}
```
Set the model to match your unit: `BLUETTI_AC300`, `BLUETTI_AC200M`,
`BLUETTI_EB3A`, `BLUETTI_EP500P`, `BLUETTI_AC500`, `BLUETTI_EP500`,
`BLUETTI_EP600`.
## 4. Upload and watch
Open the serial monitor at 115200. You should see the library scan, connect, and
then print a line every poll cycle (default every 3 seconds). Turn on debug for
the raw command/connection trace:
```cpp
bluetti.setDebug(true);
```
## 5. Control output (optional)
Once connected you can toggle the outputs:
```cpp
if (bluetti.isConnected()) {
bluetti.setACOutput(true); // turn AC output on
bluetti.setDCOutput(false); // turn DC output off
}
```
## Troubleshooting
- **Never connects** — double-check the BLE name is exact (case sensitive), and
that the Bluetti app on your phone is closed (a Bluetti accepts one BLE client
at a time).
- **Connects but no data** — make sure the model enum matches your hardware; the
register map is model-specific.
- **Drops out** — keep `bluetti.loop()` running every iteration; the library
reconnects automatically after a disconnect.