Oct 26, 2022

Week Notes - You Win or You Learn

A quote from Nelson Mandela apparently. It’s been in my head recently as I spent several days working on an LED project I shouldn’t have agreed to do with too little time, too little experience with the tools I eventually had to use, and without ever getting to see the physical installation. It feels like I’ve learnt a lot though and I’m inspired to learn more. So here’s a few rough notes, so I don’t forget, and in case there’s anything useful to other people.

Sensors

Originally there was a plan to use a sensor to control the speed that the lights moved and their brightness. I experimented with several different inputs:

Potentiometer

esp32_with_potentiometer.jpg

I used this code from Sensing the City to make a light move along a strip of LEDs (it looks even better if it’s moving around a disk!). Sensing the City is a great site, with loads of other good ideas.

Capacitive Touch Sensor

capacitive_touch.jpg

I already had an Adafruit CAP1188 breakout, recommended to me by Chris E at the Friday night cycling group I go to. It was easy to set up following the instructions on the Adafruit site and worked well, although I didn’t go further than blinking the onboard lights on this occasion. It seems worth putting in a bit more time and investigating some of its other features.

Although I didn’t get to use the Azoteq pressure sensor originally suggested for the project, I did see an Arduino sketch that used it. It looks as though there’s more to set up, but apparently it is very reliable, so might be worth further investigation too.

Pressure Sensors

We’ve used home made pressure sensors a lot at DoES Liverpool, mainly because we’ve found them a bit more predictable than capacitive touch.

I refamiliarised myself with these foam/wire/Velostat sensors that we made for Laura Pullig / Lanacaster Univerity’s What Does Health Look Like? project:

They work well and can use similar code to the potentiometer.

Along with Chris T, I also refurbished one of these much larger, but functionally similar, pressure sensors from MCQN Ltd’s Play the Tree/Geometric Lights. There are another 3 of these at DoES Liverpool and we’re now thinking of new uses for them:

large_pressure_sensor.jpg

Mapping Irregular LED Layouts

The project involved a fairly large number of pixels, arranged irregularly. In the end some of the pixels weren’t added until the day before the project shipped, so they had to be laid out physically in the order they would light up. I did try out several tools that might help me do pixel mapping in future though:

xLights Generate Custom Model

I’ve tried this before, and I didn’t have any more luck this time. The consensus seems to be that you need a decent camera, so I think it’s going to be worth borrowing one, watching a bunch of YouTubes, and trying again. On the other hand, I did find out that you can now control WLED via wifi from xLights on your laptop, so all good.

This semi-automatic pixel mapper might also be worth investigating.

LED-Mapper by Jason Coon

This is great - you do have to use Google Sheets to create a layout first, but it then allows you “to generate and visualize maps for irregular and/or gapped LED layouts, for use with FastLED, Pixelblaze and other libraries” and “also generates coordinate maps for radius and angle.”

I used both a disk of regularly spaced rings (wired as a spiral) and an irregular spiral made from WS2811 Xmas tree style pixels, taped onto Correx. Both were good although obviously the more closely-packed disk shows the pattern much better. This Tweet shows the regular disk running Jason Coon’s example sketch:

I used laser-cut polypropylene grids to work out the coordinates of the pixels, but Jason replied to the Tweet recommending this, which should be easier and more accurate.

I put together a quick push button circuit on the Arduino to help me identify the next pixel in line in the irregular spiral, and I can see that being useful again. The sketch is here.

Raspberry Pi as localhost with several ESP32s running WLED (or PicoWs?)

Another thing I didn’t get very far with before it became apparent that we weren’t going to use it, but I found some easy to follow instructions here and here. I’d like to take this further.

There are some alternatives to mqtt that might be worth looking at too - e.g. this YouTube shows how to make a lightshow with WLED, FPP, xLights and DDP data.

Arduino Mega 2560

This was what I finally wrote the sketch on, as there was one on site and I had one here. Memory was a bit of an issue, and because I didn’t get to see the final output, I wasn’t able to easily make amendments when things didn’t work as the users wanted (another lesson learned is that it might have helped to demonstrate the kind of effects that can be created at the start, and with what density of pixels).

Thanks to Adrian and Chris T for advice on C++ (the current spaghetti is my responsibility).

So I still want to do more LED projects…

~ ~ ~