A Frustrating Weekend!

So, now that things are starting to come together, I decided it was time to think about the glitter in Glitterator. I have some Mote sticks that I was planning to use on it, but they are considerably bigger than the bot. Brian Corteil helpfully pointed me towards APA102 LEDs, which is essentially what the Mote sticks are made of, and can be purchased in strips. So I got myself a strip of them, and set about getting them to work. Cue much frustration!

I’d done a bit of research, and realised that they are unlikely to work directly of the Pi3 controlling Glitterator, with all the other work it is doing, due to the very fast timing of the protocol. But I figured that I could at least test them out with another Pi I have, that’s not running anything else – there are plenty of examples out there on the web of people doing this. So I got myself a level-shifter (APA102 operate at 5V) and connected a short length (3 LEDs) up to a spare Pi3 via the SPI0 pins. Then I grabbed the Adafruit Dotstar library for raspberry pi and write a short python script that should have just set each of the LEDs to red, green and blue respectively, blinking them on and off. Something happened, but not what I wanted. Lights went on and off, but not according to the timing in my script (1 sec on, 1 sec off), and while the first and second LEDs sometimes showed red and green, they also showed a bunch of other colours, and the third LED never showed the blue it was meant to (but did show other colours). Just in case it was a problem with the library, I also tried it with this library, but had the same problem. I suspect it’s a timing issue, because there was something happening, just not what I wanted… I also tried it using a pi zero, with the same results. I suspect that to pursue this path, I’m going to need a dedicated microcontroller, such as an arduino of some sort, receiving high level commands from the pi… but I’d like to spend most of my time leading up to the competition refining the algorithms for the challenges, not learning a whole new architecture. (While I would like to play with them, now is not the time!)

So then I thought “Well, if the Mote sticks are just APA102s, I should be able to drive my strip off the Mote controller board!” So I sliced up a USB cable and wired it to a section (12 LEDs) of the APA102 strip:

img_20170226_181151733

Then I plugged it in to the Mote controller board, and that into my computer, and a random selection of LEDs lit up, and stayed lit up. The mote sticks on the other three sockets of the controller still worked fine – here they are in the process of showing a rainbow:

img_20170226_182128070

While the Mote sticks cycled nicely through the pattern, the strip stayed static. I’m going to look again at the wiring – particularly the joints and whether I have the clock and data the right way round – but given that I’ve re-wired it several times (started with a much longer strip) and got the same result, I would be surprised if it’s the soldering. At this rate, I might just take a cutter to my Mote strips so that they are the appropriate length.

We did make some positive progress this weekend though, with work on the flicker for skittles. Angus and Peter have managed to put together a good strong “kick” from lego technics and an additional motor:

Unfortunately we still have some issues with fine grained control and weight distribution, making the ball capture not so good:

Still, it’s a great First-Attempt-In-Learning 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s