Go Down

Topic: "No flicker" Multiplexing of LCDs...fun with the HT16K33 (Read 327 times) previous topic - next topic

GreyArea

This post might take a while. I'm a newbie, figured this out for myself with some help here. Not sure if the way I've done this is right, and you can pretty sure it's not the best or most professional way to do it...but it might help a newbie is was struggling like I was.

The task;

Make a lightbox where you can control the RGB values of the light it emits, but also see those values on LCD displays.

I make nightlights that use filtered light to project images. It's important to get the RGB balance just right so that one filter "vanishes" completely and doesn't interfere with the image generated by the other. I wanted a quick and "touchy feely" way of changign the light values, whilst stil accurately recording the values from 0-255 so that I could include them in sketches later.

The challenges;

"Too many inputs!"

Three values of 0-255 = 3 x 3 digits = NINE digits total.

A single seven segment LCD has EIGHT terminals (seven segments plus one for the decimal point)...nine x eight = 72 terminals. I'm using a trinket with limited outputs. I'm grateful to Paul S on here for his suggestion of multiplexing and for, in his own way..."helping". Aristotle would be proud.

"No Flicker"

I was told that mutiplexing with the Trinket would lead to flicker. I'd tried a simple sketch and boy they were right. You have to mess with delay statmeents to minimise it and even then it's noticeable. I hate flicker, so it had to go, or I was jacking it all in.

"I am John Snow"

Seriously. I know nothing. I barely knew what a bit was prior to this, let alone how to bang or shift some...thinking in binary is hard...but surprisingly effective when controlling thse things"

"HTK...no...HKT...HK16...sod it, Im calling you Hattie".

If you think HT16K33 is hard to say...try working with one. They have a little "foible" that really takes some sorting out. I had help on this project from a guy who used to consult on programming at hundreds of pounds an hour. It did his head in. He was thinking like a guy who's used to these things working sensibly. It doesn't. More on that later.

Parts list;
Eventually I intend to work this up to a printed circuit board, or at least a wired one. Currently it's still on my breadboard. Yes, I can hear the sniffs of disgust even now. Tough. It's what I have and it works.

To make the WHOLE things you'll need;

For the light box;
an Ikea "Ribba" photo frame
144 WS2812b LEDs (60 per metre, arranged in a 12x12 grid)
a 1000 microfarad capacitor
a 470 ohm resistor
something to opacify the front glass
  • ordinary copier paper actually works quite well
  • tracing paper gives less opacity
  • sticky back plastic (fablon) also works well, even a solid white one
  • or you could push the boat out like I did and get a 23cm square of frosted perspex cut by someone

Optional; you can mirror the surface of the frame if you want with one-way mirror window film.

Plus the normal tools - wire, solder, soldering iron, power etc

Buildng the actual light box is the easy part...cut the LEDs into 12 strips with 12 on each (it will work with 30/m LEDs in which case use 36 cut into 6 strips of six each)

Take the hardboard back out of the frame. Measure and mark it so that the LEDS are even space in a 12 x 12 (or 6 x 6) grid.

REMEMBER! Data in to Data out! I find it easier to wire them in a long snake (like a snakes and ladders board), but if you want to use more wire you could connect them all running the same wat if you wish.

The self adhesive on the LEDs is pants. Use some pritt (other brands are available) stick on the hardboard first and they stick much better.

Solder and wire them (yes, you can glue them first and then solder...I've done it many times and the hardboard does not burst into flames). Add some connections that come out of the box (there's a convenient triangle cut out of one of the corners of the hardboard. Yeah I probably should have mentioned that earlier. This would be a good time for you to realise that this is me, not going back to edit it, and you might want to read ahead before you go any further.

Solder the capacitor to the connecting wires as cllose as possible to the first LED (I just solder it across the pads with the connecting wires...it should "bridge" the +5v and GND wires/terminals...and it only goes one way round - -ve to -ve, +ve to +ve. Solder the resistor to the "Data in line", and then another wire to the other end to connect to the arduino.

I find it easier at this point to reverse the frame. The Ribba is a box frame so theres a frame of fibreboard that gives about an inch space between front and back. Take it out and take the plastic (it used to be glass in older Ribba frames) front out as well.

Put the hardboard back into the recess of the frame with teh lights facing in. Put the fibreboard frame back in.

This is why I use my perspex...you CAN just about get away with working on the cheap flimsy plastic that Ikea uses these days...but 3mm of acrylic is nice and tough. Your choice...be cheap and stick copier paper to the plastic, or spend a few quid getting the perspex. Put the opacified layer back in the frame...it sits just below the outer edge. I adjusted mine to sit a little higher, and now I can just lift the perspex (in my  case) out easily if I want to change for a different material.

So...that's your box. If you have any sketches that run LEDs, you can connect the Arduino of your choice to it, set N_LEDs (or whatever) to 144 and watch it run the pretty animations. Or, y'know, just flash on and off.

Now you have a ligght box. Next post - parts you'll need to control it and how to wire them.

(probably be tomorrow now, getting late).

GreyArea

Haven't forgotten...draft post ready to go but it's kinda long...and one of the "How to test a seven segment LCD" sites turned out to be a browser hijacker....grrr...I'll get back to this soon...

Go Up