Close

Lighting Controller v4 Part 2

joshua-beckJoshua Beck wrote 05/21/2023 at 08:04 • 5 min read • Like

< Part One [Part Two] Part Three >

Continuing on from last time my boards have arrived from JLC PCB.

Looks good!

I did a quick inspection for issues and some basic electrical tests to make sure the thing's not going to turn into a pile of melted plastic as soon as I plug in the DC jack.

No problems so far.

I started loading the components.

S

So far so good....


Oh. Crap.

So it turns out getting the version with the headers already installed was a pretty bad idea.

They're all on the wrong side!

Now I'll have to desolder 50+ pins per module.

Or will I?


After engaging my brain for I moment I realised that you can just flip the capacitor and terminals. then install the module upside down and all the pinout remains the same!

Well, I'll have to connect the terminals the opposite way around and the pin numbers are now flipped such that channel sixteen becomes channel one and visa-versa. But that's something fixable in software.

With this unorthodox modification, I finished the rest of the soldering:

Well, almost. Most of the connectors are still stuck in the Australia Post system, and my workshop supplies were surprisingly empty after using most of them for the v3 boards at the beginning of the year.

In the meantime, I connected up the board and built a little webserver in CircuitPython:

Yep, that's all of it. Easy stuff.

All it does is wait for a POST to /set, convert it to an int, and send it to the PWM controller.

Fortunately,  Adafruit has a PCA9685 library for CircuitPython; because I'm not one to reinvent the wheel.

I made a little LED attachment to test it.

When the headers finally arrived I assembled the rest of it and started testing.

I tested it out with a POST action from the Tasker app on my Android device:

Seems to work okay and respond to changes in brightness.

But I need a better API that can set the value of specific channels.

So I jumped back to VSCode and wrote a simple JSON command system that lets you run on, off, and set commands with light number and brightness in the case of the light.

This is just to test it out, it's not the language that the actual controllers are using.

I sent a lot of requests to test it out:

(You can send multiple at the same time using the JSON array.)

Brightness seems to be adjusting okay and on/off is working. Very responsive.

I tested the other ports to make sure there were no unexpected surprises.

Join me next time as I put together a 3D-printed case and implement this archaic scripting code that I originally developed for the very memory-limited v1:

Not exactly well documented!

But all my light programs are already running it so I don't really want to change it.

See you later!

Like

Discussions