Carrer Guidance Pro
Carrer Guidance Pro
Career Guidance
Program-Electronics
1|Page
Activity-1
Introduction to Robotics
Objective:
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:
6 Motor driver circuit L298N Motor Driver Shield or relative Driver Shield
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
4|Page
Activity-2
Bluetooth-Controlled Robot:
Components Required:
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>
void setup() {
// Initialize serial communication with Bluetooth module
bluetooth.begin(9600);
6|Page
// Ensure motors are stopped
stopMotors();
}
void loop() {
if (bluetooth.available()) {
char command = bluetooth.read();
executeCommand(command);
}
}
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>
// Define pins
const int trigPin = 10;
const int echoPin = 11;
const int servoPin = 12;
// Create servo object
Servo myServo;
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);
// OLED setup
u8g2.begin();
}
distance = getAverageDistance();
displayRadar(angle, distance);
}
11 | P a g e
distance = getAverageDistance();
displayRadar(angle, distance);
}
}
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);
}
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);
}
Working Principle:
Circuit Diagram:
Block diagram:
14 | P a g e
Arduino code:
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
void setup() {
// Begin serial communication for debugging
Serial.begin(115200);
// 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);
16 | P a g e
// Wait before making the next request
delay(500); // Adjust delay as needed
}
Python code:
app = Flask(_name_)
@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>
https://autohome.pythonanywhere.com/
19 | P a g e