0% found this document useful (0 votes)
19 views25 pages

Carrer Guidance Program

The document outlines a career guidance program focused on electronics, specifically introducing robotics and its applications. It details three practical projects: a Bluetooth-controlled robot, a radar system using Arduino, and a home automation system, along with the necessary components and coding instructions for each project. The document serves as a comprehensive guide for students to understand and implement robotics in real-world scenarios.

Uploaded by

Ankitha Madivala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views25 pages

Carrer Guidance Program

The document outlines a career guidance program focused on electronics, specifically introducing robotics and its applications. It details three practical projects: a Bluetooth-controlled robot, a radar system using Arduino, and a home automation system, along with the necessary components and coding instructions for each project. The document serves as a comprehensive guide for students to understand and implement robotics in real-world scenarios.

Uploaded by

Ankitha Madivala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

Government Technical Training Centre (GTTC)

Career Guidance
Program-Electronics

1|Page
Activity-1
Introduction to Robotics

Robotics is the design, construction, operation, and application of robots to


perform tasks that are repetitive, complex, or dangerous.

Objective:

The objective of robotics is to automate tasks, enhance efficiency, and


improve human life by performing complex or hazardous activities. It
focuses on innovation, AI integration, and advancing technology across
industries.

Practical application of robotics in three specific projects:

1. Bluetooth-Controlled Robot
2. Radar System with Arduino Uno
3. Home Automation System using ESP8266

Projects Overview:

• Bluetooth-Controlled Robot:
A robot controlled remotely using a smartphone and Bluetooth
module.
• Radar System Using Arduino:
A system to detect and measure the distance of objects using
ultrasonic sensors.
• Home Automation Using ESP8266:
A smart system to control home devices using sensors and
ESP8266 microcontroller.

2|Page
Components Required:

Sl.No Name Specification


1 Arduino Uno Atmega328P-8 bit AVR family microcontroller,
equivalent or better.Operating Voltage :5V. Digital
I/O Pins: 14 ( of which 6 provide PWm Output).
PWM Digital I/O Pins:6. Accessories: Case shell,
enclosure, compatible USB cable ( length-6inch or
more)

2 USB Cable Type-B USB Cables - USB Cable Set (A to B, 12 inch or


more)
3 Usb cable for uno USB Type: Type-A to Type-B
Weight: 25 gm.
Length: 50 cm.
Fully compatible with the PC.
Aluminum under-mold shield helps meet FCC
requirements on KMI/RFI interference.

4 Bluetooth module HC 05 Bluetooth Module, voltage rating 5 Volt

5 Ultrasonic sensor with holder Operating Voltage: 5 V


Sonar Sensing Range: 2-400 cm
Max. Sensing Range: 4500 cm
Frequency: 40 KHz
Thickness: 2.8-3.1 mm
The diameter of mounting hole: 3.8mm
Mounting Bracket Material: acrylic

6 Motor driver circuit L298N Motor Driver Shield or relative Driver Shield

7 Battery 12V 2000 mAh rechargeable battery


8 Adapter Stabilized DC Output with Low Ripples &
Interference
Short Circuit & Overload Protection
High Efficiency & Low Energy Consumption

9 Wire stripper An improved handle for extra comfort and grip.


Sharp cutting edge.
Suitable for industrial applications.
H-8mm L-13cm W-78 gm.

3|Page
10 Screw driver set Compact and Portable pocket toolkit
30 different head style
Rubber Shockproof gripped handle
Strong and durable plastic Case
Colour: Yellow-Red
Interchangeable Precise Manual Tool Kit.
11 12v battery jack 12 volt battery clips with DC Jack
12 Adhesive tape Tape- 5mm/10mm wide
13 Robot chassis It can be used for distance measurement, velocity.
Can use with other devices to realize function of
tracing, obstacle avoidance, distance testing, speed
testing,
Wireless remote control.
Size: 21 x 15 cm (L x W).
Wheel size: 6.5 x 2.7cm (Dia. x H).
14 Connecting wires(MF,FF,MM) Dupont Cable Color Jumper Wire, 2.54mm 1P-1P
Strip M/M, M/F, F/F
15 Bulb Energy Efficient

16 Bulb holder Holder type- B22

17 Red and Black Wires Tinned Copper,Cable Thickness (AWG):28,Cable


Length (m): 5
18 Plug(Male) Designed for electrical connections and power
cords
Compatible with standard 2 pin sockets
Made from high-quality materials for durability
19 Relay Module Input signal can come directly from a
microcontroller
Works at 3V or 5V to control relays
Can switch a variety of AC or DC high voltage loads

20 ESP8266 Power input: 4.5V ~ 9V (10VMAX), USB-powered


Transfer rate: 110-460800bps
Support UART / GPIO data communication
interface
Support Smart Link Smart Networking
Working temperature: -40°C ~ + 125°C

4|Page
Activity-2

Bluetooth-Controlled Robot:

Build a robot that can be controlled using a smartphone through Bluetooth.

Components Required:

Arduino Uno, Bluetooth Module, Motor Driver Circuit, Robot Chassis,


Wheels,12V Battery, Connecting Wires

Working Principle:

The smartphone sends control signals via Bluetooth to the Arduino. Arduino
interprets the commands and controls the motors via the motor driver.

Circuit Diagram:

The connection between the Arduino, Bluetooth module, motor driver, and
motors.

5|Page
Block Diagram:

Arduino code:

#include <SoftwareSerial.h>

// Define motor driver pins


const int IN1 = 2;
const int IN2 = 3;
const int IN3 = 4;
const int IN4 = 5;

// Define Bluetooth RX and TX pins


const int BT_RX = 1;
const int BT_TX = 0;

// Create a SoftwareSerial object


SoftwareSerial bluetooth(BT_RX, BT_TX);

void setup() {
// Initialize serial communication with Bluetooth module
bluetooth.begin(9600);

// Initialize motor driver pins as outputs


pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);

// Ensure motors are stopped

6|Page
stopMotors();
}

void loop() {
if (bluetooth.available()) {
char command = bluetooth.read();
executeCommand(command);
}
}

void executeCommand(char command) {


switch (command) {
case 'F': // Move forward
moveForward();
break;
case 'B': // Move backward
moveBackward();
break;
case 'L': // Turn left
turnLeft();
break;
case 'R': // Turn right
turnRight();
break;
case 'S': // Stop
stopMotors();
break;
}
}

void moveForward() {
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
}

void moveBackward() {
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, LOW);

7|Page
digitalWrite(IN4, HIGH);
}

void turnLeft() {
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
}

void turnRight() {
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
}

void stopMotors() {
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, LOW);
}

8|Page
Activity-3
Radar System with Arduino Uno

Working Principle:

A radar system using Arduino Uno works by emitting radio waves through a
transmitter and receiving the reflected waves using a receiver. The Arduino
processes the time delay between transmission and reception to calculate the
distance of an object and display the results.

Circuit Diagram:

The connection between the Arduino Uno, Ultrasonic sensor and Servo
motor.

Block Diagram:

9|Page
Steps to run:

1. Upload Arduino Code:

 Open the Arduino IDE.


 Copy and paste the Arduino code provided earlier.
 Click on the Upload button to upload the code to your Arduino.

2. Install the Processing IDE:

 Download and install the Processing IDE from Processing.org.

https://processing.org/download

3. Connect Arduino to Computer:

 Connect your Arduino board to your computer via USB.

4. Check and Change the Port Number in Processing Code:

 Open the Processing IDE.

In line 19, change "COM3" to the correct serial port where your Arduino is
connected. You can check the port on the following systems:

 Windows: Go to Device Manager → Ports (COM & LPT) to see which


port your Arduino is connected to (e.g., "COM4").

5. Run the Processing Code:

 Click Run in the Processing IDE to start the radar visualization.

6. Observe the Radar Display:

 The radar system should now appear on the Processing IDE window,
displaying the distance as a line based on the angle.

Arduino code:

#include <Servo.h>.
// Defines Tirg and Echo pins of the Ultrasonic Sensor
const int trigPin = 10;
const int echoPin = 9;
// Variables for the duration and the distance

10 | P a g e
long duration;
int distance;
Servo myServo; // Creates a servo object for controlling the servo motor
void setup() {
pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
pinMode(echoPin, INPUT); // Sets the echoPin as an Input
Serial.begin(9600);
myServo.attach(3); // Defines on which pin is the servo motor attached
}
void loop() {
// rotates the servo motor from 15 to 165 degrees
for(int i=15;i<=165;i++){
myServo.write(i);
delay(30);
distance = calculateDistance();// Calls a function for calculating the distance
measured by the Ultrasonic sensor for each degree

Serial.print(i); // Sends the current degree into the Serial Port


Serial.print(","); // Sends addition character right next to the previous value needed
later in the Processing IDE for indexing
Serial.print(distance); // Sends the distance value into the Serial Port
Serial.print("."); // Sends addition character right next to the previous value needed
later in the Processing IDE for indexing
}
// Repeats the previous lines from 165 to 15 degrees
for(int i=165;i>15;i--){
myServo.write(i);
delay(30);
distance = calculateDistance();
Serial.print(i);

11 | P a g e
Serial.print(",");
Serial.print(distance);
Serial.print(".");
}
}
// Function for calculating the distance measured by the Ultrasonic sensor
int calculateDistance(){

digitalWrite(trigPin, LOW);
delayMicroseconds(5);
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH); // Reads the echoPin, returns the sound wave
travel time in microseconds
distance= duration*0.034/2;
return distance;
}

Processing Code:

import processing.serial.*; // imports library for serial communication


import java.awt.event.KeyEvent; // imports library for reading the data from the serial
port
import java.io.IOException;
Serial myPort; // defines Object Serial
// defubes variables
String angle="";
String distance="";
String data="";
String noObject;
float pixsDistance;
int iAngle, iDistance;

12 | P a g e
int index1=0;
int index2=0;
PFont orcFont;
void setup() {

size (1920, 1080);


smooth();
myPort = new Serial(this,"COM4", 9600); // starts the serial communication
myPort.bufferUntil('.'); // reads the data from the serial port up to the character '.'. So
actually it reads this: angle,distance.

}
void draw() {

fill(98,245,31);

// simulating motion blur and slow fade of the moving line


noStroke();
fill(0,4);
rect(0, 0, width, 1010);

fill(98,245,31); // green color


// calls the functions for drawing the radar
drawRadar();
drawLine();
drawObject();
drawText();
}
void serialEvent (Serial myPort) { // starts reading data from the Serial Port

13 | P a g e
// reads the data from the Serial Port up to the character '.' and puts it into the String
variable "data".
data = myPort.readStringUntil('.');
data = data.substring(0,data.length()-1);

index1 = data.indexOf(","); // find the character ',' and puts it into the variable
"index1"
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
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

// converts the String variables into Integer


iAngle = int(angle);
iDistance = int(distance);
}
void drawRadar() {
pushMatrix();
translate(960,1000); // moves the starting coordinats to new location
noFill();
strokeWeight(2);
stroke(98,245,31);
// draws the arc lines
arc(0,0,1800,1800,PI,TWO_PI);
arc(0,0,1400,1400,PI,TWO_PI);
arc(0,0,1000,1000,PI,TWO_PI);
arc(0,0,600,600,PI,TWO_PI);
// draws the angle lines
line(-960,0,960,0);
line(0,0,-960*cos(radians(30)),-960*sin(radians(30)));
line(0,0,-960*cos(radians(60)),-960*sin(radians(60)));
line(0,0,-960*cos(radians(90)),-960*sin(radians(90)));

14 | P a g e
line(0,0,-960*cos(radians(120)),-960*sin(radians(120)));
line(0,0,-960*cos(radians(150)),-960*sin(radians(150)));
line(-960*cos(radians(30)),0,960,0);
popMatrix();
}
void drawObject() {
pushMatrix();
translate(960,1000); // moves the starting coordinats to new location
strokeWeight(9);
stroke(255,10,10); // red color
pixsDistance = iDistance*22.5; // covers the distance from the sensor from cm to
pixels
// limiting the range to 40 cms
if(iDistance<40){
// draws the object according to the angle and the distance
line(pixsDistance*cos(radians(iAngle)),-
pixsDistance*sin(radians(iAngle)),950*cos(radians(iAngle)),-
950*sin(radians(iAngle)));
}
popMatrix();
}
void drawLine() {
pushMatrix();
strokeWeight(9);
stroke(30,250,60);
translate(960,1000); // moves the starting coordinats to new location
line(0,0,950*cos(radians(iAngle)),-950*sin(radians(iAngle))); // draws the line
according to the angle
popMatrix();
}

15 | P a g e
void drawText() { // draws the texts on the screen

pushMatrix();
if(iDistance>40) {
noObject = "Out of Range";
}
else {
noObject = "In Range";
}
fill(0,0,0);
noStroke();
rect(0, 1010, width, 1080);
fill(98,245,31);
textSize(25);
text("10cm",1180,990);
text("20cm",1380,990);
text("30cm",1580,990);
text("40cm",1780,990);
textSize(40);
text("Object: " + noObject, 240, 1050);
text("Angle: " + iAngle +" °", 1050, 1050);
text("Distance: ", 1380, 1050);
if(iDistance<40) {
text(" " + iDistance +" cm", 1400, 1050);
}
textSize(25);
fill(98,245,60);
translate(961+960*cos(radians(30)),982-960*sin(radians(30)));
rotate(-radians(-60));
text("30°",0,0);
resetMatrix();
translate(954+960*cos(radians(60)),984-960*sin(radians(60)));
rotate(-radians(-30));

16 | P a g e
text("60°",0,0);
resetMatrix();
translate(945+960*cos(radians(90)),990-960*sin(radians(90)));
rotate(radians(0));
text("90°",0,0);
resetMatrix();
translate(935+960*cos(radians(120)),1003-960*sin(radians(120)));
rotate(radians(-30));
text("120°",0,0);
resetMatrix();
translate(940+960*cos(radians(150)),1018-960*sin(radians(150)));
rotate(radians(-60));
text("150°",0,0);
popMatrix();
}

17 | P a g e
Activity-4

Home Automation System using ESP8266

Working Principle:

Home automation using ESP8266 works by connecting the ESP8266 microcontroller to


WiFi, allowing it to receive commands from a web server, smartphone app, or voice
assistant to control devices like lights, fans, or appliances. The ESP8266 interprets these
commands and activates relays or GPIO pins to operate the connected devices.

Circuit Diagram:

Block diagram:

18 | P a g e
Arduino code:

#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>

// Replace with your network credentials const


char* ssid = "";
const char* password = "";

// Replace with your server URL


const String serverUrl = " https://autohome.pythonanywhere.com/fetch";

// GPIO where the relay is connected


const int relayPin = D6; // Use appropriate GPIO pin (D6 corresponds to GPIO12)

WiFiClient wifiClient; // Create a WiFiClient object

void setup() {
// Begin serial communication for debugging
Serial.begin(115200);

// Initialize relayPin as an output and set it off by default


pinMode(relayPin, OUTPUT);
digitalWrite(relayPin, HIGH); // Relay off by default

// Connect to Wi-Fi
Serial.println("Connecting to Wi-Fi...");
WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {


delay(1000);
Serial.print(".");
}

Serial.println();
Serial.println("Connected to Wi-Fi!");
Serial.print("IP Address: ");
Serial.println(WiFi.localIP());
}

void loop() {
if (WiFi.status() == WL_CONNECTED) {

19 | P a g e
HTTPClient http;

// Start connection and send the GET request using the updated API if
(http.begin(wifiClient, serverUrl)) { // Pass WiFiClient object and URL
int httpCode = http.GET();

if (httpCode > 0) { //
HTTP response received
Serial.printf("HTTP Response code: %d\n", httpCode);
String payload = http.getString();
Serial.println("Payload: " + payload);

// Process server response


if (payload == "on") {
digitalWrite(relayPin, LOW); // Turn on relay
Serial.println("Relay turned ON");
} else if (payload == "off") {
digitalWrite(relayPin, HIGH); // Turn off relay
Serial.println("Relay turned OFF");
} else {
Serial.println("Unknown command: " + payload);
}
} else {
Serial.printf("HTTP request failed, error: %s\n", http.errorToString(httpCode).c_str());
}

http.end(); // Free resources


} else {
Serial.println("HTTP connection failed!");
}
} else {
Serial.println("Wi-Fi not connected!");
}

// Wait before making the next request


delay(500); // Adjust delay as needed
}

Python code:

from flask import Flask, render_template, jsonify

app = Flask(_name_)

# State to store button status


button_status = {"status": "OFF"}

20 | P a g e
status="off" @app.route('/') def
home():
return render_template('index1.html', button_status=button_status["status"])

@app.route('/toggle', methods=['GET'])
def toggle(): global status
# Toggle the button state if
button_status["status"] == "OFF":
status = 'on'
button_status["status"] = "ON"

else:
button_status["status"] = "OFF"
status='off'
return jsonify(status=button_status["status"])

@app.route('/fetch', methods=['GET'])
def fetch():
global status
print(status)
return str(status)

if _name_ == '_main_':
app.run(debug=True, host='0.0.0.0')

Html code:

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home Automation</title>
<style>
/* Global Styles */
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
background-size: cover; /* Ensures background covers the entire page */
background-position: center;
background-repeat: no-repeat;

21 | P a g e
margin: 0;
padding: 0;
text-align: center;
}

nav {
background-color: white; /* Set navbar background to white */
padding: 20px 0; /* Vertical padding for space inside the navbar */
position: relative;
display: flex;
justify-content: center;
align-items: center;
border-bottom: 2px solid #ddd; /* Optional: adds a subtle border at the bottom */
height: 54px; /* Adjust this height to make the navbar bigger */
}

nav h1 {
color: black;
margin: 0;
font-size: 24px;
font-weight: bold;
}

nav img {
position: absolute;
right: 20px;
top: -15px;
width: 100px;
height: auto;
}

/* Add this for the new image in the top-left corner */


nav img.left-image {
position: absolute;
left: 20px;
top: -2px;
width: 100px;
height: auto;
}
/* Main Content Section */
.content {
display: flex;
justify-content: space-between;
padding: 50px 20px;
margin-top: 30px;
}

22 | P a g e
/* Left Section (Push Button and Status) */
.left-section {
flex: 1;
background-color: white;
padding: 20px;
margin-right: 20px;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
height: 250px; /* Set a fixed height */
width: 250px; /* Set width equal to height for a square */
display: flex;
flex-direction: column;
justify-content: center;
}

/* Right Section (GIF) */


.right-section {
flex: 1;
background-color: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
height: 250px; /* Set a fixed height */
width: 250px; /* Set width equal to height for a square */
display: flex;
justify-content: center;
align-items: center;
}

h2 {
color: #333;
font-size: 28px;
}

button {
padding: 15px 30px;
font-size: 18px;
border: none;
cursor: pointer;

23 | P a g e
background-color: #007bff;
color: white;
border-radius: 5px;
transition: background-color 0.3s ease;
}

button:hover {
background-color: #0056b3;
}

.status {
margin-top: 20px;
font-size: 20px;
color: #333;
}

/* Responsive Styles */
@media (max-width: 600px) {
.content {
flex-direction: column;
padding: 20px;
}

.left-section,
.right-section {
margin-right: 0;
margin-bottom: 20px;
height: auto;
}

nav h1 {
font-size: 20px;
}

button {
width: 100%;
padding: 12px;
}

nav img {
width: 120px;
}
}
</style>
</head>

24 | P a g e
<body>
<nav>
<img src="static/karnataka.png" alt="Karnataka Logo" class="left-image">
<h1>Home Automation</h1>
<img src="static/gttc.png" alt="Logo" class="right-logo">
</nav>

<div class="content">
<!-- Left Section for Button and Status -->
<div class="left-section">
<h2>Push Button ON/OFF</h2>
<button id="toggle-button">Toggle</button>
<div class="status">Current Status: <span id="status">OFF</span></div>
</div>

<!-- Right Section for GIF -->


<div class="right-section">
<img src="static/SaveElectricBill-Automated-House.gif" alt="GIF" style="max-
width: 100%; height: auto;">
</div>
</div>

<script>
const button = document.getElementById('toggle-button');
const statusSpan = document.getElementById('status');
button.addEventListener('click', async () => {
// Use GET method instead of POST
const response = await fetch('/toggle', { method: 'GET' });
const data = await response.json();
statusSpan.textContent = data.status;
});
</script>
</body>
</html>

Run this URL:

https://autohome.pythonanywhere.com/

25 | P a g e

You might also like