logo-mobile

ROHM

ROHM
Menu
  • Arduino –
  • Raspberry Pi –
  • Trending –
  • Others –
  • About –
  • Contact –

Arduino

Make a Laser Arduino Robot Using Parallax Laser Sensor – Part 1

Purnomo Nuhalim
Published by Purnomo Nuhalim at October 26, 2016
Categories
  • Arduino
Tags
  • Arduino
  • arduino robot
  • laser robot
  • robot
  • servomotor
  • stepper motor
arduino robot

arduino robot

 

Imagine you’ve just moved into a new place. You need furniture ASAP but you don’t have measure tape with you. Well, this Parallax laser Arduino robot would come in very handy!

In the previous posts, How To Make Your Own Robot and How To Make Your Own Robot (Part 2), we showed a simple way to build your own robot from scratch using Arduino UNO R3. In this article, we will further improve the functionality of the robot by making it mobile and adding laser range finder (LRF) to allow the robot to detect objects and measure distances.

The laser sensor will allow us to obtain more accurate and reliable data. This Arduino robot is designed to be autonomous. It’ll be able to detect and avoid obstacles as they roam around.

The robot is designed to:

  • Move forward, backward, turn 90 degree left & right and turn 45 degree left & right.
  • Avoid obstacles by moving in different directions based on best available paths.
  • Measure distance from various directions (forward, 90 degree left & right, 45 degree left & right.
  • Make decision on which direction it will take (forward, backward, left or right) based on the longest distance available.

The sensor is attached to a servo so the robot can pan left and right to take several measurements. The distance measured is then displayed on a small OLED. We’ll use stepper motor for smooth, quiet operation.

We will discuss the building of this Arduino robot step by step,  first step is the basic installation of the chassis, motors and  Arduino/motor shield. Then a small program was shown to test the motors to ensure proper connections and software installation. Then, in the next article we will add on the rest of the devices one by one, followed by programs to test correct installation and connection. By doing this approach, if any problem occurs, it will be easier to fix.

Hardware

The hardware required for this robot are available in many electronics shops, we provide examples of shops in the  Hardware list.

    • Arduino Uno rev 3 (www.adafruit.com/products/50)
    • Adafruit Motor Stepper Shield for Arduino (www.adafruit.com/products/1438)
    • Stepper Motor (www.adafruit.com/products/324)
    • Chassis, screws and tail wheel from Parallax.com
    • Wheels, Rubber tires and hubs from Makeblock.com
    • Servo and mounting set (www.parallax.com/product/570-28015)
    • Parallax Laser Range Finder (www.parallax.com/product/28044)
    • OLED display (www.seeedstudio.com/Grove-OLED-Display-1.12”-p-824.html)
    • Grove-Red Wrapper/case (http://www.seeedstudio.com/Grove-Red-Wrapper-1*2(4-PCS-pack)-p-2585.html
    • Lipo battery 3s (11.1V)  and Connectors (http://www.hobbyking.com/hobbyking/store/__18203)
    • Acrylics – 195 x 195 x 3mm (http://www.jaycar.com.au/clear-acrylic-sheet/p/HM9509)

 

Software

  • Arduino IDE
  • Adafruit Motor Shield Library
  • LCD Display9696 Library.zip

Tools

  • Round file
  • Dremel Rotary Tool
  • Soldering Iron
  • Mini Hacksaw

Install motors, wheels, and the acrylic base

The chassis from Parallax is made from strong aluminium. It is specifically designed for servo instead of stepper motor, so we need to make a little modification to the design.

First, we will cut the lower part of both sides of the chassis to save space for motor attachment. Use Dremel to get a clean cut.

We’re using NEMA 17 stepper motor, which has a resolution of 200 steps/revolution. It can be powered at 12V 350mA.

To install motors we need  6.5 cm x 4.5 cm acrylics for mounting motor into the chassis as shown in Figure 1. Cut the acrylics using hacksaw and drill the holes by using Dremel. Use M2 x 10mm screws to attach motors into the acrylics mounting; it requires 8 screws for both motors. Then, attach the acrylics into the chassis.

arduino robot

Figure 1. Mounting stepper motor to 6.5 x 4.5 cm acrylic board

Cut 15 cm x 8 cm acrylics for the base to attach Arduino and OLED display (Figure 2). Install the acrylics base using 4 spacers and screws, then install tail wheel using the pin provided.

 

arduino robot

Figure 2 Chassis, tail wheel and 15 x 8 acrylic board for the base

 

arduino robot

Figure 3.  Wheels and  shaft connectors

 

arduino robot

Figure 4. Stepper motors and tail wheel attached to the chassis

To install the wheels, we use shaft connectors as shown in Figure 3. There is one small modification required. The diameter of the hole of the shaft is 4mm, whereas the stepper motor’s shaft has diameter of 5mm. So we need to make the connector’s hole bigger to 5 mm. Use round file or Dremel to make the hole bigger. Do it carefully.

arduino robot

Figure 5. Acrylic base installed to chassis

Pull the cables from motors through the holes provided to the top, and put the battery under the chassis using double tapes. Lipo (Lithium Polymer) battery is the perfect solution for this project as it gives 11.1V 800mAh~1000mAh, which allowswill runtime for more than 1 hour. It’s also rechargeable. But we need a special charger for this battery. If you are an aeromodeller or RC car driver then you must be familiar with this type of battery. It can be replaced with 6 or 8 x AA batteries that provide 9-12 V.

arduino robot

Figure 6. Attach battery to chassis using double tape

Connect cable from motors to motor shield

Adafruit motor shield specs – Adafruit

  • 2 connections for 5V ‘hobby’ servos connected to the Arduino’s high-resolution dedicated timer
  • 4 H-Bridges: TB6612 chipset provides 1.2A per bridge  (3A for brief 20ms peaks) with thermal shutdown protection, internal kickback protection diodes. Can run motors on 4.5VDC to 13.5VDC.
  • Up to 4 bi-directional DC motors with individual 8-bit speed selection.
  • Up to 2 stepper motors (unipolar or bipolar) with single coil, double coil, interleaved or micro-stepping.
  • Tested compatible with Arduino UNO, Leonardo, ADK/Mega R3, Diecimila & Duemilanove. Works with Due with 3.3v logic jumper. Works with Mega/ADK R2 and earlier with 2 wire jumpers.
  • 5v or 3.3v compatible logic levels – jumper configurable.

This motor shield is capable of running 2 stepper motors and 2 servos. The beauty  of this stepper motor shield is that it does not use any pin in Arduino because it is connected through I2C. The only pin needed is for servo. Just follow the instruction to connect the wires from motors.

To learn the basics of stepper motor and its connection to Arduino UNO R3, please refer back to Using Arduino with Parts and Sensors – Stepper Motor Part 1

arduino robot

Figure 7. Connecting stepper motors to motor shield

 

arduino robot

Figure 8. Arduino and motor shield attached to acrylic base

Now simply install the wheels and battery connector as shown below.

 

arduino robot

Figure 9. Stepper motor’s cable connected to motor shield

Install Software and upload the code

We are now ready to run our first code. First, we need to install Arduino IDE from Arduino website and motor shield library from Adafruit. After successful installation, copy the following source code to the Arduino.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//*******************************************************************************************************************************************
 
#include <Wire.h>
 
#include <Adafruit_MotorShield.h>
 
#include "utility/Adafruit_MS_PWMServoDriver.h"
 
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
 
Adafruit_StepperMotor *myMotor1 = AFMS.getStepper(200, 1);
 
Adafruit_StepperMotor *myMotor2 = AFMS.getStepper(200, 2);
 
void setup()
 
{  Serial.begin(9600);           // set up Serial library at 9600 bps
 
 Serial.println("Stepper test!");
 
 AFMS.begin();  // create with the default frequency 1.6KHz  
 
 myMotor1->setSpeed(100);  // 100 rpm   
 
 myMotor2->setSpeed(100);  // 100 rpm   
 
 }
 
void loop()
 
{
 
Motor(50,3);                    // turn Left for 50 steps
 
delay(1000);
 
Motor(100,4);                   // turn Right for 100 steps
 
delay(1000);
 
Motor(50,3);                    // turn Left for 50 steps (back to original position)
 
delay(1000);
 
Motor(400,1);                   // move Forward for 400 steps
 
delay(1000);
 
Motor(400,2);                   // move Backward for 400 steps
 
delay(1000);
 
}
 
//******************************************* *************************************
 
void Motor(int x,int y)
 
{   int i = 0;
 
 for ( i; (i < x); i ++)
 
 { if (y == 1)   // move forward
 
{ myMotor1->step(1, FORWARD, SINGLE);
 
 myMotor2->step(1, BACKWARD, SINGLE);}
 
  if (y == 2)   // move backward
 
 {myMotor1->step(1, BACKWARD, SINGLE);
 
 myMotor2->step(1, FORWARD, SINGLE);}
 
 if (y == 3)    // move left
 
  { myMotor1->step(1, FORWARD, SINGLE);
 
 myMotor2->step(1, FORWARD, SINGLE);}
 
 if (y == 4)    // move right
 
  { myMotor1->step(1, BACKWARD, SINGLE);
 
 myMotor2->step(1, BACKWARD, SINGLE);}}
 
}
 
//********************************************************************************************************************************************

This code is very simple. It allows the robot to make 90 degree turns to the left and 90 degree turns to the right. It also allows turning back to original position, moving forward for 400 steps and moving backward to the original position. Within the loop we run Motor function, which has 2 parameters. The first parameter tells how many steps the motor must turn and the second parameter tells about the direction (e.g. forward, backward, left and right).

When the program is running, the Arduino robot will move like in the above video.

In the next article, we will continue adding the rest of the parts such as the servo and Laser Range Finder (LRF) and writing a program that allows the robot to move around autonomously. So stay tuned for my next article!

Purnomo Nuhalim
Purnomo Nuhalim
Hailing from Melbourne, Purnomo is a retiree and electronics enthusiast. Currently he is keeping himself busy with various open hardware projects using Arduino and Raspberry Pi. Besides electronics, he is also passionate about aero modelling and astronomy.

Check us out on Social Media

  • Facebook
  • Twitter

Recommended Posts

  • Make a Laser Arduino Robot Using Parallax Laser Sensor – Part 2Make a Laser Arduino Robot Using Parallax Laser Sensor – Part 2
  • How To Make Your Own Robot (Part 2)How To Make Your Own Robot (Part 2)
  • An Intro to: CMUcam5 Pixy Vision Camera SensorAn Intro to: CMUcam5 Pixy Vision Camera Sensor
  • How To Make Your Own RobotHow To Make Your Own Robot
  • The Coolest Kickstarter Robots Part 2 – Past CampaignsThe Coolest Kickstarter Robots Part 2 – Past Campaigns
  • Innovation Success Factors from the Creator of RapiroInnovation Success Factors from the Creator of Rapiro
Receive update on new postsPrivacy Policy

Recommended Tutorials

  • How to integrate an RFID module with Raspberry Pi How to integrate an RFID module with Raspberry Pi
  • How to Use the NRF24l01+ Module with Arduino How to Use the NRF24l01+ Module with Arduino
  • How to Run Arduino Sketches on Raspberry Pi How to Run Arduino Sketches on Raspberry Pi
  • Setting Up Raspberry Pi as a Home Media Server Setting Up Raspberry Pi as a Home Media Server

Recommended Trends

  • SewBot Is Revolutionizing the Clothing Manufacturing Industry SewBot Is Revolutionizing the Clothing Manufacturing Industry
  • All About The Sumo Robot Competition And Technology All About The Sumo Robot Competition And Technology
  • 5 Interesting Tips to Calculating the Forward Kinematics of a Robot 5 Interesting Tips to Calculating the Forward Kinematics of a Robot
  • Go Inside the Drones That Are Changing Food Delivery Go Inside the Drones That Are Changing Food Delivery
Menu
  • Arduino –
    Arduino Beginner’s Guide
  • Raspberry Pi –
    Raspberry Pi Beginner's Guide
  • Trending –
    Updates on New Technologies
  • Others –
    Interviews / Events / Others

Check us out on Social Media

  • Facebook
  • Twitter
  • About
  • Company
  • Privacy Policy
  • Terms of Service
  • Contact
  • Japanese
  • 简体中文
  • 繁體中文
Don’t Forget to Follow Us!
© Copyright 2016-2023. Device Plus - Powered by ROHM
© 2023 Device Plus. All Rights Reserved. Muffin group

istanbul escort istanbul escort istanbul escort