├── Arduino-Calculator ├── arduino-calculator-circuit.png └── arduino-calculator.ino ├── Automatic-Day-Light-Sensing-for-Home-Automation └── automatic-day-light-sensing-for-home-automation.ino ├── Automatic-Door-Opening-Using-IR-Sensor └── automatic-door-opening-using-ir-sensor.ino ├── Automatic-Visitor-Counter ├── automatic-visitor-counter-circuit.jpg └── automatic-visitor-counter.ino ├── ContactLess-Doorbell └── contactless-doorbell.ino ├── Control-Bulb-Using-Mobile ├── APK │ └── bulbcontrolardunio.zip ├── control-bulb-using-mobile-arduino.jpg └── control-bulb-using-mobile.ino ├── Control-Bulb-Using-PIR-Sensor └── control-bulb-using-pir-sensor.ino ├── Control-Bulb-Using-RFID └── control-bulb-using-rfid.ino ├── Control-LED-Using-Sound ├── control-led-using-sound.ino └── control-led-using-voice.jpg ├── DIY-Tachometer └── diy-tachometer.ino ├── Dancing-Light-Using-Arduino ├── dancing-led-circuit.jpg └── dancing-light-using-arduino.ino ├── Display-Alphabets-in-Dot-Matrix-Display └── display-alphabets-in-dot-matrix-display.ino ├── Display-Current-Date-and-Time-in-LCD └── display-current-date-and-time-in-LCD.ino ├── Display-Image-in-TFT-Display └── display-image-in-tft-display.ino ├── Display-Text-in-LCD-Display └── display-text-in-lcd-display.ino ├── Display-Text-in-TFT-LCD-Display └── display-text-in-tft-lcd-display.ino ├── Distance-Measurement-Using-Ultrasonic-Sensor-With-LCD-I2C └── Distance-Measurement-Using-Ultrasonic-Sensor-With-LCD-I2C.ino ├── Distance-Measurement-Using-Ultrasonic-Sensor-and-LCD-Display └── distance-measurement-using-ultrasonic-sensor-and-LCD.ino ├── Distance-Measurement-in-OLED-Display └── distance-measurement-in-oled-display.ino ├── Distance-Measurement-with-JSN-SR04T-Ultrasonic-Sensor-and-Arduino-Uno └── distance-measurement-with-jsn-sr04t-ultrasonic-sensor-and-arduino-uno.ino ├── Electronic-Voting-Machine ├── electronic-voting-machine-circuit.png └── electronic-voting-machine.ino ├── Facial-Expression-Display-Using-Arduino-and-Dot-Matrix-Display ├── facial-expression-display-Using-arduino-and-dot-matrix-display.ino └── facial-expression-display-circuit.png ├── Fire-Detection-Alarm ├── fire-detection-alarm.ino └── fire-detection-circuit.png ├── Gas-Detection-Alarm ├── gas-detection-alarm-circuit.png └── gas-detection-alarm.ino ├── How-to-store-temperature-data-in-SD-card └── temperature-data-logger-in-SD-card.ino ├── I2C-Scanner └── i2c-scanner.ino ├── KeyPad-Security-System ├── keypad-security-system-circuit.png └── keypad-security-system.ino ├── LED-Chaser-Using-Arduino ├── led-chaser-circuit.jpg └── led-chaser-using-arduino.ino ├── Light-Intensity-Measurement-Using-Arduino-Uno └── light-intensity-measurement-using-arduino-uno.ino ├── Mario-LCD-Game └── mario-lcd-game.ino ├── Motion-Sensor-Controlled-LED └── motion-sensor-controlled-LED.ino ├── Object-Detection-Alarm-Using-Ultrasonic-Sensor ├── object-detection-alarm-using-ultrasonic-sensor.ino └── object-detection-using-ultrasonic-sensor.jpg ├── Pulse-Oximeter-Using-Arduino-Uno-and-LCD └── pulse-oximeter-using-arduino-uno-LCD.ino ├── Pulse-Rate-Detector └── pulse-rate-detector.ino ├── RF-Transmitter-and-Receiver ├── RF-Receiver.ino └── RF-Transmitter.ino ├── RFID-Automatic-Door └── rfid-automatic-door.ino ├── RFID-Integration-With-Arduino └── RFID-integration-with-arduino.ino ├── RFID-Security-System-with-LCD └── RFID-security-system-with-LCD.ino ├── RFID-Security-System ├── RFID-security-system-circuit.png └── RFID-security-system.ino ├── Rain-Alarm-System ├── rain-alarm-circuit.jpg └── rain-alarm-system.ino ├── Real-Time-Clock └── real-time-clock.ino ├── Real-Time-Distance-Measurement-System-with-ToF-Sensor └── real-time-distance-measurement-system-with-tof-sensor.ino ├── Remote-Control-Home-Automation └── remote-control-home-automation.ino ├── Remote-Control-LED ├── remote-control-LED-circuit.png └── remote-control-led.ino ├── Smart-Blind-Shoe └── smart-blnd-shoe.ino ├── Smart-Breath-Analyzer └── smart-breath-analyzer ├── Smart-Irrigation-System ├── smart-irrigation-system-circuit.png └── smart-irrigation-using-arduino-uno.ino ├── Smart-Notice-Board └── smart-notice-board.ino ├── Smart-Street-Lighting-System └── smart-street-lighting-system.ino ├── Soil-Moisture-Measurement ├── soil-moisture-measurement-circuit.jpg └── soil-moisture-measurement.ino ├── Temperature-Display-in-OLED-Display └── temperature-display-in-oled-display.ino ├── Temperature-Display-in-Seven-Segment-Display └── temperature-display-in-seven-segment-display.ino ├── Temperature-Monitor-Using-DS18B20-Temperature-Sensor └── temperature-monitor-using-DS18B20-temperature-sensor.ino ├── Temperature-Pressure-Altitude-Data-Logger-in-SD-Card └── temperature-pressure-altitude-data-logger-in-SD-Card.ino ├── Temperature-Pressure-Altitude-Display-in-LCD └── temperature-pressure-altitude-display-in-LCD.ino ├── Temperature-and-Humidity-Monitor ├── temperature-and-humidity-monitor.ino └── temperature-and-humidity-monitor.png ├── Touch-Control-Electric-Bulb └── touch-control-electric-bulb.ino ├── Traffic-Light-Controller ├── traffic-light-control-circuit.jpg └── traffic-light-controller.ino ├── Transmit-Temperature-Readings-to-Receiver-Using-RF-Transmitter-Receiver-Module ├── receiver.ino └── transmitter.ino ├── Ultrasonic-Radar ├── processingapp.txt ├── ultrasonic-radar-circuit.png └── ultrasonic-radar.ino ├── Voice-Controlled-Light ├── control-bulb-using-voice-circuit.jpg └── voice-controlled-light.ino ├── Water-Level-Indicator └── water-level-indicator.ino └── Wireless-Notice-Board └── wireless-notice-board.ino /Arduino-Calculator/arduino-calculator-circuit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tech-Trends-Shameer/Arduino-Projects/fa8d0a6b0261c52e029f0719cd3e3789c64958a9/Arduino-Calculator/arduino-calculator-circuit.png -------------------------------------------------------------------------------- /Arduino-Calculator/arduino-calculator.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | LiquidCrystal_I2C lcd(0x27, 16, 2); 5 | 6 | const byte ROWS = 4; 7 | const byte COLS = 4; 8 | 9 | char keys [ROWS] [COLS] = { 10 | {'1', '2', '3', '+'}, 11 | {'4', '5', '6', '-'}, 12 | {'7', '8', '9', '*'}, 13 | {'C', '0', '=', '/'} 14 | }; 15 | byte rowPins[ROWS] = {13,12,11,10}; 16 | byte colPins[COLS] = {9,8,7,6}; 17 | 18 | Keypad myKeypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS ); 19 | 20 | 21 | boolean presentValue = false; 22 | boolean next = false; 23 | boolean final = false; 24 | String num1, num2; 25 | long answer; 26 | char op; 27 | 28 | 29 | void setup() 30 | { 31 | lcd.begin(); 32 | 33 | 34 | lcd.backlight(); 35 | lcd.clear(); 36 | lcd.setCursor(2,0); 37 | lcd.print("Tech Trends"); 38 | lcd.setCursor(0,1); 39 | lcd.print(" Calculator"); 40 | delay(3000); 41 | lcd.clear(); 42 | lcd.setCursor(0,0); 43 | lcd.print("Please Like And"); 44 | lcd.setCursor(0,1); 45 | lcd.print(" Subscribe" ); 46 | delay(3000); 47 | lcd.clear(); 48 | } 49 | 50 | void loop() 51 | { 52 | char key = myKeypad.getKey(); 53 | 54 | if (key != NO_KEY && (key=='1'||key=='2'||key=='3'||key=='4'||key=='5'||key=='6'||key=='7'||key=='8'||key=='9'||key=='0')) 55 | { 56 | if (presentValue != true) 57 | { 58 | num1 = num1 + key; 59 | int numLength = num1.length(); 60 | lcd.setCursor(15 - numLength, 0); //to adjust one whitespace for operator 61 | lcd.print(num1); 62 | } 63 | else 64 | { 65 | num2 = num2 + key; 66 | int numLength = num2.length(); 67 | lcd.setCursor(15 - numLength, 1); 68 | lcd.print(num2); 69 | final = true; 70 | } 71 | } 72 | 73 | else if (presentValue == false && key != NO_KEY && (key == '/' || key == '*' || key == '-' || key == '+')) 74 | { 75 | if (presentValue == false) 76 | { 77 | presentValue = true; 78 | op = key; 79 | lcd.setCursor(15,0); 80 | lcd.print(op); 81 | } 82 | } 83 | 84 | else if (final == true && key != NO_KEY && key == '='){ 85 | if (op == '+'){ 86 | answer = num1.toInt() + num2.toInt(); 87 | } 88 | else if (op == '-'){ 89 | answer = num1.toInt() - num2.toInt(); 90 | } 91 | else if (op == '*'){ 92 | answer = num1.toInt() * num2.toInt(); 93 | } 94 | else if (op == '/'){ 95 | answer = num1.toInt() / num2.toInt(); 96 | } 97 | lcd.clear(); 98 | lcd.setCursor(15,0); 99 | lcd.autoscroll(); 100 | lcd.print(answer); 101 | lcd.noAutoscroll(); 102 | } 103 | else if (key != NO_KEY && key == 'C'){ 104 | lcd.clear(); 105 | presentValue = false; 106 | final = false; 107 | num1 = ""; 108 | num2 = ""; 109 | answer = 0; 110 | op = ' '; 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /Automatic-Day-Light-Sensing-for-Home-Automation/automatic-day-light-sensing-for-home-automation.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Automatic Day Light Sensing for Home Automation 3 | 4 | const int sensorPin = A0; // Connect TEMP600 to analog pin A0 5 | const int relayPin = 2; // Connect relay or transistor to digital pin D2 6 | 7 | void setup() { 8 | Serial.begin(115200); 9 | pinMode(sensorPin, INPUT); 10 | pinMode(relayPin, OUTPUT); 11 | } 12 | 13 | void loop() { 14 | int lightIntensity = analogRead(sensorPin); 15 | 16 | // Adjust the threshold value based on your environment 17 | //int threshold = 500; 18 | Serial.print("Light Intensity"); 19 | Serial.println(lightIntensity); 20 | if (lightIntensity < 150) { 21 | // Turn on the light 22 | digitalWrite(relayPin, HIGH); 23 | } else { 24 | // Turn off the light 25 | digitalWrite(relayPin, LOW); 26 | } 27 | 28 | delay(2000); // Adjust the delay based on your needs 29 | } 30 | -------------------------------------------------------------------------------- /Automatic-Door-Opening-Using-IR-Sensor/automatic-door-opening-using-ir-sensor.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Automatic Door Opening using IR Sensor 3 | 4 | #include 5 | 6 | #include 7 | 8 | Servo tap_servo; 9 | 10 | int sensor_pin = 4; 11 | int tap_servo_pin =5; 12 | int val; 13 | 14 | void setup(){ 15 | pinMode(sensor_pin,INPUT); 16 | tap_servo.attach(tap_servo_pin); 17 | Serial.begin(9600); 18 | } 19 | 20 | void loop(){ 21 | val = digitalRead(sensor_pin); 22 | Serial.println(val); 23 | if (val==0) 24 | { 25 | tap_servo.write(0); 26 | delay(2000); 27 | tap_servo.write(180); 28 | } 29 | /*if (val==1) 30 | { 31 | tap_servo.write(180); 32 | 33 | }*/ 34 | } 35 | -------------------------------------------------------------------------------- /Automatic-Visitor-Counter/automatic-visitor-counter-circuit.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tech-Trends-Shameer/Arduino-Projects/fa8d0a6b0261c52e029f0719cd3e3789c64958a9/Automatic-Visitor-Counter/automatic-visitor-counter-circuit.jpg -------------------------------------------------------------------------------- /Automatic-Visitor-Counter/automatic-visitor-counter.ino: -------------------------------------------------------------------------------- 1 | 2 | //Tech Trends Shameer 3 | //Visitor Counter 4 | 5 | #include 6 | #include 7 | #define trigPin 13 //Sensor Echo pin connected to Arduino pin 13 8 | #define echoPin 12 //Sensor Trip pin connected to Arduino pin 12 9 | //Create Liquid Crystal Object called LCD 10 | LiquidCrystal lcd(11, 10, 5, 4, 3, 2); 11 | int counter = 0; 12 | int currentState1 = 0; 13 | int previousState1 = 0; 14 | int currentState2 = 0; 15 | int previousState2 = 0; 16 | int inside = 0; 17 | int outside = 0; 18 | 19 | void setup() 20 | { 21 | // Initialize the LCD 22 | lcd.begin(16,2); //Tell Arduino to start your 16 column 2 row LCD 23 | //Serial.begin (9600); 24 | pinMode(trigPin, OUTPUT); 25 | pinMode(echoPin, INPUT); 26 | } 27 | 28 | void loop() 29 | { 30 | lcd.setCursor(0, 0); //Set cursor to first column of first row 31 | lcd.print("IN: "); 32 | lcd.setCursor(8, 0); 33 | lcd.print("OUT: "); 34 | lcd.setCursor(0, 1); //Set cursor to first column of second row 35 | lcd.print("Total Inside: "); 36 | long duration, distance; 37 | digitalWrite(trigPin, LOW); 38 | delayMicroseconds(2); 39 | digitalWrite(trigPin, HIGH); 40 | delayMicroseconds(10); 41 | digitalWrite(trigPin, LOW); 42 | duration = pulseIn(echoPin, HIGH); 43 | distance = (duration/2) / 29.1; 44 | if (distance <= 7){ 45 | currentState1 = 1; 46 | } 47 | else { 48 | currentState1 = 0; 49 | } 50 | delay(100); 51 | if(currentState1 != previousState1){ 52 | if(currentState1 == 1){ 53 | counter = counter + 1;} 54 | lcd.setCursor(14, 1); 55 | lcd.print(counter); 56 | inside = inside +1;} 57 | lcd.setCursor(4, 0); 58 | lcd.print(inside); 59 | if (distance > 7 && distance <= 14){ 60 | currentState2 = 1; 61 | } 62 | else { 63 | currentState2 = 0; 64 | } 65 | delay(100); 66 | if(currentState2 != previousState2){ 67 | if(currentState2 == 1){ 68 | counter = counter - 1;} 69 | lcd.setCursor(14, 1); 70 | lcd.print(counter); 71 | outside = outside +1;} 72 | lcd.setCursor(13, 0); 73 | lcd.print(outside); 74 | lcd.setCursor(14, 1); 75 | lcd.print(counter); 76 | if (counter > 9 || counter < 0){ 77 | lcd.setCursor(14, 1); 78 | lcd.print(counter); 79 | delay(100); 80 | lcd.clear(); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /ContactLess-Doorbell/contactless-doorbell.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Contactless Doorbell 3 | 4 | // Define pins numbers 5 | const int trigPin = 13; //Connect Trig pin in Ultrasonic Sensor to Arduino Pin 13 6 | const int echoPin = 12; //Connect Echo pin in Ultrasonic Sensor to Arduino Pin 13 7 | 8 | const int relay= 10; //Connect Positive pin of LED to Arduino Pin 10 9 | 10 | // Define variables 11 | long duration; 12 | int distance; 13 | int safetyDistance; 14 | 15 | 16 | void setup() { 17 | pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output 18 | pinMode(echoPin, INPUT); // Sets the echoPin as an Input 19 | 20 | pinMode(relay, OUTPUT); 21 | Serial.begin(9600); // Starts the serial communication 22 | } 23 | 24 | 25 | void loop() { 26 | // Clears the trigPin 27 | digitalWrite(trigPin, LOW); 28 | delayMicroseconds(2); 29 | 30 | // Sets the trigPin on HIGH state for 15 micro seconds 31 | digitalWrite(trigPin, HIGH); 32 | delayMicroseconds(15); 33 | digitalWrite(trigPin, LOW); 34 | 35 | // Reads the echoPin, returns the sound wave travel time in microseconds 36 | duration = pulseIn(echoPin, HIGH); 37 | 38 | // Calculate the distance 39 | distance= duration*0.034/2; 40 | 41 | safetyDistance = distance; 42 | if (safetyDistance <= 10){ 43 | digitalWrite(relay, HIGH); 44 | } 45 | else{ 46 | digitalWrite(relay, LOW); 47 | } 48 | 49 | // Print the distance on the Serial Monitor 50 | Serial.print("Distance: "); 51 | Serial.println(distance); 52 | } 53 | -------------------------------------------------------------------------------- /Control-Bulb-Using-Mobile/APK/bulbcontrolardunio.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tech-Trends-Shameer/Arduino-Projects/fa8d0a6b0261c52e029f0719cd3e3789c64958a9/Control-Bulb-Using-Mobile/APK/bulbcontrolardunio.zip -------------------------------------------------------------------------------- /Control-Bulb-Using-Mobile/control-bulb-using-mobile-arduino.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tech-Trends-Shameer/Arduino-Projects/fa8d0a6b0261c52e029f0719cd3e3789c64958a9/Control-Bulb-Using-Mobile/control-bulb-using-mobile-arduino.jpg -------------------------------------------------------------------------------- /Control-Bulb-Using-Mobile/control-bulb-using-mobile.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Control Bulb through Mobile using Arduino 3 | 4 | char data = 0; 5 | void setup() 6 | { 7 | Serial.begin(9600); 8 | pinMode(13, OUTPUT); 9 | } 10 | void loop() 11 | { 12 | if(Serial.available() > 0) 13 | { 14 | data = Serial.read(); 15 | Serial.print(data); 16 | 17 | if(data == '1') 18 | digitalWrite(13, HIGH); 19 | else if(data == '0') 20 | digitalWrite(13, LOW); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Control-Bulb-Using-PIR-Sensor/control-bulb-using-pir-sensor.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Control Electric Bulb using PIR Sensor 3 | 4 | int pirsensor = 0; 5 | 6 | void setup() { 7 | Serial.begin(9600); 8 | pinMode(13, OUTPUT); //Connect the Signal Pin of relay to Pin 13 9 | pinMode(4, OUTPUT); //Connect the Positive Pin of Buzzer to Pin 4 10 | pinMode(2, INPUT); //Connect the Output pin of PIR Sensor to Pin 2 11 | 12 | } 13 | void loop() { 14 | int pirsensor = digitalRead(2); 15 | Serial.println(pirsensor); 16 | if (pirsensor == 1) 17 | { 18 | digitalWrite(13, HIGH); 19 | digitalWrite(4, HIGH); 20 | } 21 | else 22 | { 23 | digitalWrite(13,LOW); 24 | digitalWrite(4, LOW); 25 | } 26 | delay(10); 27 | } 28 | -------------------------------------------------------------------------------- /Control-Bulb-Using-RFID/control-bulb-using-rfid.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Control Bulb Using RFID 3 | 4 | #include 5 | #include 6 | 7 | 8 | #define SS_PIN 10 9 | #define RST_PIN 9 10 | int relay=6; 11 | int buzzer = 7; 12 | 13 | MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance. 14 | 15 | void setup() 16 | { 17 | 18 | pinMode(relay, OUTPUT); 19 | pinMode(buzzer, OUTPUT); 20 | Serial.begin(9600); // Initiate a serial communication 21 | SPI.begin(); // Initiate SPI bus 22 | mfrc522.PCD_Init(); // Initiate MFRC522 23 | Serial.println("Approximate your card to the reader..."); 24 | Serial.println(); 25 | /* lcd.begin(); 26 | 27 | 28 | lcd.backlight(); 29 | lcd.clear(); 30 | lcd.setCursor(3,0); 31 | lcd.print("Tech Trends"); 32 | lcd.setCursor(5,1); 33 | lcd.print("Shameer"); 34 | delay(3000); 35 | lcd.clear(); 36 | lcd.setCursor(1,0); 37 | lcd.print("RFID Security"); 38 | lcd.setCursor(5,1); 39 | lcd.print("System"); 40 | delay(3000); 41 | display();*/ 42 | } 43 | void loop() 44 | { 45 | // Look for new cards 46 | if ( ! mfrc522.PICC_IsNewCardPresent()) 47 | { 48 | return; 49 | } 50 | // Select one of the cards 51 | if ( ! mfrc522.PICC_ReadCardSerial()) 52 | { 53 | return; 54 | } 55 | //Show UID on serial monitor 56 | Serial.print("UID tag :"); 57 | String content= ""; 58 | byte letter; 59 | for (byte i = 0; i < mfrc522.uid.size; i++) 60 | { 61 | Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "); 62 | Serial.print(mfrc522.uid.uidByte[i], HEX); 63 | content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ")); 64 | content.concat(String(mfrc522.uid.uidByte[i], HEX)); 65 | } 66 | Serial.println(); 67 | Serial.print("Message : "); 68 | content.toUpperCase(); 69 | if (content.substring(1) == "2C 83 4C 4A") //Change the UID of the card/cards that you want to give access 70 | { 71 | Serial.println("Authorized access"); 72 | Serial.println(); 73 | 74 | digitalWrite(relay, HIGH); 75 | digitalWrite(buzzer, LOW); 76 | delay(3000); 77 | digitalWrite(relay, LOW); 78 | } 79 | 80 | else { 81 | Serial.println(" Access denied"); 82 | 83 | digitalWrite(relay, LOW); 84 | digitalWrite(buzzer, HIGH); 85 | delay(3000); 86 | digitalWrite(buzzer, LOW); 87 | 88 | 89 | 90 | 91 | } 92 | } 93 | 94 | -------------------------------------------------------------------------------- /Control-LED-Using-Sound/control-led-using-sound.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Control LED Using Sound 3 | 4 | int sound = 5; //This is the pin number in arduino to connect the output pin from sound sensor. 5 | int led1=7; //Connect the positive end of LED to pin 7 in Arduino 6 | 7 | boolean LEDStatus = false; 8 | 9 | void setup() 10 | { 11 | pinMode (sound,INPUT); 12 | pinMode (led1, OUTPUT); 13 | 14 | } 15 | 16 | void loop() 17 | { 18 | int sensor = digitalRead(sound); 19 | 20 | if (sensor == 1) 21 | { 22 | if(LEDStatus==false) 23 | { 24 | LEDStatus=true; 25 | digitalWrite(led1,HIGH); 26 | 27 | } 28 | else 29 | { 30 | LEDStatus=false; 31 | digitalWrite(led1, LOW); 32 | 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Control-LED-Using-Sound/control-led-using-voice.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tech-Trends-Shameer/Arduino-Projects/fa8d0a6b0261c52e029f0719cd3e3789c64958a9/Control-LED-Using-Sound/control-led-using-voice.jpg -------------------------------------------------------------------------------- /DIY-Tachometer/diy-tachometer.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Tachometer 3 | 4 | #include 5 | LiquidCrystal_I2C lcd (0x27, 16, 2); 6 | 7 | const byte PulsesPerRevolution = 2; 8 | const unsigned long ZeroTimeout = 100000; 9 | const byte numReadings = 2; 10 | 11 | volatile unsigned long LastTimeWeMeasured; 12 | volatile unsigned long PeriodBetweenPulses = ZeroTimeout + 1000; 13 | volatile unsigned long PeriodAverage = ZeroTimeout + 1000; 14 | unsigned long FrequencyRaw; 15 | unsigned long FrequencyReal; 16 | unsigned long RPM; 17 | unsigned int PulseCounter = 1; 18 | unsigned long PeriodSum; 19 | 20 | unsigned long LastTimeCycleMeasure = LastTimeWeMeasured; 21 | unsigned long CurrentMicros = micros(); 22 | unsigned int AmountOfReadings = 1; 23 | unsigned int ZeroDebouncingExtra; 24 | unsigned long readings[numReadings]; 25 | unsigned long readIndex; 26 | unsigned long total; 27 | unsigned long average; 28 | void setup() { 29 | Serial.begin(9600); 30 | lcd.begin(); 31 | lcd.backlight(); 32 | lcd.setCursor(3,0); 33 | lcd.print("Tech Trends"); 34 | delay(1000); 35 | lcd.clear(); 36 | attachInterrupt(digitalPinToInterrupt(2), Pulse_Event, RISING); 37 | delay(1000); 38 | 39 | } 40 | void loop() { 41 | LastTimeCycleMeasure = LastTimeWeMeasured; 42 | CurrentMicros = micros(); 43 | if (CurrentMicros < LastTimeCycleMeasure) { 44 | LastTimeCycleMeasure = CurrentMicros; 45 | } 46 | FrequencyRaw = 10000000000 / PeriodAverage; 47 | if (PeriodBetweenPulses > ZeroTimeout - ZeroDebouncingExtra || CurrentMicros - LastTimeCycleMeasure > ZeroTimeout - ZeroDebouncingExtra) { 48 | FrequencyRaw = 0; // Set frequency as 0. 49 | ZeroDebouncingExtra = 2000; 50 | } else { 51 | ZeroDebouncingExtra = 0; 52 | } 53 | FrequencyReal = FrequencyRaw / 10000; 54 | 55 | RPM = FrequencyRaw / PulsesPerRevolution * 60; 56 | RPM = RPM / 10000; 57 | total = total - readings[readIndex]; 58 | readings[readIndex] = RPM; 59 | total = total + readings[readIndex]; 60 | readIndex = readIndex + 1; 61 | 62 | if (readIndex >= numReadings) { 63 | readIndex = 0; 64 | } 65 | average = total / numReadings; 66 | 67 | 68 | 69 | Serial.print("Period: "); 70 | Serial.print(PeriodBetweenPulses); 71 | Serial.print("\tReadings: "); 72 | Serial.print(AmountOfReadings); 73 | Serial.print("\tFrequency: "); 74 | Serial.print(FrequencyReal); 75 | Serial.print("\tRPM: "); 76 | Serial.print(RPM); 77 | Serial.print("\tTachometer: "); 78 | Serial.println(average); 79 | // delay(3000); 80 | lcd.setCursor(0, 0); 81 | lcd.print("RPM : "); 82 | lcd.print(RPM); 83 | lcd.print(" "); 84 | 85 | } 86 | 87 | void Pulse_Event() { 88 | PeriodBetweenPulses = micros() - LastTimeWeMeasured; 89 | LastTimeWeMeasured = micros(); 90 | if (PulseCounter >= AmountOfReadings) { 91 | PeriodAverage = PeriodSum / AmountOfReadings; 92 | PulseCounter = 1; 93 | PeriodSum = PeriodBetweenPulses; 94 | 95 | int RemapedAmountOfReadings = map(PeriodBetweenPulses, 40000, 5000, 1, 10); 96 | RemapedAmountOfReadings = constrain(RemapedAmountOfReadings, 1, 10); 97 | AmountOfReadings = RemapedAmountOfReadings; 98 | } else { 99 | PulseCounter++; 100 | PeriodSum = PeriodSum + PeriodBetweenPulses; 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /Dancing-Light-Using-Arduino/dancing-led-circuit.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tech-Trends-Shameer/Arduino-Projects/fa8d0a6b0261c52e029f0719cd3e3789c64958a9/Dancing-Light-Using-Arduino/dancing-led-circuit.jpg -------------------------------------------------------------------------------- /Dancing-Light-Using-Arduino/dancing-light-using-arduino.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Dancing LED 3 | 4 | int sound = 5; 5 | int led1=7; 6 | int led2=8; 7 | int led3=9; 8 | int led4=10; 9 | int led5=11; 10 | int led6=12; 11 | boolean LEDStatus = false; 12 | 13 | void setup() 14 | { 15 | pinMode (sound,INPUT); 16 | pinMode (led1, OUTPUT); 17 | pinMode (led2, OUTPUT); 18 | pinMode (led3, OUTPUT); 19 | pinMode (led4, OUTPUT); 20 | pinMode (led5, OUTPUT); 21 | pinMode (led6, OUTPUT); 22 | } 23 | 24 | void loop() 25 | { 26 | int sensor = digitalRead(sound); 27 | 28 | if (sensor == 1) 29 | { 30 | if(LEDStatus==false) 31 | { 32 | LEDStatus=true; 33 | digitalWrite(led1,HIGH); 34 | digitalWrite(led2,HIGH); 35 | digitalWrite(led3,HIGH); 36 | digitalWrite(led4,HIGH); 37 | digitalWrite(led5,HIGH); 38 | digitalWrite(led6,HIGH); 39 | } 40 | else 41 | { 42 | LEDStatus=false; 43 | digitalWrite(led1, LOW); 44 | digitalWrite(led2, LOW); 45 | digitalWrite(led3, LOW); 46 | digitalWrite(led4, LOW); 47 | digitalWrite(led5, LOW); 48 | digitalWrite(led6, LOW); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Display-Alphabets-in-Dot-Matrix-Display/display-alphabets-in-dot-matrix-display.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Display Alphabets in Dot Matrix Display 3 | 4 | #include "LedControl.h" 5 | #include "binary.h" 6 | 7 | /* 8 | DIN connects to pin 12 10 9 | CLK connects to pin 11 8 10 | CS connects to pin 10 9 11 | */ 12 | LedControl lc=LedControl(10,8,9,1); 13 | 14 | unsigned long delaytime=2000; //Delay time between each expression display 15 | 16 | 17 | byte A[]= {B00000000,B00111100,B01100110,B01100110,B01111110,B01100110,B01100110,B01100110}; 18 | byte B[] = {B01111000,B01001000,B01001000,B01110000,B01001000,B01000100,B01000100,B01111100}; 19 | byte C[] = {B00000000,B00011110,B00100000,B01000000,B01000000,B01000000,B00100000,B00011110}; 20 | byte D[] = {B00000000,B00111000,B00100100,B00100010,B00100010,B00100100,B00111000,B00000000}; 21 | byte E[] = {B00000000,B00111100,B00100000,B00111000,B00100000,B00100000,B00111100,B00000000}; 22 | byte F[] = {B00000000,B00111100,B00100000,B00111000,B00100000,B00100000,B00100000,B00000000}; 23 | byte G[] = {B00000000,B00111110,B00100000,B00100000,B00101110,B00100010,B00111110,B00000000}; 24 | byte H[] = {B00000000,B00100100,B00100100,B00111100,B00100100,B00100100,B00100100,B00000000}; 25 | byte I[] = {B00000000,B00111000,B00010000,B00010000,B00010000,B00010000,B00111000,B00000000}; 26 | byte J[] = {B00000000,B00011100,B00001000,B00001000,B00001000,B00101000,B00111000,B00000000}; 27 | byte K[] = {B00000000,B00100100,B00101000,B00110000,B00101000,B00100100,B00100100,B00000000}; 28 | byte L[] = {B00000000,B00100000,B00100000,B00100000,B00100000,B00100000,B00111100,B00000000}; 29 | byte M[] = {B00000000,B00000000,B01000100,B10101010,B10010010,B10000010,B10000010,B00000000}; 30 | byte N[] = {B00000000,B00100010,B00110010,B00101010,B00100110,B00100010,B00000000,B00000000}; 31 | byte O[] = {B00000000,B00111100,B01000010,B01000010,B01000010,B01000010,B00111100,B00000000}; 32 | byte P[] = {B00000000,B00111000,B00100100,B00100100,B00111000,B00100000,B00100000,B00000000}; 33 | byte Q[] = {B00000000,B00111100,B01000010,B01000010,B01000010,B01000110,B00111110,B00000001}; 34 | byte R[] = {B00000000,B00111000,B00100100,B00100100,B00111000,B00100100,B00100100,B00000000}; 35 | byte S[] = {B00000000,B00111100,B00100000,B00111100,B00000100,B00000100,B00111100,B00000000}; 36 | byte T[] = {B00000000,B01111100,B00010000,B00010000,B00010000,B00010000,B00010000,B00000000}; 37 | byte U[] = {B00000000,B01000010,B01000010,B01000010,B01000010,B00100100,B00011000,B00000000}; 38 | byte V[] = {B00000000,B00100010,B00100010,B00100010,B00010100,B00010100,B00001000,B00000000}; 39 | byte W[] = {B00000000,B10000010,B10010010,B01010100,B01010100,B00101000,B00000000,B00000000}; 40 | byte X[] = {B00000000,B01000010,B00100100,B00011000,B00011000,B00100100,B01000010,B00000000}; 41 | byte Y[] = {B00000000,B01000100,B00101000,B00010000,B00010000,B00010000,B00010000,B00000000}; 42 | byte Z[] = {B00000000,B00111100,B00000100,B00001000,B00010000,B00100000,B00111100,B00000000}; 43 | //byte AZ[] = {B00000000,B00000000,B11100111,B10100001,B11100010,B10100111,B00000000,B00000000}; 44 | 45 | void setup() { 46 | lc.shutdown(0,false); 47 | // Set brightness to a medium value 48 | lc.setIntensity(0,8); 49 | // Clear the display 50 | lc.clearDisplay(0); 51 | } 52 | 53 | void displayAlphabets(){ 54 | 55 | 56 | //Display Alphabet 57 | lc.setRow(0,0,A[0]); 58 | lc.setRow(0,1,A[1]); 59 | lc.setRow(0,2,A[2]); 60 | lc.setRow(0,3,A[3]); 61 | lc.setRow(0,4,A[4]); 62 | lc.setRow(0,5,A[5]); 63 | lc.setRow(0,6,A[6]); 64 | lc.setRow(0,7,A[7]); 65 | delay(delaytime); 66 | 67 | //Display B 68 | lc.setRow(0,0,B[0]); 69 | lc.setRow(0,1,B[1]); 70 | lc.setRow(0,2,B[2]); 71 | lc.setRow(0,3,B[3]); 72 | lc.setRow(0,4,B[4]); 73 | lc.setRow(0,5,B[5]); 74 | lc.setRow(0,6,B[6]); 75 | lc.setRow(0,7,B[7]); 76 | delay(delaytime); 77 | 78 | //Display C 79 | lc.setRow(0,0,C[0]); 80 | lc.setRow(0,1,C[1]); 81 | lc.setRow(0,2,C[2]); 82 | lc.setRow(0,3,C[3]); 83 | lc.setRow(0,4,C[4]); 84 | lc.setRow(0,5,C[5]); 85 | lc.setRow(0,6,C[6]); 86 | lc.setRow(0,7,C[7]); 87 | delay(delaytime); 88 | 89 | //Display D 90 | lc.setRow(0,0,D[0]); 91 | lc.setRow(0,1,D[1]); 92 | lc.setRow(0,2,D[2]); 93 | lc.setRow(0,3,D[3]); 94 | lc.setRow(0,4,D[4]); 95 | lc.setRow(0,5,D[5]); 96 | lc.setRow(0,6,D[6]); 97 | lc.setRow(0,7,D[7]); 98 | delay(delaytime); 99 | 100 | //Eisplay E 101 | lc.setRow(0,0,E[0]); 102 | lc.setRow(0,1,E[1]); 103 | lc.setRow(0,2,E[2]); 104 | lc.setRow(0,3,E[3]); 105 | lc.setRow(0,4,E[4]); 106 | lc.setRow(0,5,E[5]); 107 | lc.setRow(0,6,E[6]); 108 | lc.setRow(0,7,E[7]); 109 | delay(delaytime); 110 | 111 | //Fisplay F 112 | lc.setRow(0,0,F[0]); 113 | lc.setRow(0,1,F[1]); 114 | lc.setRow(0,2,F[2]); 115 | lc.setRow(0,3,F[3]); 116 | lc.setRow(0,4,F[4]); 117 | lc.setRow(0,5,F[5]); 118 | lc.setRow(0,6,F[6]); 119 | lc.setRow(0,7,F[7]); 120 | delay(delaytime); 121 | 122 | //Gisplay G 123 | lc.setRow(0,0,G[0]); 124 | lc.setRow(0,1,G[1]); 125 | lc.setRow(0,2,G[2]); 126 | lc.setRow(0,3,G[3]); 127 | lc.setRow(0,4,G[4]); 128 | lc.setRow(0,5,G[5]); 129 | lc.setRow(0,6,G[6]); 130 | lc.setRow(0,7,G[7]); 131 | delay(delaytime); 132 | 133 | //Hisplay H 134 | lc.setRow(0,0,H[0]); 135 | lc.setRow(0,1,H[1]); 136 | lc.setRow(0,2,H[2]); 137 | lc.setRow(0,3,H[3]); 138 | lc.setRow(0,4,H[4]); 139 | lc.setRow(0,5,H[5]); 140 | lc.setRow(0,6,H[6]); 141 | lc.setRow(0,7,H[7]); 142 | delay(delaytime); 143 | 144 | //Iisplay I 145 | lc.setRow(0,0,I[0]); 146 | lc.setRow(0,1,I[1]); 147 | lc.setRow(0,2,I[2]); 148 | lc.setRow(0,3,I[3]); 149 | lc.setRow(0,4,I[4]); 150 | lc.setRow(0,5,I[5]); 151 | lc.setRow(0,6,I[6]); 152 | lc.setRow(0,7,I[7]); 153 | delay(delaytime); 154 | 155 | //JJsplay J 156 | lc.setRow(0,0,J[0]); 157 | lc.setRow(0,1,J[1]); 158 | lc.setRow(0,2,J[2]); 159 | lc.setRow(0,3,J[3]); 160 | lc.setRow(0,4,J[4]); 161 | lc.setRow(0,5,J[5]); 162 | lc.setRow(0,6,J[6]); 163 | lc.setRow(0,7,J[7]); 164 | delay(delaytime); 165 | 166 | //KKsplay K 167 | lc.setRow(0,0,K[0]); 168 | lc.setRow(0,1,K[1]); 169 | lc.setRow(0,2,K[2]); 170 | lc.setRow(0,3,K[3]); 171 | lc.setRow(0,4,K[4]); 172 | lc.setRow(0,5,K[5]); 173 | lc.setRow(0,6,K[6]); 174 | lc.setRow(0,7,K[7]); 175 | delay(delaytime); 176 | 177 | //LLsplay L 178 | lc.setRow(0,0,L[0]); 179 | lc.setRow(0,1,L[1]); 180 | lc.setRow(0,2,L[2]); 181 | lc.setRow(0,3,L[3]); 182 | lc.setRow(0,4,L[4]); 183 | lc.setRow(0,5,L[5]); 184 | lc.setRow(0,6,L[6]); 185 | lc.setRow(0,7,L[7]); 186 | delay(delaytime); 187 | 188 | //MMspMay M 189 | lc.setRow(0,0,M[0]); 190 | lc.setRow(0,1,M[1]); 191 | lc.setRow(0,2,M[2]); 192 | lc.setRow(0,3,M[3]); 193 | lc.setRow(0,4,M[4]); 194 | lc.setRow(0,5,M[5]); 195 | lc.setRow(0,6,M[6]); 196 | lc.setRow(0,7,M[7]); 197 | delay(delaytime); 198 | 199 | //NNspNay N 200 | lc.setRow(0,0,N[0]); 201 | lc.setRow(0,1,N[1]); 202 | lc.setRow(0,2,N[2]); 203 | lc.setRow(0,3,N[3]); 204 | lc.setRow(0,4,N[4]); 205 | lc.setRow(0,5,N[5]); 206 | lc.setRow(0,6,N[6]); 207 | lc.setRow(0,7,N[7]); 208 | delay(delaytime); 209 | 210 | //Display O 211 | lc.setRow(0,0,O[0]); 212 | lc.setRow(0,1,O[1]); 213 | lc.setRow(0,2,O[2]); 214 | lc.setRow(0,3,O[3]); 215 | lc.setRow(0,4,O[4]); 216 | lc.setRow(0,5,O[5]); 217 | lc.setRow(0,6,O[6]); 218 | lc.setRow(0,7,O[7]); 219 | delay(delaytime); 220 | 221 | //Display P 222 | lc.setRow(0,0,P[0]); 223 | lc.setRow(0,1,P[1]); 224 | lc.setRow(0,2,P[2]); 225 | lc.setRow(0,3,P[3]); 226 | lc.setRow(0,4,P[4]); 227 | lc.setRow(0,5,P[5]); 228 | lc.setRow(0,6,P[6]); 229 | lc.setRow(0,7,P[7]); 230 | delay(delaytime); 231 | 232 | //Display q 233 | lc.setRow(0,0,Q[0]); 234 | lc.setRow(0,1,Q[1]); 235 | lc.setRow(0,2,Q[2]); 236 | lc.setRow(0,3,Q[3]); 237 | lc.setRow(0,4,Q[4]); 238 | lc.setRow(0,5,Q[5]); 239 | lc.setRow(0,6,Q[6]); 240 | lc.setRow(0,7,Q[7]); 241 | delay(delaytime); 242 | 243 | //Display R 244 | lc.setRow(0,0,R[0]); 245 | lc.setRow(0,1,R[1]); 246 | lc.setRow(0,2,R[2]); 247 | lc.setRow(0,3,R[3]); 248 | lc.setRow(0,4,R[4]); 249 | lc.setRow(0,5,R[5]); 250 | lc.setRow(0,6,R[6]); 251 | lc.setRow(0,7,R[7]); 252 | delay(delaytime); 253 | 254 | //Display S 255 | lc.setRow(0,0,S[0]); 256 | lc.setRow(0,1,S[1]); 257 | lc.setRow(0,2,S[2]); 258 | lc.setRow(0,3,S[3]); 259 | lc.setRow(0,4,S[4]); 260 | lc.setRow(0,5,S[5]); 261 | lc.setRow(0,6,S[6]); 262 | lc.setRow(0,7,S[7]); 263 | delay(delaytime); 264 | 265 | //Display T 266 | lc.setRow(0,0,T[0]); 267 | lc.setRow(0,1,T[1]); 268 | lc.setRow(0,2,T[2]); 269 | lc.setRow(0,3,T[3]); 270 | lc.setRow(0,4,T[4]); 271 | lc.setRow(0,5,T[5]); 272 | lc.setRow(0,6,T[6]); 273 | lc.setRow(0,7,T[7]); 274 | delay(delaytime); 275 | 276 | //Display U 277 | lc.setRow(0,0,U[0]); 278 | lc.setRow(0,1,U[1]); 279 | lc.setRow(0,2,U[2]); 280 | lc.setRow(0,3,U[3]); 281 | lc.setRow(0,4,U[4]); 282 | lc.setRow(0,5,U[5]); 283 | lc.setRow(0,6,U[6]); 284 | lc.setRow(0,7,U[7]); 285 | delay(delaytime); 286 | 287 | //Display V 288 | lc.setRow(0,0,V[0]); 289 | lc.setRow(0,1,V[1]); 290 | lc.setRow(0,2,V[2]); 291 | lc.setRow(0,3,V[3]); 292 | lc.setRow(0,4,V[4]); 293 | lc.setRow(0,5,V[5]); 294 | lc.setRow(0,6,V[6]); 295 | lc.setRow(0,7,V[7]); 296 | delay(delaytime); 297 | 298 | //Display W 299 | lc.setRow(0,0,W[0]); 300 | lc.setRow(0,1,W[1]); 301 | lc.setRow(0,2,W[2]); 302 | lc.setRow(0,3,W[3]); 303 | lc.setRow(0,4,W[4]); 304 | lc.setRow(0,5,W[5]); 305 | lc.setRow(0,6,W[6]); 306 | lc.setRow(0,7,W[7]); 307 | delay(delaytime); 308 | 309 | //Display X 310 | lc.setRow(0,0,X[0]); 311 | lc.setRow(0,1,X[1]); 312 | lc.setRow(0,2,X[2]); 313 | lc.setRow(0,3,X[3]); 314 | lc.setRow(0,4,X[4]); 315 | lc.setRow(0,5,X[5]); 316 | lc.setRow(0,6,X[6]); 317 | lc.setRow(0,7,X[7]); 318 | delay(delaytime); 319 | 320 | //Display Y 321 | lc.setRow(0,0,Y[0]); 322 | lc.setRow(0,1,Y[1]); 323 | lc.setRow(0,2,Y[2]); 324 | lc.setRow(0,3,Y[3]); 325 | lc.setRow(0,4,Y[4]); 326 | lc.setRow(0,5,Y[5]); 327 | lc.setRow(0,6,Y[6]); 328 | lc.setRow(0,7,Y[7]); 329 | delay(delaytime); 330 | 331 | //Display Z 332 | lc.setRow(0,0,Z[0]); 333 | lc.setRow(0,1,Z[1]); 334 | lc.setRow(0,2,Z[2]); 335 | lc.setRow(0,3,Z[3]); 336 | lc.setRow(0,4,Z[4]); 337 | lc.setRow(0,5,Z[5]); 338 | lc.setRow(0,6,Z[6]); 339 | lc.setRow(0,7,Z[7]); 340 | delay(delaytime); 341 | 342 | //Display AZ 343 | /* lc.setRow(0,0,AZ[0]); 344 | lc.setRow(0,1,AZ[1]); 345 | lc.setRow(0,2,AZ[2]); 346 | lc.setRow(0,3,AZ[3]); 347 | lc.setRow(0,4,AZ[4]); 348 | lc.setRow(0,5,AZ[5]); 349 | lc.setRow(0,6,AZ[6]); 350 | lc.setRow(0,7,AZ[7]); 351 | delay(delaytime);*/ 352 | } 353 | 354 | void loop(){ 355 | displayAlphabets(); 356 | } 357 | -------------------------------------------------------------------------------- /Display-Current-Date-and-Time-in-LCD/display-current-date-and-time-in-LCD.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Display Date and Time in LCD Display 3 | 4 | 5 | #include 6 | #include "RTClib.h" 7 | #include 8 | RTC_DS3231 rtc; 9 | 10 | char daysOfTheWeek[7][4] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; 11 | 12 | int Day; 13 | int Month; 14 | int Year; 15 | int Secs; 16 | int Minutes; 17 | int Hours; 18 | 19 | String dofweek; // day of week 20 | 21 | String myDate; 22 | String myTime; 23 | 24 | // for the 16x2 LCD 25 | 26 | #define rs 9 27 | #define en 8 28 | #define d4 7 29 | #define d5 6 30 | #define d6 5 31 | #define d7 4 32 | // initialize the library with the numbers of the interface pins 33 | //LiquidCrystal lcd(rs, en, d4, d5, d6, d7); 34 | LiquidCrystal_I2C lcd(0x27, 16, 2); 35 | 36 | void setup () 37 | { 38 | Serial.begin(9600); 39 | lcd.begin(); 40 | delay(3000); // wait for console opening 41 | 42 | if (! rtc.begin()) { 43 | Serial.println("Couldn't find RTC"); 44 | while (1); 45 | } 46 | 47 | if (rtc.lostPower()) { 48 | Serial.println("RTC lost power, lets set the time!"); 49 | 50 | // Comment out below lines once you set the date & time. 51 | // Following line sets the RTC to the date & time this sketch was compiled 52 | rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); 53 | 54 | // Following line sets the RTC with an explicit date & time 55 | // for example to set January 27 2017 at 12:56 you would call: 56 | // rtc.adjust(DateTime(2017, 1, 27, 12, 56, 0)); 57 | } 58 | 59 | lcd.backlight(); 60 | lcd.clear(); 61 | lcd.setCursor(3,0); 62 | lcd.print("Tech Trends"); 63 | lcd.setCursor(5,1); 64 | lcd.print("Shameer"); 65 | delay(3000); 66 | lcd.clear(); 67 | } 68 | 69 | void loop () 70 | { 71 | DateTime now = rtc.now(); 72 | lcd.clear(); 73 | Day = now.day(); 74 | Month = now.month(); 75 | Year = now.year(); 76 | Secs = now.second(); 77 | Hours = now.hour(); 78 | Minutes = now.minute(); 79 | dofweek = daysOfTheWeek[now.dayOfTheWeek()]; 80 | 81 | myDate = myDate +dofweek+ " "+ Day + "/" + Month + "/" + Year ; 82 | myTime = myTime + Hours +":"+ Minutes +":" + Secs ; 83 | // send to serial monitor 84 | Serial.println(dofweek); 85 | Serial.println(myDate); 86 | Serial.println(myTime); 87 | //Print on lcd 88 | lcd.setCursor(0,0); 89 | lcd.print(myDate); 90 | lcd.setCursor(0,1); 91 | lcd.print("Time:"); 92 | lcd.setCursor(6,1); 93 | lcd.print(myTime); 94 | myDate = ""; 95 | myTime = ""; 96 | delay(1000); 97 | } 98 | -------------------------------------------------------------------------------- /Display-Image-in-TFT-Display/display-image-in-tft-display.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Display Image in TFT Display 3 | 4 | //#include // Core graphics library 5 | //#include // Hardware-specific library 6 | #include // Core graphics library 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #define LCD_CS A3 // Chip Select goes to Analog 3 13 | #define LCD_CD A2 // Command/Data goes to Analog 2 14 | #define LCD_WR A1 // LCD Write goes to Analog 1 15 | #define LCD_RD A0 // LCD Read goes to Analog 0 16 | 17 | #define SD_CS 10 //SD card pin on your shield 18 | 19 | #define BLACK 0x0000 20 | #define BLUE 0x001F 21 | #define RED 0xF800 22 | #define GREEN 0x07E0 23 | #define CYAN 0x07FF 24 | #define MAGENTA 0xF81F 25 | #define YELLOW 0xFFE0 26 | #define WHITE 0xFFFF 27 | 28 | Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, A4); 29 | 30 | void setup() 31 | { 32 | 33 | 34 | Serial.begin(9600); 35 | tft.reset(); 36 | uint16_t identifier = tft.readID(); 37 | pinMode(10, OUTPUT); 38 | digitalWrite(10, HIGH); 39 | tft.begin(identifier); 40 | if (!SD.begin(SD_CS)) { 41 | progmemPrintln(PSTR("failed!")); 42 | return; 43 | } 44 | 45 | tft.reset(); 46 | //uint16_t identifier = tft.readID(); 47 | tft.begin(identifier); 48 | tft.setRotation(1); 49 | tft.fillScreen(WHITE); 50 | tft.drawRect(0,0,319,240,YELLOW); 51 | 52 | tft.setCursor(30,40); 53 | tft.setTextColor(BLACK); 54 | tft.setTextSize(2); 55 | tft.print("Tech Trends Shameer"); 56 | 57 | tft.setCursor(30,80); 58 | tft.setTextColor(GREEN); 59 | tft.setTextSize(2); 60 | tft.print("Display Image in TFT"); 61 | 62 | tft.fillRect(50,180, 210, 40, RED); 63 | tft.drawRect(50,180,210,40,BLACK); 64 | tft.setCursor(60,190); 65 | tft.setTextColor(WHITE); 66 | tft.setTextSize(2); 67 | tft.print("Please Subscribe"); 68 | delay(3000); 69 | tft.setRotation(0); 70 | //tft.reset(); 71 | } 72 | 73 | void loop() 74 | { 75 | bmpDraw("techtrends.bmp", 0, 0); //Calling the bmpDraw function ("Name_of_your_image.bmp",x,y) (x,y) is the starting position of the picture drawing 76 | delay(2000); 77 | 78 | } 79 | 80 | 81 | #define BUFFPIXEL 20 //Drawing speed, 20 is meant to be the best but you can use 60 altough it takes a lot of uno's RAM 82 | 83 | //Drawing function, reads the file from the SD card and do the 84 | //conversion and drawing, also it shows messages on the Serial monitor in case of a problem 85 | //No touchy to this function :D 86 | 87 | void bmpDraw(char *filename, int x, int y) { 88 | 89 | File bmpFile; 90 | int bmpWidth, bmpHeight; // W+H in pixels 91 | uint8_t bmpDepth; // Bit depth (currently must be 24) 92 | uint32_t bmpImageoffset; // Start of image data in file 93 | uint32_t rowSize; // Not always = bmpWidth; may have padding 94 | uint8_t sdbuffer[3*BUFFPIXEL]; // pixel in buffer (R+G+B per pixel) 95 | uint16_t lcdbuffer[BUFFPIXEL]; // pixel out buffer (16-bit per pixel) 96 | uint8_t buffidx = sizeof(sdbuffer); // Current position in sdbuffer 97 | boolean goodBmp = false; // Set to true on valid header parse 98 | boolean flip = true; // BMP is stored bottom-to-top 99 | int w, h, row, col; 100 | uint8_t r, g, b; 101 | uint32_t pos = 0, startTime = millis(); 102 | uint8_t lcdidx = 0; 103 | boolean first = true; 104 | 105 | if((x >= tft.width()) || (y >= tft.height())) return; 106 | 107 | Serial.println(); 108 | progmemPrint(PSTR("Loading image '")); 109 | Serial.print(filename); 110 | Serial.println('\''); 111 | // Open requested file on SD card 112 | if ((bmpFile = SD.open(filename)) == NULL) { 113 | progmemPrintln(PSTR("File not found")); 114 | return; 115 | } 116 | 117 | // Parse BMP header 118 | if(read16(bmpFile) == 0x4D42) { // BMP signature 119 | progmemPrint(PSTR("File size: ")); Serial.println(read32(bmpFile)); 120 | (void)read32(bmpFile); // Read & ignore creator bytes 121 | bmpImageoffset = read32(bmpFile); // Start of image data 122 | progmemPrint(PSTR("Image Offset: ")); Serial.println(bmpImageoffset, DEC); 123 | // Read DIB header 124 | progmemPrint(PSTR("Header size: ")); Serial.println(read32(bmpFile)); 125 | bmpWidth = read32(bmpFile); 126 | bmpHeight = read32(bmpFile); 127 | if(read16(bmpFile) == 1) { // # planes -- must be '1' 128 | bmpDepth = read16(bmpFile); // bits per pixel 129 | progmemPrint(PSTR("Bit Depth: ")); Serial.println(bmpDepth); 130 | if((bmpDepth == 24) && (read32(bmpFile) == 0)) { // 0 = uncompressed 131 | 132 | goodBmp = true; // Supported BMP format -- proceed! 133 | progmemPrint(PSTR("Image size: ")); 134 | Serial.print(bmpWidth); 135 | Serial.print('x'); 136 | Serial.println(bmpHeight); 137 | 138 | // BMP rows are padded (if needed) to 4-byte boundary 139 | rowSize = (bmpWidth * 3 + 3) & ~3; 140 | 141 | // If bmpHeight is negative, image is in top-down order. 142 | // This is not canon but has been observed in the wild. 143 | if(bmpHeight < 0) { 144 | bmpHeight = -bmpHeight; 145 | flip = false; 146 | } 147 | 148 | // Crop area to be loaded 149 | w = bmpWidth; 150 | h = bmpHeight; 151 | if((x+w-1) >= tft.width()) w = tft.width() - x; 152 | if((y+h-1) >= tft.height()) h = tft.height() - y; 153 | 154 | // Set TFT address window to clipped image bounds 155 | tft.setAddrWindow(x, y, x+w-1, y+h-1); 156 | 157 | for (row=0; row= sizeof(sdbuffer)) { // Indeed 176 | // Push LCD buffer to the display first 177 | if(lcdidx > 0) { 178 | tft.pushColors(lcdbuffer, lcdidx, first); 179 | lcdidx = 0; 180 | first = false; 181 | } 182 | bmpFile.read(sdbuffer, sizeof(sdbuffer)); 183 | buffidx = 0; // Set index to beginning 184 | } 185 | 186 | // Convert pixel from BMP to TFT format 187 | b = sdbuffer[buffidx++]; 188 | g = sdbuffer[buffidx++]; 189 | r = sdbuffer[buffidx++]; 190 | lcdbuffer[lcdidx++] = tft.color565(b,g,r); 191 | } // end pixel 192 | } // end scanline 193 | // Write any remaining data to LCD 194 | if(lcdidx > 0) { 195 | tft.pushColors(lcdbuffer, lcdidx, first); 196 | } 197 | progmemPrint(PSTR("Loaded in ")); 198 | Serial.print(millis() - startTime); 199 | Serial.println(" ms"); 200 | } // end goodBmp 201 | } 202 | } 203 | 204 | bmpFile.close(); 205 | if(!goodBmp) progmemPrintln(PSTR("BMP format not recognized.")); 206 | } 207 | 208 | // These read 16- and 32-bit types from the SD card file. 209 | // BMP data is stored little-endian, Arduino is little-endian too. 210 | // May need to reverse subscript order if porting elsewhere. 211 | 212 | uint16_t read16(File f) { 213 | uint16_t result; 214 | ((uint8_t *)&result)[0] = f.read(); // LSB 215 | ((uint8_t *)&result)[1] = f.read(); // MSB 216 | return result; 217 | } 218 | 219 | uint32_t read32(File f) { 220 | uint32_t result; 221 | ((uint8_t *)&result)[0] = f.read(); // LSB 222 | ((uint8_t *)&result)[1] = f.read(); 223 | ((uint8_t *)&result)[2] = f.read(); 224 | ((uint8_t *)&result)[3] = f.read(); // MSB 225 | return result; 226 | } 227 | 228 | // Copy string from flash to serial port 229 | // Source string MUST be inside a PSTR() declaration! 230 | void progmemPrint(const char *str) { 231 | char c; 232 | while(c = pgm_read_byte(str++)) Serial.print(c); 233 | } 234 | 235 | // Same as above, with trailing newline 236 | void progmemPrintln(const char *str) { 237 | progmemPrint(str); 238 | Serial.println(); 239 | } 240 | -------------------------------------------------------------------------------- /Display-Text-in-LCD-Display/display-text-in-lcd-display.ino: -------------------------------------------------------------------------------- 1 | #include 2 | int Contrast=75; 3 | LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 4 | 5 | void setup() 6 | { 7 | analogWrite(6,Contrast); 8 | lcd.begin(16, 2); 9 | } 10 | void loop() 11 | { 12 | lcd.setCursor(0, 0); 13 | lcd.print("NICE"); 14 | 15 | lcd.setCursor(0, 1); 16 | lcd.print("Friends"); 17 | } 18 | -------------------------------------------------------------------------------- /Display-Text-in-TFT-LCD-Display/display-text-in-tft-lcd-display.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Display Text in TFT Display 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #define LCD_CS A3 9 | #define LCD_CD A2 10 | #define LCD_WR A1 11 | #define LCD_RD A0 12 | #define LCD_RESET A4 13 | 14 | #define TS_MINX 122 15 | #define TS_MINY 111 16 | #define TS_MAXX 942 17 | #define TS_MAXY 890 18 | 19 | #define YP A3 20 | #define XM A2 21 | #define YM 9 22 | #define XP 8 23 | 24 | #define BLACK 0x0000 25 | #define BLUE 0x001F 26 | #define RED 0xF800 27 | #define GREEN 0x07E0 28 | #define CYAN 0x07FF 29 | #define MAGENTA 0xF81F 30 | #define YELLOW 0xFFE0 31 | #define WHITE 0xFFFF 32 | 33 | Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET); 34 | 35 | TouchScreen ts = TouchScreen(XP, YP, XM, YM, 364); 36 | 37 | boolean buttonEnabled = true; 38 | 39 | void setup() { 40 | 41 | tft.reset(); 42 | uint16_t identifier = tft.readID(); 43 | tft.begin(identifier); 44 | tft.setRotation(1); 45 | tft.fillScreen(WHITE); 46 | tft.drawRect(0,0,319,240,YELLOW); 47 | 48 | tft.setCursor(30,40); 49 | tft.setTextColor(BLACK); 50 | tft.setTextSize(2); 51 | tft.print("Touch Screen LCD Display"); 52 | 53 | tft.setCursor(115,80); 54 | tft.setTextColor(BLACK); 55 | tft.setTextSize(2); 56 | tft.print("\n by"); 57 | 58 | tft.fillRect(25,140, 240, 30, BLACK); 59 | tft.drawRect(25,140,240,30,BLACK); 60 | tft.setCursor(35,150); 61 | tft.setTextColor(WHITE); 62 | tft.setTextSize(2); 63 | tft.print("Tech Trends Shameer"); 64 | 65 | tft.fillRect(50,180, 210, 30, RED); 66 | tft.drawRect(50,180,210,30,BLACK); 67 | tft.setCursor(60,190); 68 | tft.setTextColor(WHITE); 69 | tft.setTextSize(2); 70 | tft.print("Please Subscribe"); 71 | 72 | } 73 | 74 | void loop() { 75 | TSPoint p = ts.getPoint(); 76 | 77 | if (p.z > ts.pressureThreshhold) { 78 | 79 | p.x = map(p.x, TS_MAXX, TS_MINX, 0, 320); 80 | p.y = map(p.y, TS_MAXY, TS_MINY, 0, 480); 81 | 82 | if(p.x>50 && p.x<260 && p.y>180 && p.y<270 && buttonEnabled){ 83 | 84 | buttonEnabled = false; 85 | 86 | pinMode(XM, OUTPUT); 87 | pinMode(YP, OUTPUT); 88 | 89 | tft.fillScreen(WHITE); 90 | tft.drawRect(0,0,319,240,YELLOW); 91 | tft.setCursor(50,70); 92 | tft.setTextColor(BLACK); 93 | tft.setTextSize(3); 94 | tft.print(" Thank you\n\n for\n\n support"); 95 | } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /Distance-Measurement-Using-Ultrasonic-Sensor-With-LCD-I2C/Distance-Measurement-Using-Ultrasonic-Sensor-With-LCD-I2C.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Distance Measurement using Ultrasonic Sensor 3 | 4 | #include 5 | #include 6 | 7 | LiquidCrystal_I2C lcd(0x27, 16, 2); 8 | #define trigPin 7 //Sensor Echo pin connected to Arduino pin 13 9 | #define echoPin 6 //Sensor Trip pin connected to Arduino pin 12 10 | 11 | void setup() 12 | { 13 | pinMode(trigPin, OUTPUT); 14 | pinMode(echoPin, INPUT); 15 | lcd.begin(); 16 | lcd.backlight(); 17 | lcd.clear(); 18 | lcd.setCursor(4,0); 19 | lcd.print("Tech Trends"); 20 | delay(2000); 21 | lcd.setCursor(0,0); //Set LCD cursor to upper left corner, column 0, row 0 22 | lcd.print("Target Distance:"); //Print Message on First Row 23 | } 24 | 25 | void loop() 26 | { 27 | long duration, distance; 28 | digitalWrite(trigPin, LOW); 29 | delayMicroseconds(2); 30 | digitalWrite(trigPin, HIGH); 31 | delayMicroseconds(10); 32 | digitalWrite(trigPin, LOW); 33 | duration = pulseIn(echoPin, HIGH); 34 | distance = (duration/2) / 29.1; 35 | 36 | lcd.setCursor(0,1); //Set cursor to first column of second row 37 | lcd.print(" "); //Print blanks to clear the row 38 | lcd.setCursor(0,1); //Set Cursor again to first column of second row 39 | lcd.print(distance); //Print measured distance 40 | lcd.print(" cm"); //Print your units. 41 | delay(250); //pause to let things settle 42 | } 43 | -------------------------------------------------------------------------------- /Distance-Measurement-Using-Ultrasonic-Sensor-and-LCD-Display/distance-measurement-using-ultrasonic-sensor-and-LCD.ino: -------------------------------------------------------------------------------- 1 | /* 2 | HC-SR04 Ultrasonic Sensor with LCD dispaly 3 | 4 | HC-SR04 Ultrasonic Sensor 5 | VCC to Arduino 5V 6 | GND to Arduino GND 7 | Echo to Arduino pin 12 8 | Trig to Arduino pin 13 9 | 10 | LCD Display (I used JHD162A) 11 | VSS to Arduino GND 12 | VCC to Arduino 5V 13 | VEE to Arduino GND 14 | RS to Arduino pin 11 15 | R/W to Arduino pin 10 16 | E to Arduino pin 9 17 | DB4 to Arduino pin 2 18 | DB5 to Arduino pin 3 19 | DB6 to Arduino pin 4 20 | DB7 to Arduino pin 5 21 | LED+ to Arduino 5V 22 | LED- to Arduino GND 23 | 24 | Modified by Ahmed Djebali (June 1, 2015). 25 | */ 26 | #include //Load Liquid Crystal Library 27 | LiquidCrystal LCD(11,10,9,2,3,4,5); //Create Liquid Crystal Object called LCD 28 | 29 | #define trigPin 13 //Sensor Echo pin connected to Arduino pin 13 30 | #define echoPin 12 //Sensor Trip pin connected to Arduino pin 12 31 | 32 | //Simple program just for testing the HC-SR04 Ultrasonic Sensor with LCD dispaly 33 | //URL: 34 | 35 | void setup() 36 | { 37 | pinMode(trigPin, OUTPUT); 38 | pinMode(echoPin, INPUT); 39 | 40 | LCD.begin(16,2); //Tell Arduino to start your 16 column 2 row LCD 41 | LCD.setCursor(0,0); //Set LCD cursor to upper left corner, column 0, row 0 42 | LCD.print("Target Distance:"); //Print Message on First Row 43 | } 44 | 45 | void loop() { 46 | long duration, distance; 47 | digitalWrite(trigPin, LOW); 48 | delayMicroseconds(2); 49 | digitalWrite(trigPin, HIGH); 50 | delayMicroseconds(10); 51 | digitalWrite(trigPin, LOW); 52 | duration = pulseIn(echoPin, HIGH); 53 | distance = (duration/2) / 29.1; 54 | 55 | LCD.setCursor(0,1); //Set cursor to first column of second row 56 | LCD.print(" "); //Print blanks to clear the row 57 | LCD.setCursor(0,1); //Set Cursor again to first column of second row 58 | LCD.print(distance); //Print measured distance 59 | LCD.print(" cm"); //Print your units. 60 | delay(250); //pause to let things settle 61 | } 62 | 63 | -------------------------------------------------------------------------------- /Distance-Measurement-in-OLED-Display/distance-measurement-in-oled-display.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Distance Measurement Display in OLED 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | 10 | 11 | #define SCREEN_WIDTH 128 // OLED display width, in pixels 12 | #define SCREEN_HEIGHT 64 // OLED display height, in pixels 13 | 14 | #define OLED_RESET 4 15 | //Adafruit_SH1106 display(OLED_RESET); 16 | Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT); 17 | 18 | 19 | #define BLUE 0x001F 20 | 21 | 22 | #define trigPin 7 //Sensor Echo pin connected to Arduino pin 7 23 | #define echoPin 6 //Sensor Trip pin connected to Arduino pin 6 24 | 25 | void setup() { 26 | Serial.begin(115200); 27 | pinMode(trigPin, OUTPUT); 28 | pinMode(echoPin, INPUT); 29 | // display.begin(SH1106_SWITCHCAPVCC, 0x3C); 30 | display.begin(SSD1306_SWITCHCAPVCC, 0x3C); 31 | delay(2000); 32 | display.clearDisplay(); 33 | display.setTextColor(SSD1306_WHITE); 34 | // display.setTextColor(BLUE); 35 | } 36 | 37 | void loop() { 38 | delay(2000); 39 | 40 | long duration, distance; 41 | digitalWrite(trigPin, LOW); 42 | delayMicroseconds(2); 43 | digitalWrite(trigPin, HIGH); 44 | delayMicroseconds(10); 45 | digitalWrite(trigPin, LOW); 46 | duration = pulseIn(echoPin, HIGH); 47 | distance = (duration/2) / 29.1; 48 | 49 | Serial.print(distance); 50 | //clear display 51 | display.clearDisplay(); 52 | 53 | // display Distance 54 | display.setTextSize(1); 55 | display.setCursor(0,7); 56 | //display.setTextColor(BLUE); 57 | display.print("Distance: "); 58 | display.setTextSize(2); 59 | display.setCursor(0,16); 60 | display.print(distance); 61 | display.print(" "); 62 | display.setTextSize(1); 63 | // display.cp437(true); 64 | // display.write(167); 65 | display.setTextSize(2); 66 | // display.print("C"); 67 | 68 | 69 | display.display(); 70 | } 71 | -------------------------------------------------------------------------------- /Distance-Measurement-with-JSN-SR04T-Ultrasonic-Sensor-and-Arduino-Uno/distance-measurement-with-jsn-sr04t-ultrasonic-sensor-and-arduino-uno.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Distance Measurement 3 | 4 | #include 5 | #include 6 | LiquidCrystal_I2C lcd(0x27, 16, 2); 7 | 8 | #define TRIG 11 //Module pins 9 | #define ECHO 12 10 | 11 | void setup() { 12 | 13 | Serial.begin(9600); // Serial monitoring 14 | pinMode(TRIG, OUTPUT); // Initializing Trigger Output and Echo Input 15 | pinMode(ECHO, INPUT_PULLUP); 16 | lcd.begin(); 17 | lcd.backlight(); 18 | lcd.clear(); 19 | lcd.setCursor(3,0); 20 | lcd.print("Welcome To"); 21 | lcd.setCursor(3,1); 22 | lcd.print("Tech Trends "); 23 | delay(3000); 24 | lcd.clear(); 25 | } 26 | 27 | void loop() { 28 | 29 | digitalWrite(TRIG, LOW); // Set the trigger pin to low for 2uS 30 | delayMicroseconds(2); 31 | 32 | digitalWrite(TRIG, HIGH); // Send a 10uS high to trigger ranging 33 | delayMicroseconds(20); 34 | 35 | digitalWrite(TRIG, LOW); // Send pin low again 36 | int distance = pulseIn(ECHO, HIGH,26000); // Read in times pulse 37 | 38 | distance= distance/58; //Convert the pulse duration to distance 39 | //You can add other math functions to calibrate it well 40 | 41 | Serial.print("Distance "); 42 | Serial.print(distance); 43 | Serial.println("cm"); 44 | 45 | lcd.clear(); 46 | lcd.print("Distance:"); 47 | lcd.setCursor(0,1); 48 | lcd.print(distance,1); 49 | lcd.setCursor(6,1); 50 | lcd.print("cm"); 51 | delay(500); 52 | 53 | } 54 | -------------------------------------------------------------------------------- /Electronic-Voting-Machine/electronic-voting-machine-circuit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tech-Trends-Shameer/Arduino-Projects/fa8d0a6b0261c52e029f0719cd3e3789c64958a9/Electronic-Voting-Machine/electronic-voting-machine-circuit.png -------------------------------------------------------------------------------- /Electronic-Voting-Machine/electronic-voting-machine.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Electronic Voting Machine 3 | 4 | #include 5 | #include 6 | 7 | LiquidCrystal_I2C lcd(0x27, 16, 2); 8 | 9 | #define v1 7 10 | #define v2 6 11 | #define v3 5 12 | #define v4 4 13 | #define v5 3 14 | int vote1=0; 15 | int vote2=0; 16 | int vote3=0; 17 | int vote4=0; 18 | 19 | void setup() 20 | { 21 | 22 | pinMode(v1, INPUT); 23 | pinMode(v2,INPUT); 24 | pinMode(v3,INPUT); 25 | pinMode(v4,INPUT); 26 | pinMode(v5,INPUT); 27 | pinMode(13,OUTPUT); 28 | pinMode(12,OUTPUT); 29 | 30 | lcd.begin(); 31 | lcd.backlight(); 32 | lcd.clear(); 33 | lcd.setCursor(3,0); 34 | lcd.print("Tech Trends"); 35 | delay(5000); 36 | lcd.setCursor(0,0); 37 | lcd.print("Electronic "); 38 | lcd.setCursor(0,1); 39 | lcd.print("Voting Machine"); 40 | 41 | delay(26000); 42 | digitalWrite(v1, HIGH); 43 | digitalWrite(v2, HIGH); 44 | digitalWrite(v3, HIGH); 45 | digitalWrite(v4, HIGH); 46 | digitalWrite(v5, HIGH); 47 | lcd.clear(); 48 | lcd.setCursor(1,0); 49 | lcd.print("A"); 50 | lcd.setCursor(5,0); 51 | lcd.print("B"); 52 | lcd.setCursor(9,0); 53 | lcd.print("C"); 54 | lcd.setCursor(13,0); 55 | lcd.print("D"); 56 | } 57 | 58 | void loop() 59 | { 60 | lcd.setCursor(1,0); 61 | lcd.print("A"); 62 | lcd.setCursor(1,1); 63 | lcd.print(vote1); 64 | lcd.setCursor(5,0); 65 | lcd.print("B"); 66 | lcd.setCursor(5,1); 67 | lcd.print(vote2); 68 | lcd.setCursor(9,0); 69 | lcd.print("C"); 70 | lcd.setCursor(9,1); 71 | lcd.print(vote3); 72 | lcd.setCursor(13,0); 73 | lcd.print("D"); 74 | lcd.setCursor(13,1); 75 | lcd.print(vote4); 76 | 77 | if(digitalRead(v1)==0) 78 | { 79 | digitalWrite(12,HIGH); 80 | vote1++; 81 | while(digitalRead(v1)==0); 82 | digitalWrite(12,LOW); 83 | delay(1000); 84 | } 85 | 86 | if(digitalRead(v2)==0) 87 | { 88 | vote2++; 89 | digitalWrite(12,HIGH); 90 | while(digitalRead(v2)==0); 91 | digitalWrite(12,LOW); 92 | delay(1000); 93 | } 94 | 95 | if(digitalRead(v3)==0) 96 | { 97 | digitalWrite(12,HIGH); 98 | vote3++; 99 | while(digitalRead(v3)==0); 100 | digitalWrite(12,LOW); 101 | delay(1000); 102 | } 103 | 104 | if(digitalRead(v4)==0) 105 | { 106 | digitalWrite(12,HIGH); 107 | vote4++; 108 | while(digitalRead(v4)==0); 109 | digitalWrite(12,LOW); 110 | delay(1000 ); 111 | } 112 | 113 | if(digitalRead(v5)==0) 114 | { 115 | digitalWrite(13,HIGH); 116 | int vote=vote1+vote2+vote3+vote4; 117 | if(vote) 118 | { 119 | if((vote1 > vote2 && vote1 > vote3 && vote1 > vote4)) 120 | { 121 | lcd.clear(); 122 | lcd.print("A Wins"); 123 | delay(5000); 124 | lcd.clear(); 125 | } 126 | else if((vote2 > vote1 && vote2 > vote3 && vote2 > vote4)) 127 | { 128 | lcd.clear(); 129 | lcd.print("B Wins"); 130 | delay(5000); 131 | lcd.clear(); 132 | } 133 | else if((vote3 > vote1 && vote3 > vote2 && vote3 > vote4)) 134 | { 135 | lcd.clear(); 136 | lcd.print("C Wins"); 137 | delay(5000); 138 | lcd.clear(); 139 | } 140 | else if(vote4 > vote1 && vote4 > vote2 && vote4 > vote3) 141 | { 142 | lcd.setCursor(0,0); 143 | lcd.clear(); 144 | lcd.print("D Wins"); 145 | delay(5000); 146 | lcd.clear(); 147 | } 148 | 149 | else 150 | { 151 | lcd.clear(); 152 | lcd.print(" Vote Tied "); 153 | lcd.setCursor(0,1); 154 | lcd.print(" "); 155 | delay(5000); 156 | lcd.clear(); 157 | } 158 | 159 | } 160 | else 161 | { 162 | lcd.clear(); 163 | lcd.print("No Vote Polled"); 164 | delay(5000); 165 | lcd.clear(); 166 | } 167 | vote1=0; 168 | vote2=0; 169 | vote3=0; 170 | vote4=0; 171 | vote=0; 172 | lcd.clear(); 173 | digitalWrite(12,HIGH); 174 | digitalWrite(13,LOW); 175 | } 176 | 177 | } 178 | -------------------------------------------------------------------------------- /Facial-Expression-Display-Using-Arduino-and-Dot-Matrix-Display/facial-expression-display-Using-arduino-and-dot-matrix-display.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Facial Expressions Display 3 | 4 | #include "LedControl.h" 5 | #include "binary.h" 6 | 7 | /* 8 | DIN connects to pin 12 10 9 | CLK connects to pin 11 8 10 | CS connects to pin 10 9 11 | */ 12 | LedControl lc=LedControl(10,8,9,1); 13 | 14 | unsigned long delaytime=5000; //Delay time between each expression display 15 | 16 | 17 | byte hf[8]= {B00111100,B01000010,B10100101,B10000001,B10100101,B10011001,B01000010,B00111100}; //Happy Face 18 | byte sf[8]= {B00111100,B01000010,B10100101,B10000001,B10011001,B10100101,B01000010,B00111100}; //Sad Face 19 | byte nf[8]={B00111100, B01000010,B10100101,B10000001,B10111101,B10000001,B01000010,B00111100}; //Neutral Faec 20 | byte A[8]= {B00000000,B00111100,B01100110,B01100110,B01111110,B01100110,B01100110,B01100110}; //Alphabet 21 | byte heart[8] = {B01100110,B11111111, B11111111, B11111111, B01111110, B00111100, B00011000, B00000000}; //Heart 22 | byte thumbsup[8]= {B00000000, B01000000, B01100000, B01111100, B01000010, B01000010, B01111100, B00000000}; //Thumbsup 23 | 24 | 25 | void setup() { 26 | lc.shutdown(0,false); 27 | // Set brightness to a medium value 28 | lc.setIntensity(0,8); 29 | // Clear the display 30 | lc.clearDisplay(0); 31 | } 32 | 33 | void drawFaces(){ 34 | 35 | // Display Happy Face 36 | lc.setRow(0,0,hf[0]); 37 | lc.setRow(0,1,hf[1]); 38 | lc.setRow(0,2,hf[2]); 39 | lc.setRow(0,3,hf[3]); 40 | lc.setRow(0,4,hf[4]); 41 | lc.setRow(0,5,hf[5]); 42 | lc.setRow(0,6,hf[6]); 43 | lc.setRow(0,7,hf[7]); 44 | delay(delaytime); 45 | 46 | //Display Sad Face 47 | lc.setRow(0,0,sf[0]); 48 | lc.setRow(0,1,sf[1]); 49 | lc.setRow(0,2,sf[2]); 50 | lc.setRow(0,3,sf[3]); 51 | lc.setRow(0,4,sf[4]); 52 | lc.setRow(0,5,sf[5]); 53 | lc.setRow(0,6,sf[6]); 54 | lc.setRow(0,7,sf[7]); 55 | delay(delaytime); 56 | 57 | //Display Neutral Face 58 | lc.setRow(0,0,nf[0]); 59 | lc.setRow(0,1,nf[1]); 60 | lc.setRow(0,2,nf[2]); 61 | lc.setRow(0,3,nf[3]); 62 | lc.setRow(0,4,nf[4]); 63 | lc.setRow(0,5,nf[5]); 64 | lc.setRow(0,6,nf[6]); 65 | lc.setRow(0,7,nf[7]); 66 | delay(delaytime); 67 | 68 | 69 | 70 | 71 | //Display Alphabet 72 | lc.setRow(0,0,A[0]); 73 | lc.setRow(0,1,A[1]); 74 | lc.setRow(0,2,A[2]); 75 | lc.setRow(0,3,A[3]); 76 | lc.setRow(0,4,A[4]); 77 | lc.setRow(0,5,A[5]); 78 | lc.setRow(0,6,A[6]); 79 | lc.setRow(0,7,A[7]); 80 | delay(delaytime); 81 | 82 | //Display Heart 83 | lc.setRow(0,0,heart[0]); 84 | lc.setRow(0,1,heart[1]); 85 | lc.setRow(0,2,heart[2]); 86 | lc.setRow(0,3,heart[3]); 87 | lc.setRow(0,4,heart[4]); 88 | lc.setRow(0,5,heart[5]); 89 | lc.setRow(0,6,heart[6]); 90 | lc.setRow(0,7,heart[7]); 91 | delay(delaytime); 92 | 93 | //Display Thumbsup 94 | lc.setRow(0,0,thumbsup[0]); 95 | lc.setRow(0,1,thumbsup[1]); 96 | lc.setRow(0,2,thumbsup[2]); 97 | lc.setRow(0,3,thumbsup[3]); 98 | lc.setRow(0,4,thumbsup[4]); 99 | lc.setRow(0,5,thumbsup[5]); 100 | lc.setRow(0,6,thumbsup[6]); 101 | lc.setRow(0,7,thumbsup[7]); 102 | delay(delaytime); 103 | } 104 | 105 | void loop(){ 106 | drawFaces(); 107 | } 108 | -------------------------------------------------------------------------------- /Facial-Expression-Display-Using-Arduino-and-Dot-Matrix-Display/facial-expression-display-circuit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tech-Trends-Shameer/Arduino-Projects/fa8d0a6b0261c52e029f0719cd3e3789c64958a9/Facial-Expression-Display-Using-Arduino-and-Dot-Matrix-Display/facial-expression-display-circuit.png -------------------------------------------------------------------------------- /Fire-Detection-Alarm/fire-detection-alarm.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Flame Detection using Arduino and Flame Sensor 3 | 4 | const int buzzerPin = 13; 5 | const int flamePin = 12; 6 | int Flame = HIGH; 7 | int redled = 6; 8 | int greenled = 7; 9 | void setup() 10 | { 11 | pinMode(buzzerPin, OUTPUT); 12 | pinMode(redled, OUTPUT); 13 | pinMode(greenled, OUTPUT); 14 | 15 | pinMode(flamePin, INPUT); 16 | Serial.begin(9600); 17 | } 18 | 19 | void loop() 20 | { 21 | Flame = digitalRead(flamePin); 22 | if (Flame== LOW) 23 | { 24 | digitalWrite(buzzerPin, HIGH); 25 | digitalWrite(redled, HIGH); 26 | digitalWrite(greenled, LOW); 27 | } 28 | else 29 | { 30 | digitalWrite(buzzerPin, LOW); 31 | digitalWrite(greenled, HIGH); 32 | digitalWrite(redled, LOW); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Fire-Detection-Alarm/fire-detection-circuit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tech-Trends-Shameer/Arduino-Projects/fa8d0a6b0261c52e029f0719cd3e3789c64958a9/Fire-Detection-Alarm/fire-detection-circuit.png -------------------------------------------------------------------------------- /Gas-Detection-Alarm/gas-detection-alarm-circuit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tech-Trends-Shameer/Arduino-Projects/fa8d0a6b0261c52e029f0719cd3e3789c64958a9/Gas-Detection-Alarm/gas-detection-alarm-circuit.png -------------------------------------------------------------------------------- /Gas-Detection-Alarm/gas-detection-alarm.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Gas Detection Alarm 3 | 4 | int redLed = 9; 5 | int blueLed = 10; 6 | int buzzer = 8; 7 | int smokeA0 = A0; 8 | // Threshold value 9 | int sensorThres = 100; 10 | 11 | void setup() { 12 | pinMode(redLed, OUTPUT); 13 | pinMode(blueLed, OUTPUT); 14 | pinMode(buzzer, OUTPUT); 15 | pinMode(smokeA0, INPUT); 16 | Serial.begin(9600); 17 | 18 | } 19 | 20 | void loop() { 21 | int analogSensor = analogRead(smokeA0); 22 | 23 | Serial.print("Pin A0: "); 24 | Serial.println(analogSensor); 25 | 26 | // Checks if it has reached the threshold value 27 | if (analogSensor-50 > sensorThres) 28 | { 29 | digitalWrite(redLed, HIGH); 30 | 31 | digitalWrite(blueLed, LOW); 32 | tone(buzzer, 1000, 200); 33 | } 34 | else 35 | { 36 | digitalWrite(redLed, LOW); 37 | digitalWrite(blueLed, HIGH); 38 | 39 | noTone(buzzer); 40 | } 41 | delay(500); 42 | } 43 | -------------------------------------------------------------------------------- /How-to-store-temperature-data-in-SD-card/temperature-data-logger-in-SD-card.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Temperature Data Log into SD Card 3 | 4 | #include // Include SPI library (needed for the SD card) 5 | #include // Include SD library 6 | #include // Include DHT sensor library 7 | 8 | File dataFile; 9 | 10 | #define DHTPIN 4 // DHT11 data pin is connected to Arduino pin 4 11 | #define DHTTYPE DHT11 // DHT11 sensor is used 12 | DHT dht(DHTPIN, DHTTYPE); // Initialize DHT library 13 | 14 | void setup() { 15 | // Open serial communications and wait for port to open: 16 | Serial.begin(9600); 17 | while (!Serial) 18 | ; // wait for serial port to connect. Needed for native USB port only 19 | Serial.print("Initializing SD card..."); 20 | if (!SD.begin()) 21 | { 22 | Serial.println("initialization failed!"); 23 | while (1); 24 | } 25 | Serial.println("initialization done."); 26 | delay(2000); 27 | dht.begin(); 28 | } 29 | 30 | uint16_t line = 1; 31 | 32 | void loop() { 33 | delay(1000); 34 | // Read humidity 35 | byte RH = dht.readHumidity(); 36 | //Read temperature in degree Celsius 37 | byte Temp = dht.readTemperature(); 38 | 39 | dataFile = SD.open("DHT11Log.txt", FILE_WRITE); 40 | 41 | // if the file opened okay, write to it: 42 | if (dataFile) 43 | { 44 | Serial.print(line); 45 | Serial.print(": Temperature = "); 46 | Serial.print(Temp); 47 | Serial.print("°C, Humidity = "); 48 | Serial.print(RH); 49 | Serial.println("%"); 50 | // Write data to SD card file (DHT11Log.txt) 51 | dataFile.print(line++); 52 | dataFile.print(": Temperature = "); 53 | dataFile.print(Temp); 54 | dataFile.print("°C, Humidity = "); 55 | dataFile.print(RH); 56 | dataFile.println("%"); 57 | dataFile.close(); 58 | 59 | } 60 | // if the file didn't open, print an error: 61 | else 62 | Serial.println("error opening DHT11Log.txt"); 63 | } 64 | -------------------------------------------------------------------------------- /I2C-Scanner/i2c-scanner.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void setup() 4 | { 5 | Wire.begin(); 6 | 7 | Serial.begin(9600); 8 | while (!Serial); // Leonardo: wait for serial monitor 9 | Serial.println("I2C Scanner"); 10 | } 11 | 12 | 13 | void loop() 14 | { 15 | byte error, address; 16 | int nDevices; 17 | 18 | Serial.println("Scanning..."); 19 | 20 | nDevices = 0; 21 | for(address = 1; address < 127; address++ ) 22 | { 23 | // The i2c_scanner uses the return value of 24 | // the Write.endTransmisstion to see if 25 | // a device did acknowledge to the address. 26 | Wire.beginTransmission(address); 27 | error = Wire.endTransmission(); 28 | 29 | if (error == 0) 30 | { 31 | Serial.print("I2C device found at address 0x"); 32 | if (address<16) 33 | Serial.print("0"); 34 | Serial.print(address,HEX); 35 | Serial.println(" !"); 36 | 37 | nDevices++; 38 | } 39 | else if (error==4) 40 | { 41 | Serial.print("Unknown error at address 0x"); 42 | if (address<16) 43 | Serial.print("0"); 44 | Serial.println(address,HEX); 45 | } 46 | } 47 | if (nDevices == 0) 48 | Serial.println("No I2C devices found"); 49 | else 50 | Serial.println("done 51 | "); 52 | 53 | delay(5000); // wait 5 seconds for next scan 54 | } 55 | -------------------------------------------------------------------------------- /KeyPad-Security-System/keypad-security-system-circuit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tech-Trends-Shameer/Arduino-Projects/fa8d0a6b0261c52e029f0719cd3e3789c64958a9/KeyPad-Security-System/keypad-security-system-circuit.png -------------------------------------------------------------------------------- /KeyPad-Security-System/keypad-security-system.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //KeyPad Security Lock System 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | LiquidCrystal_I2C lcd(0x27, 16, 2); 10 | char password[4]; 11 | char initial_password[4],new_password[4]; 12 | int i=0; 13 | int relay_pin = 10; 14 | char key_pressed=0; 15 | const byte rows = 4; 16 | const byte columns = 4; 17 | char hexaKeys[rows][columns] = 18 | { 19 | {'1','2','3','A'}, 20 | {'4','5','6','B'}, 21 | {'7','8','9','C'}, 22 | {'*','0','#','D'} 23 | }; 24 | 25 | byte row_pins[rows] = {9,8,7,6}; 26 | byte column_pins[columns] = {5,4,3,2}; 27 | Keypad keypad_key = Keypad( makeKeymap(hexaKeys), row_pins, column_pins, rows, columns); 28 | 29 | void setup() 30 | { 31 | lcd.begin(); 32 | lcd.backlight(); 33 | lcd.clear(); 34 | lcd.setCursor(3,0); 35 | lcd.print("Tech Trends"); 36 | delay(2000); 37 | pinMode(relay_pin, OUTPUT); 38 | lcd.clear(); 39 | lcd.setCursor(2,0); 40 | lcd.print("KeyPad Lock"); 41 | lcd.setCursor(4,1); 42 | lcd.print("System"); 43 | delay(2000); 44 | lcd.clear(); 45 | lcd.print("Enter Password"); 46 | lcd.setCursor(0,1); 47 | initialpassword(); 48 | } 49 | 50 | void loop() 51 | { 52 | digitalWrite(relay_pin, HIGH); 53 | key_pressed = keypad_key.getKey(); 54 | if(key_pressed=='#') 55 | change(); 56 | if (key_pressed) 57 | { 58 | password[i++]=key_pressed; 59 | lcd.print(key_pressed); 60 | } 61 | if(i==4) 62 | { 63 | delay(200); 64 | for(int j=0;j<4;j++) 65 | initial_password[j]=EEPROM.read(j); 66 | if(!(strncmp(password, initial_password,4))) 67 | { 68 | lcd.clear(); 69 | lcd.print("Pass Accepted"); 70 | digitalWrite(relay_pin, LOW); 71 | delay(3000); 72 | lcd.setCursor(0,1); 73 | lcd.print("Pres # to change"); 74 | delay(2000); 75 | lcd.clear(); 76 | lcd.print("Enter Password:"); 77 | lcd.setCursor(0,1); 78 | i=0; 79 | } 80 | else 81 | { 82 | digitalWrite(relay_pin, HIGH); 83 | lcd.clear(); 84 | lcd.print("Wrong Password"); 85 | lcd.setCursor(0,1); 86 | delay(3000); 87 | lcd.print("Pres # to Change"); 88 | delay(2000); 89 | lcd.clear(); 90 | lcd.print("Enter Password"); 91 | lcd.setCursor(0,1); 92 | i=0; 93 | } 94 | } 95 | } 96 | 97 | void change() 98 | { 99 | int j=0; 100 | lcd.clear(); 101 | lcd.print("Current Password"); 102 | lcd.setCursor(0,1); 103 | while(j<4) 104 | { 105 | char key=keypad_key.getKey(); 106 | if(key) 107 | { 108 | new_password[j++]=key; 109 | lcd.print(key); 110 | } 111 | key=0; 112 | } 113 | delay(500); 114 | if((strncmp(new_password, initial_password, 4))) 115 | { 116 | lcd.clear(); 117 | lcd.print("Wrong Password"); 118 | lcd.setCursor(0,1); 119 | lcd.print("Try Again"); 120 | delay(1000); 121 | } 122 | else 123 | { 124 | j=0; 125 | lcd.clear(); 126 | lcd.print("New Password:"); 127 | lcd.setCursor(0,1); 128 | while(j<4) 129 | { 130 | char key=keypad_key.getKey(); 131 | if(key) 132 | { 133 | initial_password[j]=key; 134 | lcd.print(key); 135 | EEPROM.write(j,key); 136 | j++; 137 | } 138 | } 139 | delay(3000); 140 | lcd.print("Pass Changed"); 141 | delay(1000); 142 | } 143 | lcd.clear(); 144 | lcd.print("Enter Password"); 145 | lcd.setCursor(0,1); 146 | key_pressed=0; 147 | } 148 | 149 | void initialpassword() 150 | { 151 | for(int j=0;j<4;j++) 152 | EEPROM.write(j, j+49); 153 | for(int j=0;j<4;j++) 154 | initial_password[j]=EEPROM.read(j); 155 | } 156 | -------------------------------------------------------------------------------- /LED-Chaser-Using-Arduino/led-chaser-circuit.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tech-Trends-Shameer/Arduino-Projects/fa8d0a6b0261c52e029f0719cd3e3789c64958a9/LED-Chaser-Using-Arduino/led-chaser-circuit.jpg -------------------------------------------------------------------------------- /LED-Chaser-Using-Arduino/led-chaser-using-arduino.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //LED Chaser 3 | 4 | int LED1 = 13; 5 | int LED2 = 12; 6 | int LED3 = 11; 7 | int LED4 = 10; 8 | int LED5 = 9; 9 | int LED6 = 8; 10 | int LED7 = 7; 11 | int LED8 = 6; 12 | 13 | 14 | void setup() { 15 | pinMode(LED1, OUTPUT); 16 | pinMode(LED2, OUTPUT); 17 | pinMode(LED3, OUTPUT); 18 | pinMode(LED4, OUTPUT); 19 | pinMode(LED5, OUTPUT); 20 | pinMode(LED6, OUTPUT); 21 | pinMode(LED7, OUTPUT); 22 | pinMode(LED8, OUTPUT); 23 | } 24 | 25 | 26 | void loop() { 27 | digitalWrite(LED1, HIGH); // turn on LED1 28 | delay(100); // wait for 200ms 29 | digitalWrite(LED2, HIGH); // turn on LED2 30 | delay(100); // wait for 200ms 31 | digitalWrite(LED3, HIGH); // turn on LED3 32 | delay(100); // wait for 200ms 33 | digitalWrite(LED4, HIGH); // turn on LED4 34 | delay(100); // wait for 200ms 35 | digitalWrite(LED5, HIGH); // turn on LED5 36 | delay(100); // wait for 200ms 37 | digitalWrite(LED6, HIGH); // turn on LED6 38 | delay(100); // wait for 200ms 39 | digitalWrite(LED7, HIGH); // turn on LED7 40 | delay(100); // wait for 200ms 41 | digitalWrite(LED8, HIGH); // turn on LED8 42 | delay(100); // wait for 200ms 43 | 44 | digitalWrite(LED1, LOW); // turn off LED1 45 | delay(100); // wait for 300ms 46 | digitalWrite(LED2, LOW); // turn off LED2 47 | delay(100); // wait for 300ms 48 | digitalWrite(LED3, LOW); // turn off LED3 49 | delay(100); // wait for 300ms 50 | digitalWrite(LED4, LOW); // turn off LED4 51 | delay(100); // wait for 300ms 52 | digitalWrite(LED5, LOW); // turn off LED5 53 | delay(100); // wait for 300ms 54 | digitalWrite(LED6, LOW); // turn off LED6 55 | delay(100); // wait for 300ms 56 | digitalWrite(LED7, LOW); // turn off LED7 57 | delay(100); // wait for 300ms 58 | digitalWrite(LED8, LOW); // turn off LED8 59 | delay(100); // wait for 300ms before running program all over again 60 | } 61 | -------------------------------------------------------------------------------- /Light-Intensity-Measurement-Using-Arduino-Uno/light-intensity-measurement-using-arduino-uno.ino: -------------------------------------------------------------------------------- 1 | /Tech Trends Shameer 2 | //Light Intensity Measurement Using Arduino Uno 3 | 4 | #include 5 | LiquidCrystal_I2C lcd(0x27, 16, 2); 6 | 7 | int temt6000Pin = A0; 8 | float light; 9 | int light_value; 10 | 11 | 12 | void setup() 13 | { 14 | Serial.begin(115200); 15 | lcd.begin(); 16 | //lcd.backlight(); 17 | lcd.clear(); 18 | lcd.setCursor(2,0); 19 | lcd.print("Tech Trends"); 20 | 21 | delay(3000); 22 | lcd.clear(); 23 | pinMode(temt6000Pin, INPUT); //data pin for ambientlight sensor 24 | lcd.setCursor(0, 0); 25 | lcd.print("Light Intensity"); 26 | } 27 | 28 | void loop() 29 | { 30 | int light_value = analogRead(temt6000Pin); 31 | light = light_value * 0.0976;// percentage calculation 32 | Serial.print("Light Value"); 33 | Serial.println(light_value); 34 | Serial.print("Light %"); 35 | Serial.println(light); 36 | lcd.setCursor(0, 1); 37 | lcd.print(light); 38 | lcd.setCursor(6, 1); 39 | lcd.print("%"); 40 | delay(2000); 41 | } 42 | -------------------------------------------------------------------------------- /Mario-LCD-Game/mario-lcd-game.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Mario LCD Game 3 | 4 | #include 5 | 6 | #define JoyX 2 7 | #define PIN_AUTOPLAY 1 8 | #define PIN_READWRITE 10 9 | #define PIN_CONTRAST 12 10 | 11 | #define SPRITE_RUN1 1 12 | #define SPRITE_RUN2 2 13 | #define SPRITE_JUMP 3 14 | #define SPRITE_JUMP_UPPER '.' // Use the '.' character for the head 15 | #define SPRITE_JUMP_LOWER 4 16 | #define SPRITE_TERRAIN_EMPTY ' ' // User the ' ' character 17 | #define SPRITE_TERRAIN_SOLID 5 18 | #define SPRITE_TERRAIN_SOLID_RIGHT 6 19 | #define SPRITE_TERRAIN_SOLID_LEFT 7 20 | 21 | #define BOY_HORIZONTAL_POSITION 1 // Horizontal position of hero on screen 22 | 23 | #define TERRAIN_WIDTH 16 24 | #define TERRAIN_EMPTY 0 25 | #define TERRAIN_LOWER_BLOCK 1 26 | #define TERRAIN_UPPER_BLOCK 2 27 | 28 | #define BOY_POSITION_OFF 0 // boy is invisible 29 | #define BOY_POSITION_RUN_LOWER_1 1 // boy is running on lower row (pose 1) 30 | #define BOY_POSITION_RUN_LOWER_2 2 // (pose 2) 31 | 32 | #define BOY_POSITION_JUMP_1 3 // Starting a jump 33 | #define BOY_POSITION_JUMP_2 4 // Half-way up 34 | #define BOY_POSITION_JUMP_3 5 // Jump is on upper row 35 | #define BOY_POSITION_JUMP_4 6 // Jump is on upper row 36 | #define BOY_POSITION_JUMP_5 7 // Jump is on upper row 37 | #define BOY_POSITION_JUMP_6 8 // Jump is on upper row 38 | #define BOY_POSITION_JUMP_7 9 // Half-way down 39 | #define BOY_POSITION_JUMP_8 10 // About to land 40 | 41 | #define BOY_POSITION_RUN_UPPER_1 11 // boy is running on upper row (pose 1) 42 | #define BOY_POSITION_RUN_UPPER_2 12 // (pose 2) 43 | 44 | //LiquidCrystal lcd(11, 9, 6, 5, 4, 3); 45 | 46 | LiquidCrystal_I2C lcd(0x27, 16, 2); 47 | static char terrainUpper[TERRAIN_WIDTH + 1]; 48 | static char terrainLower[TERRAIN_WIDTH + 1]; 49 | static bool buttonPushed = false; 50 | 51 | void initializeGraphics(){ 52 | static byte graphics[] = { 53 | // Run position 1 54 | B01100, 55 | B01100, 56 | B00000, 57 | B01110, 58 | B11100, 59 | B01100, 60 | B11010, 61 | B10011, 62 | // Run position 2 63 | B01100, 64 | B01100, 65 | B00000, 66 | B01100, 67 | B01100, 68 | B01100, 69 | B01100, 70 | B01110, 71 | // Jump 72 | B01100, 73 | B01100, 74 | B00000, 75 | B11110, 76 | B01101, 77 | B11111, 78 | B10000, 79 | B00000, 80 | // Jump lower 81 | B11110, 82 | B01101, 83 | B11111, 84 | B10000, 85 | B00000, 86 | B00000, 87 | B00000, 88 | B00000, 89 | // Ground 90 | B11111, 91 | B11111, 92 | B11111, 93 | B11111, 94 | B11111, 95 | B11111, 96 | B11111, 97 | B11111, 98 | // Ground right 99 | B00011, 100 | B00011, 101 | B00011, 102 | B00011, 103 | B00011, 104 | B00011, 105 | B00011, 106 | B00011, 107 | // Ground left 108 | B11000, 109 | B11000, 110 | B11000, 111 | B11000, 112 | B11000, 113 | B11000, 114 | B11000, 115 | B11000, 116 | }; 117 | int i; 118 | // Skip using character 0, this allows lcd.print() to be used to 119 | // quickly draw multiple characters 120 | for (i = 0; i < 7; ++i) { 121 | lcd.createChar(i + 1, &graphics[i * 8]); 122 | } 123 | for (i = 0; i < TERRAIN_WIDTH; ++i) { 124 | terrainUpper[i] = SPRITE_TERRAIN_EMPTY; 125 | terrainLower[i] = SPRITE_TERRAIN_EMPTY; 126 | } 127 | } 128 | 129 | // Slide the terrain to the left in half-character increments 130 | // 131 | void advanceTerrain(char* terrain, byte newTerrain){ 132 | for (int i = 0; i < TERRAIN_WIDTH; ++i) { 133 | char current = terrain[i]; 134 | char next = (i == TERRAIN_WIDTH-1) ? newTerrain : terrain[i+1]; 135 | switch (current){ 136 | case SPRITE_TERRAIN_EMPTY: 137 | terrain[i] = (next == SPRITE_TERRAIN_SOLID) ? SPRITE_TERRAIN_SOLID_RIGHT : SPRITE_TERRAIN_EMPTY; 138 | break; 139 | case SPRITE_TERRAIN_SOLID: 140 | terrain[i] = (next == SPRITE_TERRAIN_EMPTY) ? SPRITE_TERRAIN_SOLID_LEFT : SPRITE_TERRAIN_SOLID; 141 | break; 142 | case SPRITE_TERRAIN_SOLID_RIGHT: 143 | terrain[i] = SPRITE_TERRAIN_SOLID; 144 | break; 145 | case SPRITE_TERRAIN_SOLID_LEFT: 146 | terrain[i] = SPRITE_TERRAIN_EMPTY; 147 | break; 148 | } 149 | } 150 | } 151 | 152 | bool drawBoy(byte position, char* terrainUpper, char* terrainLower, unsigned int score) { 153 | bool collide = false; 154 | char upperSave = terrainUpper[BOY_HORIZONTAL_POSITION]; 155 | char lowerSave = terrainLower[BOY_HORIZONTAL_POSITION]; 156 | byte upper, lower; 157 | switch (position) { 158 | case BOY_POSITION_OFF: 159 | upper = lower = SPRITE_TERRAIN_EMPTY; 160 | break; 161 | case BOY_POSITION_RUN_LOWER_1: 162 | upper = SPRITE_TERRAIN_EMPTY; 163 | lower = SPRITE_RUN1; 164 | break; 165 | case BOY_POSITION_RUN_LOWER_2: 166 | upper = SPRITE_TERRAIN_EMPTY; 167 | lower = SPRITE_RUN2; 168 | break; 169 | case BOY_POSITION_JUMP_1: 170 | case BOY_POSITION_JUMP_8: 171 | upper = SPRITE_TERRAIN_EMPTY; 172 | lower = SPRITE_JUMP; 173 | break; 174 | case BOY_POSITION_JUMP_2: 175 | case BOY_POSITION_JUMP_7: 176 | upper = SPRITE_JUMP_UPPER; 177 | lower = SPRITE_JUMP_LOWER; 178 | break; 179 | case BOY_POSITION_JUMP_3: 180 | case BOY_POSITION_JUMP_4: 181 | case BOY_POSITION_JUMP_5: 182 | case BOY_POSITION_JUMP_6: 183 | upper = SPRITE_JUMP; 184 | lower = SPRITE_TERRAIN_EMPTY; 185 | break; 186 | case BOY_POSITION_RUN_UPPER_1: 187 | upper = SPRITE_RUN1; 188 | lower = SPRITE_TERRAIN_EMPTY; 189 | break; 190 | case BOY_POSITION_RUN_UPPER_2: 191 | upper = SPRITE_RUN2; 192 | lower = SPRITE_TERRAIN_EMPTY; 193 | break; 194 | } 195 | if (upper != ' ') { 196 | terrainUpper[BOY_HORIZONTAL_POSITION] = upper; 197 | collide = (upperSave == SPRITE_TERRAIN_EMPTY) ? false : true; 198 | } 199 | if (lower != ' ') { 200 | terrainLower[BOY_HORIZONTAL_POSITION] = lower; 201 | collide |= (lowerSave == SPRITE_TERRAIN_EMPTY) ? false : true; 202 | } 203 | 204 | byte digits = (score > 9999) ? 5 : (score > 999) ? 4 : (score > 99) ? 3 : (score > 9) ? 2 : 1; 205 | 206 | // Draw the scene 207 | terrainUpper[TERRAIN_WIDTH] = '\0'; 208 | terrainLower[TERRAIN_WIDTH] = '\0'; 209 | char temp = terrainUpper[16-digits]; 210 | terrainUpper[16-digits] = '\0'; 211 | lcd.setCursor(0,0); 212 | lcd.print(terrainUpper); 213 | terrainUpper[16-digits] = temp; 214 | lcd.setCursor(0,1); 215 | lcd.print(terrainLower); 216 | 217 | lcd.setCursor(16 - digits,0); 218 | lcd.print(score); 219 | 220 | terrainUpper[BOY_HORIZONTAL_POSITION] = upperSave; 221 | terrainLower[BOY_HORIZONTAL_POSITION] = lowerSave; 222 | return collide; 223 | } 224 | 225 | // Handle the button push as an interrupt 226 | void buttonPush() { 227 | buttonPushed = true; 228 | } 229 | 230 | void setup(){ 231 | pinMode(PIN_READWRITE, OUTPUT); 232 | digitalWrite(PIN_READWRITE, LOW); 233 | pinMode(PIN_CONTRAST, OUTPUT); 234 | digitalWrite(PIN_CONTRAST, LOW); 235 | pinMode(JoyX, INPUT); 236 | digitalWrite(JoyX, HIGH); 237 | pinMode(PIN_AUTOPLAY, OUTPUT); 238 | digitalWrite(PIN_AUTOPLAY, HIGH); 239 | 240 | // Digital pin 2 maps to interrupt 0 241 | attachInterrupt(0/*PIN_BUTTON*/, buttonPush, FALLING); 242 | 243 | initializeGraphics(); 244 | 245 | // lcd.begin(16, 2); 246 | 247 | lcd.begin(); 248 | 249 | 250 | lcd.backlight(); 251 | lcd.clear(); 252 | lcd.setCursor(4,0); 253 | lcd.print("Hello "); 254 | } 255 | 256 | void loop(){ 257 | static byte boyPos = BOY_POSITION_RUN_LOWER_1; 258 | static byte newTerrainType = TERRAIN_EMPTY; 259 | static byte newTerrainDuration = 1; 260 | static bool playing = false; 261 | static bool blink = false; 262 | static unsigned int distance = 0; 263 | 264 | if (!playing) { 265 | drawBoy((blink) ? BOY_POSITION_OFF : boyPos, terrainUpper, terrainLower, distance >> 3); 266 | if (blink) { 267 | lcd.setCursor(0,0); 268 | lcd.print("Press Start"); 269 | } 270 | delay(250); 271 | blink = !blink; 272 | if (buttonPushed) { 273 | initializeGraphics(); 274 | boyPos = BOY_POSITION_RUN_LOWER_1; 275 | playing = true; 276 | buttonPushed = false; 277 | distance = 0; 278 | } 279 | return; 280 | } 281 | 282 | // Shift the terrain to the left 283 | advanceTerrain(terrainLower, newTerrainType == TERRAIN_LOWER_BLOCK ? SPRITE_TERRAIN_SOLID : SPRITE_TERRAIN_EMPTY); 284 | advanceTerrain(terrainUpper, newTerrainType == TERRAIN_UPPER_BLOCK ? SPRITE_TERRAIN_SOLID : SPRITE_TERRAIN_EMPTY); 285 | 286 | // Make new terrain to enter on the right 287 | if (--newTerrainDuration == 0) { 288 | if (newTerrainType == TERRAIN_EMPTY) { 289 | newTerrainType = (random(3) == 0) ? TERRAIN_UPPER_BLOCK : TERRAIN_LOWER_BLOCK; 290 | newTerrainDuration = 2 + random(10); 291 | } else { 292 | newTerrainType = TERRAIN_EMPTY; 293 | newTerrainDuration = 10 + random(10); 294 | } 295 | } 296 | 297 | if (buttonPushed) { 298 | if (boyPos <= BOY_POSITION_RUN_LOWER_2) boyPos = BOY_POSITION_JUMP_1; 299 | buttonPushed = false; 300 | } 301 | 302 | if (drawBoy(boyPos, terrainUpper, terrainLower, distance >> 3)) { 303 | playing = false; // The boy collided with something. Too bad. 304 | } else { 305 | if (boyPos == BOY_POSITION_RUN_LOWER_2 || boyPos == BOY_POSITION_JUMP_8) { 306 | boyPos = BOY_POSITION_RUN_LOWER_1; 307 | } else if ((boyPos >= BOY_POSITION_JUMP_3 && boyPos <= BOY_POSITION_JUMP_5) && terrainLower[BOY_HORIZONTAL_POSITION] != SPRITE_TERRAIN_EMPTY) { 308 | boyPos = BOY_POSITION_RUN_UPPER_1; 309 | } else if (boyPos >= BOY_POSITION_RUN_UPPER_1 && terrainLower[BOY_HORIZONTAL_POSITION] == SPRITE_TERRAIN_EMPTY) { 310 | boyPos = BOY_POSITION_JUMP_5; 311 | } else if (boyPos == BOY_POSITION_RUN_UPPER_2) { 312 | boyPos = BOY_POSITION_RUN_UPPER_1; 313 | } else { 314 | ++boyPos; 315 | } 316 | ++distance; 317 | 318 | digitalWrite(PIN_AUTOPLAY, terrainLower[BOY_HORIZONTAL_POSITION + 2] == SPRITE_TERRAIN_EMPTY ? HIGH : LOW); 319 | } 320 | delay(100); 321 | } 322 | -------------------------------------------------------------------------------- /Motion-Sensor-Controlled-LED/motion-sensor-controlled-LED.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Control LED using PIR Sensor 3 | 4 | int pirsensor = 0; 5 | 6 | void setup() { 7 | Serial.begin(9600); 8 | pinMode(13, OUTPUT); //Connect LED Positive to Pin 13 9 | pinMode(4, OUTPUT); //Connect Buzzer Positive to Pin 4 10 | pinMode(2, INPUT); //Connect PIR Sensor Out pin to Pin 2 11 | 12 | } 13 | void loop() { 14 | int pirsensor = digitalRead(2); 15 | Serial.println(pirsensor); 16 | if (pirsensor == 1) { 17 | digitalWrite(13, HIGH); // The Relay Input works Inversly 18 | digitalWrite(4, HIGH); 19 | } 20 | else 21 | { 22 | digitalWrite(13,LOW); 23 | digitalWrite(4, LOW); 24 | } 25 | delay(10); 26 | } 27 | -------------------------------------------------------------------------------- /Object-Detection-Alarm-Using-Ultrasonic-Sensor/object-detection-alarm-using-ultrasonic-sensor.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Object Detection Alarm 3 | 4 | // Define pins numbers 5 | const int trigPin = 13; //Connect Trig pin in Ultrasonic Sensor to Arduino Pin 13 6 | const int echoPin = 12; //Connect Echo pin in Ultrasonic Sensor to Arduino Pin 13 7 | const int buzzer = 11; //Connect Positive pin of Buzzer to Arduino Pin 11 8 | const int ledPin = 10; //Connect Positive pin of LED to Arduino Pin 10 9 | 10 | // Define variables 11 | long duration; 12 | int distance; 13 | int safetyDistance; 14 | 15 | 16 | void setup() { 17 | pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output 18 | pinMode(echoPin, INPUT); // Sets the echoPin as an Input 19 | pinMode(buzzer, OUTPUT); 20 | pinMode(ledPin, OUTPUT); 21 | Serial.begin(9600); // Starts the serial communication 22 | } 23 | 24 | 25 | void loop() { 26 | // Clears the trigPin 27 | digitalWrite(trigPin, LOW); 28 | delayMicroseconds(2); 29 | 30 | // Sets the trigPin on HIGH state for 15 micro seconds 31 | digitalWrite(trigPin, HIGH); 32 | delayMicroseconds(15); 33 | digitalWrite(trigPin, LOW); 34 | 35 | // Reads the echoPin, returns the sound wave travel time in microseconds 36 | duration = pulseIn(echoPin, HIGH); 37 | 38 | // Calculate the distance 39 | distance= duration*0.034/2; 40 | 41 | safetyDistance = distance; 42 | if (safetyDistance <= 8){ 43 | digitalWrite(buzzer, HIGH); 44 | digitalWrite(ledPin, HIGH); 45 | } 46 | else{ 47 | digitalWrite(buzzer, LOW); 48 | digitalWrite(ledPin, LOW); 49 | } 50 | 51 | // Print the distance on the Serial Monitor 52 | Serial.print("Distance: "); 53 | Serial.println(distance); 54 | } 55 | -------------------------------------------------------------------------------- /Object-Detection-Alarm-Using-Ultrasonic-Sensor/object-detection-using-ultrasonic-sensor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tech-Trends-Shameer/Arduino-Projects/fa8d0a6b0261c52e029f0719cd3e3789c64958a9/Object-Detection-Alarm-Using-Ultrasonic-Sensor/object-detection-using-ultrasonic-sensor.jpg -------------------------------------------------------------------------------- /Pulse-Oximeter-Using-Arduino-Uno-and-LCD/pulse-oximeter-using-arduino-uno-LCD.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "MAX30100_PulseOximeter.h" 4 | 5 | #define REPORTING_PERIOD_MS 1000 6 | 7 | LiquidCrystal_I2C lcd(0x27, 16, 2); 8 | 9 | byte smile[] = { 10 | B00000, 11 | B01010, 12 | B00000, 13 | B00000, 14 | B10001, 15 | B01110, 16 | B00000, 17 | B00000 18 | }; 19 | byte mod[] = { 20 | B00000, 21 | B00000, 22 | B01010, 23 | B00000, 24 | B11111, 25 | B00000, 26 | B00000, 27 | B00000 28 | }; 29 | byte sad[] = { 30 | B00000, 31 | B01010, 32 | B00000, 33 | B00000, 34 | B01110, 35 | B10001, 36 | B00000, 37 | B00000 38 | }; 39 | byte heart[] = { 40 | B00000, 41 | B01010, 42 | B11111, 43 | B11111, 44 | B11111, 45 | B01110, 46 | B00100, 47 | B00000 48 | }; 49 | byte neutral[] = { 50 | B00000, 51 | B00100, 52 | B01110, 53 | B10101, 54 | B10101, 55 | B01110, 56 | B00100, 57 | B00000 58 | }; 59 | PulseOximeter pox; 60 | uint32_t tsLastReport = 0; 61 | 62 | void onBeatDetected() 63 | { 64 | 65 | Serial.println("Beat!!!"); 66 | 67 | } 68 | 69 | void setup() 70 | { 71 | Serial.begin(115200); 72 | lcd.begin(); 73 | lcd.backlight(); 74 | lcd.createChar(1 , smile); 75 | lcd.createChar(2 , mod); 76 | lcd.createChar(3 , sad); 77 | lcd.createChar(4, heart); // Add the heart symbol 78 | lcd.createChar(5, neutral); // New neutral symbol 79 | 80 | // Display "Tech Trends Shameer" 81 | lcd.setCursor(3, 0); 82 | lcd.print("Tech Trends "); 83 | lcd.setCursor(3, 1); 84 | lcd.print(" Shameer "); 85 | delay(3000); // Wait for 3 seconds 86 | 87 | // Clear the LCD and display "Pulse Oximeter" 88 | lcd.clear(); 89 | lcd.setCursor(3, 0); 90 | lcd.print("Pulse "); 91 | lcd.setCursor(3, 1); 92 | lcd.print("Oximeter "); 93 | lcd.setCursor(12, 0); // Adjust the position for the heart symbol 94 | lcd.write(4); // Display the heart symbol 95 | delay(2000); 96 | 97 | if (!pox.begin()) { 98 | Serial.println("FAILED"); 99 | for (;;); 100 | } else { 101 | Serial.println("SUCCESS"); 102 | } 103 | pox.setIRLedCurrent(MAX30100_LED_CURR_7_6MA); 104 | 105 | pox.setOnBeatDetectedCallback(onBeatDetected); 106 | } 107 | 108 | void loop() 109 | { 110 | pox.update(); 111 | if (millis() - tsLastReport > REPORTING_PERIOD_MS) { 112 | 113 | lcd.clear(); 114 | lcd.setCursor(0 , 0); 115 | lcd.print("BPM : "); 116 | lcd.print(pox.getHeartRate()); 117 | lcd.setCursor(12, 0); // Adjust the position for the heart symbol 118 | lcd.write(4); // Display the heart symbol 119 | lcd.setCursor(0 , 1); 120 | lcd.print("Sp02: "); 121 | lcd.print(pox.getSpO2()); 122 | lcd.print("%"); 123 | tsLastReport = millis(); 124 | 125 | if (pox.getSpO2() >= 96) { 126 | lcd.setCursor(12 , 1); 127 | lcd.write(1); 128 | } 129 | else if (pox.getSpO2() <= 95 && pox.getSpO2() >= 91) { 130 | lcd.setCursor(12 , 1); 131 | lcd.write(2); 132 | } 133 | else if (pox.getSpO2() <= 90 && pox.getSpO2() >= 1 ) { 134 | lcd.setCursor(12 , 1); 135 | lcd.write(3); 136 | } 137 | else { 138 | lcd.setCursor(12 , 1); 139 | lcd.write(5); // Display neutral symbol by default 140 | } 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /Pulse-Rate-Detector/pulse-rate-detector.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Pulse Rate Detector 3 | 4 | #include 5 | 6 | LiquidCrystal_I2C lcd(0x27, 16, 2); 7 | 8 | int pulsePin = A0; // Pulse Sensor purple wire connected to analog pin A0 9 | int blinkPin = 13; // pin to blink led at each beat 10 | 11 | // Volatile Variables, used in the interrupt service routine! 12 | volatile int BPM; // int that holds raw Analog in 0. updated every 2mS 13 | volatile int Signal; // holds the incoming raw data 14 | volatile int IBI = 600; // int that holds the time interval between beats! Must be seeded! 15 | volatile boolean Pulse = false; // "True" when User's live heartbeat is detected. "False" when not a "live beat". 16 | volatile boolean QS = false; // becomes true when Arduoino finds a beat. 17 | 18 | static boolean serialVisual = true; // Set to 'false' by Default. Re-set to 'true' to see Arduino Serial Monitor ASCII Visual Pulse 19 | 20 | volatile int rate[10]; // array to hold last ten IBI values 21 | volatile unsigned long sampleCounter = 0; // used to determine pulse timing 22 | volatile unsigned long lastBeatTime = 0; // used to find IBI 23 | volatile int P = 512; // used to find peak in pulse wave, seeded 24 | volatile int T = 512; // used to find trough in pulse wave, seeded 25 | volatile int thresh = 525; // used to find instant moment of heart beat, seeded 26 | volatile int amp = 100; // used to hold amplitude of pulse waveform, seeded 27 | volatile boolean firstBeat = true; // used to seed rate array so we startup with reasonable BPM 28 | volatile boolean secondBeat = false; // used to seed rate array so we startup with reasonable BPM 29 | 30 | void setup() 31 | { 32 | pinMode(blinkPin,OUTPUT); // pin that will blink to your heartbeat! 33 | Serial.begin(115200); // we agree to talk fast! 34 | interruptSetup(); // sets up to read Pulse Sensor signal every 2mS 35 | // IF YOU ARE POWERING The Pulse Sensor AT VOLTAGE LESS THAN THE BOARD VOLTAGE, 36 | // UN-COMMENT THE NEXT LINE AND APPLY THAT VOLTAGE TO THE A-REF PIN 37 | // analogReference(EXTERNAL); 38 | 39 | lcd.begin(); 40 | //lcd.print("Tech Trends"); 41 | 42 | lcd.clear(); 43 | } 44 | 45 | 46 | 47 | void loop() 48 | { 49 | serialOutput(); 50 | 51 | if (QS == true) // A Heartbeat Was Found 52 | { 53 | // BPM and IBI have been Determined 54 | // Quantified Self "QS" true when arduino finds a heartbeat 55 | serialOutputWhenBeatHappens(); // A Beat Happened, Output that to serial. 56 | QS = false; // reset the Quantified Self flag for next time 57 | } 58 | 59 | delay(20); // take a break 60 | } 61 | 62 | 63 | void interruptSetup() 64 | { 65 | // Initializes Timer2 to throw an interrupt every 2mS. 66 | TCCR2A = 0x02; // DISABLE PWM ON DIGITAL PINS 3 AND 11, AND GO INTO CTC MODE 67 | TCCR2B = 0x06; // DON'T FORCE COMPARE, 256 PRESCALER 68 | OCR2A = 0X7C; // SET THE TOP OF THE COUNT TO 124 FOR 500Hz SAMPLE RATE 69 | TIMSK2 = 0x02; // ENABLE INTERRUPT ON MATCH BETWEEN TIMER2 AND OCR2A 70 | sei(); // MAKE SURE GLOBAL INTERRUPTS ARE ENABLED 71 | } 72 | 73 | void serialOutput() 74 | { // Decide How To Output Serial. 75 | if (serialVisual == true) 76 | { 77 | arduinoSerialMonitorVisual('-', Signal); // goes to function that makes Serial Monitor Visualizer 78 | } 79 | else 80 | { 81 | sendDataToSerial('S', Signal); // goes to sendDataToSerial function 82 | } 83 | } 84 | 85 | void serialOutputWhenBeatHappens() 86 | { 87 | if (serialVisual == true) // Code to Make the Serial Monitor Visualizer Work 88 | { 89 | Serial.print(" Heart Beat Rate "); //ASCII Art Madness 90 | Serial.print("BPM: "); 91 | Serial.println(BPM); 92 | 93 | lcd.print("Heart Beat Rate "); 94 | lcd.setCursor(1,1); 95 | lcd.print("BPM: "); 96 | lcd.setCursor(5,1); 97 | lcd.print(BPM); 98 | delay(300); 99 | lcd.clear(); 100 | } 101 | else 102 | { 103 | sendDataToSerial('B',BPM); // send heart rate with a 'B' prefix 104 | sendDataToSerial('Q',IBI); // send time between beats with a 'Q' prefix 105 | } 106 | } 107 | 108 | void arduinoSerialMonitorVisual(char symbol, int data ) 109 | { 110 | const int sensorMin = 0; // sensor minimum, discovered through experiment 111 | const int sensorMax = 1024; // sensor maximum, discovered through experiment 112 | int sensorReading = data; // map the sensor range to a range of 12 options: 113 | int range = map(sensorReading, sensorMin, sensorMax, 0, 11); 114 | // do something different depending on the 115 | // range value: 116 | } 117 | 118 | 119 | void sendDataToSerial(char symbol, int data ) 120 | { 121 | Serial.print(symbol); 122 | Serial.println(data); 123 | } 124 | 125 | ISR(TIMER2_COMPA_vect) //triggered when Timer2 counts to 124 126 | { 127 | cli(); // disable interrupts while we do this 128 | Signal = analogRead(pulsePin); // read the Pulse Sensor 129 | sampleCounter += 2; // keep track of the time in mS with this variable 130 | int N = sampleCounter - lastBeatTime; // monitor the time since the last beat to avoid noise 131 | // find the peak and trough of the pulse wave 132 | if(Signal < thresh && N > (IBI/5)*3) // avoid dichrotic noise by waiting 3/5 of last IBI 133 | { 134 | if (Signal < T) // T is the trough 135 | { 136 | T = Signal; // keep track of lowest point in pulse wave 137 | } 138 | } 139 | 140 | if(Signal > thresh && Signal > P) 141 | { // thresh condition helps avoid noise 142 | P = Signal; // P is the peak 143 | } // keep track of highest point in pulse wave 144 | 145 | // NOW IT'S TIME TO LOOK FOR THE HEART BEAT 146 | // signal surges up in value every time there is a pulse 147 | if (N > 250) 148 | { // avoid high frequency noise 149 | if ( (Signal > thresh) && (Pulse == false) && (N > (IBI/5)*3) ) 150 | { 151 | Pulse = true; // set the Pulse flag when we think there is a pulse 152 | digitalWrite(blinkPin,HIGH); // turn on pin 13 LED 153 | IBI = sampleCounter - lastBeatTime; // measure time between beats in mS 154 | lastBeatTime = sampleCounter; // keep track of time for next pulse 155 | 156 | if(secondBeat) 157 | { // if this is the second beat, if secondBeat == TRUE 158 | secondBeat = false; // clear secondBeat flag 159 | for(int i=0; i<=9; i++) // seed the running total to get a realisitic BPM at startup 160 | { 161 | rate[i] = IBI; 162 | } 163 | } 164 | 165 | if(firstBeat) // if it's the first time we found a beat, if firstBeat == TRUE 166 | { 167 | firstBeat = false; // clear firstBeat flag 168 | secondBeat = true; // set the second beat flag 169 | sei(); // enable interrupts again 170 | return; // IBI value is unreliable so discard it 171 | } 172 | // keep a running total of the last 10 IBI values 173 | word runningTotal = 0; // clear the runningTotal variable 174 | 175 | for(int i=0; i<=8; i++) 176 | { // shift data in the rate array 177 | rate[i] = rate[i+1]; // and drop the oldest IBI value 178 | runningTotal += rate[i]; // add up the 9 oldest IBI values 179 | } 180 | 181 | rate[9] = IBI; // add the latest IBI to the rate array 182 | runningTotal += rate[9]; // add the latest IBI to runningTotal 183 | runningTotal /= 10; // average the last 10 IBI values 184 | BPM = 60000/runningTotal; // how many beats can fit into a minute? that's BPM! 185 | QS = true; // set Quantified Self flag 186 | // QS FLAG IS NOT CLEARED INSIDE THIS ISR 187 | } 188 | } 189 | 190 | if (Signal < thresh && Pulse == true) 191 | { // when the values are going down, the beat is over 192 | digitalWrite(blinkPin,LOW); // turn off pin 13 LED 193 | Pulse = false; // reset the Pulse flag so we can do it again 194 | amp = P - T; // get amplitude of the pulse wave 195 | thresh = amp/2 + T; // set thresh at 50% of the amplitude 196 | P = thresh; // reset these for next time 197 | T = thresh; 198 | } 199 | 200 | if (N > 2500) 201 | { // if 2.5 seconds go by without a beat 202 | thresh = 512; // set thresh default 203 | P = 512; // set P default 204 | T = 512; // set T default 205 | lastBeatTime = sampleCounter; // bring the lastBeatTime up to date 206 | firstBeat = true; // set these to avoid noise 207 | secondBeat = false; // when we get the heartbeat back 208 | } 209 | 210 | sei(); // enable interrupts when youre done! 211 | }// end isr 212 | -------------------------------------------------------------------------------- /RF-Transmitter-and-Receiver/RF-Receiver.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //RF Transmitter and Receiver 3 | 4 | //Below is the Receiver Program 5 | 6 | // Include RadioHead Amplitude Shift Keying Library 7 | #include 8 | // Include dependant SPI Library 9 | #include 10 | 11 | // Create Amplitude Shift Keying Object 12 | RH_ASK rf_driver; 13 | 14 | void setup() 15 | { 16 | // Initialize ASK Object 17 | rf_driver.init(); 18 | // Setup Serial Monitor 19 | Serial.begin(9600); 20 | } 21 | 22 | void loop() 23 | { 24 | // Set buffer to size of expected message 25 | uint8_t buf[24]; 26 | uint8_t buflen = sizeof(buf); 27 | // Check if received packet is correct size 28 | if (rf_driver.recv(buf, &buflen)) 29 | { 30 | 31 | // Message received with valid checksum 32 | Serial.print("Message Received: "); 33 | Serial.println((char*)buf); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /RF-Transmitter-and-Receiver/RF-Transmitter.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //RF Transmitter and Receiver 3 | 4 | //Below is the Transmitter Program 5 | 6 | // Include RadioHead Amplitude Shift Keying Library 7 | #include 8 | // Include dependant SPI Library 9 | #include 10 | 11 | // Create Amplitude Shift Keying Object 12 | RH_ASK rf_driver; 13 | 14 | void setup() 15 | { 16 | // Initialize ASK Object 17 | rf_driver.init(); 18 | } 19 | 20 | void loop() 21 | { 22 | const char *msg = "Welcome to Tech Trends "; 23 | rf_driver.send((uint8_t *)msg, strlen(msg)); 24 | rf_driver.waitPacketSent(); 25 | delay(1000); 26 | } 27 | -------------------------------------------------------------------------------- /RFID-Automatic-Door/rfid-automatic-door.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //RFID Automatic Door 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #define SS_PIN 10 9 | #define RST_PIN 9 10 | 11 | MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance. 12 | 13 | Servo tap_servo; 14 | 15 | //int sensor_pin = 4; 16 | int tap_servo_pin =5; 17 | int buzzer = 7; 18 | 19 | void setup() 20 | { 21 | //pinMode(sensor_pin,INPUT); 22 | pinMode(buzzer, OUTPUT); 23 | tap_servo.attach(tap_servo_pin); 24 | Serial.begin(9600); // Initiate a serial communication 25 | SPI.begin(); // Initiate SPI bus 26 | mfrc522.PCD_Init(); // Initiate MFRC522 27 | Serial.println("Place your RFID card to the reader..."); 28 | Serial.println(); 29 | 30 | 31 | } 32 | void loop() 33 | { 34 | // Look for new cards 35 | if ( ! mfrc522.PICC_IsNewCardPresent()) 36 | { 37 | return; 38 | } 39 | // Select one of the cards 40 | if ( ! mfrc522.PICC_ReadCardSerial()) 41 | { 42 | return; 43 | } 44 | //Show UID on serial monitor 45 | Serial.print("UID tag :"); 46 | String content= ""; 47 | byte letter; 48 | for (byte i = 0; i < mfrc522.uid.size; i++) 49 | { 50 | Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "); 51 | Serial.print(mfrc522.uid.uidByte[i], HEX); 52 | content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ")); 53 | content.concat(String(mfrc522.uid.uidByte[i], HEX)); 54 | } 55 | Serial.println(); 56 | Serial.print("Message : "); 57 | content.toUpperCase(); 58 | if (content.substring(1) == "2C 83 4C 4A") //Replace with your UID of the card/cards that you need to give access 59 | { 60 | Serial.println("Authorized access"); 61 | Serial.println(); 62 | 63 | tap_servo.write(0); 64 | delay(2000); 65 | tap_servo.write(180); 66 | delay(3000); 67 | } 68 | 69 | else { 70 | Serial.println(" Access denied"); 71 | digitalWrite(buzzer, HIGH); 72 | delay(3000); 73 | digitalWrite(buzzer, LOW); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /RFID-Integration-With-Arduino/RFID-integration-with-arduino.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //RFID Integratio with Ardino 3 | 4 | #include 5 | #include 6 | 7 | #define SS_PIN 10 8 | #define RST_PIN 9 9 | 10 | MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance. 11 | 12 | void setup() 13 | { 14 | Serial.begin(9600); // Initiate a serial communication 15 | SPI.begin(); // Initiate SPI bus 16 | mfrc522.PCD_Init(); // Initiate MFRC522 17 | Serial.println("Place your RFID card to the reader..."); 18 | Serial.println(); 19 | 20 | } 21 | void loop() 22 | { 23 | // Look for new cards 24 | if ( ! mfrc522.PICC_IsNewCardPresent()) 25 | { 26 | return; 27 | } 28 | // Select one of the cards 29 | if ( ! mfrc522.PICC_ReadCardSerial()) 30 | { 31 | return; 32 | } 33 | //Show UID on serial monitor 34 | Serial.print("UID tag :"); 35 | String content= ""; 36 | byte letter; 37 | for (byte i = 0; i < mfrc522.uid.size; i++) 38 | { 39 | Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "); 40 | Serial.print(mfrc522.uid.uidByte[i], HEX); 41 | content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ")); 42 | content.concat(String(mfrc522.uid.uidByte[i], HEX)); 43 | } 44 | Serial.println(); 45 | Serial.print("Message : "); 46 | content.toUpperCase(); 47 | if (content.substring(1) == "2C 83 4C 4A") //Replace with your UID of the card/cards that you need to give access 48 | { 49 | Serial.println("Authorized access"); 50 | Serial.println(); 51 | delay(3000); 52 | } 53 | 54 | else { 55 | Serial.println(" Access denied"); 56 | delay(3000); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /RFID-Security-System-with-LCD/RFID-security-system-with-LCD.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //RFID Security System with LCD 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | #define SS_PIN 10 10 | #define RST_PIN 9 11 | 12 | int buzzer = 5; 13 | 14 | MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance. 15 | 16 | LiquidCrystal_I2C lcd(0x27, 16, 2); 17 | void setup() 18 | { 19 | 20 | pinMode(buzzer, OUTPUT); 21 | Serial.begin(9600); // Initiate a serial communication 22 | SPI.begin(); // Initiate SPI bus 23 | mfrc522.PCD_Init(); // Initiate MFRC522 24 | Serial.println("Approximate your card to the reader..."); 25 | Serial.println(); 26 | lcd.begin(); 27 | 28 | 29 | lcd.backlight(); 30 | lcd.clear(); 31 | lcd.setCursor(3,0); 32 | lcd.print("Tech Trends"); 33 | lcd.setCursor(5,1); 34 | lcd.print("Shameer"); 35 | delay(3000); 36 | lcd.clear(); 37 | lcd.setCursor(1,0); 38 | lcd.print("RFID Security"); 39 | lcd.setCursor(5,1); 40 | lcd.print("System"); 41 | delay(3000); 42 | display(); 43 | } 44 | void loop() 45 | { 46 | // Look for new cards 47 | if ( ! mfrc522.PICC_IsNewCardPresent()) 48 | { 49 | return; 50 | } 51 | // Select one of the cards 52 | if ( ! mfrc522.PICC_ReadCardSerial()) 53 | { 54 | return; 55 | } 56 | //Show UID on serial monitor 57 | Serial.print("UID tag :"); 58 | String content= ""; 59 | byte letter; 60 | for (byte i = 0; i < mfrc522.uid.size; i++) 61 | { 62 | Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "); 63 | Serial.print(mfrc522.uid.uidByte[i], HEX); 64 | content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ")); 65 | content.concat(String(mfrc522.uid.uidByte[i], HEX)); 66 | } 67 | Serial.println(); 68 | Serial.print("Message : "); 69 | content.toUpperCase(); 70 | if (content.substring(1) == "2C 83 4C 4A") //Change the UID of the card/cards that you want to give access 71 | { 72 | Serial.println("Authorized access"); 73 | Serial.println(); 74 | 75 | lcd.clear(); 76 | lcd.print("Authorized Access"); 77 | delay(3000); 78 | lcd.clear(); 79 | display(); 80 | } 81 | 82 | else { 83 | Serial.println(" Access denied"); 84 | 85 | lcd.clear(); 86 | digitalWrite(buzzer, HIGH); 87 | lcd.print("Access denied"); 88 | 89 | delay(3000); 90 | lcd.clear(); 91 | digitalWrite(buzzer, LOW); 92 | display(); 93 | 94 | 95 | 96 | } 97 | } 98 | 99 | void display() 100 | { 101 | lcd.clear(); 102 | lcd.setCursor(1,0); 103 | lcd.print("Swipe the Card"); 104 | } 105 | -------------------------------------------------------------------------------- /RFID-Security-System/RFID-security-system-circuit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tech-Trends-Shameer/Arduino-Projects/fa8d0a6b0261c52e029f0719cd3e3789c64958a9/RFID-Security-System/RFID-security-system-circuit.png -------------------------------------------------------------------------------- /RFID-Security-System/RFID-security-system.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Security System with RFID 3 | 4 | #include 5 | #include 6 | 7 | #define SS_PIN 10 8 | #define RST_PIN 9 9 | int redLed = 7; 10 | int greenLed = 6; 11 | int buzzer = 5; 12 | 13 | MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance. 14 | 15 | void setup() 16 | { 17 | pinMode(redLed, OUTPUT); 18 | pinMode(greenLed, OUTPUT); 19 | pinMode(buzzer, OUTPUT); 20 | Serial.begin(9600); // Initiate a serial communication 21 | SPI.begin(); // Initiate SPI bus 22 | mfrc522.PCD_Init(); // Initiate MFRC522 23 | Serial.println("Approximate your card to the reader..."); 24 | Serial.println(); 25 | 26 | } 27 | void loop() 28 | { 29 | // Look for new cards 30 | if ( ! mfrc522.PICC_IsNewCardPresent()) 31 | { 32 | return; 33 | } 34 | // Select one of the cards 35 | if ( ! mfrc522.PICC_ReadCardSerial()) 36 | { 37 | return; 38 | } 39 | //Show UID on serial monitor 40 | Serial.print("UID tag :"); 41 | String content= ""; 42 | byte letter; 43 | for (byte i = 0; i < mfrc522.uid.size; i++) 44 | { 45 | Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "); 46 | Serial.print(mfrc522.uid.uidByte[i], HEX); 47 | content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ")); 48 | content.concat(String(mfrc522.uid.uidByte[i], HEX)); 49 | } 50 | Serial.println(); 51 | Serial.print("Message : "); 52 | content.toUpperCase(); 53 | if (content.substring(1) == "2C 83 4C 4A") //Change the UID of the card/cards that you want to give access 54 | { 55 | Serial.println("Authorized access"); 56 | Serial.println(); 57 | digitalWrite(greenLed, HIGH); 58 | 59 | digitalWrite(redLed, LOW); 60 | delay(3000); 61 | 62 | digitalWrite(greenLed, LOW); 63 | } 64 | 65 | else { 66 | Serial.println(" Access denied"); 67 | digitalWrite(redLed, HIGH); 68 | digitalWrite(buzzer, HIGH); 69 | digitalWrite(greenLed, LOW); 70 | delay(3000); 71 | digitalWrite(buzzer, LOW); 72 | digitalWrite(redLed, LOW); 73 | 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Rain-Alarm-System/rain-alarm-circuit.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tech-Trends-Shameer/Arduino-Projects/fa8d0a6b0261c52e029f0719cd3e3789c64958a9/Rain-Alarm-System/rain-alarm-circuit.jpg -------------------------------------------------------------------------------- /Rain-Alarm-System/rain-alarm-system.ino: -------------------------------------------------------------------------------- 1 | // Tech Trends Shameer 2 | // Rain Detection Alarm 3 | 4 | int rainsense= A0; // analog sensor input pin 0 5 | int buzzerout= 12; // digital output pin 12 in Arduino - buzzer output 6 | int countval= 0; // counter value starting from 0 and goes up by 1 every second 7 | int ledout= 10; // digital output pin 10 in Arduino- led output 8 | 9 | void setup(){ 10 | Serial.begin(9600); 11 | pinMode(buzzerout, OUTPUT); 12 | pinMode(ledout, OUTPUT); 13 | pinMode(rainsense, INPUT); 14 | } 15 | void loop(){ 16 | int rainSenseReading = analogRead(rainsense); 17 | Serial.println(rainSenseReading); // serial monitoring message 18 | delay(250);// rain sensing value from 0 to 1023. 19 | // from heavy rain - no rain. 20 | if (countval >= 35){ 21 | Serial.print("Heavy rain"); 22 | digitalWrite(buzzerout, HIGH); //raise an alert 23 | digitalWrite(ledout, HIGH); // glow LED 24 | } 25 | //If its raining for long time increase buzzer sound 26 | //If there is no rain then reset the counter value 27 | if (rainSenseReading <500){ 28 | countval++; // increment count value 29 | } 30 | else if (rainSenseReading >500) { // if there is no rain 31 | digitalWrite(buzzerout, LOW); // Turn OFF Buzzer 32 | digitalWrite(ledout, LOW); // Turn OFF led 33 | countval = 0; // reset count to 0 34 | } 35 | delay(1000); 36 | } 37 | -------------------------------------------------------------------------------- /Real-Time-Clock/real-time-clock.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Real Time Clock 3 | 4 | // Include the libraries 5 | #include "RTClib.h" 6 | #include 7 | 8 | // Define the connections pins 9 | #define CLK 2 10 | #define DIO 3 11 | 12 | // Create rtc and display object 13 | RTC_DS3231 rtc; 14 | TM1637Display display = TM1637Display(CLK, DIO); 15 | 16 | void setup() { 17 | // Begin serial communication 18 | Serial.begin(9600); 19 | 20 | // Check if RTC is connected correctly 21 | if (! rtc.begin()) { 22 | Serial.println("Couldn't find RTC"); 23 | while (1); 24 | } 25 | // Check if the RTC lost power and if so, set the time 26 | if (rtc.lostPower()) { 27 | Serial.println("RTC lost power, lets set the time!"); 28 | // The following line sets the RTC to the date & time this sketch was compiled: 29 | rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); 30 | // This line sets the RTC with an explicit date & time, for example to set 31 | // January 21, 2014 at 3am you would call: 32 | //rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0)); 33 | } 34 | 35 | // Set the display brightness (0-7) 36 | display.setBrightness(5); 37 | 38 | // Clear the display 39 | display.clear(); 40 | } 41 | 42 | void loop() { 43 | // Get current date and time 44 | DateTime now = rtc.now(); 45 | 46 | // Create time format to display 47 | int displaytime = (now.hour() * 100) + now.minute(); 48 | 49 | // Display the current time in 24 hour format with leading zeros and a center colon enabled 50 | display.showNumberDecEx(displaytime, 0b11100000, true); 51 | 52 | delay(1000); 53 | } 54 | -------------------------------------------------------------------------------- /Real-Time-Distance-Measurement-System-with-ToF-Sensor/real-time-distance-measurement-system-with-tof-sensor.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | // Initialize VL53L0X sensor 6 | Adafruit_VL53L0X lox = Adafruit_VL53L0X(); 7 | 8 | // Initialize LCD (I2C Address 0x27, 16 columns, 2 rows) 9 | LiquidCrystal_I2C lcd(0x27, 16, 2); 10 | 11 | void setup() { 12 | Serial.begin(115200); 13 | Wire.begin(); 14 | 15 | // Initialize LCD 16 | lcd.init(); 17 | lcd.backlight(); 18 | 19 | // Display Name 20 | lcd.setCursor(3, 0); 21 | lcd.print("Tech Trends"); 22 | lcd.setCursor(5, 1); 23 | lcd.print("Shameer"); 24 | delay(2000); 25 | 26 | // Display Title 27 | lcd.clear(); 28 | lcd.setCursor(0, 0); 29 | lcd.print("Distance"); 30 | lcd.setCursor(0, 1); 31 | lcd.print("Measurement"); 32 | delay(2000); 33 | 34 | // Initialize VL53L0X Sensor 35 | if (!lox.begin()) { 36 | Serial.println("Failed to initialize VL53L0X!"); 37 | lcd.clear(); 38 | lcd.setCursor(0, 0); 39 | lcd.print("VL53L0X Error!"); 40 | while (1); 41 | } 42 | 43 | Serial.println("VL53L0X Ready"); 44 | lcd.clear(); 45 | } 46 | 47 | void loop() { 48 | VL53L0X_RangingMeasurementData_t measure; 49 | 50 | // Perform distance measurement 51 | lox.rangingTest(&measure, false); 52 | 53 | lcd.setCursor(0, 0); 54 | lcd.print("Distance: "); 55 | 56 | if (measure.RangeStatus != 4) { 57 | Serial.print("Distance: "); 58 | Serial.print(measure.RangeMilliMeter); 59 | Serial.println(" mm"); 60 | 61 | lcd.setCursor(0, 1); 62 | lcd.print(measure.RangeMilliMeter); 63 | lcd.print(" mm "); 64 | delay(2000); 65 | } else { 66 | Serial.println("Out of range"); 67 | 68 | lcd.setCursor(0, 1); 69 | lcd.print("Out of range "); 70 | delay(3000); 71 | lcd.clear(); 72 | } 73 | 74 | delay(500); 75 | } 76 | -------------------------------------------------------------------------------- /Remote-Control-Home-Automation/remote-control-home-automation.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Remote Control Home Automation 3 | 4 | #include 5 | 6 | #define IR_RECEIVE_PIN 11 7 | 8 | int bulb1 = 3; 9 | int bulb2 = 5; 10 | int bulb3 = 7; 11 | int bulb4 = 9; 12 | int itsONled[] = {0, 0, 0, 0}; 13 | 14 | #define code1 0x758AFD01 // Code received from remote button no. 7 15 | #define code2 0x748BFD01 // Code received from remote button no. 8 16 | #define code3 0x3BC4FD01 // Code received from remote button no. 9 17 | #define code4 0x7887FD01 // Code received from remote button no. 0 18 | 19 | 20 | void setup() 21 | { 22 | Serial.begin(9600); 23 | Serial.println("Press the keys on the Remote"); 24 | IrReceiver.begin(IR_RECEIVE_PIN, DISABLE_LED_FEEDBACK); // Start the receiver without LED feedback 25 | pinMode(bulb1, OUTPUT); 26 | pinMode(bulb2, OUTPUT); 27 | pinMode(bulb3, OUTPUT); 28 | pinMode(bulb4, OUTPUT); 29 | } 30 | 31 | void loop() 32 | { 33 | if (IrReceiver.decode()) 34 | { 35 | uint32_t value = IrReceiver.decodedIRData.decodedRawData; 36 | 37 | switch (value) 38 | { 39 | case code1: 40 | if (itsONled[1] == 1) 41 | { // if first led is on then 42 | digitalWrite(bulb1, LOW); // Turn the LED off when the button is pressed 43 | itsONled[1] = 0; // and set its state as off 44 | } 45 | else 46 | { // else if first led is off 47 | digitalWrite(bulb1, HIGH); // Turn the LED ON when the button is pressed 48 | itsONled[1] = 1; // and set its state as on 49 | } 50 | break; 51 | case code2: 52 | if (itsONled[2] == 1) 53 | { 54 | digitalWrite(bulb2, LOW); 55 | itsONled[2] = 0; 56 | } 57 | else 58 | { 59 | digitalWrite(bulb2, HIGH); 60 | itsONled[2] = 1; 61 | } 62 | break; 63 | case code3: 64 | if (itsONled[3] == 1) 65 | { 66 | digitalWrite(bulb3, LOW); 67 | itsONled[3] = 0; 68 | } 69 | else 70 | { 71 | digitalWrite(bulb3, HIGH); 72 | itsONled[3] = 1; 73 | } 74 | break; 75 | case code4: 76 | if (itsONled[4] == 1) 77 | { 78 | digitalWrite(bulb4, LOW); 79 | itsONled[4] = 0; 80 | } 81 | else 82 | { 83 | digitalWrite(bulb4, HIGH); 84 | itsONled[4] = 1; 85 | } 86 | break; 87 | } 88 | 89 | Serial.println(value, HEX); // Print the value in Serial Monitor 90 | IrReceiver.resume(); // Receive the next value 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /Remote-Control-LED/remote-control-LED-circuit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tech-Trends-Shameer/Arduino-Projects/fa8d0a6b0261c52e029f0719cd3e3789c64958a9/Remote-Control-LED/remote-control-LED-circuit.png -------------------------------------------------------------------------------- /Remote-Control-LED/remote-control-led.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Remote Control LED 3 | 4 | #include 5 | 6 | int RECV_PIN = 11; // the pin where you connect the output pin of sensor 7 | int led1 = 3; 8 | int led2 = 5; 9 | int led3 = 7; 10 | int itsONled[] = {0,0,0,0}; 11 | 12 | #define code1 29070 // Code received from remote button no. 4 13 | #define code2 61710 // Code received from remote button no. 5 14 | #define code3 5100 // Code received from remote button no. 6 15 | 16 | IRrecv irrecv(RECV_PIN); 17 | 18 | decode_results results; 19 | 20 | void setup() 21 | { 22 | Serial.begin(9600); 23 | Serial.println("Press the keys in Remote"); 24 | irrecv.enableIRIn(); // Start the receiver 25 | pinMode(led1, OUTPUT); 26 | pinMode(led2, OUTPUT); 27 | pinMode(led3, OUTPUT); 28 | } 29 | 30 | void loop() { 31 | if (irrecv.decode(&results)) 32 | { 33 | unsigned int value = results.value; 34 | switch(value) 35 | { 36 | case code1: 37 | if(itsONled[1] == 1) 38 | { // if first led is on then 39 | digitalWrite(led1, LOW); // Turn the LED off when button is pressed 40 | itsONled[1] = 0; // and set its state as off 41 | } 42 | else 43 | { // else if first led is off 44 | digitalWrite(led1, HIGH); // Turn the LED ON when the button is pressed 45 | itsONled[1] = 1; // and set its state as on 46 | } 47 | break; 48 | case code2: 49 | if(itsONled[2] == 1) 50 | { 51 | digitalWrite(led2, LOW); 52 | itsONled[2] = 0; 53 | } 54 | else 55 | { 56 | digitalWrite(led2, HIGH); 57 | itsONled[2] = 1; 58 | } 59 | break; 60 | case code3: 61 | if(itsONled[3] == 1) 62 | { 63 | digitalWrite(led3, LOW); 64 | itsONled[3] = 0; 65 | } 66 | else 67 | { 68 | digitalWrite(led3, HIGH); 69 | itsONled[3] = 1; 70 | } 71 | break; 72 | } 73 | Serial.println(value); // Print the value in Serial Monitor 74 | irrecv.resume(); // Receive the next value 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /Smart-Blind-Shoe/smart-blnd-shoe.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Snart Blind Show 3 | 4 | // Define pins numbers 5 | const int trigPin = 13; //Connect Trig pin in Ultrasonic Sensor to Arduino Pin 13 6 | const int echoPin = 12; //Connect Echo pin in Ultrasonic Sensor to Arduino Pin 13 7 | const int buzzer = 11; //Connect Positive pin of Buzzer to Arduino Pin 11 8 | 9 | // Define variables 10 | long duration; 11 | int distance; 12 | int safetyDistance; 13 | 14 | 15 | void setup() { 16 | pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output 17 | pinMode(echoPin, INPUT); // Sets the echoPin as an Input 18 | pinMode(buzzer, OUTPUT); 19 | Serial.begin(9600); // Starts the serial communication 20 | } 21 | 22 | 23 | void loop() { 24 | // Clears the trigPin 25 | digitalWrite(trigPin, LOW); 26 | delayMicroseconds(2); 27 | 28 | // Sets the trigPin on HIGH state for 15 micro seconds 29 | digitalWrite(trigPin, HIGH); 30 | delayMicroseconds(15); 31 | digitalWrite(trigPin, LOW); 32 | 33 | // Reads the echoPin, returns the sound wave travel time in microseconds 34 | duration = pulseIn(echoPin, HIGH); 35 | 36 | // Calculate the distance 37 | distance= duration*0.034/2; 38 | 39 | safetyDistance = distance; 40 | if (safetyDistance <= 8){ 41 | digitalWrite(buzzer, HIGH); 42 | } 43 | else{ 44 | digitalWrite(buzzer, LOW); 45 | } 46 | 47 | // Print the distance on the Serial Monitor 48 | Serial.print("Distance: "); 49 | Serial.println(distance); 50 | } 51 | -------------------------------------------------------------------------------- /Smart-Breath-Analyzer/smart-breath-analyzer: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Smart Breath Analyzer 3 | 4 | #define sensorPin 2 5 | #define LED 3 6 | #define buzzer 4 7 | 8 | void setup() { 9 | pinMode(sensorPin, INPUT); 10 | pinMode(LED, OUTPUT); 11 | pinMode(buzzer, OUTPUT); 12 | Serial.begin(9600); 13 | } 14 | void loop() { 15 | bool sensorvalue = digitalRead(sensorPin); 16 | Serial.print("Alcohol value :"); 17 | Serial.println(sensorvalue); 18 | 19 | if (sensorvalue == 0) { 20 | digitalWrite(LED, HIGH); 21 | digitalWrite(buzzer, HIGH); 22 | } else { 23 | digitalWrite(LED, LOW); 24 | digitalWrite(buzzer, LOW); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Smart-Irrigation-System/smart-irrigation-system-circuit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tech-Trends-Shameer/Arduino-Projects/fa8d0a6b0261c52e029f0719cd3e3789c64958a9/Smart-Irrigation-System/smart-irrigation-system-circuit.png -------------------------------------------------------------------------------- /Smart-Irrigation-System/smart-irrigation-using-arduino-uno.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Smart Irrigation System 3 | 4 | int sensor_pin= A0; 5 | int output_value; 6 | 7 | void setup(){ 8 | pinMode(3, OUTPUT); 9 | Serial.begin(9600); 10 | Serial.println("Reading from the Moisture sensor…"); 11 | delay(2000); 12 | } 13 | 14 | void loop() 15 | { 16 | output_value= analogRead (sensor_pin); 17 | output_value= map (output_value,550,10,0,100); 18 | Serial.print("Moisture:"); 19 | Serial.print(output_value); 20 | Serial.println("%"); 21 | 22 | if (output_value<0) 23 | { 24 | delay(1000); 25 | digitalWrite(3, HIGH); 26 | } 27 | 28 | else 29 | { 30 | delay(1000); 31 | digitalWrite (3,LOW); 32 | } 33 | 34 | delay (1000); 35 | } 36 | -------------------------------------------------------------------------------- /Smart-Notice-Board/smart-notice-board.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends 2 | //Web Controlled Smart Notice Board 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | LiquidCrystal_I2C lcd(0x27, 16, 2); 11 | 12 | 13 | AsyncWebServer server(80); 14 | 15 | const char* ssid = "WiFi Username"; //wifi ssid 16 | const char* password = "WiFi Password"; //wifi password 17 | 18 | const char* PARAM_INPUT_1 = "input1"; 19 | 20 | const char index_html[] PROGMEM = R"rawliteral( 21 | 22 | Smart Notice Board 23 | 24 |

Web Controlled Smart Notice Board

25 |
26 |
27 | Enter the Text to Display: 28 | 29 |

30 | 31 |
)rawliteral"; 32 | 33 | void notFound(AsyncWebServerRequest *request) { 34 | request->send(404, "text/plain", "Not found"); 35 | } 36 | 37 | void setup() 38 | { 39 | Serial.begin(115200); 40 | Wire.begin(); 41 | lcd.begin(); 42 | lcd.backlight(); 43 | lcd.clear(); 44 | lcd.setCursor(4,0); 45 | lcd.print("Tech Trends "); 46 | 47 | 48 | WiFi.mode(WIFI_STA); 49 | WiFi.begin(ssid, password); 50 | if (WiFi.waitForConnectResult() != WL_CONNECTED) { 51 | Serial.println("WiFi Failed!"); 52 | return; 53 | } 54 | Serial.println(); 55 | Serial.print("IP Address: "); 56 | Serial.println(WiFi.localIP()); 57 | 58 | server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){ 59 | request->send_P(200, "text/html", index_html); 60 | }); 61 | 62 | server.on("/get", HTTP_GET, [] (AsyncWebServerRequest *request) { 63 | String message; 64 | String inputParam; 65 | if (request->hasParam(PARAM_INPUT_1)) { 66 | message = request->getParam(PARAM_INPUT_1)->value(); 67 | inputParam = PARAM_INPUT_1; 68 | lcd.clear(); 69 | lcd.setCursor(0,0); 70 | 71 | lcd.print(message); 72 | } 73 | else { 74 | message = "No message sent"; 75 | inputParam = "none"; 76 | } 77 | Serial.println(message); 78 | 79 | request->send(200, "text/html", index_html); 80 | }); 81 | server.onNotFound(notFound); 82 | server.begin(); 83 | } 84 | 85 | void loop() 86 | { 87 | for (int positionCounter = 0; positionCounter < 29; positionCounter++) { 88 | lcd.scrollDisplayLeft(); 89 | delay(500); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /Smart-Street-Lighting-System/smart-street-lighting-system.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Smart Street Lighting System 3 | 4 | const int sensorPin = A0; // Connect TEMP600 to analog pin A0 5 | const int relayPins[] = {2, 3, 4, 5}; // Connect relays or transistors to digital pins D2, D3, D4, D5 6 | const int numRelays = 4; // Number of bulbs 7 | 8 | void setup() { 9 | Serial.begin(115200); 10 | pinMode(sensorPin, INPUT); 11 | 12 | // Set relay pins as OUTPUT 13 | for (int i = 0; i < numRelays; i++) { 14 | pinMode(relayPins[i], OUTPUT); 15 | } 16 | } 17 | 18 | void loop() { 19 | int lightIntensity = analogRead(sensorPin); 20 | 21 | // Adjust the threshold value based on your environment 22 | int threshold = 500; 23 | Serial.print("Light Intensity: "); 24 | Serial.println(lightIntensity); 25 | 26 | if (lightIntensity < 150) { 27 | // Turn on all the bulbs with a delay 28 | for (int i = 0; i < numRelays; i++) { 29 | digitalWrite(relayPins[i], HIGH); 30 | delay(1000); // Adjust the delay based on your needs 31 | 32 | } 33 | 34 | // Turn off all the bulbs 35 | /* for (int i = 0; i < numRelays; i++) { 36 | digitalWrite(relayPins[i], LOW); 37 | }*/ 38 | } else { 39 | // Ensure all bulbs are off if the light intensity is sufficient 40 | for (int i = 0; i < numRelays; i++) { 41 | digitalWrite(relayPins[i], LOW); 42 | delay(1000); // Adjust the delay based on your needs 43 | } 44 | } 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /Soil-Moisture-Measurement/soil-moisture-measurement-circuit.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tech-Trends-Shameer/Arduino-Projects/fa8d0a6b0261c52e029f0719cd3e3789c64958a9/Soil-Moisture-Measurement/soil-moisture-measurement-circuit.jpg -------------------------------------------------------------------------------- /Soil-Moisture-Measurement/soil-moisture-measurement.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Soil Moisture Measurement 3 | 4 | #include 5 | 6 | //Assign the Arduino Pin to the LCD Pin 7 | const int rs = 4, e = 5, d4 = 6, d5 = 7, d6 = 8, d7 = 9; 8 | LiquidCrystal lcd(rs, e, d4, d5, d6, d7); 9 | int sensoroutput = A0; 10 | int sensorvalue=0; 11 | int prev=0; 12 | int pres=0; 13 | void setup() 14 | { 15 | // Initialize the LCD 16 | lcd.begin(16, 2); //Tell Arduino to start your 16 column 2 row LCD 17 | lcd.setCursor(0,0); //Set cursor to first column of first row 18 | lcd.print(" Soil Moisture "); //Print the text Soil Moisture in row 1 19 | Serial.begin(9600); 20 | } 21 | 22 | void loop() 23 | { 24 | sensorvalue=analogRead(sensoroutput); 25 | sensorvalue=map(sensorvalue,0,982,148,0); 26 | pres=sensorvalue; 27 | if(sensorvalue>100) 28 | sensorvalue=100; 29 | else if(sensorvalue<0) 30 | sensorvalue=0; 31 | lcd.setCursor(6,1); //Set cursor to sixth column of second row 32 | lcd.print(sensorvalue); 33 | lcd.print("% "); 34 | Serial.println(sensorvalue); 35 | prev=sensorvalue; 36 | delay(500); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /Temperature-Display-in-OLED-Display/temperature-display-in-oled-display.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Temperature and Humidity Display in OLED 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "DHT.h" 9 | 10 | 11 | #define SCREEN_WIDTH 128 // OLED display width, in pixels 12 | #define SCREEN_HEIGHT 64 // OLED display height, in pixels 13 | 14 | #define OLED_RESET 4 15 | //Adafruit_SH1106 display(OLED_RESET); 16 | Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT); 17 | #define DHTPIN 2 // Digital pin connected to the DHT sensor 18 | 19 | #define BLUE 0x001F 20 | 21 | // Uncomment the type of sensor in use: 22 | #define DHTTYPE DHT11 // DHT 11 23 | //#define DHTTYPE DHT22 // DHT 22 (AM2302) 24 | //#define DHTTYPE DHT21 // DHT 21 (AM2301) 25 | 26 | DHT dht(DHTPIN, DHTTYPE); 27 | 28 | void setup() { 29 | Serial.begin(115200); 30 | dht.begin(); 31 | // display.begin(SH1106_SWITCHCAPVCC, 0x3C); 32 | display.begin(SSD1306_SWITCHCAPVCC, 0x3C); 33 | delay(2000); 34 | display.clearDisplay(); 35 | display.setTextColor(SSD1306_WHITE); 36 | // display.setTextColor(BLUE); 37 | } 38 | 39 | void loop() { 40 | delay(2000); 41 | 42 | //read temperature and humidity 43 | float t = dht.readTemperature(); 44 | float h = dht.readHumidity(); 45 | if (isnan(h) || isnan(t)) { 46 | Serial.println("Failed to read from DHT sensor!"); 47 | } 48 | Serial.println(t); 49 | Serial.println(h); 50 | //clear display 51 | display.clearDisplay(); 52 | 53 | // display temperature 54 | display.setTextSize(1); 55 | display.setCursor(0,7); 56 | //display.setTextColor(BLUE); 57 | display.print("Temperature: "); 58 | display.setTextSize(2); 59 | display.setCursor(0,16); 60 | display.print(t); 61 | display.print(" "); 62 | display.setTextSize(1); 63 | display.cp437(true); 64 | display.write(167); 65 | display.setTextSize(2); 66 | display.print("C"); 67 | 68 | // display humidity 69 | display.setTextSize(1); 70 | display.setCursor(0, 37); 71 | display.print("Humidity: "); 72 | display.setTextSize(2); 73 | display.setCursor(0, 50); 74 | display.print(h); 75 | display.print(" %"); 76 | 77 | display.display(); 78 | } 79 | -------------------------------------------------------------------------------- /Temperature-Display-in-Seven-Segment-Display/temperature-display-in-seven-segment-display.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Display Temperature in Seven Segment Display 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | // Define the connections pins 9 | #define CLK 2 10 | #define DIO 3 11 | #define DHTPIN 6 12 | 13 | // Create variable 14 | int temperature_celsius; 15 | int temperature_fahrenheit; 16 | 17 | // Create °C symbol 18 | const uint8_t celsius[] = { 19 | SEG_A | SEG_B | SEG_F | SEG_G, // Circle 20 | SEG_A | SEG_D | SEG_E | SEG_F // C 21 | }; 22 | 23 | // Create °F symbol 24 | const uint8_t fahrenheit[] = { 25 | SEG_A | SEG_B | SEG_F | SEG_G, // Circle 26 | SEG_A | SEG_E | SEG_F | SEG_G // F 27 | }; 28 | 29 | #define DHTTYPE DHT11 // DHT 11 30 | //#define DHTTYPE DHT11 // DHT 22 (AM2302) 31 | 32 | // Create display object of type TM1637Display 33 | TM1637Display display = TM1637Display(CLK, DIO); 34 | 35 | // Create dht object of type DHT: 36 | DHT dht = DHT(DHTPIN, DHTTYPE); 37 | 38 | void setup() { 39 | 40 | Serial.begin(9600); 41 | // Set the display brightness (0-7) 42 | display.setBrightness(5); 43 | 44 | // Clear the display 45 | display.clear(); 46 | 47 | // Setup sensor 48 | dht.begin(); 49 | } 50 | 51 | void loop() { 52 | // Read the temperature as Celsius and Fahrenheit 53 | temperature_celsius = dht.readTemperature(); 54 | temperature_fahrenheit = dht.readTemperature(true); 55 | Serial.print(temperature_celsius); 56 | Serial.print(temperature_fahrenheit); 57 | // Display the temperature in celsius format 58 | display.showNumberDec(temperature_celsius, false, 2, 0); 59 | display.setSegments(celsius, 2, 2); 60 | delay(1000); 61 | 62 | // Display the temperature in fahrenheit format 63 | display.showNumberDec(temperature_fahrenheit, false, 2, 0); 64 | display.setSegments(fahrenheit, 2, 2); 65 | delay(1000); 66 | } 67 | -------------------------------------------------------------------------------- /Temperature-Monitor-Using-DS18B20-Temperature-Sensor/temperature-monitor-using-DS18B20-temperature-sensor.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Temperature-Monitor-Using-DS18B20-Temperature-Sensor 3 | 4 | #include 5 | #include 6 | #include 7 | #define DS18B20 4 8 | 9 | OneWire ourWire(DS18B20); 10 | DallasTemperature sensor(&ourWire); 11 | LiquidCrystal_I2C lcd(0x27, 16, 2); 12 | byte degree_symbol[8] = 13 | { 14 | 0b00111, 15 | 0b00101, 16 | 0b00111, 17 | 0b00000, 18 | 0b00000, 19 | 0b00000, 20 | 0b00000, 21 | 0b00000 22 | }; 23 | void setup() 24 | { 25 | Serial.begin(9600); 26 | delay(1000); 27 | sensor.begin(); 28 | lcd.begin(); 29 | lcd.createChar(1, degree_symbol); 30 | lcd.clear(); 31 | lcd.setCursor(3,0); 32 | lcd.print("Tech Trends"); 33 | lcd.setCursor(5,1); 34 | lcd.print("Shameer"); 35 | delay(3000); 36 | lcd.clear(); 37 | lcd.setCursor(2,0); 38 | lcd.print("Temp Monitor"); 39 | lcd.setCursor(1,1); 40 | lcd.print("Using DS18B20"); 41 | delay(3000); 42 | lcd.clear(); 43 | lcd.setCursor(0,0); 44 | lcd.print("Temp: "); 45 | } 46 | 47 | void loop() 48 | { 49 | sensor.requestTemperatures(); 50 | Serial.print("Celsius temperature: "); 51 | Serial.print(sensor.getTempCByIndex(0)); 52 | Serial.println("°C"); 53 | Serial.print("Fahrenheit temperature: "); 54 | Serial.println(sensor.getTempFByIndex(0)); 55 | lcd.setCursor(7,0); 56 | lcd.print(sensor.getTempCByIndex(0)); 57 | lcd.write(1); 58 | lcd.print("C"); 59 | lcd.setCursor(7,1); 60 | lcd.print(sensor.getTempFByIndex(0)); 61 | lcd.write(1); 62 | lcd.print("F"); 63 | delay(1000); 64 | } 65 | -------------------------------------------------------------------------------- /Temperature-Pressure-Altitude-Data-Logger-in-SD-Card/temperature-pressure-altitude-data-logger-in-SD-Card.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Temperature, Pressure, Altitude Data Log into SD Card 3 | 4 | #include // Include SPI library (needed for the SD card) 5 | #include // Include SD library 6 | //#include // Include DHT sensor library 7 | #include 8 | 9 | File dataFile; 10 | 11 | 12 | #define BMP_SCK (13) 13 | #define BMP_MISO (12) 14 | #define BMP_MOSI (11) 15 | #define BMP_CS (10) 16 | 17 | Adafruit_BMP280 bmp; // I2C 18 | 19 | byte degree_symbol[8] = 20 | { 21 | 0b00111, 22 | 0b00101, 23 | 0b00111, 24 | 0b00000, 25 | 0b00000, 26 | 0b00000, 27 | 0b00000, 28 | 0b00000 29 | }; 30 | 31 | void setup() { 32 | // Open serial communications and wait for port to open: 33 | Serial.begin(9600); 34 | while (!Serial) 35 | ; // wait for serial port to connect. Needed for native USB port only 36 | Serial.print("Initializing SD card..."); 37 | if (!SD.begin()) 38 | { 39 | Serial.println("initialization failed!"); 40 | while (1); 41 | } 42 | Serial.println("initialization done."); 43 | 44 | Serial.println(F("BMP280 test")); 45 | 46 | if (!bmp.begin(0x76)) { 47 | Serial.println(F("Could not find a valid BMP280 sensor, check wiring!")); 48 | while (1); 49 | } 50 | 51 | /* Default settings from datasheet. */ 52 | bmp.setSampling(Adafruit_BMP280::MODE_NORMAL, /* Operating Mode. */ 53 | Adafruit_BMP280::SAMPLING_X2, /* Temp. oversampling */ 54 | Adafruit_BMP280::SAMPLING_X16, /* Pressure oversampling */ 55 | Adafruit_BMP280::FILTER_X16, /* Filtering. */ 56 | Adafruit_BMP280::STANDBY_MS_500); /* Standby time. */ 57 | 58 | delay(2000); 59 | //dht.begin(); 60 | } 61 | 62 | uint16_t line = 1; 63 | 64 | void loop() { 65 | delay(1000); 66 | // Read humidity 67 | //byte RH = dht.readHumidity(); 68 | //Read temperature in degree Celsius 69 | //byte Temp = dht.readTemperature(); 70 | 71 | float temp = bmp.readTemperature(); 72 | float pressure = bmp.readPressure(); 73 | float alt = bmp.readAltitude(1013.25); 74 | 75 | dataFile = SD.open("BMP280.txt", FILE_WRITE); 76 | 77 | // if the file opened okay, write to it: 78 | if (dataFile) 79 | { 80 | Serial.print(line); 81 | Serial.print(": Temperature = "); 82 | Serial.print(temp); 83 | Serial.print("°C, Pressure = "); 84 | Serial.print(pressure); 85 | Serial.println("%, Altitude = "); 86 | Serial.print(alt); 87 | Serial.println("m"); 88 | // Write data to SD card file (DHT11Log.txt) 89 | dataFile.print(line++); 90 | dataFile.print(": Temperature = "); 91 | dataFile.print(temp); 92 | dataFile.print("°C, Pressure = "); 93 | dataFile.print(pressure); 94 | dataFile.print("%, Altitude ="); 95 | dataFile.print(alt); 96 | dataFile.println("m"); 97 | dataFile.close(); 98 | 99 | } 100 | // if the file didn't open, print an error: 101 | else 102 | Serial.println("error opening BMP280.txt"); 103 | } 104 | -------------------------------------------------------------------------------- /Temperature-Pressure-Altitude-Display-in-LCD/temperature-pressure-altitude-display-in-LCD.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Display Temperature, Pressure & Altitude in LCD 3 | 4 | /* 5 | * 6 | *************************************************************************** 7 | This is a library for the BMP280 humidity, temperature & pressure sensor 8 | Get library from: https://github.com/adafruit/Adafruit_BMP280_Library 9 | This code has been downloaded from Robojax.com 10 | Watch video instruction of this code: https://youtu.be/InNHrtnZgUQ 11 | Video Recorded Jane 22, 2019 in Ajax, Ontario Canada 12 | by Ahmad Shamshiri 13 | 14 | Designed specifically to work with the Adafruit BMEP280 Breakout 15 | ----> http://www.adafruit.com/products/2651 16 | 17 | These sensors use I2C or SPI to communicate, 2 or 4 pins are required 18 | to interface. 19 | 20 | Adafruit invests time and resources providing this open source code, 21 | please support Adafruit andopen-source hardware by purchasing products 22 | from Adafruit! 23 | 24 | Written by Limor Fried & Kevin Townsend for Adafruit Industries. 25 | BSD license, all text above must be included in any redistribution 26 | ************************************************************************** 27 | */ 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #define BMP_SCK (13) 35 | #define BMP_MISO (12) 36 | #define BMP_MOSI (11) 37 | #define BMP_CS (10) 38 | 39 | Adafruit_BMP280 bmp; // I2C 40 | //Adafruit_BMP280 bmp(BMP_CS); // hardware SPI 41 | //Adafruit_BMP280 bmp(BMP_CS, BMP_MOSI, BMP_MISO, BMP_SCK); 42 | 43 | 44 | LiquidCrystal_I2C lcd(0x27, 16, 2); 45 | byte degree_symbol[8] = 46 | { 47 | 0b00111, 48 | 0b00101, 49 | 0b00111, 50 | 0b00000, 51 | 0b00000, 52 | 0b00000, 53 | 0b00000, 54 | 0b00000 55 | }; 56 | void setup() { 57 | Serial.begin(9600); 58 | Serial.println(F("BMP280 test")); 59 | 60 | if (!bmp.begin(0x76)) { 61 | Serial.println(F("Could not find a valid BMP280 sensor, check wiring!")); 62 | while (1); 63 | } 64 | 65 | /* Default settings from datasheet. */ 66 | bmp.setSampling(Adafruit_BMP280::MODE_NORMAL, /* Operating Mode. */ 67 | Adafruit_BMP280::SAMPLING_X2, /* Temp. oversampling */ 68 | Adafruit_BMP280::SAMPLING_X16, /* Pressure oversampling */ 69 | Adafruit_BMP280::FILTER_X16, /* Filtering. */ 70 | Adafruit_BMP280::STANDBY_MS_500); /* Standby time. */ 71 | 72 | 73 | 74 | lcd.begin(); 75 | lcd.backlight(); 76 | lcd.clear(); 77 | lcd.setCursor(3,0); 78 | lcd.print("Tech Trends"); 79 | lcd.setCursor(5,1); 80 | lcd.print("Shameer"); 81 | delay(5000); 82 | lcd.clear(); 83 | } 84 | 85 | void loop() { 86 | 87 | float temp = bmp.readTemperature(); 88 | float pressure = bmp.readPressure(); 89 | float alt = bmp.readAltitude(1013.25); 90 | Serial.print(F("Temperature = ")); 91 | Serial.print(temp); 92 | Serial.println(" *C"); 93 | 94 | Serial.print(F("Pressure = ")); 95 | Serial.print(pressure); 96 | Serial.println(" Pa"); 97 | 98 | Serial.print(F("Approx altitude = ")); 99 | Serial.print(alt); /* Adjusted to local forecast! */ 100 | Serial.println(" m"); 101 | 102 | 103 | 104 | Serial.println(); 105 | // delay(2000); 106 | 107 | lcd.setCursor(0,0); 108 | lcd.print("Temperature "); 109 | lcd.setCursor(0,1); 110 | lcd.print(temp); 111 | lcd.setCursor(6,1); 112 | lcd.write(1); 113 | lcd.createChar(1, degree_symbol); 114 | lcd.setCursor(7,1); 115 | lcd.print("C"); 116 | delay(8000); 117 | lcd.clear(); 118 | lcd.setCursor(0, 0); 119 | lcd.print("Pressure "); 120 | lcd.setCursor(0,1); 121 | lcd.print(pressure); 122 | lcd.print(" pa"); 123 | delay(8000); 124 | lcd.clear(); 125 | lcd.setCursor(0, 0); 126 | lcd.print("Altitude "); 127 | lcd.setCursor(0,1); 128 | lcd.print(alt); 129 | lcd.print(" m"); 130 | delay(8000); 131 | lcd.clear(); 132 | 133 | 134 | } 135 | -------------------------------------------------------------------------------- /Temperature-and-Humidity-Monitor/temperature-and-humidity-monitor.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | 3 | #include 4 | #include 5 | #include 6 | byte degree_symbol[8] = 7 | { 8 | 0b00111, 9 | 0b00101, 10 | 0b00111, 11 | 0b00000, 12 | 0b00000, 13 | 0b00000, 14 | 0b00000, 15 | 0b00000 16 | }; 17 | 18 | int pinDHT11 = 6; 19 | SimpleDHT11 dht11(pinDHT11); 20 | LiquidCrystal_I2C lcd(0x27, 16, 2); 21 | 22 | void setup() { 23 | Serial.begin(115200); 24 | } 25 | 26 | void loop() { 27 | // start working... 28 | Serial.println("================================="); 29 | Serial.println("Sample DHT11..."); 30 | 31 | // read without samples. 32 | byte temperature = 0; 33 | byte humidity = 0; 34 | int err = SimpleDHTErrSuccess; 35 | if ((err = dht11.read(&temperature, &humidity, NULL)) != SimpleDHTErrSuccess) 36 | { 37 | Serial.print("Read DHT11 failed, err="); 38 | Serial.println(err); 39 | delay(1000); 40 | return; 41 | } 42 | 43 | 44 | lcd.begin(); 45 | 46 | // Turn on the blacklight and print a message. 47 | lcd.backlight(); 48 | /* lcd.setCursor(0,0); 49 | lcd.print("Temperature &"); 50 | lcd.setCursor(0,1); 51 | lcd.print("Humidity Monitor"); 52 | delay(2000); 53 | lcd.clear();*/ 54 | lcd.setCursor(0,0); 55 | lcd.print("Temperature "); 56 | lcd.print((int)temperature); 57 | lcd.setCursor(0, 1); 58 | lcd.print("Humidity "); 59 | lcd.print((int)humidity); 60 | lcd.setCursor(14,0); 61 | lcd.write(1); 62 | lcd.createChar(1, degree_symbol); 63 | lcd.setCursor(15,0); 64 | lcd.print("C"); 65 | lcd.setCursor(14,1); 66 | lcd.print("%"); 67 | delay(1000); 68 | } 69 | -------------------------------------------------------------------------------- /Temperature-and-Humidity-Monitor/temperature-and-humidity-monitor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tech-Trends-Shameer/Arduino-Projects/fa8d0a6b0261c52e029f0719cd3e3789c64958a9/Temperature-and-Humidity-Monitor/temperature-and-humidity-monitor.png -------------------------------------------------------------------------------- /Touch-Control-Electric-Bulb/touch-control-electric-bulb.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Touch Control Bulb 3 | 4 | int LD = 200; 5 | 6 | void setup() { 7 | Serial.begin(9600); 8 | // out pins 9 | pinMode(10, OUTPUT);// LED for button 1 10 | 11 | // input pins 12 | pinMode(2, INPUT);// Button 1 input pin 2 13 | 14 | Serial.println("Robojax Test: TTP223B touch"); 15 | } 16 | 17 | void loop() { 18 | // button 1 action 19 | if(digitalRead(2)){ 20 | Serial.println("Button Touched "); 21 | digitalWrite(10, LOW); // Turn the LED ON 22 | delay(LD); 23 | }else{ 24 | digitalWrite(10, HIGH);// Turn OFF the LED 25 | } 26 | 27 | } 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /Traffic-Light-Controller/traffic-light-control-circuit.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tech-Trends-Shameer/Arduino-Projects/fa8d0a6b0261c52e029f0719cd3e3789c64958a9/Traffic-Light-Controller/traffic-light-control-circuit.jpg -------------------------------------------------------------------------------- /Traffic-Light-Controller/traffic-light-controller.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | 3 | int red = 13; 4 | int yellow = 12; 5 | int green = 11; 6 | 7 | void setup(){ 8 | pinMode(red, OUTPUT); 9 | pinMode(yellow, OUTPUT); 10 | pinMode(green, OUTPUT); 11 | } 12 | 13 | void loop(){ 14 | changeLights(); 15 | delay(1000); 16 | } 17 | 18 | void changeLights(){ 19 | // green off, yellow on for 3 seconds 20 | digitalWrite(green, LOW); 21 | digitalWrite(yellow, HIGH); 22 | delay(2000); 23 | 24 | // turn off yellow LED, then turn red on for 5 seconds 25 | digitalWrite(yellow, LOW); 26 | digitalWrite(red, HIGH); 27 | delay(2000); 28 | 29 | // red and yellow LED on for 2 seconds (red is already on though) 30 | digitalWrite(yellow, HIGH); 31 | delay(2000); 32 | 33 | // turn off red and yellow LED, then turn on green 34 | digitalWrite(yellow, LOW); 35 | digitalWrite(red, LOW); 36 | digitalWrite(green, HIGH); 37 | delay(2000); 38 | } 39 | -------------------------------------------------------------------------------- /Transmit-Temperature-Readings-to-Receiver-Using-RF-Transmitter-Receiver-Module/receiver.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Receiver Program 3 | 4 | 5 | // Include RadioHead Amplitude Shift Keying Library 6 | #include 7 | // Include dependant SPI Library 8 | #include 9 | #include 10 | 11 | byte degree_symbol[8] = 12 | { 13 | 0b00111, 14 | 0b00101, 15 | 0b00111, 16 | 0b00000, 17 | 0b00000, 18 | 0b00000, 19 | 0b00000, 20 | 0b00000 21 | }; 22 | // Define output strings 23 | 24 | String str_humid; 25 | String str_temp; 26 | String str_out; 27 | 28 | // Create Amplitude Shift Keying Object 29 | RH_ASK rf_driver; 30 | LiquidCrystal_I2C lcd(0x27, 16, 2); 31 | void setup() 32 | { 33 | // Initialize ASK Object 34 | rf_driver.init(); 35 | // Setup Serial Monitor 36 | Serial.begin(9600); 37 | } 38 | 39 | void loop() 40 | { 41 | // Set buffer to size of expected message 42 | byte temperature = 0; 43 | byte humidity = 0; 44 | uint8_t buf[11]; 45 | uint8_t buflen = sizeof(buf); 46 | // Check if received packet is correct size 47 | if (rf_driver.recv(buf, &buflen)) 48 | { 49 | 50 | // Message received with valid checksum 51 | // Get values from string 52 | 53 | // Convert received data into string 54 | str_out = String((char*)buf); 55 | 56 | // Split string into two values 57 | for (int i = 0; i < str_out.length(); i++) 58 | { 59 | if (str_out.substring(i, i+1) == ",") 60 | { 61 | str_humid = str_out.substring(0, i); 62 | str_temp = str_out.substring(i+1); 63 | break; 64 | } 65 | 66 | } 67 | 68 | // Print values to Serial Monitor 69 | Serial.print("Humidity: "); 70 | Serial.print(str_humid); 71 | Serial.print(" - Temperature: "); 72 | Serial.println(str_temp); 73 | 74 | lcd.begin(); 75 | 76 | // Turn on the blacklight and print a message. 77 | lcd.backlight(); 78 | /* lcd.setCursor(0,0); 79 | lcd.print("Temperature &"); 80 | lcd.setCursor(0,1); 81 | lcd.print("Humidity Monitor"); 82 | delay(2000); 83 | lcd.clear();*/ 84 | lcd.setCursor(0,0); 85 | lcd.print("Temperature "); 86 | //lcd.print((int)str_temp); 87 | lcd.print(str_temp); 88 | lcd.setCursor(0, 1); 89 | lcd.print("Humidity "); 90 | // lcd.print((int)str_humid); 91 | lcd.print(str_humid); 92 | lcd.setCursor(14,0); 93 | lcd.write(1); 94 | lcd.createChar(1, degree_symbol); 95 | lcd.setCursor(15,0); 96 | lcd.print("C"); 97 | lcd.setCursor(14,1); 98 | lcd.print(" %"); 99 | delay(1000); 100 | 101 | } 102 | 103 | 104 | } 105 | -------------------------------------------------------------------------------- /Transmit-Temperature-Readings-to-Receiver-Using-RF-Transmitter-Receiver-Module/transmitter.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Transmitter Program 3 | 4 | // Include RadioHead Amplitude Shift Keying Library 5 | #include 6 | // Include dependant SPI Library 7 | #include 8 | 9 | // Include DHT Libraries from Adafruit 10 | // Dependant upon Adafruit_Sensors Library 11 | #include "DHT.h"; 12 | 13 | // Define Constants 14 | 15 | #define DHTPIN 7 // DHT-22 Output Pin connection 16 | #define DHTTYPE DHT11 // DHT Type is DHT 22 (AM2302) 17 | 18 | // Define Variables 19 | 20 | float hum; // Stores humidity value in percent 21 | float temp; // Stores temperature value in Celcius 22 | 23 | // Define output strings 24 | 25 | String str_humid; 26 | String str_temp; 27 | String str_out; 28 | 29 | // Create Amplitude Shift Keying Object 30 | RH_ASK rf_driver; 31 | 32 | // Initialize DHT sensor for normal 16mhz Arduino 33 | DHT dht(DHTPIN, DHTTYPE); 34 | 35 | void setup() { 36 | 37 | // Initialize ASK Object 38 | rf_driver.init(); 39 | // Start DHT Sensor 40 | dht.begin(); 41 | 42 | Serial.begin(9600); 43 | 44 | } 45 | 46 | void loop() 47 | { 48 | 49 | delay(2000); // Delay so DHT-22 sensor can stabalize 50 | 51 | hum = dht.readHumidity(); // Get Humidity value 52 | temp= dht.readTemperature(); // Get Temperature value 53 | 54 | // Convert Humidity to string 55 | str_humid = String(hum); 56 | 57 | // Convert Temperature to string 58 | str_temp = String(temp); 59 | 60 | // Combine Humidity and Temperature 61 | str_out = str_humid + "," + str_temp; 62 | 63 | // Compose output character 64 | static char *msg = str_out.c_str(); 65 | 66 | rf_driver.send((uint8_t *)msg, strlen(msg)); 67 | rf_driver.waitPacketSent(); 68 | 69 | Serial.print("Humidity: "); 70 | Serial.print(str_humid); 71 | Serial.print(" - Temperature: "); 72 | Serial.println(str_temp); 73 | 74 | } 75 | -------------------------------------------------------------------------------- /Ultrasonic-Radar/processingapp.txt: -------------------------------------------------------------------------------- 1 | import processing.serial.*; // This will import the library for Serial Communication 2 | import java.awt.event.KeyEvent; // This will import the library for reading the data from the Serial Port 3 | import java.io.IOException; 4 | Serial myPort; // defines Object Serial 5 | // defubes variables 6 | String angle=""; 7 | String distance=""; 8 | String data=""; 9 | String noObject; 10 | float pixsDistance; 11 | int iAngle, iDistance; 12 | int index1=0; 13 | int index2=0; 14 | PFont orcFont; 15 | void setup() { 16 | 17 | size (1366, 768); //Change this parameter to your Screen Resolution 18 | smooth(); 19 | myPort = new Serial(this,"COM6", 9600); //Change the port based the port in your machine 20 | myPort.bufferUntil('.'); // Reads the data from the serial port up to the character '.'. So actually it reads this: angle,distance. 21 | } 22 | void draw() { 23 | 24 | fill(98,245,31); 25 | // simulating motion blur and slow fade of the moving line 26 | noStroke(); 27 | fill(0,4); 28 | rect(0, 0, width, height-height*0.065); 29 | 30 | fill(98,245,31); // green color 31 | // calls the functions for drawing the radar 32 | drawRadar(); 33 | drawLine(); 34 | drawObject(); 35 | drawText(); 36 | } 37 | void serialEvent (Serial myPort) { // starts reading data from the Serial Port 38 | // reads the data from the Serial Port up to the character '.' and puts it into the String variable "data". 39 | data = myPort.readStringUntil('.'); 40 | data = data.substring(0,data.length()-1); 41 | 42 | index1 = data.indexOf(","); // find the character ',' and puts it into the variable "index1" 43 | angle= data.substring(0, index1); // read the data from position "0" to position of the variable index1 or thats the value of the angle the Arduino Board sent into the Serial Port 44 | distance= data.substring(index1+1, data.length()); // read the data from position "index1" to the end of the data pr thats the value of the distance 45 | 46 | // converts the String variables into Integer 47 | iAngle = int(angle); 48 | iDistance = int(distance); 49 | } 50 | void drawRadar() { 51 | pushMatrix(); 52 | translate(width/2,height-height*0.074); // moves the starting coordinats to new location 53 | noFill(); 54 | strokeWeight(2); 55 | stroke(98,245,31); 56 | // draws the arc lines 57 | arc(0,0,(width-width*0.0625),(width-width*0.0625),PI,TWO_PI); 58 | arc(0,0,(width-width*0.27),(width-width*0.27),PI,TWO_PI); 59 | arc(0,0,(width-width*0.479),(width-width*0.479),PI,TWO_PI); 60 | arc(0,0,(width-width*0.687),(width-width*0.687),PI,TWO_PI); 61 | // draws the angle lines 62 | line(-width/2,0,width/2,0); 63 | line(0,0,(-width/2)*cos(radians(30)),(-width/2)*sin(radians(30))); 64 | line(0,0,(-width/2)*cos(radians(60)),(-width/2)*sin(radians(60))); 65 | line(0,0,(-width/2)*cos(radians(90)),(-width/2)*sin(radians(90))); 66 | line(0,0,(-width/2)*cos(radians(120)),(-width/2)*sin(radians(120))); 67 | line(0,0,(-width/2)*cos(radians(150)),(-width/2)*sin(radians(150))); 68 | line((-width/2)*cos(radians(30)),0,width/2,0); 69 | popMatrix(); 70 | } 71 | void drawObject() { 72 | pushMatrix(); 73 | translate(width/2,height-height*0.074); // moves the starting coordinats to new location 74 | strokeWeight(9); 75 | stroke(255,10,10); // red color 76 | pixsDistance = iDistance*((height-height*0.1666)*0.025); // covers the distance from the sensor from cm to pixels 77 | // limiting the range to 40 cms 78 | if(iDistance<40){ 79 | // draws the object according to the angle and the distance 80 | line(pixsDistance*cos(radians(iAngle)),-pixsDistance*sin(radians(iAngle)),(width-width*0.505)*cos(radians(iAngle)),-(width-width*0.505)*sin(radians(iAngle))); 81 | } 82 | popMatrix(); 83 | } 84 | void drawLine() { 85 | pushMatrix(); 86 | strokeWeight(9); 87 | stroke(30,250,60); 88 | translate(width/2,height-height*0.074); // moves the starting coordinats to new location 89 | line(0,0,(height-height*0.12)*cos(radians(iAngle)),-(height-height*0.12)*sin(radians(iAngle))); // draws the line according to the angle 90 | popMatrix(); 91 | } 92 | void drawText() { // draws the texts on the screen 93 | 94 | pushMatrix(); 95 | if(iDistance>40) { 96 | noObject = "Out of Range"; 97 | } 98 | else { 99 | noObject = "In Range"; 100 | } 101 | fill(0,0,0); 102 | noStroke(); 103 | rect(0, height-height*0.0648, width, height); 104 | fill(98,245,31); 105 | textSize(25); 106 | 107 | text("10cm",width-width*0.3854,height-height*0.0833); 108 | text("20cm",width-width*0.281,height-height*0.0833); 109 | text("30cm",width-width*0.177,height-height*0.0833); 110 | text("40cm",width-width*0.0729,height-height*0.0833); 111 | textSize(40); 112 | text("Tech Trends Shameer", width-width*0.875, height-height*0.0277); 113 | text("Angle: " + iAngle +" ", width-width*0.48, height-height*0.0277); 114 | text("Distance: ", width-width*0.26, height-height*0.0277); 115 | if(iDistance<40) { 116 | text(" " + iDistance +" cm", width-width*0.225, height-height*0.0277); 117 | } 118 | textSize(25); 119 | fill(98,245,60); 120 | translate((width-width*0.4994)+width/2*cos(radians(30)),(height-height*0.0907)-width/2*sin(radians(30))); 121 | rotate(-radians(-60)); 122 | text("30 ",0,0); 123 | resetMatrix(); 124 | translate((width-width*0.503)+width/2*cos(radians(60)),(height-height*0.0888)-width/2*sin(radians(60))); 125 | rotate(-radians(-30)); 126 | text("60 ",0,0); 127 | resetMatrix(); 128 | translate((width-width*0.507)+width/2*cos(radians(90)),(height-height*0.0833)-width/2*sin(radians(90))); 129 | rotate(radians(0)); 130 | text("90 ",0,0); 131 | resetMatrix(); 132 | translate(width-width*0.513+width/2*cos(radians(120)),(height-height*0.07129)-width/2*sin(radians(120))); 133 | rotate(radians(-30)); 134 | text("120 ",0,0); 135 | resetMatrix(); 136 | translate((width-width*0.5104)+width/2*cos(radians(150)),(height-height*0.0574)-width/2*sin(radians(150))); 137 | rotate(radians(-60)); 138 | text("150 ",0,0); 139 | popMatrix(); 140 | } 141 | -------------------------------------------------------------------------------- /Ultrasonic-Radar/ultrasonic-radar-circuit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tech-Trends-Shameer/Arduino-Projects/fa8d0a6b0261c52e029f0719cd3e3789c64958a9/Ultrasonic-Radar/ultrasonic-radar-circuit.png -------------------------------------------------------------------------------- /Ultrasonic-Radar/ultrasonic-radar.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | 3 | 4 | #include . // Includes the Servo library 5 | 6 | const int trigPin = 8; // Defines Trig pin of the Ultrasonic Sensor 7 | const int echoPin = 9; // Defines Echo pin of the Ultrasonic Sensor 8 | 9 | // Variables for the duration and the distance 10 | long duration; 11 | int distance; 12 | Servo myServo; // Creates a servo object for controlling the servo motor 13 | void setup() { 14 | pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output 15 | pinMode(echoPin, INPUT); // Sets the echoPin as an Input 16 | Serial.begin(9600); 17 | myServo.attach(10); // Defines on which pin is the servo motor attached 18 | } 19 | void loop() { 20 | // rotates the servo motor from 15 to 165 degrees 21 | for(int i=15;i<=165;i++){ 22 | myServo.write(i); 23 | delay(30); 24 | distance = calculateDistance();// Calls a function for calculating the distance measured by the Ultrasonic sensor for each degree 25 | 26 | Serial.print(i); // Sends the current degree into the Serial Port 27 | Serial.print(","); // Sends addition character right next to the previous value needed later in the Processing IDE for indexing 28 | Serial.print(distance); // Sends the distance value into the Serial Port 29 | Serial.print("."); // Sends addition character right next to the previous value needed later in the Processing IDE for indexing 30 | } 31 | // Repeats the previous lines from 165 to 15 degrees 32 | for(int i=165;i>15;i--){ 33 | myServo.write(i); 34 | delay(30); 35 | distance = calculateDistance(); 36 | Serial.print(i); 37 | Serial.print(","); 38 | Serial.print(distance); 39 | Serial.print("."); 40 | } 41 | } 42 | // Function for calculating the distance measured by the Ultrasonic sensor 43 | int calculateDistance(){ 44 | 45 | digitalWrite(trigPin, LOW); 46 | delayMicroseconds(2); 47 | // Sets the trigPin on HIGH state for 10 micro seconds 48 | digitalWrite(trigPin, HIGH); 49 | delayMicroseconds(10); 50 | digitalWrite(trigPin, LOW); 51 | duration = pulseIn(echoPin, HIGH); // Reads the echoPin, returns the sound wave travel time in microseconds 52 | distance= duration*0.034/2; 53 | return distance; 54 | } 55 | -------------------------------------------------------------------------------- /Voice-Controlled-Light/control-bulb-using-voice-circuit.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tech-Trends-Shameer/Arduino-Projects/fa8d0a6b0261c52e029f0719cd3e3789c64958a9/Voice-Controlled-Light/control-bulb-using-voice-circuit.jpg -------------------------------------------------------------------------------- /Voice-Controlled-Light/voice-controlled-light.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Voice Controlled Light 3 | 4 | String voice; 5 | 6 | #define relay 12 7 | 8 | void setup() 9 | { // put your setup code here, to run once: 10 | Serial.begin(9600); 11 | pinMode(relay, OUTPUT); 12 | digitalWrite(relay, LOW); 13 | } 14 | 15 | int relayVal; 16 | 17 | void loop() { 18 | 19 | while (Serial.available()) //Check if there is an available byte to read 20 | { 21 | delay(10); //Delay added to make thing stable 22 | char c = Serial.read(); //Conduct a serial read 23 | if (c == '#') {break;} //Exit the loop when the # is detected after the word 24 | voice += c; //Shorthand for voice = voice + c 25 | } 26 | 27 | if (voice.length() > 0) { 28 | Serial.println(voice); 29 | //----------Control Light----------// 30 | 31 | if(voice == "*turn on the light") // To tune ON the bulb 32 | { 33 | digitalWrite(relay, HIGH); 34 | } 35 | else if(voice == "*turn off the light") // To turn OFF the bulb 36 | { 37 | digitalWrite(relay, LOW); 38 | } 39 | 40 | voice=""; //Reset the variable after initiating 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Water-Level-Indicator/water-level-indicator.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Water Level Indicator 3 | 4 | #include 5 | #include 6 | 7 | LiquidCrystal_I2C lcd(0x27, 16, 2); 8 | int resval = 0; // holds the value 9 | int respin = A3; // Water Level Sensor Pin 10 | 11 | 12 | void setup() 13 | { 14 | Serial.begin(9600); 15 | lcd.begin(); 16 | lcd.backlight(); 17 | lcd.clear(); 18 | lcd.setCursor(3,0); 19 | lcd.print("Tech Trends "); 20 | lcd.setCursor(0,0); 21 | delay(2000); 22 | lcd.setCursor(3,0); 23 | lcd.print("Water Level"); 24 | lcd.setCursor(4,1); 25 | lcd.print("Indicator"); 26 | delay(8000); 27 | lcd.clear(); 28 | 29 | } 30 | 31 | void loop() 32 | { 33 | // set the cursor to column 0, line 1 34 | lcd.setCursor(0, 0); 35 | lcd.println("Water Level "); 36 | lcd.setCursor(0, 1); 37 | 38 | resval = analogRead(respin); //Read data from analog pin and store it to resval variable 39 | 40 | if (resval<=100) 41 | { 42 | lcd.println("Empty "); 43 | } 44 | else if (resval>10 && resval<=200) 45 | { 46 | lcd.println("Low "); 47 | } 48 | else if (resval>200 && resval<=250) 49 | { 50 | lcd.println("Medium "); 51 | } 52 | else if (resval>250) 53 | { 54 | lcd.println("High "); 55 | } 56 | delay(1000); 57 | } 58 | -------------------------------------------------------------------------------- /Wireless-Notice-Board/wireless-notice-board.ino: -------------------------------------------------------------------------------- 1 | //Tech Trends Shameer 2 | //Wireless Display Board 3 | 4 | #include 5 | #include 6 | 7 | //Create Liquid Crystal Object called LCD 8 | LiquidCrystal lcd (4, 5, 6, 7, 8, 9); 9 | SoftwareSerial mySerial (2, 3); //(Connect TX, RX from bluetooth to Pin 2,3 in Arduino); 10 | 11 | String val = "No Data"; 12 | String oldval; 13 | String newval = "No Data"; 14 | int i = 0; 15 | 16 | void setup() 17 | { 18 | // Initialize the LCD 19 | lcd.begin(16,2); //Tell Arduino to start your 16 column 2 row LCD 20 | mySerial.begin(9600); 21 | Serial.begin(9600); 22 | lcd.setCursor(0, 0); //Set cursor to first column of first row 23 | lcd.print("Tech Trends"); 24 | lcd.setCursor(0, 1); //Set cursor to first column of second row 25 | lcd.print(" "); 26 | delay(280000); 27 | lcd.clear(); 28 | lcd.print("Welcome!"); 29 | delay(8000); 30 | } 31 | 32 | void loop() 33 | { 34 | val = mySerial.readString(); 35 | val.trim(); 36 | Serial.println(val); 37 | if(val != oldval) 38 | { 39 | newval = val; 40 | } 41 | lcd.clear(); 42 | lcd.setCursor(i, 0); 43 | lcd.print(newval); 44 | i++; 45 | if(i >= 15) 46 | { 47 | i = 0; 48 | } 49 | val = oldval; 50 | } 51 | --------------------------------------------------------------------------------