OUTPUT.jpg

LSA08 Line Follower with MC40SE

Introduction

LSA08 is an Advance Line Following Sensor bar with build up with 8 pair of super bright green LED as the sensor’s transmitter. LSA08 is able to operate at various color surfaces with distinct brightness. The LSA08 has several output mode and convenience of use for any system. Namely, digital output port, serial communication port, and analog output port.

In this tutorial, we will be using the MC40SE to control the robot. The LSA08 will be a guide to detect the line and MC40SE is use to interpret information from LSA08 further give order to the robot which direction to go and follow.

So, let’s start the project.

Hardware required:

LSA08 x1

lsa088

MC40SE x1

mc40se

• MOTOR x2

• WHEEL x2

• BATTERY x2

• Mobile robot x1

Software required:

MPLAB IDE & HITECH C PRO Installation

PICKIT 2

Related References:

• How to set up MPLAB IDE

How to Create a project

• How to use PicKit2

User manual for MC40SE

 

Project:

Line Following using LSA08 with MC40SE

 

Procedure:

Before we start setting up the robot, we have to decide which motor to use. In this tutorial, I will be using the LINIX brushless motor. Below are some pictures of the wire connected to the mobile robot.

DSCF7818

Brushless motor driver connection

DSCF7817

Connection of the brushless motor driver to the MC40se board

It is up to you which type of motor to use, we have plenty of tutorial showing various types of motor being used together with MC40SE, check out our tutorials 🙂

Example:

1. Output Port

LSA08 has 2 output ports. One of it is digital output port which provides digital status of each sensor. This port is labeled as port B. For the 1st example I am going to demonstrate the method to use this digital port, interface with MC40SE.

A brief about LSA08 digital output, each output pin is TTL 5V, which should be directly connected to sensor port of MC40SE. It represent the status of sensor on LSA08, whether bright color (white) or dark color (black) is detected.  We should be using LSA08 digital output like 8 normal sensor, connect it to 8 digital input port on MC40SE.  I am using female to female jumpers wire to make connection, for experiment purpose it is fine. But for competition and robustness, I do not recommend using this wires as it is easily disconnect, please use proper IDE socket for LSA08 (it should come with LSA08) and 2510 3 ways socket for MC40SE (should come with MC40SE too).

To calibrate the LSA08, please do refer to the User’s Manual of LSA08.

Connection

DSCF7815

Connection to PORT B at LSA08.

DSCF7816

Connection to MC40SE’s digital input port. If  you look carefully, we are connecting power supply of 12V to LSA08 from SEN1 port of MC40SE. The rest of SEN ports are connected with Signal pin only 🙂

OUTPUT

Circuit diagram for you all to look at it^^

 

Sample Code

These are some important coding which use in line following…

io1

This is the main body of doing line following

io2

The code is too long to paste in this blog, so please do download it from the attachment under this article.

io3

If you have problem on the code, please do discuss in our technical forum.

2. ADC Port

According to the User’s Manual of LSA08, there is another output from LSA08. The ADC output will generate analog voltage to indicate where is the line. The ADC output is located in PORT A of LSA08 together with UART port.

The advantage of using ADC output is minimum of wires interface 🙂 Because with 3 to 4 wires, you can obtain the line information from LSA08 for line following. For the details on ADC output, please check out the User’s Manual, page 37.

Connection

DSCF7829

PORT A of LSA08, check the manual for detailed pin assignment.  Besides the ADC from LSA08, I am using the junction pulse output too.

DSCF7827

Connection to MC40SE board, ADC output of LSA08 connect to ADC input of MC40SE. The power is connected to ADC port too, do select 12V for the ADC + to power up LSA08. The Junction pulse from LSA08 connect to Signal pin of SEN1 port.

ADCp

Circuit Diagram

 

Sample Code for using ADC

adc1

Main body….

adc2

adc21

For complete source code, please download from the attachment at the bottom of this article.

 

3. UART Port

The 3rd interface option from LSA08 is UART port and is located at Port A too (together with ADC). It comes with TX, RX and UEN. TX and RX are are normal UART transmitter and receiver pin. While UEN is to enable UART interface. UART interface can be used to configure various setting of  LSA08 beside getting sensing information.

And for this tutorial, we are going to get the sensor information only for line following purpose 🙂

Connection

The connection is as illustrated below. For detailed pin assignment, please again refer to User’s Manual, page 34.

DSCF7835

Connection on LSA08.

DSCF7834

Connection on MS40SE, please connect the TX and RX to UART port (left of 2×8 LCD), for 12V supply you can either take from SENx PORT (digital port), ADC port or the port under UART port.

UART

Circuit Diagram.

 

Sample Code

Here is the sample source code for the UART mode 1. There are mode 2 and 3., it is up to you which to use. I am using mode 1 in this tutorial.

Sample code are as below

uart1

Main body of the code

uart3

Line following

uart2

Cross count

For further information on UART protocol and command, please refer to LSA08 User’s Manual.

 

PRECAUTION:

Read first before you start doing the project. The project maybe harmful!!!

1. Check all the connections, especially the positive and negative terminals to avoid short circuit.

2. Check the battery connection

3. Please lift your robot so the tires can run freely before powering up

4. Please note that there were no kids beside.

TUTORIAL END HERE, any inquiry you could as at below command or our forum.

Here are some video and sample code…. enjoy!

VIDEO:

[youtube]http://www.youtube.com/watch?v=SZKW_Gn9Oks&feature=plcp[/youtube]

Attachment:

Sample code

In Github repository contains:

  • MC40SE with PIC16F887 + LSA08 using ADC
  • MC40SE with PIC16F887 + LSA08 using Digital
  • MC40SE with PIC16F887 + LSA08 using UART updated Jan 2013

Buy

,

Related Post

Line-Following Robot Using LSA08 in Serial Mode with Digital Output

Line-Following Robot Using LSA08 in Analog Mode

Line-Following Robot Using LSA08 in Serial Mode with PID Controller

Line-Following Robot Using LSA08 in Digital Mode

Leave a Reply

Your email address will not be published. Required fields are marked *