Close

Screening for bugs

A project log for TapV2

ESP32-Pico based, sensor-packed, kinda-silly wearable for not-every-day use!

xasinXasin 11/01/2021 at 22:290 Comments

Well, arguably one of the most important features of the Badge is finally operational, as you can see in the demonstration video in the Project Details!

However, getting to that point was a little tricky - and had a little surprise in store for me to debug!

An almost recognizable Hello World!!

Read on below to see how this slightly oddly wired OLED panel confused us for a while, and how eventually it too was brought under control~

OLED screens such as the module for Tap are, all in all, very easy to control.
The display here is a little 64x32 screen based on the popular SSD1306 IC, which has many libraries and fairly good documentation.

We even had a library written ourselves, which, without modifications, gave the result above - a somewhat readable "world", though the lines weren't drawn properly, and things seemed quite misshaped, all in all.

No bother, all OLED screens need a bit of tweaking in terms of the output muxing and interleaving of columns - but even after correctly setting these options according to the manufacturer's datasheet, the display still didn't behave quite right.

For one, the column/page wrapping options seemed to be ignored despite trying different ways of setting them up. This meant that instead of properly writing one page of data (which means eight rows, or one byte per column), and then wrapping on to the next, it would keep overwriting the same page, over and over.

This was the easy part to fix, by simply switching to a page addressing mode and manually wrapping to the next page. This means a little more I2C overhead by having to re-set the writing position, but it's minimal.

The second problem, however, was far more interesting.
See, the SSD1306 is actually meant for 128x32 pixel displays. It has a very strict mapping that essentially forces certain RAM addresses to physical pins, which can not be changed. Unneeded rows can be disabled, but unneeded columns can not.

When it comes to mapping a 64-pixel wide display onto these 128 pixels, one would assume that some sane parameters would be chosen, such as centering or aligning it to one of the edges.
The manufacturer of this screen, however, chose the very peculiar value of... 36 pixels of shift. Presumably, this simplified the hardware layout, but since this value wasn't documented, it made for a weird last hurdle to figure out.

Using a binary pattern to identify how the columns were mapped from RAM to physical layout made it easy and quick to determine the correct offsets needed!

Once all was said and done though, finally nothing stood in the way of making an old-time classic happen - the good old "Hello World"

It certainly is a rite of passage when getting a new program or hardware running, and Tap has officially passed this moment.

Next up will be making actual, practical use of Tap.
This includes cleaning up the software to provide cleaner interfaces, making the ring of LEDs work better, and perhaps adding a basic UI experience.

I am especially looking forward to getting the actual "Tap" in Tap to work - it's not just a funky name, you know?

Discussions