A robot car with ultrasonic sensor
this week project is about to make a simple circuit connected wirelessly with the arduino through GUI app on my mobile , so I chose a simple project which is ( one DC motor which will work as a robot wheel with ultrasonic sensor which will decrease and increase the motor speed depending on the distance).
I used some electronics like:
DC motor.
ultrasonic sensor.
some jumpers
Arduino
breadboard.
CD working as a wheel.
H_bridge module.
cardboard.
Bluetooth module.
GUI App.
the real connection
part 1
It has three steps:
I started with designing my connection using tinkercad .
Then I made the connection between the component on the real.
then I wrote the code and test it.
After that I trying to make the wireless connection.
Finally, I tried to control it remotely.
tinkercad connection
here when I doenloaded AF_Motor library
tinkercad design ( H-bridge for motor at arduino pins (9/10) + ultrasonic sensor at pins (3/2) and finally buzzer at pin 4).
part 2
the implementation process contained applying the connection on the real following the instructions and info from tinkercad design ,then writing the code for every condition i need to apply using the DC motor and the ultrasonic sensor( because i need the motor to change it's speed depending on the distance which will be measured by the sensor to avoid obstacles).
so the code in this process has 3 if conditions the first one is when the distance which be read from ultrasonic sensor is less than 30 so the speed for motor 1 will be '100' and foe motor 2 it will be '0'/ the second one when distance is more than or equal 30 so the motor 1 speed will be '150 ' and motor 2 will be also '0'/ the third one when distance is more than or equal 60 so the motor 1 speed will be '200' and the motor 2 will be '0'/ finally if the obstacles can't be found in 90 cm then the first motor speed will be '250' and the buzzer will be on )
Then i had to integrate the code which will be responsible for the wireless connection with my code and also add the bluetooth module to connect successfully.
Finally, I tried to test my code and circuit with Arduino usb and also without it by using the bluetooth app.
GUI module
changing the code according to the speed and directions
Actually, in this week I learned some different things from my friends and also they helped me to choose this idea , as i am not good enough with coding and also with how to discover the function of new component so they helped me to discover how ultrasonic sensor work and how we connect it with other parts and the great help was in the coding process because i wanted to code the DC motor to stop when the distance measured by the sensor equal zero but i get stuck , so my fried abdelfattah give me another point of view when he send me another project similar with my own one and i discovered that i can change the speed according to the measured distance and also change the directions when he see obstacles.
in this project i had two different problems :
the first one was about the bractes in code and my classmate mahmoud helped me to correct them .
the second one that when i trued to test my Arduino i faced a problem that my Arduino can't be saw by Arduion program and i faced this problem before and i changed the Arduino module but when I tried to use the new one the same obstacle appears.
the bractes problems
The Arduino problem
this is my final project circuit , i applied the skills which I gained this week in coding and wireless connection to create this project but unfortunately , i had a problem with my Arduino so, i can't recording the final output.
the coolest thing was the robot arm we built in the lab and the competition that happened .
the competition
Title of Media