Code Monkey home page Code Monkey logo

trs80-twilio's Introduction

TRS80-Twilio

Sending a text message from a TRS-80 Model 100 using the Twilio SMS API and an ESP8266.

This is one of my entries to the Twilio Hackathon on DEV (2020).

Here are the links to my submission post and demo.


TRS80-TWILIO

Background

After I decided I was going to participate in the Twilio hackathon I stumbled across documentation for using an ESP8266 to send an SMS. Naturally, I decided to take it a step further and make a complete coding abomination. The basic goal was to use a vintage computer as a frontend and an ESP8266 as a backend to send a text message. This probably won't get judged (I can't blame them), but this was one of the funnest projects I've ever done.

I started out making the "frontend" on a TRS-80 Model 4P using BASIC and Z80 assembly. To summarize, I woke up one morning and my old computer no longer worked...Read more at test/TRS80-4P. So, I had to start from scratch 5 days before the due date of this hackathon. I recently bought a cheap TRS-80 model 100, so I switched over to learning how it worked.

TRS80-TWILIO

To my surprise, it was magnitudes easier to work with than the TRS-80 model 4P. With the model 4P, I was forced to embed Z80 machine code into BASIC in order to write to its serial port. With the model 100, all I had to do was open the serial port like a file and print to it...amazing. The primary frontend file is TWILIO.BAS. The frontend's job was to:

  • provide a simple interface to input a phone number and message
  • build a buffer of 145 bytes from user input
  • basic phone number validation
  • send buffer to the ESP8266 via RS232 (serial).

The "backend" was pretty easy to build. I recently refreshed on Arduino and learned how to use PlatformIO. The biggest challenge with the backend was waiting for the incredibly slow serial port send all of the data. The primary backend file is src/main.cpp The backend's job was to:

  • establish connection to WiFi
  • output helpful messages to OLED
  • read serial input and parse buffer from TRS80
  • establish connection to Twilio API
  • build and invoke HTTP request to Twilio SMS API

TRS80-TWILIO

Project Layout

TRS80-TWILIO

### Basic Wiring ###

TRS80 DB25 --> DB25-DB9 Null Modem --> DB9 Male-Male --> TTL-RS232 ...

TTL-RS232   ESP8266      Mini OLED
              GND <----> GND
              3V3 <----> VCC
              D1  <----> SCL
              D2  <----> SDA
GND <-------> GND
VCC <-------> 3V3
TXD <-------> D6 (RXD)
RXD <-------> D5 (TXD)

Setup

In case anyone feels inclined to set this up (or I forget how to in the future)

  • Setup Twilio Account using Twilio's documentation
  • Own a working TRS-80 model 100
  • Either enter TWILIO.BA by hand (what I did) or transfer via TELCOM application.
  • Hardware - refer to Project Layout above
  • Install VS Code and PlatformIO extension (refer to Embedded Development in VS Code below)
  • git clone https://github.com/barrettotte/TRS80-Twilio
  • Open repository with VS Code
  • Create include/trs80_twilio_config.h based on include/template_config.h
  • Setup ESP2866, TTL-RS232 breakout, and mini OLED - refer to Project Layout above
  • Connect ESP2866 via USB, compile, and upload with PlatformIO extension
  • On TRS80 Model 100, load TWILIO.BA and execute RUN in BASIC interpreter

There's some other fun stuff included in docs/, have a look.

Embedded Development in VS Code

I decided I would take this opportunity to learn about a new tool, PlatformIO.

PlatformIO IDE Extension

Linux Additional Steps:

References

License

MIT

Disclaimer

No warranty expressed or implied. Software is as is.

As stated in official Twilio documentation (https://www.twilio.com/docs/sms/tutorials/how-to-send-sms-messages-esp8266-cpp) "If this device is deployed in the field you should only deploy a revocable key. This code is only suitable for prototyping or if you retain physical control of the installation."

In no way is this practical or should be recreated. This was solely for fun; don't take this too seriously.

trs80-twilio's People

Contributors

barrettotte avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.