I am working on a project in which I'm supposed to take some readings from sensors, then do some analysis on them and output a result. I want to display this result on my android phone. How would I go about that?
Use BLE (Bluetooth Low Energy) it's easy to use through pip's pygatt
library on the RPi.
First pip3 install pygatt
Example of reading from the RPi shown below:
import pygatt
import time
adapter = pygatt.GATTToolBackend()
try:
adapter.start()
device = adapter.connect('C4:4F:33:16:58:37')
while True:
value = device.char_read(
"beb5483e-36e1-4688-b7f5-ea07361b26a8", timeout=30)
value = int.from_bytes(value, byteorder="little")
print(value)
time.sleep(2)
finally:
adapter.stop()
And on the Android phone you can develop your own app where you can read the data from the RPi, or use nRF Connect app on PlayStore which connects and read data from any Bluetooth device.