The software that allows CALEIDUINO to work is based on the Arduino IDE and two graphic libraries that allow the use of of TFT screens (ours is 1.8’) and ST7735 library and a GFX library, both of which are designed by Adafruit.

Follow the steps to install everything you need to get your CALEIDUINO up and running. First open the link below and download the Arduino IDE:

Choose the software according to your operating system and install it according to the instructions. Once installed, open it and a framework like this should appear:


Then, access the Adafruit website and download the Adafruit library ST7735:

And the GFX library:

Once these have been downloaded, to easily install them, follow these instructions:

Once you have everything ready, simply download the next Arduino sketch or copy the code from the box below. This is an example of how we can easily create the graphics and sounds with the CALEIDUINO.


         xxxx xxxx x    xxxx x xxx  x  x x x  x xxxx
         x    x  x x    x    x x  x x  x x xx x x  x
         x    xxxx x    xxx  x x  x x  x x x xx x  x
         x    x  x x    x    x x  x x  x x x  x x  x
         xxxx x  x xxxx xxxx x xxx  xxxx x x  x xxxx (1)

This CALEIDUINO sketch is based on Adafruit’s GFX and ST_7735 libraries, 
which allows the Arduino to be connected to a 1.8’ TFT screen. I give thanks to Arduino and Adafruit for developing the hardware and software that makes the CALEIDUINO project possible. This sketch code is open source and public domain. It is available to anyone who wants to create their own CALEIDUINO.

Come on and create your own digital sonic kaleidoscope!!

(CC) Jose Manuel Gonzalez 2016

// Connections to the TFT screen
// #define sclk 13 / Use this line if you prefer Option 1 (slow)
// #define mosi 11 / Use this line if you prefer Option 1 (slow)
#define cs 8
#define dc 9
#define rst 10

// #include "pitches.h" / If you would like to play with the musical notes 
// from the folder “pitches.h”, you will find them below. 
// More information:

#include <Adafruit_GFX.h> // Library which permits to design the graphics //on the screen
#include <Adafruit_ST7735.h> // Library which permits the use of the chip // of the 1.8' TFT screen 
#include <SPI.h> // Library so that Arduino communicates with the TFT via // the Serial protocol

#if defined(__SAM3X8E__)
#undef __FlashStringHelper::F(string_literal)
#define F(string_literal) string_literal

// Option 1: Use all of the PINS but the screen will work a little 
// more slowly:
// Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, mosi, sclk, rst);

// Option 2: You should use the SPI PINS. 
// (for Arduino UNO PINS sclk = 13 y mosi = 11). 
// This method is faster: 
// Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, rst);
// float p = 3.1415926;

// The three analogical accelerator inputs, which respond to the 3 axis 
// X, Y and Z, 
// connect to the PINS of the 
Arduino in A0, A1 and A2:

const int xPin = A0;
const int yPin = A1;
const int zPin = A2;

// We generate a map of the values of the sensors 
// The minimum value is 260 and the maximum 420:

int minVal = 260; 
int maxVal = 420;

// We name the input values from PINS A0, A1 y A2:

int val1 = 0;
int val2 = 0;
int val3 = 0;
int sound = 0;

void setup(void) {
// Start the TFT screen in black:

uint16_t time = millis();

// PIN 4 is the buzzer output:

pinMode(4, OUTPUT);


// In the void loop is where the fun begins!!

void loop() {
int sensorValue1 = analogRead(xPin);
int sensorValue2 = analogRead(yPin);
int sensorValue3 = analogRead(zPin);
// Convert the analogical exit (which goes from 0 - 1023)
// to the voltage (0 - 5V):

float voltage1 = sensorValue1;
float voltage2 = sensorValue2;
float voltage3 = sensorValue3;
// Map the entrance values of the accelerometer
// to use them later in the TFT screen
// +---------- 160px -----------+
// + +
// + +
// 128px +
// + +
// + +
// +----------------------------+

val1 = map(voltage1, minVal, maxVal, 1, 160); // From 0 to 160px width
val2 = map(voltage2, minVal, maxVal, 1, 128); // From 0 to 128px height
val3 = map(voltage3, minVal, maxVal, 1, 128); // From 0 to 128px height

// Map the values of val3 to create sounds.
// Look at the values in the table below: 

sound = map(voltage3, minVal, maxVal, 31, 4978); 

// The tone function (PIN, Frequency, Duration).
// More information at:
// Here, add randomisation to the duration of
// the sound of the buzzer to create fun sounds. 

tone(4, sound, val1/random(1, 10));
// Thanks to the Serial port, we can see the entrance values
// of the accelerometer on the screen and, accordingly, the
// values of the sound released by the piezoelectric. This 
// will happen while you have the Arduino board connected
// to the USB cable.
// It may be useful to calibrate the values according to our needs: 

Serial.print("value X ="); 
Serial.print("value Y ="); 
Serial.print("value Z ="); 
Serial.print("sound ="); 

/* Here there are a number of examples of the graphical functions that
the Adafruit GFX library will permit. It works in a similar way to the basic functions of drawing in Processing. It allows us to draw triangles, 
rectangles, circles, ellipses, vertical, horizontal, oblique lines, etc. 
Play with the different possibilities and combine them so that the graphics 
on your TFT screen make fun and interesting kaleidoscopical shapes. For 
more information:

Next we are going to draw a colour filled triangle. To understand this 
function, and all of the rest, note that there are 7 values in brackets 
The function works like this:

tft.fillTriangle(X1, Y1, X2, Y2, X3, Y3, Colour);

X1 / Y1 --> coordinates of the first vertex of the triangle
X2 / Y2 --> coordinates of the second vertex of the triangle
X3 / Y3 --> coordinates of the third vertex of the triangle
Color ----> 16 bits value, RED(0/31), GREEN(0/63) y BLUE(0/31)

tft.fillTriangle(val1, val2, val3, val1, random(120), random(120), random(316331)); 

// Draw a rectangle with round corners in a random colour: 

tft.fillRoundRect(val1, val2, random(10,80), random(10,80), random(5), random(316331)); 

// Draw the perimeter of the circumference in a random colour: 

tft.drawCircle(val1, val3, val2/3, random(316331)); 

// Draw a circle filled with a random colour: 

tft.fillCircle(val1, val2, random(30), random(316331)); 

// Draw vertical lines with a random colour: 

tft.drawFastVLine(val2, 1, tft.height(), random(316331)); 

// Draw oblique lines with a random colour:

tft.drawLine(val1, val2, val2, val3, random(316331));

// Draw perimeter of a rectangle in a random colour:

tft.drawRect(val2, random(127), random(127), random(127), random(316331));

// The time to refresh the graphics must not be = 0. 
// If this happens the TFT screen will go crazy: 

val1 = 1; }
// The delay () allows the loop () to rest. The AO PIN receives 
// the input from the sensor which determines the value of the delay, 
// controlling the speed of the pause in graphics depending on 
// the position of the CALEIDUINO:



// END

Copy the program and paste it into the Arduino IDE. Then, if you want to play with musical notes, instead of with simple noises, you should create a new tab inside the same patch and name it pitches.h. Then, copy the code below and paste it into the tab you have just created. Before doing this and playing with the “music” that could generate your CALEIDUINO, I would recommend taking a look at this tutorial created by Tom Igoe, to understand it clearly.

#define NOTE_B0 31
#define NOTE_C1 33
#define NOTE_CS1 35
#define NOTE_D1 37
#define NOTE_DS1 39
#define NOTE_E1 41
#define NOTE_F1 44
#define NOTE_FS1 46
#define NOTE_G1 49
#define NOTE_GS1 52
#define NOTE_A1 55
#define NOTE_AS1 58
#define NOTE_B1 62
#define NOTE_C2 65
#define NOTE_CS2 69
#define NOTE_D2 73
#define NOTE_DS2 78
#define NOTE_E2 82
#define NOTE_F2 87
#define NOTE_FS2 93
#define NOTE_G2 98
#define NOTE_GS2 104
#define NOTE_A2 110
#define NOTE_AS2 117
#define NOTE_B2 123
#define NOTE_C3 131
#define NOTE_CS3 139
#define NOTE_D3 147
#define NOTE_DS3 156
#define NOTE_E3 165
#define NOTE_F3 175
#define NOTE_FS3 185
#define NOTE_G3 196
#define NOTE_GS3 208
#define NOTE_A3 220
#define NOTE_AS3 233
#define NOTE_B3 247
#define NOTE_C4 262
#define NOTE_CS4 277
#define NOTE_D4 294
#define NOTE_DS4 311
#define NOTE_E4 330
#define NOTE_F4 349
#define NOTE_FS4 370
#define NOTE_G4 392
#define NOTE_GS4 415
#define NOTE_A4 440
#define NOTE_AS4 466
#define NOTE_B4 494
#define NOTE_C5 523
#define NOTE_CS5 554
#define NOTE_D5 587
#define NOTE_DS5 622
#define NOTE_E5 659
#define NOTE_F5 698
#define NOTE_FS5 740
#define NOTE_G5 784
#define NOTE_GS5 831
#define NOTE_A5 880
#define NOTE_AS5 932
#define NOTE_B5 988
#define NOTE_C6 1047
#define NOTE_CS6 1109
#define NOTE_D6 1175
#define NOTE_DS6 1245
#define NOTE_E6 1319
#define NOTE_F6 1397
#define NOTE_FS6 1480
#define NOTE_G6 1568
#define NOTE_GS6 1661
#define NOTE_A6 1760
#define NOTE_AS6 1865
#define NOTE_B6 1976
#define NOTE_C7 2093
#define NOTE_CS7 2217
#define NOTE_D7 2349
#define NOTE_DS7 2489
#define NOTE_E7 2637
#define NOTE_F7 2794
#define NOTE_FS7 2960
#define NOTE_G7 3136
#define NOTE_GS7 3322
#define NOTE_A7 3520
#define NOTE_AS7 3729
#define NOTE_B7 3951
#define NOTE_C8 4186
#define NOTE_CS8 4435
#define NOTE_D8 4699
#define NOTE_DS8 4978

To finish, download everything on the board using the mini USB cable connected to the computer. To do this, first you should choose the Arduino IDE board (Arduino nano for the CALEIDUINO board) and the serial port. In the instance that you experience problems with your PC (Windows), or your Mac (OSX), check the serial port of the Arduino, and take a look at this article that explains how to download the drivers for PC and Mac.

Once you have checked that the Arduino IDE recognizes the board, press the compile button to check that there is no fault in the code, then press the button to download the program. You will see how one of the Arduino’s LEDs starts blinking, which means that the software is downloading. Once the LED and the Arduino IDE stop blinking this indicates that the program has been downloaded. Now the CALEIDUINO is ready and will start to work, Now the fun begins!!

brochure-2 copia

You are welcome to change the code, patch it up, use other libraries to create graphics with the 1.8’TFT screen or to generate different sounds using the buzzer and the data from the three axis X, Y and Z from the analogical accelerometer…

Here are some interesting libraries that you can use to hack your CALEIDUINO:

UTFT, designed by Henning Karlsen to control TFT screens. 

TFT , included in the Arduino IDE which is very similar to Adafruit GFX library and whose function is to control the graphics on the TFT screen:

toneAC , designed by Tim Eckel. This allows you to increase the sonority of the piezoelectric

MOZZI, designed byTim Barras and serves to generate synthesized sound.

MIDI, also included in the Arduino IDE and allows you to communicate your board, via serial port, with any musical program that receives MIDI signals and converts them to music on your computer (Audacity, GarageBand, ProTools…);

Set your imagination free and improve upon the design. Do so using open source, under CC licenses and share.

spread your ideas!!