BrainPlay - Howest MCT

by ChadiaWillems in Circuits > Raspberry Pi

23 Views, 0 Favorites, 0 Comments

BrainPlay - Howest MCT

B1C2ECBC-11F5-438D-B63F-90B8F8624FCB.png
12ABF2D3-980D-48D0-BFA2-479DC267ED57.png

Brainplay is a smart, interactive play cube designed to monitor cognitive and motor function in people with dementia, even when they are still living independently at home.

The cube features four interactive games that test reaction time and fine motor skills. A connected web dashboard collects data from these games and displays it in graphs, giving caregivers or relatives a clearer picture of the user’s condition and progress over time.

Note: A better photo of the final prototype is coming soon.

Supplies

Building the Electronics Circuit

D97876F6-3616-4189-B640-E09FCAB1D120.png
Screenshot 2025-06-14 at 15.40.37.png
Screenshot 2025-06-14 at 15.40.18.png

This step involves connecting all the hardware components to the Raspberry Pi and configuring the power setup.

Key Instructions

  1. The LCD screen is connected via a PCF8574 I²C expander to save GPIO pins.
  2. 5 LEDs are connected via another PCF8574, with the A0 pin connected to 3.3 V instead of GND.
  3. The LDR sensor and joystick axes are analog and connected to an MCP3008 on the SPI bus.
  4. All other digital components (button, buzzer, encoder, etc.) are connected to GPIO pins.

Important:

  1. The RFID reader must be connected to CE0. It is hardcoded to work on that chip-select pin.
  2. The MCP3008 should be connected to CE1.
  3. To prevent overloading the Raspberry Pi, power your components using a separate 3.3 V and 5 V external supply.

Preparing the Raspberry Pi

We’ll now install the operating system and set up network access.

What You’ll Need

  1. Raspberry Pi
  2. MicroSD card
  3. Raspberry Pi Imager

Instructions

  1. Open Raspberry Pi Imager on your PC.
  2. Insert the microSD card and select:
  3. Your Pi model
  4. OS: Raspberry Pi OS Lite (64-bit) recommended
  5. SD card as the storage device
  6. In the “advanced options,” configure:
  7. SSH (enable)
  8. Username & password
  9. Wi-Fi (optional)
  10. Click Write and wait for it to complete.
  11. Insert the SD card into the Pi and connect it to your network using a LAN cable.
  12. Connect to it via SSH using the IP address (findable via router or tool like ping or arp-scan).

Troubleshooting tip: If SSH fails, check firewall settings, IP config, or try connecting via HDMI + keyboard.

Creating Database

Screenshot 2025-06-14 at 15.43.18.png

This step involves setting up a database for storing user data, sensor logs, and game statistics.

What It Does

  1. Saves game sessions
  2. Tracks user performance over time
  3. Avoids hardcoded front-end content

Files & Tools

  1. Use the brainplay.sql file to import the full schema and tables.

Available on GitHub:

  1. Data > brainplay.sql

The ERD (Entity Relationship Diagram) for the database is also provided.

Coding the System

Screenshot 2025-06-14 at 16.45.16.png
Screenshot 2025-06-14 at 16.45.22.png
Screenshot 2025-06-14 at 16.45.28.png

Your code is split into a frontend and a backend, each with its own responsibilities.

Frontend (HTML, CSS, JavaScript)

Before coding, I recommend prototyping your interface in Figma. This will help plan layout and flow—especially useful since the UI is optimized for mobile use.

Above you’ll see my Figma design as an example.

Backend (Python + FastAPI)

The backend controls all sensor logic and communication with GPIO pins.

  1. I use FastAPI to serve the backend.
  2. Custom Python classes manage each sensor.
  3. For RFID, I use the SimpleMFRC522 library.
from mfrc522 import SimpleMFRC522
reader = SimpleMFRC522()
id, text = reader.read_no_block()

If this library doesn’t work, search online for alternative forks or libraries.

📎 GitHub paths:

  1. Backend > app.py
  2. Front > script > app.js

Building the Enclosure

D620F192-421D-423D-BBDB-C0841AC24428.png
0AC6BF8A-EFC3-4D5F-AEF5-A4837E2A57D5.png
18BFDE25-13B7-49C5-95D4-BB64055C4EFC.png
FFDB5E71-E9DF-44A1-934E-31C30C3287A1.png
C6EA2E58-21E2-485E-90D8-0AB4EC832A04.png
26F77170-F854-442F-9946-F965453563FE.png

For the casing, I laser-cut a cube out of 3 mm MDF.

Assembly Instructions

  1. Use wood glue to assemble the cube.
  2. For the servo motor door, I:
  3. Glued a thin screw into the motor’s top with super glue.
  4. Attached the screw to a small wooden square on the door.

All interior parts are fixed using a combination of wood glue, super glue, or hot glue depending on the component.

Technical drawing available at:

  1. Docs > behuizing.ai

Conclusion & GitHub

You can find the full project, including code, diagrams, and designs, here:

🔗 GitHub Repositoryhttps://github.com/howest-mct/2024-2025-projectone-mct-ChadiaWillems

Feel free to recreate or adapt this project!