Page 2 of 2

Re: DotStar Pi Painter HELP !

Posted: Mon Sep 11, 2023 11:36 am
by mikeysklar
Nicely done! I like the png file name.

I'll update the guide for the mount syntax change to:

Code: Select all

PrivateMounts=no

Re: DotStar Pi Painter HELP !

Posted: Mon Sep 25, 2023 4:58 am
by ludwig_pop
Bonjour tout le monde, I'm come back to give you some news about the DotStarPipainter.
I finished the hardware assembly part. And I did some tests.

The strandtest.py script lights up all 288 LEDs in the strip! :) :) :)
putty_2023-09-25_10-55-51.png
putty_2023-09-25_10-55-51.png (50.29 KiB) Viewed 5255 times
All works fine !!!
001-strandtest.py-web.jpg
001-strandtest.py-web.jpg (534.12 KiB) Viewed 5255 times
I placed 3 images on a USB key. When I run the DotStarPiPainter.py script, I have a problem again. The device only uses 144 LEDs! At the end, two white leds are lighting on 145 and 146 position.
When I configure the signal printing speed with the buttons (pin_faster pin_slower), the light mark does not go beyond 144 LEDs.
002-144-leds-2-white-leds-pb.jpg
002-144-leds-2-white-leds-pb.jpg (152.25 KiB) Viewed 5255 times
Do you have any idea what the problem is?

Re: DotStar Pi Painter HELP !

Posted: Mon Sep 25, 2023 6:41 pm
by mikeysklar
Post the code to your version (I assume it has been modified) DotStarPipainter script. My guess is that numpixels is not set correctly. numpixels is being set correctly in your 288 test.

Re: DotStar Pi Painter HELP !

Posted: Tue Sep 26, 2023 2:46 pm
by ludwig_pop
You are right !
The "num_leds = 144" parameter was wrong. I modified the code to "num_leds = 288"

Code: Select all

pi@raspberrypi:~/DotStarPiPainter $ nano DotStarPiPainter.py
  GNU nano 5.4                                                                                                 DotStarPiPainter.py
#   learn.adafruit.com/adafruit-dotstar-leds/python-circuitpython
# - usbmount:
#   sudo apt-get install usbmount
#   See file "99_lightpaint_mount" for add'l info.
#
# Written by Phil Burgess / Paint Your Dragon for Adafruit Industries.
#
# Adafruit invests time and resources providing this open source code,
# please support Adafruit and open-source hardware by purchasing products
# from Adafruit!
# --------------------------------------------------------------------------

import os
import select
import signal
import time
import board
import busio
import digitalio
import adafruit_dotstar as dotstar
from evdev import InputDevice, ecodes
from lightpaint import LightPaint
from PIL import Image

# CONFIGURABLE STUFF -------------------------------------------------------

num_leds   = 288         # Length of LED strip, in pixels
pin_go     = board.D22   # GPIO pin numbers for 'go' button,
pin_next   = board.D17   # previous image, next image and speed +/-.
pin_prev   = board.D4    # Buttons should connect from these pins to ground.
pin_faster = board.D23
pin_slower = board.D24
vflip      = 'true'      # 'true' if strip input at bottom, else 'false'
order      = dotstar.BGR # BGR for current DotStars, GBR for pre-2015 strips
order2     = 'bgr'       # lightpaint lib uses a different syntax for same
spispeed   = 12000000    # SPI clock rate...
# 12000000 (12 MHz) is the fastest I could reliably operate a 288-pixel
# strip without glitching. You can try faster, or may need to set it lower,
# no telling.

# DotStar strip data & clock connect to hardware SPI pins (GPIO 10 & 11).
strip     = dotstar.DotStar(board.SCK, board.MOSI, num_leds, brightness=1.0,
              auto_write=False, pixel_order=order)
# The DotStar library is used for status updates (loading progress, etc.),
# we pull shenanigans here and also access the SPI bus directly for ultra-
# fast strip updates with data out of the lightpaint library.
spi       = busio.SPI(board.SCK, MOSI=board.MOSI)
path      = '/media/usb'         # USB stick mount point
mousefile = '/dev/input/mouse0'  # Mouse device (as positional encoder)
eventfile = '/dev/input/event0'  # Mouse events accumulate here
dev       = None                 # None unless mouse is detected

gamma          = (2.8, 2.8, 2.8) # Gamma correction curves for R,G,B
color_balance  = (128, 255, 180) # Max brightness for R,G,B (white balance)
power_settings = (1450, 1550)    # Battery avg and peak current

# INITIALIZATION -----------------------------------------------------------
# Set control pins to inputs and enable pull-up resistors.
The device works perfectly! Many thanks for your help.

Re: DotStar Pi Painter HELP !

Posted: Tue Sep 26, 2023 5:32 pm
by mikeysklar
Nice. Glad that resolved it. Go make some art.