Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Kirthik vasan
Published

Flat Panel Switchboards

Digitizing household mechanical switches with CoolMOS C7. `

IntermediateFull instructions provided2 days2,780
Flat Panel Switchboards

Things used in this project

Hardware components

CoolMOS C7 Gold SJ MOSFET
Infineon CoolMOS C7 Gold SJ MOSFET
×2
SOIC/SSOP to DIP Adapter PCB
×2
XL6009 DC- DC Adjustable Step UP Boost Power Converter Module
×1
Step Down Transformer 220/12VAC 0.5A
×2
Capacitor 1000 µF
Capacitor 1000 µF
×2
1N4007 – High Voltage, High Current Rated Diode
1N4007 – High Voltage, High Current Rated Diode
×8
Linear Regulator (7805)
Linear Regulator (7805)
×1
Linear Regulator (7812)
×1
IK1212SA - Isolated Board Mount DC/DC Converter, 1 Output, 250 mW, 12 V, 20.83 mA
×1
5 mm LED: Yellow
5 mm LED: Yellow
×1
5 mm LED: Green
5 mm LED: Green
×1
2.4 inch TFT Touch Screen
×1
Arduino UNO
Arduino UNO
×1
Male Header 40 Position 1 Row (0.1")
Male Header 40 Position 1 Row (0.1")
×1
Female Header 8 Position 1 Row (0.1")
Female Header 8 Position 1 Row (0.1")
×1
PBT Connector 2 Pin
×2
Resistor 1M ohm
Resistor 1M ohm
×1
Resistor 221 ohm
Resistor 221 ohm
×1
Solderless Breadboard Full Size
Solderless Breadboard Full Size
×1
Jumper wires (generic)
Jumper wires (generic)
×1
zero pcb
×1
philips 0.5W 220-230V 50Hz
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Mastech MS8217 Autorange Digital Multimeter
Digilent Mastech MS8217 Autorange Digital Multimeter

Story

Read more

Schematics

Schematics

Flat_Panel_Switchboards

Code

TFT Touch panel

Arduino
#include <SPFD5408_Adafruit_GFX.h>    // Core graphics library
#include <SPFD5408_Adafruit_TFTLCD.h> // Hardware-specific library
#include <SPFD5408_TouchScreen.h>

#define LCD_CS A3 // Chip Select goes to Analog 3
#define LCD_CD A2 // Command/Data goes to Analog 2
#define LCD_WR A1 // LCD Write goes to Analog 1
#define LCD_RD A0 // LCD Read goes to Analog 0
#define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin
#define  BLACK   0x0000
#define BLUE    0x001F
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF
int touch=2;
Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);


#define YP A1  // must be an analog pin, use "An" notation!
#define XM A2  // must be an analog pin, use "An" notation!
#define YM 7   // can be a digital pin
#define XP 6   // can be a digital pin
#define TS_MINX 125
#define TS_MINY 85
#define TS_MAXX 965
#define TS_MAXY 905
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);
#define MINPRESSURE 10
#define MAXPRESSURE 500
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  tft.reset();
  tft.begin(0x9325); // SDFP5408
tft.fillScreen(RED);
tft.setTextColor(BLUE);
tft.setTextSize(4);
tft.setCursor(30,50);
tft.fillRect(0,0,120,120,YELLOW);
tft.println("ON");
tft.setCursor(10,180);
tft.fillRect(120,0,120,120,CYAN);
tft.setCursor(150,50);

tft.setTextColor(BLACK);
tft.setTextSize(4);

tft.println("OFF");
pinMode(A5,OUTPUT);
tft.setTextColor(WHITE);
tft.setCursor(20,130);

tft.println("Infineon");
tft.setTextColor(YELLOW);
tft.setCursor(20,160);
tft.setTextSize(4);

tft.println("Powering the Future");
tft.setTextColor(GREEN);
tft.setCursor(20,240);
tft.setTextSize(3);

tft.println("Hackster.io");

}

void loop() {
  // put your main code here, to run repeatedly:
    TSPoint p = ts.getPoint();

  if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
    p.x = map(p.x, TS_MINX, TS_MAXX, 0, tft.width());
    // *** SPFD5408 change -- End
    p.y = map(p.y, TS_MINY, TS_MAXY, 0, tft.height());
    Serial.println(p.x);
  if(p.x>0 && p.x<120)
   {  if(p.y>0 && p.y<100)
           {touch=1;}
          }
  }
    if(p.x>120 && p.x<210)
    {if(p.y>0 && p.y<100)
    {touch=0;}
    }
if(touch==1)
{
 Serial.println("on");
 digitalWrite(A5,HIGH);
    }
    if(touch==0)
    {  Serial.println("off");
     digitalWrite(A5,LOW);

}
}

SPFD5408 Library

This is a library for the 2.4" TFT display. This library works with the 2.4" TFT Breakout w/SD card

Credits

Kirthik vasan
1 project • 2 followers

Comments