Erin Tomson
Published © GPL3+

DIY Zoltar: A Fortune Telling Machine

An easy to build fortune teller with a nod to the old Zoltar machines.

BeginnerFull instructions provided1 hour4,450
DIY Zoltar: A Fortune Telling Machine

Things used in this project

Hardware components

Modulo Base
Modulo Base
×1
Modulo Controller
Modulo Controller
×1
Modulo Knob
Modulo Knob
×1
Micro Servo Motor HD-1800A
×1
Heavy Printer Paper
×1
Clear Tape
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Scissors or Craft Knife

Story

Read more

Schematics

Zoltar.ai

ZoltarAccessories.pdf

ZoltarAccessories.ai

Zoltar.pdf

Code

Zoltar.ino

Arduino
Run this sketch with the Arduino app.
#include "Modulo.h"
#include "Wire.h"
#include "Servo.h"

KnobModulo knob;
Servo servo;

int currentPos = 0;
int servoAngle = 0;
void onPositionChanged(KnobModulo &k) {
    servoAngle -= 18*(knob.getPosition()-currentPos);
    currentPos = knob.getPosition();

    if (servoAngle < 0) {
        servoAngle = 0;
    }
    if (servoAngle > 180) {
        servoAngle = 180;
    }

    knob.setHSV(servoAngle/180.0, 1, 1);
    Serial.println(servoAngle);
    servo.write(servoAngle);
}

void onButtonPress(KnobModulo &k) {
    // First get the current time in milliseconds.
    long startTime = millis();

    // Continually do this until 3 seconds (3000ms) past the start time
    while (millis() < startTime + 3000) {
        // Figure out the servo angle, which ranges between 0 and 180
        // in a sinusoidal pattern based on the current time.
        servo.write(90*(1 + sin(millis()/400.0)));

        // Set the hue of the knob based on the current time too.
        knob.setHSV((millis() % 500)/500.0, 1, 1);
    }
}


void setup() {
    servo.attach(0);
    knob.setPositionChangeCallback(onPositionChanged);
    knob.setButtonPressCallback(onButtonPress);
}

void loop() {
    Modulo.loop();

    knob.setHSV(0, 1, sin(millis()/1000.0));
}

Credits

Erin Tomson

Erin Tomson

6 projects • 31 followers

Comments