The user controls the car via bluetooth through the Bluefruit LE app. The user can switch between a "sem-auto" mode and a manual mode.

Dependencies:   Motor Ultrasonic_HCSR04_HelloWorld_code mbed

Introduction :

This is a mini-project for the final semester of my sophomore year on assembling and interfacing a semi-automatic bluetooth controlled car with the help of mbed-LPC1768. This was one of the semester projects intended for evaluation to fulfill the requirements for attaining an undergraduate degree ( Bachelor's of Technology) in Electronics and Communication Engineering.

The user can switch to an "auto-pilot" like mode by activating the functionality of the sonar sensor, thus giving complete control to the user by allowing the user to switch between manual and semi-autopilot mode. When an obstacle is detected by the sensor the bot is stopped by the sensor. Differential torque has been used to turn the car.

/media/uploads/Rohit99/project_image.jpg

Future Prospectives :

(1) Adding a few more sonar sensors on the bot to detect objects surrounding it simultaneously and automate the whole process or allowing the user to switch between a complete autopilot mode, a semi-autopilot mode and a manual mode.

(2) Integrating Simultaneous Localization and Mapping (SLAM) with the bot so that it can update a map of an unknown environment while simultaneously keeping track of an agent’s location within it using deep neural networks. (3) Adding a few gas and dust sensors to make a mobile weather station.

References :

The references mentioned below were of great help :

I would also like to acknowledge jlogreira3 for his/her project.

Files at this revision

API Documentation at this revision

Comitter:
Rohit99
Date:
Sat May 19 10:52:32 2018 +0000
Commit message:
Done

Changed in this revision

Motor.lib Show annotated file Show diff for this revision Revisions of this file
Ultrasonic_HCSR04_HelloWorld_code.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r c37818d82347 Motor.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Motor.lib	Sat May 19 10:52:32 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/Motor/#f265e441bcd9
diff -r 000000000000 -r c37818d82347 Ultrasonic_HCSR04_HelloWorld_code.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Ultrasonic_HCSR04_HelloWorld_code.lib	Sat May 19 10:52:32 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/Rohit99/code/Ultrasonic_HCSR04_HelloWorld_code/#c45cb1c1b8c4
diff -r 000000000000 -r c37818d82347 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat May 19 10:52:32 2018 +0000
@@ -0,0 +1,141 @@
+// Project
+#include "mbed.h"
+#include "Motor.h"
+#include "ultrasonic.h"
+
+Serial pc (USBTX, USBRX);
+BusOut myled(LED1,LED2,LED3,LED4);
+Serial blue(p28,p27);
+Motor motorA(p23, p6, p5); // pwm, fwd, rev
+Motor motorB(p24, p11, p12); // pwm, fwd, rev
+
+int dist;
+
+void dist_func(int distance)
+{
+    //put code here to execute when the distance has changed
+    pc.printf("Distance %d mm\r\n", distance);
+    dist = distance;
+}
+ultrasonic mu(p6, p7, .1, 1, &dist_func);
+
+int main()
+{
+    float motorSpeed_A = 0.0;
+    float motorSpeed_B = 0.0;
+    char bnum = 0;
+    char bhit = 0;
+    mu.startUpdates();//start measuring the distance
+    while(1)
+    {   
+        motorA.speed(motorSpeed_A);
+        motorB.speed(motorSpeed_B);
+        if (blue.getc() == '!') {
+            if (blue.getc() == 'B') { //button data packet
+                bnum = blue.getc(); //button number
+                bhit = blue.getc(); //1=hit, 0=release
+                if (blue.getc() == char(~('!' + 'B' + bnum + bhit))) { //checksum OK?
+                    myled = bnum - '1'; //current button number will appear on LEDs
+                    switch (bnum) {
+                        case '1' : // number button 1
+                        if (bhit == '1'){
+                            }
+                        else {
+                            mu.checkDistance();
+                            if (dist <= 50){
+                                motorSpeed_A = 0.0; // Stop
+                                motorSpeed_B = 0.0; // Stop
+                                }
+                            }
+                        break;
+                        case '2' : // number button 2
+                        if (bhit == '1'){
+                            }
+                        else {
+                            motorSpeed_A -= 0.2; // decreasing speed
+                            motorSpeed_B -= 0.2; // decreasing speed
+                            }
+                        break;
+                        case '3' : // number button 3
+                        if(bhit == '1'){
+                        }
+                        else {
+                            motorSpeed_A = 0.0; // Stop
+                            motorSpeed_B = 0.0; // Stop
+                            }
+                        break;
+                        case '4' : // Reverse Rotation
+                            // Hitting 4 on the numpad activates reverse mode and turns 
+                            if (bhit == '1'){
+                                }
+                            else {
+                                if (blue.getc() == '!') {
+                                if (blue.getc() == 'B') { //button data packet
+                                bnum = blue.getc(); //button number
+                                bhit = blue.getc(); //1=hit, 0=release
+                                if (blue.getc() == char(~('!' + 'B' + bnum + bhit))) {
+                                    // For reverse turn
+                                    myled = bnum - '1';
+                                    switch (bnum) {
+                                        case '7' : // arrow left
+                                            if (bhit == '1'){
+                                                            }
+                                            else {
+                                                motorSpeed_A = -0.5;
+                                                motorSpeed_B = -0.1;
+                                                    }
+                                            break;
+                                        case '8' : // arrow right
+                                            if (bhit == '1'){
+                                                            }
+                                            else {
+                                                motorSpeed_A = -0.1;
+                                                motorSpeed_B = -0.5;
+                                                }
+                                        default:
+                                    break;                                     
+                                        }
+                                    }
+                                }
+                            }
+                        break;                                        
+                        case '5' : // arrow up button
+                            if (bhit == '1') {
+                                //add hit code here
+                                motorSpeed_A += 0.2; // increasing speed
+                                motorSpeed_B += 0.2; // increasing speed
+                                }
+                        break;
+                        case '6' : // arrow down
+                            if (bhit == '1') {
+                                }
+                            else {
+                                motorSpeed_A -= 0.2; // decreasing speed
+                                motorSpeed_B -= 0.2; // decreasing speed
+                                }
+                        break;
+                        case '7' : // arrow left
+                            if (bhit == '1'){
+                                }
+                            else {
+                                motorSpeed_A = 0.5;
+                                motorSpeed_B = 0.1;
+                                }
+                        break;
+                        case '8' : // arrow right
+                            if (bhit == '1'){
+                                }
+                            else {
+                                motorSpeed_A = 0.1;
+                                motorSpeed_B = 0.5;
+                                }
+                        //break;                             
+                        default :
+                        break;
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
\ No newline at end of file
diff -r 000000000000 -r c37818d82347 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat May 19 10:52:32 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/994bdf8177cb
\ No newline at end of file