📟 SAM – Send A Message v1.0

đź”§ Getting Started

Follow these steps to set up both the ESP32 CYD firmware and the Flask dashboard so your SAM device can receive and display messages.

âś… Prerequisites

📲 ESP32 CYD Firmware

1. Open the Firmware Folder

Navigate into the firmware folder:

cd SAM-CYD/src/main
            

2. Update config.txt

Edit config.txt to include your Wi-Fi and API server details. Example:

device_id=samID
ssid=YourNetworkSSID
password=YourWiFiPassword
api=http://<SERVER_IP>:5000/api/sendMessage
            

• device_id: Unique identifier for your device • ssid & password: Your Wi-Fi credentials • api: URL of your Flask dashboard’s endpoint

3. Load & Upload Arduino Sketch

Open your Arduino IDE (or PlatformIO) and open SAM-CYD/src/main/main.ino. Ensure the board is set to ESP32 Dev Kit (or equivalent ESP32 target). Then click “Upload” to flash the firmware.

Once uploaded, the ESP32 will reboot, connect to your Wi-Fi, and wait for incoming messages from the dashboard.

4. Verify Connection on Your Device

If Wi-Fi credentials and API URL are correct, the TFT should show:

  • Device ID: samID
  • Status: Connected to Wi-Fi
  • “Awaiting messages...” prompt

đź’» Flask Dashboard

1. Enter the Dashboard Directory

Switch to the dashboard folder:

cd SAM-CYD/src/web_dashboard
            

2. Create & Activate Virtual Environment

(Recommended to isolate dependencies.)

python3 -m venv venv
source venv/bin/activate   # (Windows: venv\Scripts\activate)
              

Install required Python packages:

pip install -r requirements.txt
            

3. Run the Dashboard

Launch Flask so it listens on all interfaces at port 5000:

flask run --host=0.0.0.0 --port=5000
            

• If Flask complains about missing `FLASK_APP`, set it first: export FLASK_APP=app.py (Windows: set FLASK_APP=app.py).

4. Access the Dashboard in Your Browser

Visit http://<SERVER_IP>:5000/ (e.g. http://192.168.1.100:5000/). You should see a form to enter:

  • Sender: Name displayed on the TFT
  • Message: Text to show on the device
  • Timestamp: Auto-generated or custom (e.g. 2025-06-06 14:30)

⚙️ Configuration Recap

Your ESP32 CYD reads config.txt for Wi-Fi & API details. Example content:

device_id=samID
ssid=MyHomeNetwork
password=SuperSecurePass
api=http://192.168.1.100:5000/api/sendMessage
        

Make sure the API URL matches exactly where your Flask dashboard endpoint is reachable.

✔️ Verify End-to-End

1. On the web dashboard, send a test message—e.g.:

Sender: Alice
Message: Hello, SAM!
Timestamp: (automatically set)
        

2. The ESP32 CYD TFT should display:

If nothing appears, check: