0% found this document useful (0 votes)
15 views19 pages

Carrer Guidance Pro

The document outlines a career guidance program on electronics, focusing on robotics and its applications. It details three projects: a Bluetooth-controlled robot, a radar system using Arduino, and a home automation system with ESP8266, along with the necessary components and code for implementation. Each project aims to enhance efficiency and automate tasks through innovative technology integration.

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)
15 views19 pages

Carrer Guidance Pro

The document outlines a career guidance program on electronics, focusing on robotics and its applications. It details three projects: a Bluetooth-controlled robot, a radar system using Arduino, and a home automation system with ESP8266, along with the necessary components and code for implementation. Each project aims to enhance efficiency and automate tasks through innovative technology integration.

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/ 19

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);

6|Page
// Ensure motors are stopped
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);

7|Page
digitalWrite(IN2, HIGH);
digitalWrite(IN3, LOW);
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:

Block Diagram:

9|Page
Arduino code:

#include <Servo.h>
#include <U8g2lib.h>
#include <Wire.h>

// OLED display initialization


U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /*
reset=*/ U8X8_PIN_NONE); // Change if needed

// Define pins
const int trigPin = 10;
const int echoPin = 11;
const int servoPin = 12;
// Create servo object
Servo myServo;

// Variables for ultrasonic sensor


long duration;
int distance;

// Radar sweep angle range


const int minAngle = 0;
const int maxAngle = 180;

// Number of readings for averaging


const int numReadings = 5;

10 | P a g e
// Radar radius in display units (adjust based on your display)
const int radarRadius = 64 - 12; // Leave space for the last line

// Initialization function
void setup() {
Serial.begin(9600);

// Servo setup
myServo.attach(servoPin);

// Ultrasonic sensor setup


pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);

// OLED setup
u8g2.begin();
}

// Main loop function


void loop() {
for (int angle = minAngle; angle <= maxAngle; angle += 5) { // Adjust
the step size if needed
myServo.write(angle);
delay(10); // Allow the servo to move

distance = getAverageDistance();
displayRadar(angle, distance);
}

for (int angle = maxAngle; angle >= minAngle; angle -= 5) { // Adjust


the step size if needed
myServo.write(angle);
delay(10); // Allow the servo to move

11 | P a g e
distance = getAverageDistance();
displayRadar(angle, distance);
}
}

// Function to get the average distance from the ultrasonic sensor


int getAverageDistance() {
long totalDistance = 0;
for (int i = 0; i < numReadings; i++) {
totalDistance += getDistance();
delay(10); // Short delay between readings
}
return totalDistance / numReadings;
}

// Function to get a single distance reading from the ultrasonic sensor


int getDistance() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);


return duration * 0.034 / 2; // Convert to cm
}

// Function to display radar data on OLED


void displayRadar(int angle, int distance) {
// Clear the display buffer
u8g2.clearBuffer();

// Draw radar background


drawRadarBackground();

// Calculate radar point coordinates


int x = 64 + distance * cos(radians(angle)) * radarRadius / 200;
int y = 64 - 12 - distance * sin(radians(angle)) * radarRadius / 200;

12 | P a g e
// Draw the radar sweep
u8g2.drawLine(64, 64 - 12, x, y);

// Draw detected object if within display range and above the last line
if (distance < 200 && y < 64 - 12 - 3) { // Check if y is above the text
area
u8g2.drawDisc(x, y, 3);
}

// Display distance and angle on the last line


u8g2.setFont(u8g2_font_ncenB08_tr); // Choose a suitable font
u8g2.setCursor(0, 64);
u8g2.print("Angle: ");
u8g2.print(angle);
u8g2.print(" Dist: ");
u8g2.print(distance);
u8g2.print(" cm");

// Update the display


u8g2.sendBuffer();

// Print data to Serial Monitor


Serial.print("Angle: ");
Serial.print(angle);
Serial.print(" degrees, Distance: ");
Serial.print(distance);
Serial.println(" cm");
}

// Function to draw static radar background on the OLED


void drawRadarBackground() {
// Draw central axis
u8g2.drawLine(64, 64 - radarRadius - 12, 64, 64 - 12);
u8g2.drawLine(64 - radarRadius, 64 - 12, 64 + radarRadius, 64 - 12);

13 | P a g e
// Draw concentric circles for distance reference
for (int i = 1; i <= 3; i++) {
u8g2.drawCircle(64, 64 - 12, i * radarRadius / 3);
}

// Draw angle lines


for (int a = 0; a <= 180; a += 30) {
int x = 64 + cos(radians(a)) * radarRadius;
int y = 64 - 12 - sin(radians(a)) * radarRadius;
u8g2.drawLine(64, 64 - 12, x, y);
}
}
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:

14 | 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);

15 | P a g e
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) {
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!");
}

16 | P a g e
// 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"}
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)

17 | P a g e
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>Flask App</title>
<style> body { font-
family: Arial, sans-serif;
background-color: #f4f4f4;
text-align: center;
margin-top: 50px;
} button {
padding: 10px 20px; font-
size: 16px; border: none;
cursor: pointer;
background-color: #007bff;
color: white;
border-radius: 5px;
}
button:hover {
background-color: #0056b3;
}
.status {
margin-top: 20px;
font-size: 18px;
}
</style>
</head>
<body>
<h1>Push Button ON/OFF</h1>
<button id="toggle-button">Toggle</button>
<div class="status">Current Status: <span id="status">{{ button_status }}</span></div>

18 | P a g e
<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/

19 | P a g e

You might also like