Skip to main content

Computer Controlled Robot.(Serial communication)

Serial Communication :- Serial Communication is  the Process of Sending one bit of data at a time, sequentially over the communication channel or Computer bus.


Computer Controlled Robot :-

Component Required :-

  1.  2 -Motors 
  2. Motor Driver 
  3. Arduino  uno
  4. Wheels
  5. PC
Project Objectives
  1. Control the Direction of Robot by pressing any Key from keyword.
Circuit Diagram
Fig :-Circuit Diagram
Connect  the Circuit diagram as shown in Figure.
Connect the Controller Pin from Motor Driver to  6,7,8,9 pin of Arduino.
Connect  the power pin of Motor driver to 5V and GND of  Arduino.
Connect the Motor to the Motor Driver as shown in Figure.
Now Arrange the circuit in the Chasis and Connect the motor with Wheels.

Code


int lm1=6;
int lm2=7;
int rm1=8;
int rm2=9;
void setup() {
  // put your setup code here, to run once:
  pinMode(lm1,OUTPUT);
  pinMode(lm2,OUTPUT);
  pinMode(rm1,OUTPUT);
  pinMode(rm2,OUTPUT);

  Serial.begin(9600);
  Serial.println("press \n forward 8 \n backward 2 \n left 4 \n right 6 \n stop others pin");

}

void loop() {
  // put your main code here, to run repeatedly:
while(Serial.available()==0);
int val= Serial.read()-'0';
if(val==8)
{
  digitalWrite(lm1,HIGH);
  digitalWrite(lm2,LOW);
  digitalWrite(rm1,HIGH);
  digitalWrite(rm2,LOW);
  Serial.println(" \n now moving forward");
}
else if(val==2)
{
  digitalWrite(lm1,LOW);
  digitalWrite(lm2,HIGH);
  digitalWrite(rm1,LOW);
  digitalWrite(rm2,HIGH);
  Serial.println(" \n now moving backward");
}

else if(val==4)
{
  digitalWrite(lm1,HIGH);
  digitalWrite(lm2,LOW);
  digitalWrite(rm1,LOW);
  digitalWrite(rm2,HIGH);
  Serial.println(" \n now moving left");
  
}
else if(val==6)
{
  digitalWrite(lm1,LOW);
  digitalWrite(lm2,HIGH);
  digitalWrite(rm1,HIGH);
  digitalWrite(rm2,LOW);
  Serial.println("\n now moving right");
}
else
{
  digitalWrite(lm1,LOW);
  digitalWrite(lm2,LOW);
  digitalWrite(rm1,LOW);
  digitalWrite(rm2,LOW);
  Serial.println(" \n now stop");
}
Serial.flush();
}
Now upload the Code and open the Serial monitor .
Press 8 :- Robot Moves Forwards
Press 2 :- Robot Moves Backwards
Press 4 :- Robot moves in left direction
Press 6 :- Robot Moves in Right direction
Press any other keys to stop the Robot.
Project Demonstration  at Cosmos Mini Expo.

Popular posts from this blog

Multiple mcp23017 interfacing with Arduino

MCP23017 is the I/O port extender that runs on 12C. It is 16-bit I/O expender.in this tutorial we are going to interface the single and multiple  mcp23017 with arduino.  fig:- mcp32017 module IT has 16 I/O ports from PA0 to PA7 and PB0 to PB7. first of all we are going to interface the single mcp23017 with Arduino. For this  connect the circuit as shown on figure. Download the library for mcp23017  from  sketch-- include library -- manage libraries.

warm clothes distribution program

‘ Small step can make a big difference ’ Rural Women Development Centre from morang,Nepal distributed the warm clothes to the needy people. They manage it possible by collecting fund from working staffs and management committe. Here is the video link of the distribution program. https://youtu.be/AxaHbivcQUM

Top 10 sites for free stock images and videos in 2023.

Visual content is a crucial element in any successful online presence, whether it’s a website, blog post, or social media platform. However, creating high-quality images and videos can be expensive and time-consuming. Fortunately, there are many websites that offer free stock images and videos to help you elevate your content without breaking the bank. In this article, we will discuss the top 10  sites for free stock images and videos in 2023. Unplash Pexels Pixabay Freestocks.org Burst StockSnap Gratisography Kaboompics Reshot PicJumbo  Unplash Unsplash offers a large collection of free high-resolution photos so, it is popular choice for many content creators due to its extensive library of high-quality stock images. The platform offers a wide variety of photos, including images of nature, people, and architecture, making it a great choice for many types of projects. Unsplash also allows users to download and use the images for both pers...