Skip to main content

83. Painting on Adafruit TFT Touch Shield with Colour Picker

 Hey everyone

Today I am back with a new and interesting project. In this post, you will learn to make your own colour picker and use it with your Adafruit Touch shield for digital painting. The colour picker is now limited to detect up to 7 colours - Black, Blue, Brown, Green, Red, Yellow and White - but it can be programmed to detect much more. Read on further to learn how to do this project.

Hardware components used for this project

  • Arduino Mega 2560
  • Adafruit 2.8" TFT Touch Shield with Capactive Touch
  • TCS230/ TCS3200 colour sensor module
  • IR tracking sensor module
  • Solderless Breadboard - Half +
  • Male-to-Female Jumper wires (x8)
  • Male-to-Male Jumper wires (x4)

Setup









Connection

Adafruit 2.8" TFT Touch Shield

You can simply place it onto your Arduino Mega 2560 development board.

TCS230/ TCS 3200 colour sensor module

  • S0 - D34
  • S1 - D33
  • S2 - D31
  • S3 - D32
  • OUT - D30
  • OE - Ground
  • GND - Ground
  • VCC - 5V

IR Tracking sensor module

  • VCC - 5V
  • GND - Ground
  • S - D40

Coding

For this project, you will be needing the following libraries:
The SPI and Wire libraries are built-in and you do not have to install them but the other 4 libraries have to be installed by either using the Arduino library manager or manually. 
Open Arduino IDE, go to Tools and select Manage Libraries... Type in the respective libraries' names in the search bar and install the latest version.
For this project, I was inspired by the CapTouchPaint example sketch from the Adafruit FT6206 library so I advice you to first upload this example sketch to your microcontroller.
Go to File ---> Examples ---> Adafruit FT6206 library ---> CapTouchPaint. Upload this example sketch to your Arduino Mega and start experimenting to learn how the code works.
To learn how to make a colour picker, please visit one of my previous projects: Arduino based Colour detection machine. Within that post's code explanation, you will learn how to interface the colour sensor module with the Arduino development board.
Now that you may have understood about interfacing the colour sensor module, it's time for you to use that idea in this project.
You have to program your colour sensor module to 'pick' a colour correctly while your finger is hovered over the IR sensor and this colour should be displayed on the TFT display.
IR tracking sensor module will output a LOW signal when it detects an obstacle so if the LOW signal is detected, the colour sensor module should pick the colour of the object placed in front of it. The colour should be displayed on the TFT display when you tap on the margin box found on the left side of the screen. The default colour should be set to White and the default colour should be assigned when the colour sensor module detects an undefined colour.
Set the Penradius to 3 pixels.
A margin box should be drawn on the left edge of the TFT display. The fillRect( ) should be used for this purpose and the dimensions should be 240 pixels and 40 pixels. The colour used for the fill function should be the colour detected.
A grey box should be drawn on the top left corner of the screen. This will be used as the clear button. For this, you will need the fillRect( ) function and the dimesions should be 40 pixels. The colour of the box is up to you but I have used dark grey which is already defined in the ILI9341 library. The clear function must be performed when you tap within that box's dimensions. At the same time, a white rectangle should be drawn around the box to show that it has been selected and the drawRect( ) function should be used for this purpose. The white outline of the grey box should disappear after 100 milliseconds.
Please watch the YouTube video in this post to learn how this project works.
If anyone has any questions or suggestions with the coding, please feel free to comment below.

Final Look

If anyone has any questions or suggestions about this project, please feel free to comment below.

Comments

Popular posts from this blog

51. Buzz wire game using Arduino

Hello everyone! This is my first Arduino project in 2020 and it is going to be a fun and simple project. You would have heard of the Buzz Wire, a steady hand game, and today you will be learning to make one using Arduino. Hardware components used in this project Arduino Nano USB Type A to mini B cable (for Arduino Nano) Solderless Breadboard - Mini and Full-size LEDs (x2) - Green and Red Resistors (x2) - 220 Ω  Active Buzzer module (KY-012) LCD display module with I2C interface - 16x2 Male-to-Male Jumper wires (x4) - 10cm Female-to-Male Jumper wires (x5) - 20 cm Jumpers (x5) - to reduce the usage of wires Copper wire  Tape (or any form of insulation)  Setup Your hardware setup must look somewhat similar to the ones in the images above. The beginning and end of the copper wire maze must be taped to prevent conductivity between the wire loop and maze. Connections LCD display module with I2C interface GND - Ground VCC - 5V SDA - A4 SCL - A5

71. Buzz Wire Game ( Version 2.0 ) using Arduino

Hey Everyone! I hope that everyone's safe during this pandemic. Today I am going to explain you about the second version of my Buzz wire game. People who are bored of staying indoors can find this game pretty interesting and fun to play.  If you are a beginner, you can start off with my first version of this project :  51. Buzz wire game using Arduino   Hardware components used in this project Arduino Uno Solderless Breadboard (x2) - Full/ Full+ LCD display module with I2C module - 16x2 Potentiometer - B20K Push-buttons (x3) Resistor - 220 Ω Active Buzzer module (KY-012) LED - Red Copper Wire - 19/ 20 gauge thick Male-to-Male Jumper wires - 10cm and 20cm Wire - Long enough to connect the loop of copper wire to ground Other tools required for this project Cutting pliers - To cut the right amount of copper wire Round-nose pliers - To bend the copper wire and make a maze and loop Hardware setup Connections Wire Maze - D2 Wire loop - Ground (GND) B20K Potentiometer S - A0 (+) - 5V (-)

86. RFID Health tag (Arduino and Python)

 Hey everyone, Sorry I have not uploaded in a while. Today, I will be sharing an interesting project with all of you. This RFID Health tag project is useful when it comes to keeping track of vaccinated individuals, their biodata and their health conditions and medications. For this project, you will be needing Arduino and Python. Read on further to see how I did this project. Hardware components used in this project Arduino Uno Solderless Breadboard - Half+ MRFC522 RFID reader RFID key tags (x5) Push-buttons (x2) Male-to-Male Jumper wires (x12) USB Type A/ B cable (for Arduino Uno) Software required Arduino IDE - latest version recommended Python 3.8 Schematic MFRC522 RFID reader SDA/ SS - D10 SCK - D13 MOSI - D11 MISO - D12 IRQ - Not connected GND - Ground RST/ RESET - D9 3.3V - 3.3V Push-buttons Submit button - D4 Retrieve button - D5 Coding Arduino For this project, you will be using the following libraries: MFRC522 by miguelbalboa -  https://github.com/miguelbalboa/rfid SPI - In-bu