Posture Pal with Walabot – Real‑Time Distance Monitoring to Stop Neck & Back Pain
Keep your neck and back healthy by monitoring your sitting posture in real time. The Posture Pal system pairs a Walabot distance sensor with a Raspberry Pi and a custom Android app to provide instant feedback and prevent pain from slouching.
Hardware Components
- Walabot
- Raspberry Pi 3 Model B
Why I Built Posture Pal
Most professionals spend 7–8 hours a day at a desk. A common issue is a forward‑tilting head and a rounded spine, which place excess load on the cervical spine. A 15° head‑forward posture can double the effective weight on the neck, raising it from 10–12 lb to 27 lb (4.5–5.5 kg) [1]. Studies show that a 20° neck flexion doubles the likelihood of work‑related neck pain.
I created Posture Pal to provide gentle, data‑driven reminders that help users maintain proper posture without cumbersome equipment. The current release features an open‑source Android app that notifies users when they are too close to the screen.
Step 1: Start the Server on the Pi
1. Install the Walabot SDK on your Raspberry Pi. 2. Use Flask to expose the Walabot distance data via a simple web API. 3. Clone the server code from GitHub and run it.
pip install flask --user git clone https://gist.github.com/justinshenk/aa1e1eb7ceb87fd82f0b655b5ad20c8a posture-server cd posture-server python3 server.py
The server.py script creates two endpoints:
/set – receives the current distance from Walabot.
/status – returns the last measured distance as JSON.
#!/usr/local/env python
import json
import time
from flask import Flask, jsonify, request, Response
app = Flask(__name__)
distance = 0
@app.route('/set')
def set():
global distance
distance = request.args.get('distance')
return jsonify(distance)
@app.route('/status')
def status():
return Response(json.dumps({'status': distance}))
if __name__ == '__main__':
app.run(host='0.0.0.0', port=3000)
In a second terminal start the Walabot distance measurement loop:
python3 distance.py
The script reads the target depth via wlbt.get_targets() and sends it to the Flask server:
targets = wlbt.get_targets()
distance = str(targets[0].zPosCm)
import requests
r = requests.get("https://localhost:3000/set?distance=" + distance)
Step 2: Launch the Android App
Download the pre‑built APK or clone the source from GitHub: Walabot‑PosturePal. The app uses GraphView for live plotting and HTTP long polling to retrieve the distance every second.
// Fetch distance via JsonObjectRequest
String url = "https://192.168.0.100:3000/status"; // replace with your Pi IP
final JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(
Request.Method.GET, url, null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Double distance = 0.;
try {
distance = response.getDouble("status");
// Update graph
dataset = updateData(dataset, distance);
// Update text display
currDistance.setText("Distance: " + String.format("%.2f", distance));
} catch (JSONException e) { e.printStackTrace(); }
// Poll every second
new Timer().scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
queue.add(jsonObjectRequest);
}
}, 0, 1000);
}
}
);
Step 3: Calibrate
Use the app to set a baseline posture and adjust the sensitivity threshold. This ensures alerts trigger only when you drift beyond your comfortable range.
View the full source code and documentation to build or modify the system for your own use.
Manufacturing process
- Softening Tissues: How Lotion Enhances Comfort & Performance
- How to Read Temperature with a DS18B20 on Raspberry Pi 2
- Measuring Temperature on Raspberry Pi with Maxim 1‑Wire Sensors and DS2482 I2C Bridge
- Accurate Temperature Monitoring in a Server Closet with Raspberry Pi
- Walabot Touchpad: Transform Any Surface into a Wireless Touch Interface
- Walabot‑Powered Toilet Hygiene Monitor
- Mastering Robotic Transfer Systems with Laser Distance Sensors
- Arduino‑Powered HID UPS: Upgrade Your Dummy Power Supply to USB‑Compatible Backup
- Build an IR Sensor Project with Arduino UNO – Simple Guide
- Efficient 3‑Pin Wireless Sensor Transmission with nRF24L01+ and ATtiny85