This Project shows how to use Bluetooth® Low Energy (BLE) to send temperature data via the Arduino Nano 33 BLE Sense REV2 (peripheral) to an Android/iOS app (central). The central uses a single code base for both iOS and Android and is developed with the Flutter cross platform framework.
demo.mp4
- Go through the setup guide of the Arduino Nano 33 BLE Sense REV2.
- Open the Arduino IDE and add install both ArduinoBLE and Arduino_HS300x. If you are interested in more information about Bluetooth Low Energy and the ArduinoBLE library, check out the link.
- Open the peripheral.ino file and hit the upload button.
- The peripheral is setup successfully when the serial monitor prints
Bluetooth® device active, waiting for connections...
.
- First setup the crossplattform framework Flutter.
- Go to the project folder and run run
dart run build_runner build --delete-conflicting-outputs
.
The app has two build variants prod
and sim
. The prod
variant connects to a real physical device whereas the sim
variant just emulates one. So to run the app you dont really need a physical device at all. Just run the sim
variant. To do so call flutter run --release --flavor sim -t lib/main_sim.dart
. For the prod variant call flutter run --release --flavor prod -t lib/main_prod.dart
.
git tag v<major>.<minor>.<version>
git push origin --tags
- https://docs.flutter.dev/get-started/install
- https://github.com/PhilipsHue/flutter_reactive_ble
- https://github.com/arduino-libraries/Arduino_HS300x
- https://github.com/arduino-libraries/ArduinoBLE
- https://github.com/arduino-libraries/ArduinoBLE/blob/master/examples/Peripheral/BatteryMonitor/BatteryMonitor.ino
- https://docs.arduino.cc/hardware/nano-33-ble-sense-rev2
- https://docs.arduino.cc/tutorials/nano-33-ble-sense/ble-device-to-device