Mak a Christmass Tree Animation with snow, and lights using a TFT ST7735 LCD & Arduino.
Watch the Video!
Project file can be downloaded below.
Step 1: What You Will Need
- Arduino UNO (or any other Arduino)
- ST7735 or ST7789 Display
- Breadboard
- Jumper wires
- Visuino program: Download Visuino
Step 2: The Circuit
Connect:
- 1.8 TFT Display PIN [LED] to Arduino PIN [3.3 V]
- 1.8 TFT Display PIN [SCK] to Arduino PIN [13]
- 1.8 TFT Display PIN [SDA] to Arduino PIN [11]
- 1.8 TFT Display PIN [A0 or DC] to Arduino PIN [9]
- 1.8 TFT Display PIN [RESET] to Arduino PIN [8]
- 1.8 TFT Display PIN [CS] to Arduino PIN [10]
- 1.8 TFT Display PIN [GND] to Arduino PIN [GND]
- 1.8 TFT Display PIN [VCC] to Arduino PIN [5V]
NOTE: Some Arduino boards have different SPI pins so make sure you check your board documentation.
Step 3: Start Visuino, and Select the Arduino UNO Board Type
The Visuino: https://www.visuino.eu also needs to be installed. Download Free version or register for a Free Trial.
Start Visuino as shown in the first picture Click on the "Tools" button on the Arduino component (Picture 1) in Visuino When the dialog appears, select "Arduino UNO" as shown on Picture 2
Step 4: In Visuino Add & Set Components
Add "TFT Color Display ST7735/ST7789" component
Add 6X "Random Integer Generator" component
Add "Clock Multi Source" component
Add "Repeat Clock" component
Add "Clock Demux(Multiple Output channel Switch)" component
Add "Counter" component
Add "Pulse Generator" component
Select "PulseGenerator1" and in the properties window set Frequency to 0.5
Select "Counter1" and in the properties window set Max>Value to 5 and Min > Value to 0
Select "ClockDemmux1" and in the properties window set Output Pins to 5
Select "RepeatClock1" and in the properties window set "Count" to 10
Select "ClockMultiSource1" and in the properties window set "Count" to 9
Select "RandomIntegerGenerator1" and in the properties window set "Max" to 100 and "Min" to 70
Select "RandomIntegerGenerator2" and in the properties window set "Max" to 100 and "Min" to 70
Select "RandomIntegerGenerator3" and in the properties window set "Max" to 110 and "Min" to 70
Select "RandomIntegerGenerator4" and in the properties window set "Max" to 100 and "Min" to 70
Select "RandomIntegerGenerator5" and in the properties window set "Max" to 160 and "Min" to 0
Select "RandomIntegerGenerator6" and in the properties window set "Max" to 120 and "Min" to 0
Select "Display1" and in the properties window set "Orientation" to goRight and "Type" to dtST7735R_BlackTab <<If you have any other type of the LCD then select that type
Step 5: In Visuino Set the Display
Double click on the "Display1" and in the Elements window :
Drag "Draw Bitmap" to the left side and in the properties window click on the Bitmap three dots button and load the Background Christmas picture (attached here for download)
- Drag 6x "Draw Ellipse" to the left side
- Select "Draw Ellipse1" and in the properties window set "Color" to "aclBrown" , "Fill Color" to aclRed ,"Height" to 6 , "Width" to 6, Select "X" and click on the Pin Icon and Select "Integer SinkPin", Select "Y" and click on the Pin Icon and Select "Integer SinkPin"
- Select "Draw Ellipse2" and in the properties window set "Color" to "aclBlack" , "Fill Color" to aclBlue,"Height" to 6 , "Width" to 6, Select "X" and click on the Pin Icon and Select "Integer SinkPin", Select "Y" and click on the Pin Icon and Select "Integer SinkPin"
- Select "Draw Ellipse3" and in the properties window set "Color" to "aclWhite" , "Fill Color" to aclWhite,"Height" to 6 , "Width" to 6, Select "X" and click on the Pin Icon and Select "Integer SinkPin", Select "Y" and click on the Pin Icon and Select "Integer SinkPin"
- Select "Draw Ellipse4" and in the properties window set "Color" to "aclBrown" , "Fill Color" to aclRed ,"Height" to 6 , "Width" to 6, Set "X" to 97, Set "Y" 55
- Select "Draw Ellipse5" and in the properties window set "Color" to "aclBrown" , "Fill Color" to aclRed ,"Height" to 6 , "Width" to 6, Set "X" to 90, Set "Y" 60
- Select "Draw Ellipse6" and in the properties window set "Color" to "aclBrown" , "Fill Color" to aclBlue,"Height" to 6 , "Width" to 6, Set "X" to 90, Set "Y" 55
Close the "Elements Window"
Step 6: In Visuino Connect Components
- Connect "PulseGenerator1" pin [Out] to "Counter1" pin [In]
- Connect "Counter1" pin [Out] to "ClockDemmux1" pin [Select] And "ClockDemmux1" pin [In]
- Connect "ClockDemmux1" pin [0] to "Display1" > Draw Bitmap1 Pin[Clock]
- Connect "ClockDemmux1" pin [1] to "RepeatClock1" pin [In]
- Connect "ClockDemmux1" pin [2] to "Display1" > Draw Ellipse4 Pin[Clock]
- Connect "ClockDemmux1" pin [3] to "Display1" > Draw Ellipse5 Pin[Clock]
- Connect "ClockDemmux1" pin [4] to "Display1" > Draw Ellipse6 Pin[Clock]
- Connect "RepeatClock1" pin [Out] to "ClockMultiSource1" Pin [In]
- Connect "ClockMultiSource1" pin [0] to "RandomIntegerGenerator1" Pin[Clock]
- Connect "ClockMultiSource1" pin [1] to "RandomIntegerGenerator2" Pin[Clock]
- Connect "ClockMultiSource1" pin [2] to "Display1" > Draw Ellipse1 Pin[Clock]
- Connect "ClockMultiSource1" pin [3] to "RandomIntegerGenerator3" Pin[Clock]
- Connect "ClockMultiSource1" pin [4] to "RandomIntegerGenerator4" Pin[Clock]
- Connect "ClockMultiSource1" pin [5] to "Display1" > Draw Ellipse2 Pin[Clock]
- Connect "ClockMultiSource1" pin [6] to "RandomIntegerGenerator5" Pin[Clock]
- Connect "ClockMultiSource1" pin [7] to "RandomIntegerGenerator6" Pin[Clock]
- Connect "ClockMultiSource1" pin [8] to "Display1" > Draw Ellipse3 Pin[Clock]
Step 7: Generate, Compile, and Upload the Arduino Code
In Visuino, at the bottom click on the "Build" Tab, make sure the correct port is selected, then click on the "Compile/Build and Upload" button.
Step 8: Play
If you power the Arduino module, the LCD Display will start to show the Christmas Picture, Lights on the tree and the snow will be drawn by a random.
Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this Tutorial, you can download it and open it in Visuino: https://www.visuino.eu
Comments