Share it

Follow me

Twitter

Google+

LinkedIn

RasPiRepCol

RasPiRepCol (“RepCol” meanings Repeat Colors) is a project for the Raspberry Pi implementing a clone of the electronic game Simon.

Current version : 1.2, September 23, 2012

Software side

Software side of RasPiRepCol allow to pilot the electronic side of the game (LED blinking, management of the switches). It contains a main Python program, which has some requirements.

Requirements installation

You first have to install Python and the associated developer tools. With Debian / Raspbian, you have to execute as super-user the following command (you have to adapt it to the distribution you use):

$ apt-get install python python-dev

When the installation is done, you have to install a Python library in order to control the GPIO. It's RPi.GPIO (version 0.4.0a or newer), available here : http://pypi.python.org/pypi/RPi.GPIO. When you have downloaded the archive, you have to execute as super-user the following commands:

$ tar -xzf RPi.GPIO-0.4.0a.tar.gz
$ cd RPi.GPIO-0.4.0a
$ python setup.py install

When library installation is done, you may delete previously downloaded archive (“RPi.GPIO-0.4.0a.tar.gz”) and untared folder (“RPi.GPIO-0.4.0a”).

Then, you can start RasPiRepCol (still as super-user) once the electronic assembly is done:

$ python raspirepcol.py

Electronic assembly

Needed components

  • 1 x green LED
  • 1 x yellow LED
  • 1 x red LED
  • 1 x blue LED
  • 4 x 330Ω resistors
  • 4 x 1kΩ resistors
  • 4 x 10kΩ resistors
  • 4 x tactile switches
  • Enough wires to connect them all (…and in the darkness bind them)

330Ω resistors are used to protect LED (and GPIO). You may use 270Ω resistors if you want them to be brighter. Don't use to low value resistor, as you must not draw to much current from GPIO pins : no more than 16mA per pin, and no more than 51mA cumulated on all pins.

10kΩ resistors are used as pull-up resistors to maintain input in high state when the switch is not pressed (and avoid a short circuit between +3.3V line and the GPIO pin).

1kΩ resistors are here to protect GPIO pin if it's accidentally set as output, and the switch is pressed.

I used the Raspberry Pi Started Kit available at SK Pang, which provide a case for the Raspberry Pi and a part of needed components.

Circuit diagram
raspirepcol.png

Final assembly
raspirepcol_assembly.jpg

See it in action

Download RasPiRepCol software

RasPiRepCol is distributed under the terms of the modified BSD license.

  • Stable : last stable version of the application
  • GitHub : last source code of the application on GitHub (may be unstable, and sometimes break down completely)

v1.2 (September 23, 2012)

  • Add hard mode.
  • Updated for RPi.GPIO 0.4.0a

v1.1 (August 19, 2012)

  • Code cleanup.
  • Added compatibility with Python 3.x.
  • Handle nicely Ctrl+C keyboard event.
  • Add possibility to choose game difficulty.
  • Score display.

v1.0 (August 07, 2012)

  • First public version


comments powered by Disqus