TARS GPT - a Hilarious AI Weather Reporter

by Arpan Mondal in Circuits > Microcontrollers

536 Views, 8 Favorites, 0 Comments

TARS GPT - a Hilarious AI Weather Reporter

Building a Mini Interstellar TARS That Delivers Hilarious Weather Reports | AI Powered!
Youtube thumbnails.png
Screenshot 2025-01-27 181058.png
Screenshot 2025-01-27 181128.png
Screenshot 2025-01-27 181154.png

Meet TARS. The most humorous AI weather reporter you'll ever encounter. If you're not familiar, TARS is the highly advanced, AI-driven robot from the movie Interstellar. He's known for his witty sense of humor and great loyalty to the human characters, particularly Cooper and the crew.

To celebrate the movie's re-release in India for its 10th anniversary, I made this miniature version of TARS with that same hilarious sense of humor.

This mini-TARS is actually a weather reporter. Well, sort of. He has an OLED display on the front where he reports the current weather in his own unique way. For example, if it's scorching hot, he might say something like his circuits are frying, and if it's too cold, he might complain that his software will freeze any minute. It's all unique because he's powered by Gemini AI.

He'll add a fun, sarcastic touch of humor to your desk and bring a smile to your face whenever you glance at what he's saying. His responses update every hour, so he's quick to react to, say, a sudden rainfall.

Alright, now let me show you how I created this funny little robot companion!

Supplies

esp8266 microcontroller Link to buy

0.96 inch OLED display Link to buy

2x small neodymium magnets Link to buy

2x small iron discs

Soldering iron

Wires

Glue

Concept

Screenshot 2025-01-27 181446.png

Despite how it might sound, this project is actually pretty easy to build. Or, at least that's what I thought before trying to program the logic. But we'll get to that in a bit.

The concept is straightforward. First, we grab the weather information for our current location using the OpenWeatherMap API. Then, we send that weather data over to the Gemini API with a simple prompt, asking Gemini to summarize the weather with a bit of humor.

Once Gemini replies, we display the result on an OLED screen. And the whole thing is powered by an inexpensive ESP8266 board, called Wemos D1 Mini.

Working With Gemini

Screenshot 2025-01-27 181751.png
Screenshot 2025-01-27 181831.png
Screenshot 2025-01-27 181846.png

I first signed up on Google AI studio and got an API key. Then, I went through the documentation and wrote a simple python script to check how the API works.

I first asked Gemini for the weather for my current location. The answer tells us two things. Firstly, the output is in JSON format and we need to extract the text from this section. Secondly, Gemini does not have access to real time information, we cannot ask it the weather. If it could, it would save us some coding effort.

Anyway, to solve this issue, we fetch the weather from a different API called Openweathermap. I have explained how to set it up in a previous Instructable. Once we have the weather, we extract the temperature, humidity, and condition and send this over to Gemini.

You can fine my python code attached below.

Downloads

Prompt Engineering

Screenshot 2025-01-27 182310.png
Screenshot 2025-01-27 182330.png

After cleaning things up a bit, I was getting some pretty good results. But, we still have a few kinks to work out. First off, the answer is way too long to fit on our little OLED display. Secondly, Gemini's adding some extra sentences at the beginning that we don't really need. We just want that humorous sentence. And third, it doesn't quite sound like something TARS would say.

So, to fix this, let's go on a little side quest and do some prompt engineering. Basically, we need to be a bit more specific with Gemini about what we're looking for.

First, let's tell it to keep the answer between 50 and 60 characters. That'll be the perfect length to fit on our OLED display. Next, we'll instruct it to imagine it's a humorous AI and describe how the weather feels. Finally, we'll tell it to reply only with the humorous sentence and nothing else.

Here's how the prompt looks like: "You're a humorous AI robot. Describe this weather in a hilarious way. Your answer should be between 50 and 60 characters. Respond with only the humorous sentence and nothing else: {weather_data}"

As you see in the images, now we have a perfect response!

Making the Body

Screenshot 2025-01-27 182750.png
Screenshot 2025-01-27 182740.png
Screenshot 2025-01-27 182806.png
Screenshot 2025-01-27 182824.png

So, to make TARS's body, I found an awesome template on Reddit. I simply downloaded it, scaled it up just enough to fit a standard 0.96-inch OLED display, and printed it out on some nice, glossy poster paper. You can find the template PDF attached below. Make sure to print it on A3 size paper.

Next, I carefully cut out the different sections from the template and also cut a rectangular hole where the OLED display is going to sit. Then, using a screwdriver, I scored along the edges to make it easier to fold, and carefully folded the paper along those lines.

Downloads

3d Printing

screenshot_2024-12-23_101414_YM7Qwd1g0k.png
screenshot_2024-12-23_102311_bns0Z4ENVk.png
screenshot_2024-12-23_101737_QdS6wRbDkt.png
screenshot_2024-12-23_101537_e94Vq8gubg.png
screenshot_2024-12-23_102808_YquAHFxpqu.png

In case you are planning to take the 3D printing route, you can download the STL file from services like thingiverse (here's one example: https://www.thingiverse.com/thing:567688) and either print it yourself or use an online 3D printing service like Justway.

First, head over to https://www.justway.com and select 3D printing. You also have options like CNC machining, injection Molding and Urethane Casting. But for this project, we will use the 3D printing service.

Click on "upload your design". A new page will appear. Here, you need to click on "Select CAD files" and upload the STL file.

After that, select the Quantity, Material (I recommend PLA or ABS for this project). In the color section, you can either select white and paint it later, or select the color you like directly in the 3D print. This will save time later.

Finally, after selecting all the options, you can enter your email and submit the request to get a quote.

Another way to do it is to use the resin 3D printing option. In this, you'll find surface finish options like Matt spray-painting, which will be perfect for this project. This will eliminate the rough finish of a standard PLA/ABS 3D printing.

This is a great option, especially for complex prints which might be tricky to print at home with low-end printers. Plus, you get options like surface finishing and resin 3D prints.

Glue Magnets

Screenshot 2025-01-27 182931.png
Screenshot 2025-01-27 182945.png

On the sections that go at the two ends, we need to glue some magnets. This is going to allow them to stick to the central sections and move around freely, just like TARS.

Similarly, we'll glue two metal discs to the central section so that the magnets on the ends can snap right into place.

I actually salvaged these magnets and discs from a broken pair of earphones.

Solder

Screenshot 2025-01-27 183130.png
Screenshot 2025-01-27 183109.png

Alright, now it's time to solder some wires to our D1 Mini and the OLED display. I'm using a dual-color display where the top few rows of pixels are yellow, and the rest are blue. I thought it would give it a unique look.

Here's how we'll make the connections:

  1. VCC on the display goes to the 5V pin on the D1 Mini.
  2. GND goes to GND
  3. SCL goes to D1
  4. SDA goes to D2

Test the Display

Screenshot 2025-01-27 183357.png
Screenshot 2025-01-27 183407.png
Screenshot 2025-01-27 183422.png

Time to upload a test code to see if our display is working properly. I used a simple code that displays a solid rectangle. But the display showed some black bars, which you can see in the above images. This likely means the display is partially damaged.

But, instead of ordering a new display and waiting over a week for it to arrive, I decided to get a little creative. I adjusted the code to align the text so it only appears on the working lines, avoiding those black bars. This reduces the usable space on the already tiny display, but the short sentences Gemini will be generating should fit just fine.

Downloads

Assemble

Screenshot 2025-01-27 183523.png
Screenshot 2025-01-27 183532.png
Screenshot 2025-01-27 183547.png
Screenshot 2025-01-27 183510.png
Screenshot 2025-01-27 183608.png

Alright, now we can tuck the display and the D1 Mini inside TARS' central section, fitting them into the cutouts we made earlier.

I also made a small hole on the back to feed a micro USB cable through, which will power the D1 Mini. The beauty of powering it directly with a cable is that we can easily reprogram the microcontroller later by simply plugging the other end into our computer.

Finally, I used glue to secure each section together. Now, thanks to those magnets, the two end pieces should snap right into place with a satisfying click!

Code

Screenshot 2025-01-27 183819.png
Screenshot 2025-01-27 183828.png
Screenshot 2025-01-27 183842.png

I adapted my Python code to create an Arduino code that performs the same function. The code is designed to call the APIs every hour to stay up-to-date with the latest weather conditions. So, the text on the display should refresh every hour.

It's important to remember that the Gemini API has rate limits. To avoid hitting those, I've added a 30-second delay before the first API call. This way, we don't bombard the API with requests if the power keeps cutting out, for example.

Downloads

Have Fun With Your New Companion :)

Screenshot 2025-01-27 181128.png
Screenshot 2025-01-27 181058.png
Screenshot 2025-01-27 181154.png

Now, plug the USB cable into a power source and let TARS make the most hilarious weather commentary!

I hope you enjoyed this project and are inspired to build your own, because it's actually a pretty straightforward build. If you have any ideas on how to improve it, I'd love to hear them, so feel free to leave a comment below!