The ESP32 AI TextBot

by lennoxlow in Circuits > Arduino

682 Views, 8 Favorites, 0 Comments

The ESP32 AI TextBot

output.gif
FQCVPM8MEBUQE44.png

Ever wanted to google something but you don't have data or a stable connection?

Maybe you want an AI assistant that will text you back?

TETHER - your overkill, SMS sidekick that lives in a sealed box.

Inside the device:

  1. An ESP32 does all the heavy lifting and keeps track of who’s texting and remembers the conversation.
  2. A GSM/SIM module receives your messages and sends replies.
  3. Wi-Fi (optional but recommended) lets it contact ChatGPT for snappy answers.
  4. Power comes from a 5V source - However you decide ( I use a USB-C power decoy )


This isn’t just a tool - it’s your customisable assistant!

It also remembers your conversation for a 5 minutes before ghosting you.

Here’s a video I made - I highly recommend watching the first section - It shows my motivations, the general idea and me giving it emotions (last section - It became too clingy).

Supplies

changed2.png
changed.png
Screenshot 2025-08-17 at 8.06.47 AM.png

ESP32 (any variant, Here I use the DEV-V1) - Overkill for SMS, underkill for world domination but the perfect amount of headroom to let your creativity run wild

A7670SA GSM Module - This can be region specific so please check variations for your region.

SIM Card - Must have SMS credit. But unlimited texts are much cheaper than data.

5V Power Source - USB, LiPo, or a power decoy.

Wi-Fi - For chatting with ChatGPT. I suppose you could use the mobile data..... but why?

Arduino IDE - Or PlatformIO if you like syntax errors more elegantly.

How It Works

ChatGPT Image Jul 29, 2025, 06_35_37 PM.png

When you text the device, it texts back.

Simple. Mysterious. Unsettling?

Here’s what happens behind the scenes:

  1. You send a text message from your phone (something like “hey” or “How tall is Shrek?”).
  2. The SIM module (GSM modem) receives your SMS and passes it to the ESP32 over serial.
  3. The ESP32 interprets the message, logs your number, and decides what to say back.
  4. It can give you information.
  5. It can sass you (Depending on the personality you give it) .
  6. The reply is packaged up and sent back out through the SIM module as a text message.
  7. You stare at your phone, questioning reality as robots feed you information.
  8. Meanwhile, the ESP32 is keeping track of your “session” until you stop talking to it. Then it wipes its memory.

That’s it. Just raw SMS.

If you follow along, you’ll be building a device that’s:

  1. Textable
  2. Self-contained
  3. WiFi-optional
  4. And capable of being sealed away in a mysterious box where it just… talks to people

Wiring Overview

MSPaint.png

Now we give life to TETHER by connecting its electronic innards.

Luckily, there’s no tight orb shell this time (unless you put it in one - in which case,I bless your cable management journey).

Basic Connections:

SIM800L / A9G / GSM Module

  1. TX → ESP32 RX2 (GPIO 16 by default)
  2. RX → ESP32 TX2 (GPIO 17 by default)
  3. GND → ESP32 GND
  4. VCC → 5V ( but make sure your module is happy with it - some are divas and prefer 4V-ish)

ESP32

  1. USB-C / Li-ion battery via charging module for power
  2. WiFi antenna = built-in

Power Chain:

  1. If using a Li-ion battery (NOT RECOMMENDED):
  2. Battery → TP4056 charging module
  3. TP4056 OUT+ / OUT- → (direct to GSM module + ESP32 5V pin if boosted)
  4. If using a 5V supply (RECOMMENDED):
  5. Direct 5V → ESP32 5V pin + GSM module VCC
  6. Important: GSM modules draw spikes of 2A+ when transmitting, so don’t starve it - otherwise it’ll faint.

💡 Tips:

  1. Keep your GSM antenna connected - otherwise, your bot will be screaming into the void.
  2. If using jumper wires, keep them short.
  3. The GSM module is power-hungry. Give it a solid power source, not some sketchy USB cable you stole.
  4. Share a common ground between the ESP32 and GSM module. If you don’t, the module will ignore the ESP32.
  5. Hot glue is optional here, but recommended if you don’t want your module flopping around inside the enclosure like a fish. It's non conductive, so why not fill the whole thing?


The Code

The Arduino sketch is the real puppet master here. Once it’s on the ESP32, it’ll:

  1. Boot up the ESP32 and GSM module
  2. Connect to your mobile network using a SIM card
  3. Wait patiently for incoming SMS messages
  4. Forward those messages to ChatGPT via WiFi (it’s bilingual: SMS + Internet)
  5. Receive ChatGPT’s reply and transmit it back to your phone as an SMS
  6. Manage multiple users at once, keeping a short-term memory per phone number (until they ghost it for 5 minutes, at which point it forgets them)
  7. Optionally accept OTA (over-the-air) updates so you don’t have to break into the enclosure every time you typo Serial.print.

The responses can be as helpful, cryptic, or unhinged as you want - all customizable in the code.

Make sure to get an api key from OpenAI and paste it in the top of the file along with your wifi credentials.


How to Upload:

  1. Open the Arduino IDE.
  2. Install the required libraries:
  3. WiFi.h (built-in)
  4. HTTPClient.h (built-in)
  5. ArduinoJson
  6. ArduinoOTA (if you want OTA magic)
  7. Select the correct board:
  8. Board: ESP32 Dev Module (or whatever ESP variant you’re using)
  9. Port: The COM/USB port your ESP32 is hiding on
  10. Insert a SIM card into the GSM module (make sure it has an active SMS plan - otherwise you're just making a fancy brick).
  11. Plug in your ESP32 via USB or use OTA if already enabled.
  12. Hit Upload.
  13. Done! Your ESP32 now speaks fluent SMS + ChatGPT.

Debugging Tips:

  1. Use the Serial Monitor if you’re plugged in - it’s your therapist when things go wrong.
  2. If OTA is enabled, you can update wirelessly without opening the case (highly recommended if your box is sealed with glue, tape, or tears).
  3. No reply? Check your SIM balance, antenna placement, and whether you accidentally angered the cellular gods.
  4. 👉 Full code and setup guide available on GitHub here

Downloads

The Enclosure

output.gif
Screenshot 2025-08-17 at 8.14.44 AM.png
Screenshot 2025-08-17 at 9.02.40 AM.png
Screenshot 2025-08-17 at 8.15.23 AM.png

To contain this ESP32 + GSM contraption, you’ll want a box, case, or shell.

Mine is sealed shut so it can’t be tempted to escape.

You don’t have to copy my exact setup - feel free to design your own container: a cube, a cyberpunk lunchbox, a duct-taped sandwich, whatever you have on hand.

Design Tips If You Make Your Own:

Make sure your enclosure has space for:

  1. ESP32 board (whichever variant you’ve used)
  2. GSM module
  3. SIM card slot access (unless you can manage your plan without needing it)
  4. Power system: USB-C, LiPo, or 5V decoy adapter
  5. Antenna clearance (I drilled a hole for this)

Also consider:

  1. Ventilation holes if you don’t trust heat management
  2. Access to reset / OTA triggers
  3. LEDs or viewing windows just in case there is an issue

Assembly (My Build):

  1. I mounted the ESP32 and GSM module side by side
  2. The antenna pokes out through cutouts in the enclosure.
  3. Power is fed from the outside via USB-C.
  4. Hot glue was my main structural engineer.

Sealing the Box:

You have a few options for closing it all up:

  1. Magnets - classy.
  2. Super glue - permanent, .
  3. Melt the edges shut with a soldering iron - for that “why is this smoking?” finish.

Whatever you pick, make sure you can still get OTA working. Otherwise, you’ll be smashing it open the first time ChatGPT forgets a semicolon.

Downloads

Potential Improvements

Passive-aggressive replies - For people who don’t use punctuation.

Voice module - Let your ESP read replies like a tiny robot overlord.

Admin commands - Text “RESET” and watch it flip tables silently.

Daily quests - Because your ESP should have a side hustle.

LED mood lighting - Make it glow ominously while texting.

Wrapping Up

FQCVPM8MEBUQE44.png

Remember, this isn’t a strict “do this, get that” tutorial. The true reward:

  1. Learning how to add SMS to any ESP32 project.
  2. Seeing how AI can gossip via your electronics.
  3. Adding OTA updates for ultimate sealed-container convenience.
Final warning: Do not blame me if your ESP starts texting your ex with sass.


Please don't use this for evil.