Mote Phat, not all LEDS are lighting on first show

Hi, I have a new zero with the mote phat attached, 4 motes and cables. I have found that after setting the pixels (using the examples provided) and issuing the show, not all pixels are lighting. (8,16,16,8). If I then rerun the show command again they all show. This is consistent. Has anyone seen this and got any ideas as to why it might be happening ? I am using a power block rated at 3.4amps.

cheers

Could you post your code? You can use three backticks to preserve code formatting, like so:

```python
import badger

badger.badger.mushroom(123)
```
#code taken from motephat examples
import colorsys
import motephat
import time
offset = 0
for channel in range(4):
    for pixel in range(16):
        hue = offset + (10 * (channel * 16) + pixel)
        hue %= 360
        hue /= 360.0
        r, g, b = [int(c*255) for c in colorsys.hsv_to_rgb(hue, 1.0, 1.0)]
        motephat.set_pixel(channel+1, pixel, r, g, b)
        print(channel+1,pixel,r,g,b)
motephat.show()
#only partial display of the set pixels
#8,16,8,16
time.sleep(1)
#sleep to see the missing pixels
motephat.show()
#all pixels now displayed
time.sleep(2)
#sleep to see the shown pixels
#repeat to show that it always requires the 2 shows to show all pixel set changes
offset += 1
for channel in range(4):
    for pixel in range(16):
        hue = offset + (10 * (channel * 16) + pixel)
        hue %= 360
        hue /= 360.0
        r, g, b = [int(c*255) for c in colorsys.hsv_to_rgb(hue, 1.0, 1.0)]
        motephat.set_pixel(channel+1, pixel, g,r, b)
        print(channel+1,pixel,r,g,b)
motephat.show()
time.sleep(2)
motephat.show()
time.sleep(2)
#output:

‘’‘
sudo python3 test.py
1 0 255 0 0
1 1 255 4 0
1 2 255 8 0
1 3 255 12 0
1 4 255 16 0
1 5 255 21 0
1 6 255 25 0
1 7 255 29 0
1 8 255 33 0
1 9 255 38 0
1 10 255 42 0
1 11 255 46 0
1 12 255 50 0
1 13 255 55 0
1 14 255 59 0
1 15 255 63 0
2 0 0 255 169
2 1 0 255 174
2 2 0 255 178
2 3 0 255 182
2 4 0 255 187
2 5 0 255 191
2 6 0 255 195
2 7 0 255 199
2 8 0 255 203
2 9 0 255 208
2 10 0 255 212
2 11 0 255 216
2 12 0 255 221
2 13 0 255 225
2 14 0 255 229
2 15 0 255 233
3 0 255 0 170
3 1 255 0 165
3 2 255 0 161
3 3 255 0 157
3 4 255 0 152
3 5 255 0 148
3 6 255 0 144
3 7 255 0 140
3 8 255 0 135
3 9 255 0 131
3 10 255 0 127
3 11 255 0 123
3 12 255 0 119
3 13 255 0 114
3 14 255 0 110
3 15 255 0 106
4 0 0 255 0
4 1 0 255 4
4 2 0 255 8
4 3 0 255 12
4 4 0 255 16
4 5 0 255 21
4 6 0 255 25
4 7 0 255 29
4 8 0 255 33
4 9 0 255 38
4 10 0 255 42
4 11 0 255 46
4 12 0 255 50
4 13 0 255 55
4 14 0 255 59
4 15 0 255 63
1 0 255 4 0
1 1 255 8 0
1 2 255 12 0
1 3 255 16 0
1 4 255 21 0
1 5 255 25 0
1 6 255 29 0
1 7 255 33 0
1 8 255 38 0
1 9 255 42 0
1 10 255 46 0
1 11 255 50 0
1 12 255 55 0
1 13 255 59 0
1 14 255 63 0
1 15 255 67 0
2 0 0 255 174
2 1 0 255 178
2 2 0 255 182
2 3 0 255 187
2 4 0 255 191
2 5 0 255 195
2 6 0 255 199
2 7 0 255 203
2 8 0 255 208
2 9 0 255 212
2 10 0 255 216
2 11 0 255 221
2 12 0 255 225
2 13 0 255 229
2 14 0 255 233
2 15 0 255 237
3 0 255 0 165
3 1 255 0 161
3 2 255 0 157
3 3 255 0 152
3 4 255 0 148
3 5 255 0 144
3 6 255 0 140
3 7 255 0 135
3 8 255 0 131
3 9 255 0 127
3 10 255 0 123
3 11 255 0 119
3 12 255 0 114
3 13 255 0 110
3 14 255 0 106
3 15 255 0 102
4 0 0 255 4
4 1 0 255 8
4 2 0 255 12
4 3 0 255 16
4 4 0 255 21
4 5 0 255 25
4 6 0 255 29
4 7 0 255 33
4 8 0 255 38
4 9 0 255 42
4 10 0 255 46
4 11 0 255 50
4 12 0 255 55
4 13 0 255 59
4 14 0 255 63
4 15 0 255 67
’’’

Hello,

Is there any update on this issue? I’m having the exact same behavior. I’m running the pHAT on a rpi3 and the modified version of mote-api.py

Kind regards,
Tobias

Hi

this is not a correction to the behaviour but a poor workaround that may help:

always use 2 * show() in your code - which will slow down the process,

compile the base motephat library using cython, this will run *2 faster than raw python , so you end up back where you where but at least all LEDs are correctly lighting

I’ve been running some tests using the code posted here and my own code, but haven’t managed to recreate the problem yet. I know it’s possible, since we’ve observed similar results before which is what prompted @sandyjmacdonald to write this article: http://blog.pimoroni.com/apa102-variants/

It may be that you have sticks that are using a slightly different part to the ones I have available to test with, and they need slightly more bits clocked out to properly flush the data through the chain.

If you’re feeling adventurous you can clone the library from here: https://github.com/pimoroni/mote-phat

And then increase this magic number until the problem goes away: https://github.com/pimoroni/mote-phat/blob/master/library/motephat/init.py#L86

The _eof() function is the pixel “end of frame” and is just twiddling the clock pin enough times to clock all the pixel data through each pixel and to the end of the 16-pixel chains on each Mote bus.

You can install the library from the “library” folder with sudo ./setup.py install

I have just recreated this issue myself using the simple mote.set_all(colour[0], colour[1], colour[2], brightness=brightness). If colour[1] is <= 128 then it sets the red colour correctly. If >128, then only the first half of the strips are set. I suspect this is something to do with the repurposing of blinkt code to mote. May be wrong.