Ticket to Adventure
Ticket to Adventure
What I wanted to learn, and why it interested me: This week, I would like to explore the thermal printer. I want to learn how to use a thermal printer because I have seen people use it to print shipping labels and stickers. Through this topic, I can learn about how a thermal printer works while also learning about how to wire an Arduino to it.
Final outcome: The thermal printer prints a little script where the User gets to choose four designations to travel to. Then, the user can press a button on the breadboard labeled A-D. Depending on the button letter, the thermal printer will print a plane ticket that corresponds to the options on the script.
Images of final creative/exploratory output
Final product wired up and printing out the script
All the prints including introduction script and the four different ticket options
Process images from development towards creative/exploratory output
Technical Training with two buttons
Prints a message and an image of a house
Some more prints
Testing prints
Process and reflection:
First, I started by experimenting with the thermal printer and Arduino commands. For the technical training, I made two buttons that would trigger the thermal printer to print out a haiku and an image of a house, respectively. The process was relatively straightforward, as the image of the house was already converted into a file that was readable for the thermal printer. For my final project, I wanted to wire multiple buttons to the thermal printer, where each button would trigger a print of a different plane ticket design to a destination of New York, Boston, Las Vegas, or Los Angeles. Throughout the process, I had some trouble with converting the images and fitting them into the memory of the Arduino because the image files were quite big. I had to shrink the size of the actual jpeg first and then put it into processing to convert it into a form that can go through the thermal printer. After several rounds of resizing with different parameters and mutiple conversions, I was able to get 4 files that printed out. However, due to the limited memory capacity of the Arduino, only two options can be choose from at once.
Technical details
Electrical schematic
#include "Adafruit_Thermal.h"
//ticket files
#include "NewYork3.h"
#include "LasVegas1.h"
#include "Boston3.h"
#include "LosAngeles3.h"
#include "SoftwareSerial.h"
#define TX_PIN 6 // Arduino transmit YELLOW WIRE labeled RX on printer
#define RX_PIN 5 // Arduino receive GREEN WIRE labeled TX on printer
SoftwareSerial mySerial(RX_PIN, TX_PIN); // Declare SoftwareSerial obj first
Adafruit_Thermal printer(&mySerial); // Pass addr to printer constructor
//setting the pin values
const int BUTTONA = 12;
const int BUTTONB = 8;
const int BUTTONC = 9;
const int BUTTOND = 13;
void setup() {
pinMode(7, OUTPUT); digitalWrite(7, LOW);
mySerial.begin(9600);
printer.begin();
pinMode(BUTTONA, INPUT);
pinMode(BUTTONB, INPUT);
pinMode(BUTTONC, INPUT);
pinMode(BUTTOND, INPUT);
//welcome message
printer.println("Welcome to the travel printing center");
printer.println("Are you ready for an unforgettable adventure?");
printer.println("Where would you like to travel to?");
printer.println("Here are the Options:");
printer.println("A: New York");
printer.println("B: Boston");
printer.println("C: Las Vegas");
printer.println("D: Los Angeles");
printer.println("");
printer.println("");
printer.sleep(); // Tell printer to sleep
delay(3000L); // Sleep for 3 seconds
printer.wake(); // MUST wake() before printing again, even if reset
printer.setDefault();
}
void loop() {
//reading button values
int buttonValA = digitalRead(BUTTONA);
int buttonValB = digitalRead(BUTTONB);
int buttonValC = digitalRead(BUTTONC);
int buttonValD = digitalRead(BUTTOND);
//ticket to New York
if (buttonValA == HIGH){
printer.printBitmap(NewYork3_width, NewYork3_height, NewYork3_data);
}
//ticket to Boston
if (buttonValB == HIGH){
printer.printBitmap(Boston3_width, Boston3_height, Boston3_data);
}
//ticket to Las Vegas
if (buttonValC == HIGH){
printer.printBitmap(LasVegas_width, LasVegas_height, LasVegas_data);
}
//ticket to Los Angeles
if (buttonValD == HIGH){
printer.printBitmap(LosAngeles3_width, LosAngeles3_height, LosAngeles3_data);
}
}