Introduction: FORTUNE MACHINE

Let your fortune take you on an adventure.

This NYC Fortune installation uses a touch sensor to trigger a thermal printer that reveals your destiny. What awaits is a magical tour around New York City.

In this tutorial, we will be discussing how to create your own full sized fortune machine powered by Arduino.

Supplies

  1. 1/2" plywood 96" x 48"
  2. 1 black - 12” x 24” sheet of ⅛” acrylic
  3. 1 white - 12” x 24” sheet of ⅛” acrylic
  4. 1 sparkle black - 12” x 12” sheet of ⅛” acrylic
  5. Copper Foil Tape
  6. ~ 40 - ⅜” screws
  7. 6 - L Brackets
  8. Wood Glue
  9. Thermal Receipt printer
  10. Receipt Paper Roll
  11. Arduino
  12. Wire

Recommended Tools:

  1. 96” x 48” ½” Sheet of plywood

  1. CNC
  2. Laser Cutter
  3. Drill Press
  4. Power Drill
  5. Orbital Sander
  6. Band saw
  7. Table saw
  8. Belt Sander
  9. Clamps

Step 1: Download & Cut Files

In order to create the _____ you will need to CNC a 1/2" sheet of 96" x 48" plywood. For this project I used a Shopbot CNC and prepared the files with Vectric.

The bit was the 1/4" straight bit used particularly for plywood. Make sure that for the main frame pieces set your cut lines for outside, for the backdoor and receipt printer slot set them for the inside. In order to get the correct depth for your question mark and palm inlays, use a caliper to measure the thickness of the acrylic. Set the depth in your CNC software.

Once your files are prepared, send them to the CNC to get cutting.

For the laser cutter, these files are ready to be sent directly to the laser cutter.

Files attached:

  • Question Mark
  • Palm
  • CNC Parts

Step 2: Sand & Prep Parts

Once your CNC has finished cutting, remove the parts using a chisel and mallet to break out the tabs. Once removed, sand the edges of your project.

The eight arched pieces are then laminated together using wood glue and clamps. Note the picture above for technique. This should take 4 - 12 hours to dry fully. Once finished drying, remove the clamps and sand using an orbital or circular sander.

In order for the lights to be displayed around the machine, you will need to drill holes in the sides and top. I used a 7/8" drill press bit. Measure out 25 evenly space marks 3" apart where you will drill for the lights. Using two clamps for the side pieces drill out the holes. For the top arch, you will need to clamp a scrap piece of wood across the top to keep it in place. Note the method used in the images above.

Step 3: Assemble Parts

Once all of your parts are prepped, you are able to build your machine. First, you will need to glue your side pieces to the back. Make sure to line up the side pieces with the bottom of the back piece, with the light holes towards the top. Using wood glue and clamps, affix them to the back of the machine and let set for 4 - 12 hours.

Next, glue the top arch to the back of the machine using the same method as the sides. Once these are set and dried, use the orbital sander to finish sanding the piece.

Create the front sensor stand using L brackets, straight brackets, and small 3/8" screws. Using the L brackets screw together the front and sides of the stand. I recommend using a minimum of two for each side and three for good measure. Add a small shelf below the printer hole to hold the Arduino.

Insert the lightbulbs to the back, you do so by removing the bulb, and putting the port through then putting the bulb back in.

Then assemble the front sensor stand to the back using straight brackets and screws.

Step 4: Step 4: Create Touch Sensor, Insert Inlays, & Add Final Parts

Create the touch sensor by taking the small finger tip and covering the piece in copper foil tape. Solder a wire to the back. Next, drill a hole in the tip of the finger to let the wire go straight through. Insert of the tip of the finger and glue the sensor stand top to its base.

Glue the question mark into the inlay section at the top. Glue the front to the back with the lights in place and carefully clamp the piece for 4 - 12 hours.

Step 5: Create Circuit & Upload Code

Now it is time to make the NYC Fortune come to life. In order to get the sensor and printer going, you will need to build a circuit using Arduino. Attach the green and blue lines to pins 5 & 6 on your Arduino. Attach ground and power to the shared adapter for both the Arduino and printer. Attach the touch sensor wire to pin A0.

Once these are set up use the test code in Arduino to confirm it is functioning. Then upload the following code.

NYC Fortune Code:

#include "Adafruit_Thermal.h"
#include

// Becky sez: not sure what these three lines are supposed to do, they seem unneccesary //#define ADAFRUIT_THERMAL_H //#define ADAFRUIT_THERMAL_H //#include "Arduino.h"

// Here's the syntax when using SoftwareSerial (e.g. Arduino Uno) -------- // If using hardware serial instead, comment out or remove these lines:

#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

bool toPrint = false; unsigned long previousTime; unsigned long interval = 10000;

int ref0, ref1; //reference values to remove offset

SoftwareSerial mySerial(RX_PIN, TX_PIN); // Declare SoftwareSerial obj first Adafruit_Thermal printer(&mySerial); // Pass addr to printer constructor // Then see setup() function regarding serial & printer begin() calls.

// Here's the syntax for hardware serial (e.g. Arduino Due) -------------- // Un-comment the following line if using hardware serial:

//Adafruit_Thermal printer(&Serial1); // Or Serial2, Serial3, etc.

// -----------------------------------------------------------------------

// Print charset map to printer, similar to test page but // without the baud rate, etc.

void setup() { // No pins to setup, pins can still be used regularly, although it will affect readings

Serial.begin(9600);

ref0 = ADCTouch.read(A0, 500); //create reference values to ref1 = ADCTouch.read(A1, 500); //account for the capacitance of the pad // This line is for compatibility with the Adafruit IotP project pack, // which uses pin 7 as a spare grounding point. You only need this if // wired up the same way (w/3-pin header into pins 5/6/7): //pinMode(7, OUTPUT); digitalWrite(7, LOW);

mySerial.begin(9600); // Initialize SoftwareSerial //Serial1.begin(19200); // Use this instead if using hardware serial printer.begin(); // Init printer (same regardless of serial type)

// printer.println(F("DEFAULT CHARSET & CODE PAGE:")); // dump(); // printer.println(F("\nUSA CHARSET w/")); // Serial.println("this is it 1"); // printer.println(F("CP437 CODEPAGE:")); // Serial.println("this is it 2"); // // Charset selection alters a few chars in ASCII 0x23-0x7E range. printer.setCharset(CHARSET_USA); printer.setCodePage(CODEPAGE_CP437);

// Serial.println("this is it 3"); // // Code page selects alt symbols for 'upper' ASCII 0x80-0xFF. // // There's a TON of these, best to check datasheet! // Serial.println("this is it4"); // printer.underlineOn(); // Serial.println("this is it5"); // printer.println(F("CHARACTER SET EXAMPLE\n")); // Serial.println("this is it6"); // printer.underlineOff(); //// Serial.println("beginning dump..."); //// dump(); //// Serial.println("dump complete"); // printer.feed(2); // printer.setDefault(); // Restore printer to defaults //printer.sleep(); // Tell printer to sleep }

void loop() { int value0 = ADCTouch.read(A0); //no second parameter int value1 = ADCTouch.read(A1); // --> 100 samples

value0 -= ref0; //remove offset value1 -= ref1;

Serial.print("Touched: "); Serial.print(value0 > 40); //send (boolean) pressed or not pressed Serial.print("\t sensor reading: "); //use if(value > threshold) to get the state of a button

// Serial.print(value1 > 40); // Serial.print("\t\t");

Serial.println(value0); //send actual reading // Serial.print("\t"); // // Serial.println(value1); delay(100); if((value0>40)==1 && (millis()-previousTime) > interval){ toPrint = true; previousTime = millis(); } if(toPrint==true){ //printer.wake(); // MUST wake() before printing again, even if reset

//Serial.println("is printing....."); //this is where I expect it to start printing dump();

toPrint = false; delay(5000); Serial.println("done printing"); } delay(100); }

void dump() { uint8_t major, minor, c; printer.justify('C'); printer.boldOn(); printer.println(F("HOOK, LINE, & SINKER")); printer.boldOff(); printer.println(); printer.println("Your day is destined"); printer.println("for the sea."); printer.println("Meet your mate at the Pier 11"); printer.println("ferry & head to Rockaway"); printer.println("Beach.");

printer.feed(5);

}

Step 6: Plug It In!

Your code is running and now you are ready to go!