Twitter Mood Lamp Help

Hello

I’m a hobbyist and ran into a dead end with my searches in Google and GitHub.

I’m trying to make a Twitter Mood Lamp using an ESP32 and RGB LED. Here is the ESP32 I’m using: https://www.amazon.com/dp/B08246MCL5?ref=ppx_yo2ov_dt_b_product_details&th=1

I would also like to use this autoconnect or something with the same functionality as I would like to give this lamp as a gift.

https://github.com/bnbe-club/wifi-autoconnect-diy-13

Currently, I have a python script running on a server every hour on the 30-minute mark that uploads a txt file via FTP. This txt file is a result of pulling the top 50 trending tweets in the US, and then looking at 1000 of those tweets per trend to assign an emotion based on tokenized tweets and applying NRCLex 3.0.0. The text file is named ‘rank.txt’ and contains the top 5 moods for that hour period.

Here is the list of emotions, and the color I was considering attaching to them.

mood color
fear (169, 34, 10)
anger (255, 0, 0)
trust (0, 255, 0)
surprise (0, 153, 204)
positive (255, 255, 204)
negative (113, 22, 3)
sadness (0, 0, 255)
disgust (153, 51, 255)
joy (255, 255, 0)
anticipation (255, 102, 0)

This is an example of the rank.txt file contents:

Sadness 1.0

Positive 2.0

Joy 3.0

Anticipation 4.0

Trust 5.0

I would like for the ESP32 to pull the rank.txt file and use that information to determine the color the LED should display every hour on the :00 mark. I would also like to for the colors to fade into one another and be able to have each of the 5 emotion color to display for different times. For example, the first emotion color to show for 60 seconds, and the second emotion color showing for 45 seconds.

I also have the ability to write the emotion list every hour to a postgres database if that opens any possibilities.

Any assistance or a point in the right direction would be greatly appreciated.

Thanks for your time,

Alan

I expect you can find examples of an ESP pulling a file from FTP or data from postgres. More commonly, Arduino projects use MySQL as a database so it's easier to find examples.

For such a small amount of data, I'd build a little API that returns a string that the ESP can easily GET and parse. Might be JSON, might be some custom text format. Again, examples doing such things are not hard to find.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.