LSA08 Manual
LSA08 Manual
LSA08 Manual
LSA08
Users Manual
V1.1
June 2012
Information contained in this publication regarding device applications and the like is intended through suggestion only and
may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. No
representation or warranty is given and no liability is assumed by Cytron Technologies Incorporated with respect to the
accuracy or use of such information or infringement of patents or other intellectual property rights arising from such use or
otherwise. Use of Cytron Technologiess products as critical components in life support systems is not authorized except
with express written approval by Cytron Technologies. No licenses are conveyed, implicitly or otherwise, under any
intellectual property rights.
Index
1.
2.
Packing List
3.
4.
5.
Installation (hardware)
13
16
20
21
22
Getting Started
24
24
26
33
33
39
46
6.
7.
LSA08 has some special features which give advantages to the user. LSA08 has low
current consumption, typically around 26mA. Power polarity protection on LSA08 prevents
damage by applying reversed voltage. LSA08 provides multiple interface methods, namely
serial (UART), analog output and direct digital outputs (parallel output). LSA08 has total of 8
sensors spaced at 16mm. This minimizes the user effort of setup the sensor system for the
line following robot. Besides, LSA08 has LCD which displays the sensors and line
information. This LCD together with setting buttons (SEL and MODE) also enables instant
setting up of LSA08. Auto calibration feature of LSA08 calibrates the sensors to the line and
background surface easily. Furthermore, LSA08 with special selected transmitters and
receivers sensor is capable to work on reflective or glossy surface which is difficult to
normal infrared (IR) sensor.
2. PACKING LIST
Please check the parts and components according to the packing list. If there is any
part missing, please contact us at sales@cytron.com.my immediately.
45.7
38
127.3
16
Min
Typical
25.3
25.5
Maximum
Unit
130
mA
0.8
Output Signal
Minimum
7.5
Typical
12
1
15
100
Maximum
20
20
5
Unit
V
mA
cm
mm
Hz
Label
A
B
C
D
E
Function
2x8 LCD display
Main Controller
Manufacturing Points
SEL button
MODE button
Label
F
G
H
Function
Port A (UART and Analog port)
Port B (Digital port)
Power LED (PWR)
A 2x8 LCD unit to display the line information and setting menus.
B Main controller for data processing.
C Reserved for Manufacturing purpose.
D SEL button is used to enter the selected mode or setting.
E MODE button is used to select mode or setting.
F Port A is UART and Analog port
G Port B is digital parallel output port
H Power indicator LED (green) for indication of power supplied to LSA08.
4.2 Bottom:
Pair of sensors
5. INSTALLATION (HARDWARE)
LSA08 is powered from VIN and GND pin of either PORT A or PORT B. sections
below are example of hardware connection setup for LSA08. User may use either PORT A or
PORT B or both PORTs at the same time.
LSA08
Motor Ports
MD40C
SK40C
LCD
PORTA
Vin
GND
UEN
RX
TX
SK40C-RC5
SK40C-TX/RC6
SK40C-RX/RC7
PORT A
Figures above show the schematic of the connections for the PORTA of LSA08 to
SK40C and also the MD10C to SK40C. This sample uses the serial UART communication
with LSA08 to retrieve the line position from LSA08. JPULSE connection is trivial in this
case since user can retrieve the cross junction count information using UART command. The
Sample source code can be downloaded from Cytrons official website. Figure below shows
the complete setup using DC Geared Mobile Robot Base set. All the parts needed as listed
below can be found from Cytrons product range.
10
SK40C
LCD
DC Geared Mobile
Robot Base Set
LSA08
Baterry Pack
DC Geared Motor
(SPG30-20K)
Nylon Wheel
Analog pin (Pin 4) of LSA08 PORT A can be used to retrieve line position also.
Voltage on this pin represents the line position. The setup connection using this method is
simple. Only 3 wires connections are required i.e. VIN, GND and AN pin. If user needs to do
cross junction counting, then 4th connection is required to the JPULSE pin. Any digital IO
port pin can be used for JPULSE pin connection. Figure following shows the sample
connection to SK40C.
11
VIN
GND
AN
PORT A
If user wants to use LSA08s Port B on SK40C, the schematic below shows the
sample connection. This method is easy but requires more wiring. LSA08s PORT Bs output
is parallel digital output. Every pin on LSA08s Port B represents each of the sensor, where
1 represents line detected and 0 represent no line detected on that particular sensor.
12
O0
O1
O2
O3
O4
O5
O6
O7
VIN
GND
PORT B
13
UART PORT
RX
TX
VIN
GND
UEN
TX
RX
Vin(12V)
GND
RC0
PORT A
Analog port
VIN
GND
JPULSE
AN
Vin(12V)
GND
RC0
PORT A
14
Vin of LSA08 is connected to the VIN (12V) of MC40A. Soldering of wires to the
board is needed for connecting the VIN, GND and JPULSE wire. JPULSE wire is connected
to any available digital input pin for example RC0 pin in this sample. This example uses
Analog to Digital converter (ADC) of the microcontroller to read the Analog pin of LSA08.
The Sample source code can be downloaded from Cytrons official website. Figure below
shows the complete setup using DC Geared Mobile Robot Base set. All the parts needed as
listed below can be found from Cytron products range.
1. DC Geared Mobile Robot Base Set (HD-BSC-SPG-G), inclusive of robot base, DC
geared motors, Nylon wheels, DC motor Couplings and Castors.
2. Mini Mobile Robot Controller (MC40A) with LCD (optional)
3. Advance Auto-Calibrating Line Sensor (LSA08)
4. Battery pack
JPULSE is
connected to this
pin (RC0)
GND can be soldered to
this pin
Vin is connected to this
pin, user can do soldering
on the board
15
DC Geared Mobile
Robot Base Set
MC40A
Battery Pack
LSA08
DC Geared Motor
(SPG30-20K)
Nylon Wheel
IFC-AI08 can be used to retrieve line position from LSA08 using analog method.
Sample connection is shown in the figure below. IFC-Main Board retrieves the analog value
from the IFC-AI08 and processes it to get the line position to do line following task. The
reference voltage jumper on IFC-AI08 is set to 5V.
16
AN
GND
VIN
PORT A
12V
GND
IFC-DI08 card can be used for LSA08. The voltage selector jumper is set to 12V to
provide suitable voltage to LSA08. The sample connection from LSA08 to IFC-DI08 is
shown in the figure below. Port B of LSA08 which is the digital parallel port is used for this
setup. User can choose to connect the Vin of LSA08 from any of the positive voltage 12V of
IFC-DI08 sensor ports. Only one single connection is needed for the VIN and GND pin of
LSA08 from IFC-DI08.
17
O8
O7
O6
O5
O4
O3
O2
O1
GND
VIN
PORT B
Port B
Break out
board
Voltage
selector
jumper set to
12V
To setup a complete working IFC system for line following with LSA08, user will need:
1. IFC-Main Board (IFC-MB00),
2. IFC-Power Card (IFC-PC00),
3. IFC-Digital Input Card (IFC-DI08) or
Created by Cytron Technologies Sdn. Bhd. All Rights Reserved
18
Example setup shown below used the following parts which can be found from Cytrons
product list. All the parts used are listed as following.
1. DC Geared Mobile Robot Base Set (HD-BSC-SPG-G), inclusive of robot base, DC
geared motors, Nylon wheels, DC motor Couplings and Castors.
2. Interface Free Controller (IFC)
3. Advance Auto-Calibrating Line Sensor (LSA08)
4. Battery pack
IFC system is a convenient robot controller to use. Simply stacking up all the required
cards and the system is ready to be programmed for the line following task. IFC system
requires user to program IFC-Main Board (IFC-MB00) only, other slave cards are preloaded
with ready-use firmware already. Sample source code for simple PID controlled line
following can be downloaded from Cytons official website (www.cytron.com.my).
IFC system
DC Geared Mobile
Robot Base Set
Battery Pack
LSA08
DC Geared Motor
(SPG30-20K)
Nylon Wheel
19
RX
TX
TX
RX
UEN
GND
VIN
RB6
GND
12V
PORT A
Jumper:12V selected
AN
JPULSE
GND
VIN
RB6
PORTA
20
Pin10 (GND)
Pin9 (VIN)
O7
O6
O5
O4
O3
O2
O1
O0
PORTB
Digital parallel
Serial: UART
Analog
Controller
LSA08
21
GND
VIN
UEN
RX
TX
GND
VIN
UEN
RX
TX
22
GND
VIN
JPULSE
AN
GND
VIN
JPULSE
AN
23
6. GETTING STARTED
6.1 LSA08 Calibration:
LSA08 need to be calibrated to retrieve the dark and bright value of the surface that it
will do the line follow. Every of the sensor pairs need to be exposed to the dark and bright
surface for LSA08 to read and save the value. The surfaces brightness value will be saved to
non-volatile memory of LSA08. Hence, only one time calibration is needed for the same
background and line unless the background and the line changed, then recalibration is
needed.
To calibrate LSA08, go into the setting menu by pressing MODE button twice.
Choose CALB menu and enter the mode using SEL button. Calibration is started and user
needs to exposing each of sensors to the bright surface and then to the dark surface of the line
or background. LSA08 will save the brightest and darkest value from the calibration process.
User can calibrate by simply swinging the sensors across the dark and bright surface.
Example motions of calibration are show in the figure below. Same method applies for both
Dark-On and Light-On mode. If the surface has several colours, choose the pair of colour
which has less brightness different to calibrate for a better performance. For Example, line
colour is white and there are 3 background colours, red, green and blue. Choose to calibrate
on white line green background. Calibration of LSA08 can also be started by LSA08s
command packet which will be discussed in later section.
24
Once the power is supplied to LSA08, LCD will display the line position detection
and bar chart. Line position detection is a value to show the line position with respect to the
leftmost sensor of LSA08. The line position shown on LCD display is ranging from 0 to 70.
When there is no line detected, the position value will be shown as ****. If sensor S0
detected a line, the line position shown on LCD will be 0. Likewise if a line is detected on
sensor S7 the position shown will be 70. The line position value varies linearly from 0 to
70 according to the line detected by the sensors. If a line is at the middle of the LSA08 (S3
and S4), the LCD display will show the position as 35.
Line position
No line detected
line
the line
25
Selection of different Setting Menu can be done by pressing the MODE button. The
desired Setting Menu is entered by pressing the SEL button. The respective setting value can
be adjust using the SEL button after the entering the selected menu. Press on MODE button
after done adjusting the desired setting value to go back to the Menu selector. Press again the
MODE button to select other modes or Press and hold the MODE button to exit the Setting
Menu. All the settings of LSA08 are listed in the table.
Menu
Description
Calibration (CALB)
Line Mode (LINEMODE)
Threshold (THRES)
Junction Width (J WIDTH)
UART Address (UART ADD)
UART Baudrate
(BAUDRATE)
UART Mode (UARTMODE)
LCD Backlight (LCD B/L)
Exit (EXIT)
Exit Menu shortcut
26
Press MODE button once will bring user to 1st Setting Menu: LCD CON. User can
set appropriate LCD Contrast with the SEL button. Press and hold the SEL button for fast
increment of contrast value.
In the case of the characters on the LCD is invisible due to the wrong contrast, press the
Mode button once, then press Select button once to enter the LCD Contrast Menu and
press and hold the Select button to adjust the contrast.
6.2.2 CALB
Press Mode button twice will bring user to the Calibration Menu which allows user to
calibrate the LSA08s sensor to the line and background surface that it will do line following.
Press SEL button to start the sensor calibration and start swing the sensor across the different
colours or brightness surface.
6.2.3 LINEMODE
27
The third setting menu is Line Mode menu which allows user to set whether the line
following is Dark-On or Light-On. Dark-On means the line following is performed on a
darker line compare to background colour (example, black line on white background surface).
Light-On means line following is performed on brighter line compare to background colour
(example, white line on blue or green or red or black background surface).
6.2.4 THRES
Threshold Menu is the 4th setting menu. User can set the desired setting value
according to the surface condition of the line. Threshold (THRES) value of LSA08 is the
number of bars shown by the bar chart on LCD which LSA08 assumes as a valid line
detected. The threshold value can be set from 0 to 7 through the setting menu by using the
MODE and SEL button.
For example, the threshold is set to 4. In the figure on left, S3 and S4 will detect the
dark line because the bar chart is more than 4. On the other hand (Figure on right), if the bar
chart is less than 4, LSA08 assume no line because the threshold value is 4.
28
6.2.5 J WIDTH
Junction Width menu is for setting the junction width of the junction, the numbers of
sensors on LSA08 detect line which LSA08 will assume as a valid junction. This is special
feature on LSA08 for the ease of cross junction counting. The valid Junction Width value is
from 3 to 8.
UART ADD menu is for UART addressing. User can set identical UART address for
each LSA08 connected to the robot system. This enables multiple LSA08s connected to a
single UART line on main controller. Only LSA08 that matches the address called by main
controller will respond. The address value can be from 0 to 255. Press and hold the SEL
button for fast increment of address.
29
6.2.7 BAUDRATE
Baudrate menu is for setting the desire baudrate for UART serial communication.
There are several baudrate can be set as listed below. User can choose the desire baudrate
according to the table. Higher baudrate is more prone to error if the wiring is not good.
Baudrate No.
Baudrate
9600
19200
38400
57600
115200
230400
6.2.8 UARTMODE
UARTMODE menu is for setting the desired data output format from LSA08 on TX
pin of PORT A when UEN is pulled low. There are 4 available formats in the menu indicated
by number 0 to 3. Each format is described in the table below.
Created by Cytron Technologies Sdn. Bhd. All Rights Reserved
30
Output Format
Description
Digital format. Each byte represents digital value of sensor. Each bit in
the byte represents a sensor. LSB represents sensor 0 and MSB represents
sensor 7.
Line position with respect to the leftmost sensor (sensor 0). Value from 0
to 70. No line is represented by value of 255.
Raw analog value for each sensor in a packet of 9 bytes. First byte is
header (0x00) followed by 8bytes of the analog value of each sensors.
LCD Backlight Menu is for the user to set suitable backlight for the LCD unit on
LSA08. Current consumption of LSA08 is affected by the backlight value of the LCD.
Brighter backlight will consume more current. The backlight value can be set from value of 0
to 10. Value 0 means the backlight is OFF.
31
6.2.10 EXIT
Exit menu is to exit the setting menu. Press SEL button to exit the setting menu when
in this menu. Another exit method as mention before is by press and hold on mode button
while in setting menu selector screen. The Exit string will appear and LSA08 will exit to
normal line display screen.
This is a special mode for debug purpose. User can see the sensor raw value on LCD
unit of LSA08. This mode is not shown in the setting menu. To enter this mode, press and
hold the SEL button for few seconds and release. Value of 1st sensor or sensor 0 will be
displayed. This value is 10 bits value. To display value of other sensors, press the SEL button
again to switch between the sensors. To exit the debug mode, reset LSA08 by power off and
on.
32
Default setting
Light On
4
5
1
0
0
2
LSA08 has 2 output ports (Port A and Port B) for 3 types of output mode. The 3
outputs modes for LSA08 are serial communication (UART) output, Analog output and
digital output (8 parallel output line). Port A includes UART and Analog output mode and
port B is for digital parallel output mode. User may choose to use either Port A or Port B or
both. Vin and Gnd pins on both Port A and B are for providing power to LSA08. LSA08 can
be powered by either Port A or B. All the pin information is labeled clearly on the back
surface of LSA08s PCB. Figures below show the pin labeling of LSA08.
33
Symbol
UART TX (Transmit)
TX
UART RX (Receive)
RX
UEN
Analog Output
AN
Junction Pulse
JPULSE
Not used
Not used
Not used
VIN (12V)
VIN
10
GND
GND
LSA08s UART TX pin becomes floating and high impedance when it is not sending
any data i.e. when UEN pin is not pull down and there is no UART command response from
LSA08. LSA08s RX pin is weakly pulled up. UEN pin is an active low pin which is used to
enable stream of data out of the LSA08s TX pin. AN pin of LSA08 give relative position of
line detected by LSA08 in term of voltage level. This pin will be described in Analog output
mode section. JPULSE pin is for junction detection, pulse will be generated every time
LSA08 crossing a junction with a minimum width determined by Junction Width setting.
Figure below illustrates the pulse generated on JPULSE pin when LSA08 cross a junction.
User can use this feature to detect and count the junction cross. However, user can also
choose to use the LSA08s command packet to obtain the junction count if the UART
communication is available on main controller. LSA08s command packet will be discussed
in later section. VIN and GND needs to be connected to a power supply. The power supply
limitations and requirements are described previously in Product specification and limitations
section. Typically user can connect a 9 to 12V supply to LSA08.
34
Cross Junction
Junction Width
Junction
JPULSE
5V
Junction
Indicator
0V
Pulse generated
Distance
UART
Output
Enable UART Tx
Vin
GND
Junction UART Rx
Pulse
PORT A
35
UART output enable signal pin (UEN) is for controlling the flow of data from the
LSA08 board. Data stream is sent out of the TX pin only when UEN pin is pulled low. This
pin is functioning as the flow control of the UART output data. The main controller requests
the data by pulling low the pin. The data output streams can be in 4 different formats which is
set by UART Mode setting menu.
Different UART mode will set LSA08 to send different data type out of the TX pin.
There are 3 data modes available in LSA08. All 3 types of UART modes are described
below.
UART MODE 0:
This mode causes the LSA08 stops sending data out from UART port.
UART MODE 1:
UART Mode 1 sends out a byte of digital value of sensors. Every bit in the byte of the
value represents the value of each sensor. Bit value 1 represents line detected and bit value 0
represents no line.
MSB
S7
S6
LSB
S5
S4
S3
S2
S1
S0
1 Byte (8bits)
UART MODE 2:
UART Mode 2 sends out the detected line position. The value of line position is between 0 to
70. Value of 255 represents no line detected.
S0
S1
S2
S3
S4
S5
S6
S7
00.......35....70
36
UART MODE 3:
UART Mode 2 sends continuous bytes of sensors raw value. This is for debug purposes if
the user needs. The packet starts with header 0x00 and following eight bytes are the eight
sensors raw values.
Packet format:
0x00
S0
S1
S2
S3
S4
S5
S6
S7
Junction
Pulse
Vin
GND
AN
PORT A
Voltage on analog output pin represents the relative line position detected by LSA08.
User read the analog voltage on the pin using Analog to Digital converter to determine the
position of the line. The analog voltage value range from 0 Volt to 4.5 Volt which represents
the line position between sensor 0 to sensor 7. 5 Volt on the analog output pin represents no
line detected.
For example if a line is at the middle of the LSA08 which is in between sensor S3 and
S4. The LCD on LSA08 will show the position as 35 and the analog pin voltage reading will
be around 2.25V. The linear equation for conversion of analog value on Analog Output pin to
the position is shown below:
Position =
x 70
4.5V
37
Pin Description
Symbol
O0
O1
O2
O3
O4
O5
O6
O7
Vin (12V)
VIN
10
GND
GND
O6 O4
O2
O0
GND O7 O5
O3
O1
Vin
PORT B
38
Start bit
Stop bit
Data bit
Parity bit
9600
19200
38400
57600
115200
230400
Hexadecimal
(ASCII)
Value
0x43
Calibration
0x4C
0 -1
0x54
Line Threshold
0-7
0x4A
Junction Width
3-8
0x41
UART Address
0 - 255
0x42
LCD Backlight
0 - 10
0x53
LCD Contrast
0 - 255
0x52
UART Baudrate
0-5
0x44
0-3
Description
39
0x50
Junction information
0 -1
0x4F
1-2
CHECKSUM
Table above shows the command packet used to setup LSA08 or retrieve information
from LSA08. ADDRESS is the Address of the LSA08 which the value can be from 0 to 255
set by user in UART Address Menu. This Address together with UART Output Enable
features allows the user to control more than one unit of LSA08 from a single main
controller. The Checksum byte of the packet is calculated by adding up the Address byte,
Command byte and Data byte together and taking only lower byte if more than one byte after
addition.
CHECKSUM (1 Byte, Lower Byte) = ADDRESS + COMMAND + DATA
In order to successfully send a command to LSA08, user will need to continuously
send the 4 bytes value in the packet. LSA08 will only wait for a maximum of 20ms for a
continuous byte in a packet. After the wait period, LSA08 will discard the incomplete packet.
Example packet:
Address
Command
0x02
0x43
Data
0x00
Checksum
0x45
This packet will cause the LSA08 to start calibration. Thus, the user may need to start rotate
the robot to expose the LSA08 sensors to the line and background for the calibration period.
Address
0xF0
Command
0x44
Data
0x03
Checksum
0x37
The above command will set the LSA08s UART data mode to mode 3 which is the raw data
of the sensors on LSA08.
Created by Cytron Technologies Sdn. Bhd. All Rights Reserved
40
If there is confusion of UART address of the LSA08, anytime the user can manually
go into the LCD menu of the UART ADD to check for the correct address of LSA08. The
correct address for the LSA08 board is important to be known if the user wants to use the
UART serial communication with the board.
Every successful setting type command received by the LSA08 with correct address,
command and checksum value will be responded by LSA08 with a pair of ASCII characters
OK immediately upon successful execution of the command. If in case there is no response
from LSA08, this means that the packet is being ignored by LSA08 because of the wrong
address, command, checksum or communication error which may be due to incorrect
baudrate or poor signal line.
Figure below is examples of packet command sent to LSA08 using terminal on a
computer. 1st command packet sent is to set the address to 02 from the current address (01).
The 2nd command packet is to set the LCD backlight to maximum backlight (10).
Characters OK
received when
command is
successful.
A packet of
command to set
the address
A packet of
command to set the
backlight
For the command which acquire data or information from LSA08, LSA08 will not
respond with OK. Instead, LSA08 will send out the data requested immediately. For
example, the command P and command O.
41
Command
0x01
0x43
Data
0x00
Checksum
0x44
This packet is sent to LSA08 with address of 1 to command the LSA08 to perform calibration
immediately. User will need to control the robot to start rotate robot against the surfaces that
it will perform line following.
Line Mode: L
Example packet:
Address
Command
0x01
0x4C
Data
0x00
Checksum
0x4D
This packet will command the LSA08 to set the line mode to Light-On line following mode.
Address
Command
0x01
0x4C
Data
0x01
Checksum
0x4E
This packet will command the LSA08 to set the line mode to Dark-On line following mode.
Line Threshold: T
Example packet:
Address
0x01
Command
0x54
Data
0x04
Checksum
0x59
This packet will command LSA08 to set the line threshold value to 4.
42
Junction Width: J
Example packet:
Address
Command
0x01
0x4A
Data
0x08
Checksum
0x53
This packet will set the minimum junction width as 8 which mean that LSA08 will assume a
junction is crossed if 8 sensors detected line.
UART Address: A
Example packet:
Address
Command
0x01
0x41
Data
0x01
Checksum
0x43
This packet will set the Address of LSA08 as 1. This address will be used for UART
communication.
Backlight: B
Example packet:
Address
Command
0x01
0x42
Data
0x02
Checksum
0x45
Contrast: S
Example packet:
Address
0x01
Command
0x53
Data
0x50
Checksum
0xA4
43
Baudrate: R
Example packet:
Address
Command
0x01
0x52
Data
0x00
Checksum
0x53
This packet will set the LSA08s UART baudrate to 9600bps according to the baudrate
setting table shown previously.
Command
0x01
0x44
Data
0x02
Checksum
0x47
This packet will set LSA08s UART data mode to mode 2 which LSA08 will send out line
position through the TX pin when UEN pin is pulled low.
Junction Information: P
Example packet:
Address
0x01
Command
0x50
Data
0x00
Checksum
0x51
Command
0x50
Data
0x01
Checksum
0x52
This packet will cause LSA08 to send out the internal junction counter value. User can
retrieve the internal junction counter value by sending this command and use this value to
determine how many junctions had the LSA08 crossed.
44
Line/Sensor Information: O
Example packet:
Address
0x01
Command
0x4F
Data
0x01
Checksum
0x51
Sending this packet to LSA08 will return a byte of sensors digital value. MSB is sensor 7s
value and LSB is sensor 0s value.
Address
0x01
Command
0x4F
Data
0x02
Checksum
0x52
Sending this packet to LSA08 will return a byte of relative line position detected by LSA08.
The returned value is from 0 to 70.
This method to retrieve the line position using command packet is relatively slower compared
to streaming the line position out of LSA08s TX by pulling down UEN pin. User who needs
fast refresh rate of line position, especially for fast moving robot is advised to use the UEN to
stream out the line position.
45
7. WARRANTY
Prepared by
Cytron Technologies Sdn. Bhd.
19, Jalan Kebudayaan 1A,
Taman Universiti,
81300 Skudai,
Johor, Malaysia.
Tel:
Fax:
+607-521 3178
+607-521 1861
URL: www.cytron.com.my
Email: support@cytron.com.my
sales@cytron.com.my
46