Another project using an Arduino UNO and a 2.2" TFT graphics display. This sketch just generates pretty patterns using epicycles.
Have a look at my other instructables for some of the development background.
Step 1: Connecting Up the UNO to the TFT Screen
The UNO is connected to the ILI9241 2.2" TFT display like this:
- UNO +5V to display pin 1 (VCC)
- UNO +5V through a 56 Ohm resistor to display pin 8 (LED)
- UNO 0V (GND) to display pin 2 (GND)
- UNO digital pin 7 through a 1K2 resistor to display pin 4 (RESET), add a 1K8 resistor from display pin 4 to GND
- UNO digital pin 9 through a 1K2 resistor to display pin 5 (DC/RS), add a 1K8 resistor from display pin 5 to GND
- UNO digital pin 10 through a 1K2 resistor to display pin 3 (CS), add a 1K8 resistor from display pin 3 to GND
- UNO digital pin 11 through a 1K2 resistor to display pin 6 (SDI/MOSI), add a 1K8 resistor from display pin 6 to GND
- UNO digital pin 13 through a 1K2 resistor to display pin 7 (SCK), add a 1K8 resistor from display pin 7 to GND
It is important to include the 1K8 resistors to GND with this 2.2" display as otherwise it will not work. The 1K2 and 1K8 resistors are a "potential divider", acting as a logic level shifter so that the logic level at the display is reduced from 5V to around 3V. Pin 9 of the display does not need to be connected up.
Step 2: Spiro Sketch and Libraries
The graphics libraries needed are in the attached zip file. The Spiro sketch is within the examples of the "Adafruit_ILI9341_AS" library.
The libraries are the latest version superseding the version here. Some more enhancements have been made to improve drawing speeds.
Step 3: Pattern Algorithm
The patterns are produced by drawing single coloured pixels at the tip of a rotating vector, the centre of this vector is also rotating about the centre of the screen. Various parameters (radii and ratios) are changed at random before each pattern is drawn, in this way thousands of different patterns are generated. The pixel drawn changes through the colours of the rainbow, generating some nice aliasing effects.
The pictures presented are deliberately blurred slightly as this is the only way that my webcam can capture the vibrant colours properly.
Step 4: Your Patterns?
If you have created a sketch that generates amazing coloured patterns using the hardware setup and libraries in this instructable, then it would be great if you post the sketch below. Thanks and have fun!