Project: Darth-Vader-RPi

Fork Download
View on GitHub

Darth-Vader-RPi (v0.1.0a0) is a Python-based Raspberry Pi (RPi) project about activating a Darth Vader action figure by turning on LEDs on his suit and lightsaber, and by playing sounds such as some of his famous quotes.

Turning on/off the lightsaber

Contents

  1. Introduction
  2. Connection diagram
  3. Dependencies
  4. Installation instructions
  5. Usage
    1. Script start_dv
    2. Simulating on your computer
  6. Credits
    1. Sounds
    2. Others
  7. Resources
  8. References

1. Introduction

The Darth Vader action figure is 11.5 inches tall (which is this one from Hasbro) and was modified to make it more lifelike by illuminating the lightsaber, chest control box, and belt. 3 push buttons control the following sounds and LEDs:

  1. Some of his famous quotes

  2. The Imperial march theme song

  3. The lightsaber drawing, hum and retraction sounds

  4. The lightbsaber illumination (3 LEDs)

His iconic breathing sound plays in the background indefinitely almost as soon as the RPi is run with the start_dv script.

Darth Vader action figure activated

Click on the above image for the full video to see the LEDs turning on and hear the different sounds produced by pressing the push buttons


2. Connection diagram

Here’s how the various LEDs and push buttons are connected to the Raspberry Pi:


3. Dependencies


4. Installation instructions

  1. It is highly recommended to install darth_vader_rpi in a virtual environment using for example venv or conda.

  2. Make sure to update pip:

    $ pip install --upgrade pip

  3. Install the package darth_vader_rpi (released version 0.1.0a0) with pip:

    $ pip install git+https://github.com/raul23/Darth-Vader-RPi@v0.1.0a0#egg=Darth-Vader-RPi

    It will install the dependencies if they are not already found in your system.


5. Usage

5.1 Script start_dv

Once the darth_vader_rpi package is installed, you should have access to the start_dv script which turns on LEDs and plays sound effects on a Raspberry Pi (RPi).

Run the script on your RPi with default values for the GPIO channels and other settings:

$ start_dv

If you want to test the script on your computer (use the -s flag for simulation):

$ start_dv -s

To display the script’s list of options and their descriptions:

$ start_dv -h

5.2 Simulating on your computer

If you don’t have access to a Raspberry Pi (RPi) and want to try out the start_dv script, you can run it with the -s flag. It will make use of the SimulRPi library to simulate LEDs and push buttons connected to an RPi by blinking red dots in the terminal and monitoring pressed keyboard keys:

$ start_dv -s

NOTE: the last command makes use of default values. See Change default settings on how to change these values.

Here’s how the keyboard keys are related by default to push buttons connected to an RPi:

Check Change keymap if you want to change this default key-to-channel mapping.

Here is a video of what it looks like in a terminal when running the start_dv script on a computer instead of an RPi:

LEDs and buttons simulation in a terminal [Darth-Vader-RPi project]

Click on the above image for the full video


6. Credits

6.1 Sounds

6.2 Others


7. Resources


8. References