Overview
Me Line Follower is designed for line-following robots. It includes two sensors, each one consisting of one infrared emitter LED and one infrared sensitive phototransistor. Me Line Follower enables a robot to follow a black line in a white area or a white line in a black area. Even with simple circuits, it can detect lines quickly. The interface of Me Line Follower is marked with the blue color, which indicates that it is a dual-digital interface that can be connected only to an interface also marked with blue on a Makeblock main control board.
Technical specifications
- Operating voltage: 5V DC
- Detection range: 1cm–2cm
- Detection angle: within 120°
- Control mode: dual-digital interface
- Module dimension: 51 mm x 24 mm x 21 mm (L x W x H)
Features
- The area marked white is the area recommended for contact with metal beams.
- Two LED indicators, providing feedback during line following
- Protection against reverse connection, protecting the IC from damage at reverse power connection
- Easy to be influenced by ambient light, and functions limited by greatly changed ambient light
- Supporting mBlock 5 block-based programming, applicable to users of all ages
- Adopting RJ25 ports for easy connection
- Modular installation, compatible with Lego bricks
- Providing the S1, S2. VCC, and GND terminals, supporting most of the Arduino series main control boards
Instructions
You can use this module with main control boards (such as mCore and Orion) with RJ25 ports to create some interesting projects, such as a line follower car and auto-stop car.
Pin description
Pin |
Function |
GND |
Grounding |
VCC |
Power supply |
S1/S2 |
Data output of sensor 1 and 2, respectively |
D3/D4 |
Detection signal indicator of sensor 1 and 2, respectively, lighting up when the white color is detected and going off when the black color is detected |
Wiring
RJ25 connection
The port of Me Line Follower is marked blue, and therefore you need to connect it to a port marked blue on a Makeblock main control board.
Taking Makeblock Orion as an example, you can connect it to one of ports 3, 4, and 6 as follows:
Port 5 is used to connect the Bluetooth module.
Dupont connection
When using a Dupont cable to connect the module to the Arduino UNO main control board, you need to connect the S1 and S2 pins to digital ports as follows:
Programming guide
You can program Me Line Follower using the block-based or C/C++ programming. For block-based programming, you don't need to be very experienced in programming. Whether you are new or exprienced in programming, you can easily master block-based programming in a short period of time.
Compared with block-based programming, C/C++ programming is a more tranditional programming language. It works better for users understand the C language or other programming languages.
The following uses the Orion main control board as an example to describe how to program Me Line Follower.
Block-based programming—mBlock 5
Before you use mBlock 5, download mBlock based on the system running on your PC read the online help of mBlock 5 to get to know the UIs and basic operations of mBlock.
Use the Orion main control board as an example.
After adding the Orion device from the device library, you can find the block for Me Line Follower in the Sensing category.
Block description
Block |
Function description |
Parameter: select the port based on the one you connect Me Line Follower to on the main control board Function: outputs the state value of the Me Line Follower State value description: One of the four values may be output: 0, 1, 2, and 3, where 0 indicates that both sensors 1 and 2 are on a black line, 1 indicates that sensor 1 is on a black line and sensor 2 is on a white one, 2 indicates that sensor 1 is on a white line and sensor 2 is on a black one, and 3 indicates that both sensors 1 and 2 are on a white line. |
C/C++ programming—Arduino IDE
Programming environment configuration
To program Me Line Follower using the C/C++ programming language, you can configure the Arduino IDE environment by referring to the following;
(1) Get Arduino IDE and Makeblock program library
Login Arduino's official website to download Arduino IDE:
https://www.arduino.cc/en/Main/Software
You should download the installation package for corresponding operating system (Subject to the latest version).
(2) Download Makeblock library functions:
https://github.com/Makeblock-official/Makeblock-Libraries/archive/master.zip
Decompress the makeblock folder in the zip to the Arduino default library. Your Arduino library folder should now look like this:
- Windows 7(on Windows):
[arduino installation directory]\libraries\makeblock\src
[arduino installation directory]\libraries\makeblock\example
….
- or like this (on Mac):
[arduino directory]\Contents\Java\libraries\makeblock\src
[arduino directory]\Contents\Java\libraries\makeblock\example
…
(3) Open the Arduino Application. If you already open it, you need to restart to see changes.
After configuring the Arduino IDE environment, choose Examples > MakeBlockDrive > LineFollowerTest to program Me Line Follower.
Program function description
Reads the results detected by the sensors of Me Line Follower continuously and outputs the results to the serial monitor in Arduino IDE every 200 ms.
Upload the code segment to Makeblock Orion and click the Arduino serial monitor, and you will see the running results as follows:
Function description
Name |
Description |
MeLineFollower(uint8_t port) |
Define the port based on the one you connect Me Line Follower to on the main control board |
readSensors() |
Read the state value of the sensors |
Principle analysis
Me Line Follower is an accessory of robot developed on the principle of reflective photoelectric sensor. The infrared light features different reflection intensity when irradiating on different color of object surface. In the process of running, the cart irradiates infrared light on the floor continuously. When the infrared light reaches white paper floor, diffuse reflection occurs and the reflected light is received by a receiver mounted on the cart. If the infrared light reaches black line, it is absorbed and can not be received by the receiver of cart. By identifying whether the reflected infrared light is received, we can determine the position of black line and the running line of cart. (The output is 0 when irradiating to a black line, and the output is 1 when irradiating to a white line).
Comments
Please sign in to leave a comment.