Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera Ringlicht - Camera with WS2812 LED lighting #34

Open
hansamann opened this issue Aug 25, 2019 · 4 comments
Open

Camera Ringlicht - Camera with WS2812 LED lighting #34

hansamann opened this issue Aug 25, 2019 · 4 comments

Comments

@hansamann
Copy link

Hi all,

I've been trying to integrate with the Ringlicht - it's a little board that has 12 WS2812 LEDs - perfect for lighting up the scene before a shot.

https://github.com/watterott/RPi-Camera-RingLicht

Altough my experiments with the WS2812 leds and python2 are successful, I fail to integrate both. Maybe someone with a bit more python knowledge (mine is really low) could help here.

Right now I am using this libary and the examples for python of this GithHub repo work nicely, also my own examples based on these:

https://github.com/rpi-ws281x

My example code alone looks similar to this:

import time
from rpi_ws281x import PixelStrip, Color

LED_COUNT = 12        # Number of LED pixels.
LED_PIN = 18          # GPIO pin connected to the pixels (18 uses PWM!).
# LED_PIN = 10        # GPIO pin connected to the pixels (10 uses SPI /dev/spidev0.0).
LED_FREQ_HZ = 800000  # LED signal frequency in hertz (usually 800khz)
LED_DMA = 10          # DMA channel to use for generating signal (try 10)
LED_BRIGHTNESS = 255  # Set to 0 for darkest and 255 for brightest
LED_INVERT = False    # True to invert the signal (when using NPN transistor level shift)
LED_CHANNEL = 0       # set to '1' for GPIOs 13, 19, 41, 45 or 53


# Define functions which animate LEDs in various ways.
def color(strip, color, wait_ms=50):
    """Wipe color across display a pixel at a time."""
    for i in range(strip.numPixels()):
        strip.setPixelColor(i, color)
        strip.show()
        time.sleep(wait_ms / 1000.0)



# Main program logic follows:
if __name__ == '__main__':

    strip = PixelStrip(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL)
    strip.begin()
    color(strip, Color(255, 0, 0))  # Red wipe
    strip.show()

    

I've been trying to integrate it into user_interface.py (also I hacked the startup script as the led driver requires sudo, so the photobooth.sh script now does a sudo python), but I get a weird error telling me that strip.setSetPixelColor is being called with 4 arguments. I am only passing three, I am assuming that "self" from the python class system somehow gets passed. Problem is, it's a method from the pixel library, so how can I call it with only the three variables?

Sorry, I realize it is a bit confusing. Maybe someone could let me know what would be the best place to initialize the LED strip and then call the led strip functions. Ideally I want to start the led strip if someone has clicked the single/multiple/animation buttons and then turn it off again after the pics are taken.

Thx to all, this is a great project. It saved me a ton of time...

@Raffa2s
Copy link

Raffa2s commented Mar 12, 2020

HI, i want to do something similar with this led ring
Did you achieve your goal?

@hansamann
Copy link
Author

Sadly I did not but I've not tried that hard. I assume it might aloso be some python2/3 thingy...

@wyojustin
Copy link
Member

Very cool! This should not be difficult. Please paste the error message here.

@rogergithubbing
Copy link

Altough my experiments with the WS2812 leds and python2 are successful, I fail to integrate both.

Hello Hansaman... Did you succeeded integrating the led as a flash ? Anyone else ? I'm seriously planning to do my own photobooth with flash, and a raspberry 4...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants