Git Product home page Git Product logo

darkroom's Introduction

darkroom

This is my code for a darkroom timer using:

  • RaspberryPi
  • IoT Relay (power switch)
  • 8x8 x4 LED Matrix
  • USB Numpad

Hardware setup

The SPI and IoT device should be connected before the software is installed

LED Matrix wiring

LED matrix wiring LED visual

IoT Relay wiring

The IOT device should be connected to GPIO 18 (aka PI Pin number 12)

Installing

  • Enable SPI launch sudo raspi-config and into 5 Interface Options set P4 SPI to Yes
  • Launch sudo raspi-config and into 3 Boot Options then B1 Desktop / CLI and set B2 Console Autologin
  • Add user to proper groups sudo usermod -a -G spi,gpio pi
  • Install luma pre-reqs sudo apt update && sudo apt install -y build-essential python3-dev python3-pip python3-venv libfreetype6-dev libjpeg-dev libopenjp2-7 libtiff5 git
  • Checkout darkroom cd ~ && git clone https://github.com/cdgriffith/darkroom && cd darkroom
  • Create a virtual env python3 -m venv venv
  • Activate env source venv/bin/activate
  • Update pip python -m pip install --upgrade --ignore-installed pip setuptools
  • Install requirements pip install -r requirements.txt
  • Test the program python -m darkroom
  • Add it to bashrc echo "PYTHONPATH=/home/pi/darkroom /home/pi/darkroom/venv/bin/python -m darkroom" > ~/.bashrc

Once added to the bashrc file, it will automatically launch when the user logs in. This will "take over" the console, even on SSH connections, so remember if you need to switch back to console to hit E or Ctrl+C first.

Key controls

*      Start key capture (to input time via number keys, hit "*" again to accept)
+      Add a tenth of a second
-      Remove a tenth of a second
/      "Focus" - Turn the enlarger on
ENTER  "Print" - Enlarger on, timer counts down to zero then turns the enlarger back off
e      Pressing E or Ctrl+C Will exit the program 

Configuration

It is possible to customize a few things with environment variables

  • X_OFFSET (default 0)
  • Y_OFFSET (default -2)
  • BLOCK_DIR (default -90)
  • ENLARGER_PIN = (default 18)
  • STARTUP_MESSAGE = (default 'LOVE U')
  • FONT_FILE = (default "darkroom/fonts/scoreboard.ttf")

License

This is MIT Licensed, view the LICENSE file for details.

This is using the Free for personal use Scoreboard font available at https://www.ffonts.net/Score-Board.font

darkroom's People

Contributors

cdgriffith avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

axettone

darkroom's Issues

Issue on Raspberry Pi OS Buster, Pi Zero W, Python 3.7

Hi! Im getting the following error on OS Buster, pi Zero W, Python 3.7:

Traceback (most recent call last):
File "darkroom/main.py", line 6, in
from pynput import keyboard
File "/home/pi/.local/lib/python3.7/site-packages/pynput/init.py", line 40, in
from . import keyboard
File "/home/pi/.local/lib/python3.7/site-packages/pynput/keyboard/init.py", line 31, in
backend = backend(name)
File "/home/pi/.local/lib/python3.7/site-packages/pynput/_util/init.py", line 82, in backend
if resolutions else '')
ImportError: this platform is not supported: ('failed to acquire X connection: Bad display name ""', DisplayNameError(''))

Try one of the following resolutions:

  • Please make sure that you have an X server running, and that the DISPLAY environment variable is set correctly

I have the Dot Matrix up and running and all the dependencies installed. The one thing I noticed that was different from your build is that I am running python3, whereas your build appears to be on python2.7. I dont have the option to run 2.7 as luma.led_matrix is no longer supports it. Any help would be greatly appreciated!

Issue Raspbian Buster,PiZero W,Python2.7

@cdgriffith
managed to downgrade luma.led_matrix and luma.core so I could use this program (its not compatible with Python3 and luma no longer supports 2.7), but it always returns the same error when i try to run:

Traceback (most recent call last):
  File "darkroom/main.py", line 6, in <module>
    from pynput import keyboard
  File "/home/pi/.local/lib/python2.7/site-packages/pynput/__init__.py", line 40, in <module>
    from . import keyboard
  File "/home/pi/.local/lib/python2.7/site-packages/pynput/keyboard/__init__.py", line 31, in <module>
    backend = backend(__name__)
  File "/home/pi/.local/lib/python2.7/site-packages/pynput/_util/__init__.py", line 82, in backend
    if resolutions else '')
ImportError: this platform is not supported: ('failed to acquire X connection: Bad display name ""', DisplayNameError())

Try one of the following resolutions:

 * Please make sure that you have an X server running, and that the DISPLAY environment variable is set correctly

This issue appears regardless of whether run local or ssh

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.