Oh Sit!

An Internet Of Things Project

Created By George Lopez

Oh Sit Logo

About

Oh Sit! is an Internet of Things project designed to track how long a user sits in their chair. It integrates hardware and software, utilizing a Raspberry Pi and a force-sensitive resistor to detect when pressure is applied. The system records the duration of each session, sending the data to a Node server and storing it in a PostgreSQL database. A notification is also sent to their phone, detailing how long they were seated.

How Does It Work?

  1. Detection (Raspberry Pi + Resistor):
    • A force-sensitive resistor connected to a Raspberry Pi detects when pressure is applied (i.e., when someone sits).
    • The Raspberry Pi tracks how long the resistor is pressed.
  2. Data Transmission (Raspberry Pi to Server):
    • When the sitting session ends (when the user stands up), the Raspberry Pi sends the recorded duration to a Node server via a POST request to /api/v1/times.
  3. Storage (Server + Database):
    • The server saves the session data in a PostgreSQL database for tracking and analysis.
  4. Notification (Server to Mobile App):
    • After the user stands up, the server sends a notification to the user's mobile app, summarizing how long they were seated.
Diagram showcasing the system architecture

Figure 1: Diagram showcasing the system architecture

Diagram showcasing the circuit

Figure 2: Diagram showcasing the circuit

Code

Checkout the code below used on the Raspberry Pi:

Tech Stack

Frontend (Mobile App)

Expo

Ecosystem for building the mobile app.

React Native

Framework for building the mobile app.

Backend (Node Server)

TypeScript

Language used to build the server.

Node.js

JavaScript runtime for handling data from IoT devices.

Fastify

Used to set up a server for handling data from Raspberry Pi.

Drizzle

Database ORM for storing and retrieving data from PostgreSQL.

Database

PostgreSQL

Relational database for storing sitting session data.

Hardware (Raspberry Pi)

Raspberry Pi

Computer to collect sensor data and communicate with the server.

Python

Used to interact with the Raspberry Pi and send data to the server.

Gallery

Figure 3: Close up on pin board

Figure 3: Close up on pin board

Figure 4: Image of circuit

Figure 4: Image of circuit

Figure 5: Video of the project

Figure 6: Mobile App Home Page

Figure 7: Mobile App Stats Page

Figure 8: Mobile App Notification

Contact

Please feel free to reach out to me on my socials!