20150406.jpeg

I've made a Digital Light Organ Enchantment for my Perpetuum-Ebner turntable last week.

To add a little cyberpunk touch to it, I'm creating a servo lift that will pop out the light effects when there is music.



I've titled it an autonomous lift because the logic is contained within a limited set of code.

You tell it to be up or down, and it will take care to achieve that state and stay there until told differently.

The servo is a small 180° common motor, not the 360° continuous servo.


Servo Lift Code

 

The lift logic is contained in a few methods. You only have to remember to call servoInit() in your setup() code, and call servoGo() at regular times (I've put it in the loop().

You tell the servo what state it should be in by setting the boolean variable servoUp to false (down) or true (up).

The servo will work by itself to fulfill your demand.

 

There are a few parameters you can tweak:

 

SERVO_BASE: the down position of the lift.

SERVO_TOP: the up position

SERVO_DELAY: milliseconds between steps to move up or down. Affects the rise and fall time of the light organ in my player.

 

#include <Servo.h>

Servo servo;

#define SERVO_PIN 9
#define SERVO_DELAY 25
#define SERVO_BASE 90
#define SERVO_TOP (SERVO_BASE - 61)

int servoPos = SERVO_BASE;
bool servoUp = false;

void servoInit() {
    servoUp = false;
    servo.attach(SERVO_PIN);
    servoPos = SERVO_BASE;
    servo.write(SERVO_BASE);
    delay(1000);
}

void servoGoUp() {
   if (servoPos > SERVO_BASE) {
    servoInit();
  }
    if (servoPos > SERVO_TOP) {
    servoPos--;
    servo.write(servoPos);
    delay(SERVO_DELAY);
  }
}

void servoGoDown() {
   if (servoPos > SERVO_BASE) {
    servoInit();
  }
    if (servoPos < SERVO_BASE) {
    servoPos++;
    servo.write(servoPos);
    delay(SERVO_DELAY);
  }
}

void servoGo() {
  if (servoUp) {
    servoGoUp();
  } else {
    servoGoDown();
  }
}





 

Test Bed Code

 

The sketch to exercise the lift is simple.

It waits for you to enter a command in the Arduino IDE Serial Monitor.

If you enter '1', the lift will go up slowly and stay there. If you enter '0' it will go down.

 

void setup()
{
  Serial.begin(9600);
  servoInit();
  Serial.println("Menu: Up: 1, Down: 0");
}

void loop()
{
  while (Serial.available() > 0) {
    servoUp = (Serial.parseInt() > 0);
  }
  servoGo();
}




 

The lift is supposed to go into the cable storage area of the Perpetuum-Ebner Musical 1.

Photo 06-04-15 10 11 21.jpg

 

 

Table of Contents
Chapter 1: Fix the turntable
1: Perpetuum Ebner Musical 1
2: A Time to Kill and a Time to Heal
3: Preparation for Motor Drive
4: Motor control with Infineon Motor Shield and Arduino UNO
5: Turntable speed sample testbed with Arduino UNO
6: Turntable Speed Sensor design
7: Control Theory - End of Chapter 1
Chapter 2: First Enchantments
8: Digital Light Organ Enchantment
9: Autonomous Servo Lift
10: SMD Time - Solder the IR Speed Sensor PCB
11: Yelp - who can Help me to Compile and Run my First SAMA5D4 C Program
12: Son et Lumiere - End of Chapter 2
Chapter 3: Taming the Board
13: Breakthrough - Run my own C++ Program on the SAMA5D4
14: Digital Light Organ Input Buffer
15: SAMA5D4 Blinky
16: Scope Creep
17: Audio Sampling with 16-bit ADC ADS8343
18: Sending Files to SAMA5D4 over USB
19: Port my Light Organ from Arduino to SAMA5D4
20: Fast Fourier Transform on the SAMA5D4 - End of Chapter 3
Epilogue: Reaching for the Clouds
21: Right-Sizing my Plans
22: My Own C++ Buffered Sampler on the SAMA5D4
Interlude
23: Building In the Motorized Light Organ
24: Up to the Clouds with Yún
25: Publish or Perish
26: Turntable Finished
Stretch & Boni
Bonus 1a: Remote Light Organ with WiFI pt. 1
Bonus 1b: Remote Light Organ with WiFI pt. 2
Grande Finale: Paho MQTT Client on the SAMA5D4
Related blog
Vintage Turntable repair: Can I fix a Perpetuum Ebner from 1958
Review 1: Atmel SMART SAMA5D4 Xplained Ultra Unboxing and First Steps
Review 2: Atmel SMART SAMA5D4 Xplained Ultra - Building the Libraries from Source
Review 3: Digital Continuous Rotation (360°) Servo Part 1
Review 4: Digital Continuous Rotation (360°) Servo Part 2
Review 5: Atmel SMART SAMA5D4 Xplained Ultra - TCP/IP running
Review 6: Atmel SMART SAMA5D4 Xplained Ultra - LINUX Distro with SSH support
poem
Enchanted Objects: Let's work together to tame the ATMEL SMART SAMA5D4 Xplained Ultra kit
17 bis: Off South...
Review 7: Atmel SMART SAMA5D4 Xplained Ultra - C++ ADC Example on Linux
Review 8: Atmel SMART SAMA5D4 Xplained Ultra - Product Review
Review 9a: Atmel SMART SAMA5D4 Xplained Ultra - Set up ADC Buffer with Hardware Trigger Part 1
Review 9b: Atmel SMART SAMA5D4 Xplained Ultra - Set up ADC Buffer with Hardware Trigger Part 2
Review 10: Atmel SMART SAMA5D4 Xplained Ultra - New Content on AT91.com
1958 Turntable from the Black Forest - Summary of the Enchanted Player Story