Introduction: Autonomous Robot With LinkitONE

Ever wondered how autonomous robots are made? Wanted to make a cool project? Got a Linkit board? Then you are at the right place!

Here i'll be making a robot with LinkitONE with some local robotic parts and servo motors.

Lets begin..

Step 1: What Do You Need?

Electronics:

1) LinkitONE board

2) Battery pack

3) Breadboard

Robotic parts:

1) Axels

2) Gears

3) Wheels

3) Sliders

4) Metal board

5) Plastic shelters

6) Relay box

Step 2: Building the Main Strcuture

Now we need to build the main structure. For this we'll use 2 main metal sheets and one half size sheet to attach the both. This will make a basic structure for balancing the robot.

Step 3: Attaching the Servos

Now we'll attach some servo motors and then plug them up. Carefully attach them using holes and use more than 2 nuts and bolts to attach so it is not loose and can be tightened up.

After this, move to the next step.

Step 4: Hooking Up Gears

Now we'll hook up some gears. We'll attach 2 gears together with one small gear in between like this. This will help us make a good maniacal design that gives more amount of tourge.

Step 5: Attaching the Wheels

Now attach the wheels! Carefully attach them on the axle and tighten it up nicely so it doesn't come out. Do check twice that the wheels are in their proper position.

Step 6: Adding a Breadboard

Now we can also interface sensors, for that add a breadboard to it. Add it under the robot so its not visible!

Step 7: Add Sensors

Add this sound sensor so that when ever you clap, the robot starts to move! :D :D

Step 8: Connecting the Motors

Finally connect the motors together and connect the wires to the relay box.

Step 9: Attaching the Relay Box With Linkit

This comes the main part. You'll need to interface Linkit board with your relay bx as the relay box has batteries and motor ICs. Interface that using the servo library.

Pin connections:

SN1 - Pin 13

SN2 - Pin 12

SN1 - Pin 11

VCC - VCC of your board

GND - GND of your board

After this you are done! Now we'll program the robot and get started with the code.

Step 10: Finalizing the Design!

Finalize the design by attaching the relay box correctly and tightening up everything.

Step 11: Writing Some Code

The code here is very simple!

You robot has can do many functions like moving forward, moving backward, rotating etc. You can figure out the functions.

Here we are making a obstacle avoid er using ultrasound sensor. We;ll use the servo library in this.

CODE:

---------------------

#include<servo.h>

const int RForward = 0; const int RBackward = 180; const int LForward = RBackward; const int LBackward = RForward; const int RNeutral = 90; const int LNeutral = 90; //constants for motor speed const int pingPin = 7; const int irPin = 0; //Sharp infrared sensor pin const int dangerThresh = 10; //threshold for obstacles (in cm) int leftDistance, rightDistance; //distances on either side Servo panMotor; Servo leftMotor; Servo rightMotor; //declare motors long duration; //time it takes to recieve PING))) signal

void setup() { rightMotor.attach(11); leftMotor.attach(10); panMotor.attach(6); //attach motors to proper pins panMotor.write(90); //set PING))) pan to center }

void loop() { int distanceFwd = ping(); if (distanceFwd>dangerThresh) //if path is clear { leftMotor.write(LForward); rightMotor.write(RForward); //move forward } else //if path is blocked { leftMotor.write(LNeutral); rightMotor.write(RNeutral); panMotor.write(0); delay(500); rightDistance = ping(); //scan to the right delay(500); panMotor.write(180); delay(700); leftDistance = ping(); //scan to the left delay(500); panMotor.write(90); //return to center delay(100); compareDistance(); } } void compareDistance() { if (leftDistance>rightDistance) //if left is less obstructed { leftMotor.write(LBackward); rightMotor.write(RForward); //turn left delay(500); } else if (rightDistance>leftDistance) //if right is less obstructed { leftMotor.write(LForward); rightMotor.write(RBackward); //turn right delay(500); } else //if they are equally obstructed { leftMotor.write(LForward); rightMotor.write(RBackward); //turn 180 degrees delay(1000); } }

long ping() { // Send out PING))) signal pulse pinMode(pingPin, OUTPUT); digitalWrite(pingPin, LOW); delayMicroseconds(2); digitalWrite(pingPin, HIGH); delayMicroseconds(5); digitalWrite(pingPin, LOW); //Get duration it takes to receive echo pinMode(pingPin, INPUT); duration = pulseIn(pingPin, HIGH); //Convert duration into distance return duration / 29 / 2; }

------------

Step 12: Attaching a Battery

Now carefully attach a battery pack so it is self powered.

Step 13: Testing It Out!

Now test your bot!

You wrote different codes!

This is my ultrasound bot!

Make your own now :P

Comments

author
DIY Hacks and How Tos (author)2015-11-26

Awesome robot

About This Instructable

588views

7favorites

License:

More by ssarthak598:DIY Smart Home Monitoring BottleArduino Video Game (The DIY Gift)Is My Fridge Door Open?!
Add instructable to: