bk1285 / rpi_wordclock

Software to create a Raspberry Pi based wordclock
GNU General Public License v3.0
214 stars 106 forks source link

Wordclock doesn't light up right LED's #182

Closed shruiik closed 2 years ago

shruiik commented 3 years ago

Hello there, I have setted up a Wordclock on my new Rpi.

since I have little space for the cables, I wrote a new wiring that looks like this:

Y/X 0 1 2 3 4 5 6 7 8 9 10
0 114 E 113 S 112 K 111 I 110 S 109 T 108 L 107 F 106 Ü 105 N 104 F
1 93 Z 94 E 95 H 96 N 97 Z 98 W 99 A 100 N 101 Z 102 I 103 G
2 92 D 91 R 90 E 89 I 88 V 87 I 86 E 85 R 84 T 83 E 82 L
3 71 T 72 G 73 N 74 A 75 C 76 H 77 V 78 O 79 R 80 J 81 M
4 70 H 69 A 68 L 67 B 66 Q 65 Z 64 W 63 Ö 62 L 61 F 60 P
5 49 Z 50 W 51 E 52 I 53 N 54 S 55 I 56 E 57 B 58 E 59 N
6 48 K 47 D 46 R 45 E 44 I 43 R 42 H 41 F 40 Ü 39 N 38 F
7 27 E 28 L 29 F 30 N 31 E 32 U 33 N 34 V 35 I 36 E 37 R
8 26 W 25 A 24 C 23 H 22 T 21 Z 20 E 19 H 18 N 17 R 16 S
9 5 B 6 S 7 E 8 C 9 H 10 S 11 F 12 M 13 U 14 H 15 R

And my Wiring implementation looks like this:

   class maiks_wiring:

    def __init__(self, WCA_WIDTH, WCA_HEIGHT):
        self.WCA_WIDTH = WCA_WIDTH
        self.WCA_HEIGHT = WCA_HEIGHT
        self.LED_COUNT = self.WCA_WIDTH * self.WCA_HEIGHT + 4

    def getStripIndexFrom2D(self, x, y):
        """
        Mapping coordinates to the wordclocks display
        Needs hardware/wiring dependent implementation
        Final range:
             (0,0): top-left
             (self.WCA_WIDTH-1, self.WCA_HEIGHT-1): bottom-right
        """
        if y % 2 == 0:
            pos = self.LED_COUNT - ((y * self.WCA_WIDTH) + (x))
        else:
            pos = self.LED_COUNT - (((y+1) * self.WCA_WIDTH) - (x+1))
        return pos

    def mapMinutes(self, min):
        """
        Access minutes (1,2,3,4)
        Needs hardware/wiring dependent implementation
        This implementation assumes the minutes to be wired as the last four leds of the led-strip
        """
        if min == 1:
            return 3 
        elif min == 2:
            return 2
        elif min == 3:
            return 1
        elif min == 4:
            return 0
        else:
            print('WARNING: Out of range, when mapping minutes...')
            print(min)
            return 0

Unfortunately, the wrong LEDs or no LEDs at all are lit. Even if I choose another wiring, the correct number of LEDs is not lit. I don't get any errors in the Console and when I debug, by using "print" lines, I get the solution that my mapping runs fine. But I don't get the right output. :(

I'm trying to solve this bug for 3 weeks now, but I can't find any solution. Can someone please help me.

phenze commented 3 years ago

Did you have a common ground for your LED's and your RPI? take a look here: https://github.com/bk1285/rpi_wordclock/issues/110

What is the output of strandtest example ? https://github.com/bk1285/rpi_wordclock/issues/102 https://github.com/bk1285/rpi_wordclock/issues/106

With strandtest example file you can test which LED of your strip is causing an error.

bk1285 commented 2 years ago

@shruiik Please reopen, if not resolved.