IoT and DIY Smart Car Starter Kit

IoT and DIY Smart Car Starter Kit

Summary

Are you ready to embark on an exciting journey into the world of Internet of Things (IoT) and DIY projects? Look no further! Our latest blog introduces the ultimate IoT DIY Smart Car Starter Kit, packed with endless possibilities. Discover what's included in the kit and get a glimpse of the thrilling experiments you can undertake. From controlling LEDs through Arduino's Serial Monitor to building a line-following robot, this kit offers a wide range of engaging projects. Learn how to set up Arduino IDE and dive into experiments like secure door locks, home automation, WiFi multicolored lights, and more. Get inspired, empower your creativity, and join the IoT revolution today!

What’s in the Kit?

Components 

Quantity 

Arduino Uno R3 board + cable 

1 

Esp8266 NodeMCU 

1 

Breadboard 

1 

Push Button 

2 

10K Potentiometer 

1 

9V Battery 

1 

7 Segment 1 digit display 

1 

IC 75HC595 

1 

2N2222A NPN Transistor 

2 

RGB LED 

5 

Red LED 

5 

Green LED 

5 

Yellow LED 

5 

Blue LED 

5 

DHT11  

1 

DC motor 

1 

BO Motor 200 RPM 

2 

SG90 Servo Motor 

1 

L293D Motor Driver Shield 

1 

16x2 LCD 

1 

Buzzer 

1 

HC SR04 ultrasonic sensor 

1 

HC-05 Bluetooth Module 

1 

Diode 

2 

Resistor Box 

1 

Jumper cables 

120 

1 channel Relay 

1 

IR Sensors 

2 

LDR Sensor 

2 

DC Connector 

1 

2WD Car chassis 

1 

Screws, Nuts, Bolts 

10 

9V Battery 

1 

Manual 

1 

Experiment List

  • LED control using Arduino’s Serial Monitor

  • Secure Door Lock

  • Automate Home Appliances

  • Wi-Fi MultiColoured Lights

  • 0-9 Counter using a 7 Segment Display

  • Wi-Fi Clock

  • Environment Monitoring

  • Controlling Motor Speed using Potentiometer and L293D Motor Driver Shield

  • Obstacle Avoidance Robot

  • Line Following Robot


Setting Up Arduino IDE:

  • Step 1: Download the Arduino IDE  
  • Step 2: Connect the USB Cable to the Arduino. 
  • Step 3: Verify if the device is detected or not. 
  • Step 4: Write your first Sketch 
  • Open IDE and Open the Tools Menu from the Menu bar and select your Arduino Board and select the assigned COM port. 

Exp 1:LED Control Using Arduino’s Serial Monitor

This experiment makes a LED glow on command from the serial monitor 

Material Required: 

  • Arduino board
  • LED
  • 220-ohm resistor

Circuit Diagram:

 

 

Program:


void setup() 

{ 

  pinMode(13, OUTPUT); 

  Serial.begin(9600); 

  while (!Serial); 

  Serial.println("Input 1 to Turn led on and 2 to off"); 

} 

void loop()  

{ 

  if (Serial.available()) 

  { 

    int state = Serial.parseInt(); 

    if (state == 1) 

    { 

      digitalWrite(13, HIGH); 

      Serial.println("Command completed led turned ON"); 

    } 

    if (state == 2) 

{ 

      digitalWrite(13, LOW); 

      Serial.println("Command completed led turned OFF"); 

    } 

  } 

} 

Procedure: 

  1. Follow the Circuit Diagram and hook up the components as shown in the image given below. 
  2. Connect the Arduino to the computer using the USB cable provided. 
  3. Upload the code to the Arduino Uno.  
  4. Now just connect the Uno to your PC and now open the serial monitor (to do so navigate through Tools > Serial monitor). 
  5. Now when you send “1” the LED turns on and turns off when you send “2”. 

Result:

You should see your LED turn on and off. If the required output is not seen, make sure you have assembled the circuit correctly, and uploaded the code to your board.

 

Exp 2: Secure Door Lock

 To Control a Servo Motor that can act as a door Lock/Unlock mechanism and the servo will rotate 0° to 90° when both the buttons are pressed and will return to 0° when the Buttons are released. 

Material Required:  

  • Arduino Uno 
  • Servo Motor 
  • Jumper Cables 
  • Push Buttons 
  • Resistors 

 Circuit Diagram: 

 

Program: 


#include 

int pos = 0; 

Servo servo; 

void setup()  

{ 

  pinMode(2, INPUT); 

  pinMode(3, INPUT); 

  servo.attach(9); 

} 

void loop()  

{ 

  if (digitalRead(2) == HIGH && digitalRead(3) == HIGH)  

 { 

    servo.write(0); 

    delay(1000); 

  } 

  else  

 { 

    servo.write(90); 

  } 

} 

Procedure: 

  1. Connect the Servo Motors as shown in the circuit diagram. 
  2. Connect the Arduino to a computer using a USB cable. 
  3. Upload the code to the Arduino Uno. 
  4. The code here is to press both the Buttons simultaneously to make the servo move, you can change that to your liking. 

Result: 

The Servo will rotate 0° to 90° when both the Buttons are pressed and will return to 0° when the Buttons are released. 

 

 

Exp 3: Automate Home Appliances

To control a Home Appliance using a Relay and Arduino 

The AC blub will be blinking on/off every 10 seconds. You can explore more about the project by playing around with the delay values.  

NOTE: We are using a LED in place of Live AC Appliances as low Power Electronics are a good replacement to test our circuits first.  

To connect AC Devices, the Neutral Line must be connected at the relay NO and COM pins just like we did with the led. 

Warning: This project involves AC Voltage. Please exercise caution and always perform the experiment under supervision. 

Materials Required:  

    • Arduino Uno 
    • 5V Relay Module 220v 
    • LED 
    • Jumper Cables 

     Circuit Diagram: 

    Program: 

    
    void setup() { 
    
      pinMode(13, OUTPUT);     
    
    } 
    
    // the loop function runs over and over again forever 
    
     
    
    void loop() { 
    
      digitalWrite(13, HIGH);    
    
      delay(10000);         // Wait for a second 
    
      digitalWrite(13, LOW);   
    
      delay(10000);                    
    
    } 
    

    Procedure: 

    1. Connect the Relay Module to the Arduino and the Relay to the LED as shown in the diagram below and remember to not plug anything into AC mains while doing so. 
    2. Make sure that all the connections are right and plug the Arduino into the computer using a USB cable. 
    3. Upload the code to the Arduino. 

    Result: 

    The LED will be blinking on/off every 10 seconds. You can explore more about the project by playing around with the delay values.You can use this concept to make this circuit interface with various other devices like Motors, Fan, Bulbs, AC, Etc. 

    Exp 4: WI-FI MultiColoured Lights

    To change the colours of an RGB LED using a Web Browser. The colours of the LED keeps changing from Red, Green, Blue, Raspberry, Cyan, Magenta, Yellow, and White with every change in the input from the web server. 

    Components:   

    • Esp8266 NodeMCU  
    • Resistor 220 ohms   
    • RGB LED 
    • Breadboard 
    • Jumper Cables  

    Circuit Diagram: 

    Program: 

    
    /* RGB web server with ESP8266 
    
    * analogWrite with values received from web page 
    
    * WiFi router that creates a fixed domain: http://rgb 
    
    * Web page returns POST request with 3 RGB parameters http://192.168.1.5/ 
    
    */ 
    
    #include  
    
    #include  
    
    #include  
    
    const char * ssid = "The IoT Projects"; 
    
    const char * password = ""; 
    
    const byte DNS_PORT = 53; 
    
    const int redled = 0; //D3 
    
    const int greenled = 4; //D2 
    
    const int blueled = 5; //D1 
    
    IPAddress apIP(192, 168, 1, 5); 
    
    DNSServer dnsServer; 
    
    ESP8266WebServer webServer(80); 
    
    String webpage = "" 
    
    "RGB control
    
    
    
    " 
    
    "" 
    
    "" 
    
    "
    
    "; ///////////////////////////////////////////////////////// void handleRoot() {   // Serial.println("handle root..");   String red = webServer.arg(0); // read RGB arguments   String green = webServer.arg(1);   String blue = webServer.arg(2);   if ((red != "") && (green != "") && (blue != "")) {     analogWrite(redled, 1023 - red.toInt());     analogWrite(greenled, 1023 - green.toInt());     analogWrite(blueled, 1023 - blue.toInt());   }   Serial.print("Red: ");   Serial.println(red.toInt());   Serial.print("Green: ");   Serial.println(green.toInt());   Serial.print("Blue: ");   Serial.println(blue.toInt());   Serial.println();   webServer.send(200, "text/html", webpage); } //////////////////////////////////////////////////////// void setup() {   pinMode(redled, OUTPUT);   pinMode(greenled, OUTPUT);   pinMode(blueled, OUTPUT);   analogWrite(redled, 0);   analogWrite(greenled, 0);   analogWrite(blueled, 0);   delay(1000);   Serial.begin(115200);   Serial.println();   WiFi.mode(WIFI_AP);   WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));   WiFi.softAP(ssid);   // if DNSServer is started with "*" for domain name, it will reply with provided IP to all DNS request   dnsServer.start(DNS_PORT, "rgb", apIP);   webServer.on("/", handleRoot);   webServer.begin();   testRGB(); } ///////////////////////////////////////////////////////// void loop() { dnsServer.processNextRequest();   webServer.handleClient(); } ///////////////////////////////////////////////////////// void testRGB() { // fade in and out of Red, Green, Blue   analogWrite(redled, 0); // R off   analogWrite(greenled, 0); // G off   analogWrite(blueled, 0); // B off   fade(redled); // R   fade(greenled); // G   fade(blueled); // B } //////////////////////////////////////////////////////// void fade(int pin) {   for (int u = 0; u < 1024; u++) {     analogWrite(pin, u);     delay(1);   }   for (int u = 0; u < 1024; u++) {     analogWrite(pin, 1023 - u);     delay(1);   } } 

    Procedure: 

    1. Connect the Circuit as shown in the above Circuit Diagram. 
    2. Upload the file to your Esp8266 NodeMCU. This may take up to a minute. Be patient. While you are waiting, please open your serial monitor and make sure it is set to 115200 Baud Rate. 
    3. You should see a Wi-Fi network called “your-name”. Switch your laptop (or your phone) to this network. 
    4. Go to http://rgb or http://192.168.1.5/ if it doesn’t work find the IP address of your NodeMCU through Wi-Fi scanner apps or router settings 
    5. Once in the web portal, choose the colour in the palette and the RGB LED should try to match it. 

    Result: 

    The colours of the LED keeps changing from red, green, blue, raspberry, cyan, magenta, yellow, and white with every change in the input from the web server.  

    Exp 5: 0-9 Counter using a 7-Segment display

    To build a 0-9 counter and count from 0 to 9 every 1 second. 

    Components: 

    • Arduino Uno 
    • 7 segment display 1 digit 
    • Breadboard 
    • Jumper wires 
    • Resistor 

    Circuit Diagram: 

     

     

    Program: 

    
    //Arduino Pins: 2,3,4,5,6,7,8,9 
    
    //Display Pins: 7,6,4,2,1,9,10 
    
    #include "SevSeg.h" 
    
    SevSeg sevseg; 
    
     
     
    
    void setup() 
    
    { 
    
      //Set to 1 for single digit display 
    
    byte numDigits = 1; 
    
     
     
    
      //defines common pins while using multi-digit display. Left empty as we have a single digit display 
    
      byte digitPins[] = {}; 
    
     
     
    
      //Defines arduino pin connections in order: A, B, C, D, E, F, G, DP 
    
      byte segmentPins[] = {3, 2, 8, 7, 6, 4, 5, 9}; 
    
      bool resistorsOnSegments = true; 
    
     
     
    
      //Initialize sevseg object. Uncomment second line if you use common cathode 7 segment 
    
      //sevseg.begin(COMMON_ANODE, numDigits, digitPins, segmentPins, resistorsOnSegments); 
    
      sevseg.begin(COMMON_CATHODE, numDigits, digitPins, segmentPins, resistorsOnSegments); 
    
     
     
    
      sevseg.setBrightness(50); 
    
    } 
    
     
     
    
    void loop() 
    
    {  
    
       //Display numbers one by one with 2 seconds delay 
    
       for(int i = 0; i < 10; i++) 
    
       { 
    
         sevseg.setNumber(i); 
    
         sevseg.refreshDisplay();  
    
         delay(1000); 
    
       } 
    
    }  
    

    Procedure: 

    1. Connect the 7-segment display to Arduino as shown in the Circuit Diagram Section. 
    2. Connect the Arduino to the computer using a USB cable. 
    3. Upload the code to the Arduino. 

    Result: 

    The number displayed in the 7 Segment display will increment every one second. 

    Exp 6: Wi-Fi Clock

    To display time on LCD which has been connected to Esp8266 which is in turn connected to NTP server where you can observe the time on the LCD, and it gets updated every minute. 

    Materials Required:  

    • NodeMCU Esp8266 
    • 16x2 LCD 
    • Breadboard 
    • Jumper Wires 
    • 10k Potentiometer 

    Circuit Diagram: 

    Program: 

    
    #include  
    
    #include  
    
    #include  
    
    #include  
    
    #include  
    
    LiquidCrystal lcd(D6, D5, D1, D2, D3, D4); 
    
    char * ssid = "SSID"; //wifi ssid 
    
    char * password = "PASSWORD"; //wifi password 
    
    WiFiUDP ntpUDP; 
    
    NTPClient timeClient(ntpUDP, "asia.pool.ntp.org", 20700, 60000); 
    
    char Time[] = "TIME:00:00:00"; 
    
    char Date[] = "DATE:00/00/2000"; 
    
    byte last_second, second_, minute_, hour_, day_, month_; 
    
    int year_; 
    
    void setup() { 
    
      Serial.begin(115200); 
    
      lcd.begin(16, 2); // Initialize 16x2 LCD Display 
    
      lcd.clear(); 
    
      lcd.setCursor(0, 0); 
    
      lcd.print(Time); 
    
      lcd.setCursor(0, 1); 
    
      lcd.print(Date); 
    
      WiFi.begin(ssid, password); 
    
      Serial.print("Connecting."); 
    
      while (WiFi.status() != WL_CONNECTED) { 
    
        delay(500); 
    
        Serial.print("."); 
    
      } 
    
      Serial.println("connected"); 
    
      timeClient.begin(); 
    
    } 
    
    void loop() { 
    
      timeClient.update(); 
    
      unsigned long unix_epoch = timeClient.getEpochTime(); // Get Unix epoch time from the NTP server 
    
      second_ = second(unix_epoch); 
    
      if (last_second != second_) { 
    
        minute_ = minute(unix_epoch); 
    
        hour_ = hour(unix_epoch); 
    
        day_ = day(unix_epoch); 
    
        month_ = month(unix_epoch); 
    
        year_ = year(unix_epoch); 
    
        Time[12] = second_ % 10 + 48; 
    
        Time[11] = second_ / 10 + 48; 
    
        Time[9] = minute_ % 10 + 48; 
    
        Time[8] = minute_ / 10 + 48; 
    
        Time[6] = hour_ % 10 + 48; 
    
        Time[5] = hour_ / 10 + 48; 
    
        Date[5] = day_ / 10 + 48; 
    
        Date[6] = day_ % 10 + 48; 
    
        Date[8] = month_ / 10 + 48; 
    
        Date[9] = month_ % 10 + 48; 
    
        Date[13] = (year_ / 10) % 10 + 48; 
    
        Date[14] = year_ % 10 % 10 + 48; 
    
        Serial.println(Time); 
    
        Serial.println(Date); 
    
        lcd.setCursor(0, 0); 
    
        lcd.print(Time); 
    
        lcd.setCursor(0, 1); 
    
        lcd.print(Date); 
    
        last_second = second_; 
    
      } 
    
      delay(500); 
    
    } 
    

    Procedure: 

    1. Download the Libraries from tools-> Manage Libraries. 
    2. Install the Libraries. 
    3. Establish connections as shown under the Circuit Diagram Section. 
    4. Modify the program and add your own Wi-Fi credentials 
    5. Connect the Esp8266 to a computer using USB cable. 
    6. Upload the code to the Esp8266. 

    Results: 

     Now you can observe the time on the LCD, as it gets updated every minute. 

    Exp 7: Environment Monitoring

    To find the Temperature and Humidity in real time and the LCD displays the current Temperature and Humidity levels. 

    Components:  

    • Arduino Uno 
    • DHT11 
    • LCD 
    • Breadboard 
    • Jumper Cables 
    • 10K Potentiometer 

    Circuit Diagram: 

    Program: 

    
    //Interface the DHT11 Temperature & Humidity sensor and display Humidity and Temperature 
    
    //in Celsius on a 16x2 character LCD 
    
    #include 
    
    #include  
    
    #define DHTPIN 8        
    
    #define DHTTYPE DHT11 
    
    DHT dht(DHTPIN, DHTTYPE); 
    
    const int RS = 2, EN = 3, D4 = 4, D5 = 5, D6 = 6, D7 = 7; 
    
    LiquidCrystal lcd(RS,EN,D4,D5,D6,D7); //set Unopins that are connected to LCD, 4-bit mode 
    
    void setup() { 
    
      lcd.begin(16,2); //set 16 columns and 2 rows of 16x2 
    
    dht.begin(); 
    
    } 
    
    void loop() { 
    
                           //grab 40-bit data packet from DHT sensor 
    
    lcd.setCursor(0,0);  
    
    lcd.print("Temp: "); 
    
    lcd.print(dht.readTemperature()); 
    
    //lcd.print((char)223); //used to display degree symbol on display 
    
    //lcd.write(0xdf); //another way to display degree symbol 
    
    lcd.print("C"); 
    
    lcd.setCursor(0,1); 
    
    lcd.print("Humidity: "); 
    
    lcd.print(dht.readHumidity()); 
    
    lcd.print("%"); 
    
    delay(3000); 
    
    } 
    

    Procedure: 

    1. Make the following connection as shown under the Circuit Diagram Section. 
    2. Connect the Uno to a computer using a USB cable. 
    3. Upload the code to the Uno. 

    Result: 

    Now the LCD displays the current temperature and Humidity levels. 

    Exp 8: Controlling Motor Speed using Potentiometer and L293D Motor driver Shield

    Control the speed of a DC motor using a Potentiometer and L293D Module. 

    Components:  

    • Arduino Uno 
    • DC motor 
    • L293D Motor Driver Shield   
    • Breadboard 
    • Jumper Wires 
    • 9V Battery 
    • Potentiometer 

    Circuit Diagram: 

    Program: 

    
    #include  
    
    AF_DCMotor motor(4); 
    
     
     
    
    int enable1Pin = 10; 
    
    int i; 
    
    int dir; 
    
    int spd; 
    
    void setup()  
    
    { 
    
      //Set initial speed of the motor & stop 
    
     
     
    
    motor.setSpeed(200); 
    
    motor.run(RELEASE); 
    
    pinMode(enable1Pin, OUTPUT); 
    
     
     
     
    
    } 
    
     
     
    
    void loop()  
    
    { 
    
    uint8_t i; 
    
    int potInput = analogRead(A0); // Read potentiometer //value  
    
    spd = map(abs(potInput - 512), 0, 512, 0, 255); 
    
    //Calculate motor speed, pot travel from midpoint 
    
    if (potInput > 512) // Compare to potentiometer midpoint //to get motor direction 
    
    dir = 0; 
    
    else 
    
    dir = 1; 
    
    driveMotor(); //Call function to drive motor at  
    
     
     
    
      // Now turn off motor 
    
    motor.run(RELEASE); 
    
    delay(1000); 
    
    } 
    
     
     
    
    void driveMotor() 
    
    { 
    
    if (dir) 
    
    { 
    
    motor.run(FORWARD); 
    
    // Accelerate from zero to maximum speed 
    
    for ( i=0; i<255; i++)  
    
     { 
    
        motor.setSpeed(i);   
    
        delay(10); 
    
      } 
    
      // Decelerate from maximum speed to zero 
    
      for (i=255; i!=0; i--)  
    
      { 
    
        motor.setSpeed(i);   
    
        delay(10); 
    
      } 
    
    } 
    
    else 
    
    { 
    
    motor.run(BACKWARD); 
    
     // Accelerate from zero to maximum speed 
    
     for (i=0; i<255; i++)  
    
     { 
    
        motor.setSpeed(i);   
    
        delay(10); 
    
      } 
    
      // Decelerate from maximum speed to zero 
    
      for (i=255; i!=0; i--)  
    
      { 
    
        motor.setSpeed(i);   
    
        delay(10); 
    
      } 
    
     
     
     
    
    } 
    
    analogWrite(enable1Pin, spd); 
    
    } 
    

    Procedure: 

    1. We are going to be setting up two circuits one to control the Motor and the other to take input from a Potentiometer so that you can adjust the Potentiometer to control the Motor speed and direction, and the second is to interface the Motor and Motor Driver shield with the Arduino Uno. 
    2. The Potentiometer circuit is a straightforward analogue input circuit with the potentiometer wiper connected to the Arduino analogue input “0”.  
    3. This is going to be used to control the motor’s direction and speed.  
    4. The potentiometer’s midpoint corresponds with zero speed and turning it clockwise moves the Motor forward with increasing speed and anti-clockwise moves it in reverse with increasing speed.  
    5. You could also wire up a Push Button to control the motor direction if you’d like and this will give you the full potentiometer range to control the Motor’s speed. 
    6. Unless your Motor is small, you’ll need to power it separately, not through your Arduino’s onboard supply. This is easily done using an external Battery Pack or Power Supply.  
    7. This can be the same supply as you are using for your Arduino if it can provide adequate voltage and has enough capacity.  
    8. Make sure that your battery is the correct voltage for your Motor, use a small battery pack for the DC Motor in the kit. 
    9. Please mount the motor driver shield onto the Uno. 
    10. Connecting you Uno to the computer and uploading the code. 
    11. The Motor Driver Module Provided in the Kit it able to drive up to 4 motors or 2 Stepper Motors at once.  

    Result: 

    You can now control the speed of the motor using the Potentiometer. 

    Exp 9: Collision avoidance Robot

    Collision avoidance robot using Ultrasonic sensor to detect the obstacles 

    Materials Required: 

    • Arduino UNO 
    • Car Model 
    • L293D Motor Driver Shield  
    •  Pair of DC Motors 
    • Ultrasonic Sensor 
    • Power Supply or Battery 

    Circuit Diagram: 


    Program: 

    
    #include  
    
    #include  
    
     
     
    
    AF_DCMotor motor3(3, MOTOR34_1KHZ);  
    
    AF_DCMotor motor4(4, MOTOR34_1KHZ); 
    
     
     
    
    #define TRIGGER_PIN A1 
    
    #define ECHO_PIN A0 
    
    #define MAX_DISTANCE 200 // Maximum distance in centimeters 
    
     
     
    
    NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); 
    
     
     
    
    void setup() { 
    
      Serial.begin(9600); 
    
      motor3.setSpeed(180); 
    
      motor4.setSpeed(180); 
    
    } 
    
     
     
    
    void loop() { 
    
      delay(100); // Delay between readings 
    
       
    
      unsigned int distance = sonar.ping_cm(); 
    
      Serial.println(distance); 
    
      if(distance >= 15) 
    
      { 
    
         
    
        motor3.run(FORWARD); 
    
        motor4.run(FORWARD);  
    
      } 
    
      else 
    
      { 
    
        motor3.run(FORWARD); 
    
        motor4.run(RELEASE);  
    
        delay(500); 
    
        motor3.run(FORWARD); 
    
        motor4.run(FORWARD);  
    
      } 
    
    }
    

    Procedure: 

    1. Establish the connections as shown above in the image. 
    2. Connect the motors to the ports M3 and M4. 
    3. Connect the battery to the L298D Motor Driver power supply input. 
    4.  Connect the ultrasonic sensor to pin A0 & A1 
    5. Connect the UNO to a computer using a USB cable. 
    6. Upload the code into the UNO. 

    Result: 

    Robot will be moving until any obstacle is sensed and will move to avoid the obstacle. 

    Exp 10: Line Following Robot

    To make a robot that travels along a Line and doesn’t deviate off the path. The Robot will move along the line and take corrective measure if the line starts to curve. 

    Materials Required:  

    • Arduino Uno 
    • L293D Motor Driver Shield   
    • Pair of DC Motors 
    • Pair IR sensor module 
    • Battery Pack  

    Circuit Diagram: 

    Program: 

    
    #include  
    
    #define R_S A0  //ir sensor right 
    
    #define L_S A1  //ir sensor left 
    
    AF_DCMotor m3(3);  //define motor 3 as LEFT MOTOR 
    
    AF_DCMotor m4(4);  //define motor 4 as RIGHT MOTOR 
    
    void setup() { 
    
      //Set initial speed of the motor & stop 
    
      m4.setSpeed(200); 
    
      m4.run(RELEASE); 
    
      m3.setSpeed(200); 
    
      m3.run(RELEASE); 
    
      pinMode(R_S, INPUT); 
    
      pinMode(L_S, INPUT); 
    
     
     
    
      delay(1000); 
    
    } 
    
     
     
    
    void loop() { 
    
      if ((digitalRead(R_S) == 0) && (digitalRead(L_S) == 0)) { 
    
        forward(); 
    
      }  //if Right Sensor and Left Sensor are at Whitecolour then it will call the forward function 
    
       if ((digitalRead(R_S) == 1) && (digitalRead(L_S) == 0)) { 
    
        turnRight(); 
    
      }  //if Right Sensor is Black and Left Sensor isWhite then it will call turn Right function  
    
      if ((digitalRead(R_S) == 0) && (digitalRead(L_S) == 1)) { 
    
        turnLeft(); 
    
      }  //if Right Sensor is White and Left Sensor is Black then it will call turn Left function 
    
      if ((digitalRead(R_S) == 1) && (digitalRead(L_S) == 1)) { 
    
        Stop(); 
    
      }  //if Right Sensor and Left Sensor are at Blackcolor then it will call Stop function 
    
    } 
    
     
     
     
    
    void forward() {   
    
      m3.run(FORWARD); 
    
      m4.run(FORWARD); 
    
    } 
    
    void turnRight() {  
    
      m3.run(FORWARD); 
    
      m4.run(BACKWARD); 
    
    } 
    
    void turnLeft() {  
    
      m3.run(BACKWARD); 
    
      m4.run(FORWARD); 
    
    } 
    
    void Stop() {   
    
      m3.run(RELEASE); 
    
      m4.run(RELEASE); 
    
    } 
    

    Procedure: 

    1. Hook up the connections as shown under the Circuit Diagram section. 
    2. Place the IR modules in the front of the car with the IR Modules facing downwards. 
    3. The IR Modules might need to be calibrated with the help of on board potentiometer to recognise the correct distance between the sensor and the ground. 
    4. Layout a black line to which the robot must follow. 
    5. Connect the Arduino to a computer using a USB cable. 
    6. Upload the code to the Arduino Uno and start the robot. 

    Result: 

    The robot will move along the line and take corrective measure if the line starts to curve. 

    Conclusion

    The IoT and DIY Smart Car Starter Kit offers a thrilling journey into the world of smart car automation and home IoT projects. From LED control and secure door locks to environment monitoring and collision avoidance robots, this kit is a treasure trove of innovative experiments that will captivate hobbyists, students, and tech enthusiasts alike.

    With step-by-step instructions and the versatile Arduino IDE, each experiment becomes a gateway to mastering the fundamentals of IoT and robotics. Unleash your creativity, automate your home appliances, and bring life to mesmerizing multicolored lights controlled via Wi-Fi.

    Get ready to be inspired by the endless possibilities this kit offers, from building a Wi-Fi clock to mastering the art of line-following robots. Embrace the power of DIY technology and embark on an exciting adventure that will ignite your passion for smart car projects and beyond.

    You may also like to read

    Frequently Asked Questions

    Back to blog

    Leave a comment

    Please note, comments need to be approved before they are published.

    You may also like to read