This project was completed in collaboration with sculpture art students, the visual and decorative components of this project were made by my partner for this project.
This sculpture project was inspired by the theme of "Struggle". To illustrate this theme, we settled to focus on the idea of mental struggles, and how people experience those hardships. We needed to integrate an online data source to inform the physical behavior of our project based on some real-world events or data.
As "mental struggles" are hard to quantify, and finding an API or data source for the topic proved difficult, I settled on building my own API from scratch using social media APIs to construct a real-time "mental health" indicator. My API utilizes the Bluesky API SDK to read recent posts and the VADER sentiment analysis library to determine the sentiment of text. Together, I used these tools to develop an API that can be used to broadly model recent sentiments in social media, usually determining whether a majority of people are happy or sad.
PYTHON SENTIMENT APIThe API is essentially a Flask python web server hosted on a personal device that I expose to the internet using a reverse proxy. There's no particular reason to use a reverse proxy over other methods, but it was the easiest to get things working quickly in my use case.
Every day at 12:00 PM the server will request around 500 new posts from Bluesky posted within the last day. It does this by looking for posts with particular mental-health related keywords such as "anxiety" or "stress". Then, it performs sentiment analysis on the text content of each post and saves them into a list. Using these sentiment scores, it can calculate the "sentiment index" in a few ways, such as a simple average or threshold.
Once this index is calculated and stored, navigating to '/get' on the web server will return the value. This way, you can programmatically retrieve the sentiment value from any device with an internet connection.
All the components are wired together on a protoboard. I attached a power jack to ground and VUSB so you can power the micro controller without needing to connect it to USB (make sure to use the proper voltage adapter or you might fry your components, for the Photon 2 that's 5V). The lights are 3 separate RGB LEDs wired in series.
For the firmware, the micro controller will check the sentiment API at the beginning of every new day (12:00 AM). Once it retrieves the current sentiment index, it updates its behavior and the visual appearance of the sculpture.
As the sentiment index increases, the color of the lights will transition from a cool purple color to a warm orange one.
When the sentiment index is below 0.25, the servo will spin erratically.
When the sentiment index is below 0.5, the servo will spin slowly.
When the sentiment index is above 0.5, the servo will remain stationary.
PROCESS/HOW IT WAS DONEIn the beginning, my first step was to find an API that could supply information about mental health. Due to there not being any easy ones to use, I settled on building my own.
After building the API, I started by wiring my components onto a simple breadboard. This helped give me an idea about the layout of my circuit and plan for writing the firmware.
I then wrote the firmware for the micro controller. This included using Particle's "Integrations" system of their cloud service. It is the primary way the Photon 2 interacts with web services. I also used a serial monitor a lot to debug any issues.
Once the firmware was complete and working, I moved the components onto a protoboard and soldered them together. Then, me and my partner moved the components into the sculpture and hot glued them in appropriate places.
FINAL PRODUCTHere are some pictures and videos of the project in action:
Comments