Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
umer0586 committed Oct 19, 2024
2 parents 44c6b01 + 7ae2aa5 commit b5be0be
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
#### Stream real-time Android sensor data using [UDP (User Datagram Protocol)](https://en.wikipedia.org/wiki/User_Datagram_Protocol), a connectionless transport layer protocol designed for low-latency, fast data transmission without establishing a persistent connection.

<img src="https://github.com/user-attachments/assets/0f8476cd-add4-4f19-8124-64db871e2e9b" width="250">
<img src="https://github.com/user-attachments/assets/82598003-610a-4b22-92b3-560dca22e503" width="250">
<img src="https://github.com/user-attachments/assets/098bc959-ab34-449a-90d8-cdfdc1056e83" width="250">
<img src="https://github.com/user-attachments/assets/bab0c973-4f08-4bfc-bae9-ac8acf3202ae" width="250">
<img src="https://github.com/user-attachments/assets/54cb7935-4306-4c69-a6b6-24a195345a3a" width="250">



## Usage
In the app, select the desired sensors from the list and tap the "Stream" button. This will begin transmitting sensor data to the specified address. To receive the data, you'll need to set up a UDP server. The app sends the data in JSON format.

Expand Down Expand Up @@ -74,7 +76,14 @@ def onData(data):
sensorType = jsonData["type"]
timestamp = jsonData["timestamp"]
values = jsonData["values"]
print(f"{sensorType} {values} {timestamp}")

if sensorType == "android.sensor.accelerometer":
x, y, z = values
print(f"accelerometer : x = {x}, y = {y}, z = {z} timestamp = {timestamp} ")

if sensorType == "android.sensor.gyroscope":
x, y, z = values
print(f"gyroscope : x = {x}, y = {y}, z = {z} timestamp = {timestamp} ")

# Initialize the server to listen on all network interfaces (0.0.0.0) and port 8080
server = UDPServer(address=("0.0.0.0", 8080))
Expand All @@ -90,7 +99,22 @@ In the app's settings, enter the IP address of the machine running this script.
- On **Windows**, use the `ipconfig` command.
- On **Linux**, use the `ifconfig` command.

## Stream On Boot
The app can stream sensor data to a specified address upon device boot. For devices running Android 9 or lower, the app automatically enables Wi-Fi on boot and starts the data stream. However, for devices running Android 10 and later, apps cannot directly control Wi-Fi settings. Therefore, you need to ensure your device's Wi-Fi is enabled before shutting down or restarting. This allows the system to automatically restore the Wi-Fi state when the device boots up. Additionally, make sure the app is not restricted from performing background activities, which you can adjust through your device's system settings.

### Video Demo
A demonstration of Sensagram's sensor data streaming capabilities via UDP, utilizing a Python script within Blender to map phone orientation and dynamically control the rotation of a 3D object. See [rotate.py](https://gist.github.com/a5b1247b1999848fe16dda340335dfe6.git)

[![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/IxHCX9Im31A/0.jpg)](https://www.youtube.com/watch?v=IxHCX9Im31A)



## Installation
Download apk from [release](https://github.com/umer0586/SensaGram/releases) section. Not available on F-Droid yet
[<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png"
alt="Get it on F-Droid"
height="100">](https://f-droid.org/packages/com.github.umer0586.sensagram/)

OR

Download apk from [release](https://github.com/umer0586/SensaGram/releases) section.

0 comments on commit b5be0be

Please sign in to comment.