Blog - Sketching with Hardware

Team 7 – Karl the Typewriter

Published on: | Author: Philipp Kramer | Categories: 2015b, Projects

Team 7

Hello! We’re Simone and Philipp, Team 7 of “Sketching with Hardware 2015b”.
We present our project Karl the Typewriter, an old typewriter that’s not only a medium of communication but also an intelligent communicator.

Brainstorming

One of the first ideas that stuck, was to use some sort of
bot or artificial intelligence as the Internet-part of the project.
This means the user will be communicating through whatever device
we will be modifying.

Some “old things” that came to mind included a crystal sphere,
an old radio and a telephone.

But since all of these options raised further questions on how to capture
user input, we decided to use a typewriter for the following reasons:

  • The user can just type what he wants to input
  • The user is given immediate analog feedback wich maintains the typewriters original function and makes the usage of Karl very intuitive
  • output can be done via text to speech audio, or a display.

 

first sketch:

skizze

Building

We started by wiring up the typewriter’s keys. For this we used
the typewriter’s internal metal frame as the positive pole.
The keys were connected to 32 digital input pins on the Arduino.
To protect the input pins 32 100 Ohm resistors were used, as well as
32 pull-down resistors, to keep the pins signals from flipping.

t7_key_contacts

 

t7_platine

 

Next a sketch for accepting the input signals was created.

After some testing and fixing connections, all the keys were wired up
and there signals were mapped to the corresponding letters.
The “dot” key was chosen as “Enter”, backspace to reset the input.

Now it was time to get Wifi working. After some minor difficulties,
the Wifi module was sending and receiving HTTP requests.
To keep parsing effort to a minimum, a small PHP script to serve as a
proxy between the Arduino and th API was created.

All the Arduino has to do is send a simple HTTP-GET request to the script. The script would then relay the user input to the API, parse the response using PHP’s SimpleXML, and then just return the plain answer to the Arduino.

For the output, a small, 2 x 16 characters LCD was used. The “LiquidCrystal”-library provided a set of functions for easy use of the Display. Some more code was written, to make the text scroll, in case the text is longer than 16 chars.

t7_lcd

 

t7_lcd2

 

While everything was working now, all the electronics was spread out
on the desk. To take care of that, we cut a hole into an old suitcase,
dropped everything inside, and put the typewriter on top.

t7_putting_it_tohether

Of course after that nothing worked anymore. Oh well.
Two hours of checking and fixing contacts and connections later,
Karl came finally to life.

t7_done

 

Result

The end result of our hard work was a typewriter, where someone could type a question or message, which then would be relayed to a chat bot. The bot’s response would than be shown on a Display.

The Hardware used consisted of:

  • Arduino Mega
  • ESP8266 Wifi Module
  • LCD-Display Module
  • red & green LED
  • a whole lot of resistors and wiring

On the software side, code was written to:

  • compute the keys input
  • send the request via the Wifi
  • format and output the response on the LCD
  • PHP Script to parse the API response

Besides cold contacts, we faced some additional problems:

To separate the API’s response from the HTTP headers, some control characters were used in order to cut out just the response string,
using Arduino’s build in string functions.

When we realized that using the Seeed Music Shield V2 to playback the API response as text to speech audio would take way too much effort, we decided to restrict output to the LCD.

And finally: The API we used throughout the project, “Cleverbot”, stopped responding, right on the morning of presentation day!

Disaster.

Apparently our many requests throughout testing seemed to have us getting banned, or something ?!?!?

Fortunately, a working alternative in the form of “Brain Bot” was quickly found. After adjusting the PHP script to process the new Bots XML response instead of the old ones JSON, Karl the Typewriter had a new Brain, and was ready for his great act.

linked categories 2015b, Projects

|

Write a comment

Comment