A digital Kaleidoscope

Sun, Jan 24, 2021 2-minute read


In part 2 of the creative engineering class, we needed to pick a problem that dealt with art, and used the arduino, so I made a digital Kaleidoscope.

The Idea is instead of having physical junk moving around at the end of your kaleidoscope, you have virtual junk moving around instead.

The final build was an arduino mega, with an Elegoo tft shield mounted on top that has a 3d printed mount that holds the mirrors for the kaleidoscope. At the top of this contraption is another base that holds a webcam.


The downside to using the tft shiled is that the refresh rate is very very slow, so it’s hard to create smooth animations, and instead I created more dragging animations that didn’t clear after themselves. If I update this in the future i’ll probably use a raspberry pi with a small display that can refresh faster and make a pretty case to hold the whole thing. I also want to look into using a simple 2d physics engine to make actual junk that can fall and interact with other junk in the system.


I also learned while making this that these displays don’t use normal hex color encoding, but use rgb565, so if you are trying to convert rgb color to the 565 syntax for the adafruit libraries, this code does the trick:

// https://www.barth-dev.de/about-rgb565-and-how-to-convert-into-it/
// rgb 565 is required
long rgb(byte red, byte green, byte blue) {
  // return ((long)R << 16L) | ((long)G << 8L) | (long)B;
  return (((red & 0xf8)<<8) + ((green & 0xfc)<<3) + (blue>>3));

Code for the kaleidoscope and base can be found here.