Skip to main content

Grove - Line Finder V1.1

Grove-Line finder is designed for line-following robot. It has an IR emitting LED and an IR sensitive phototransistor. It can output digital signal to a microcontroller so that the robot can follow a black line on white background, or vice versa.

Version

Product VersionChangesReleased Date
Grove-Line Finder V1.0InitialJan 29 2010
Grove-Line Finder V1.1Add test pointsDec 28 2015

Specification

ParameterValue/Range
Power supply5
Digital output modeTTL (High when black is detected, Low when white is detected)
Connector4 pin Buckled Grove interface
Dimension20mm*20mm
ROHSYes
Photo reflective diodeRS-06WD
ComparatorMV358

!!!Tip More details about Grove modules please refer to Grove System

Platform Supported

ArduinoRaspberry Pi
caution

The platforms mentioned above as supported is/are an indication of the module's software or theoritical compatibility. We only provide software library or code examples for Arduino platform in most cases. It is not possible to provide software library / demo code for all possible MCU platforms. Hence, users have to write their own software library.

Getting Started

Play With Arduino

Hardware

  • Step 1. Prepare the below stuffs:
Seeeduino V4.2Base ShieldGrove - Button
Get One NowGet One NowGet One Now
  • Step 2. Connect Grove-line finder to port D3 of Grove-Base Shield.
  • Step 3. Plug Grove - Base Shield into Seeeduino.
  • Step 4. Connect Seeeduino to PC through a USB cable.
note

If we don't have Grove Base Shield, We also can directly connect Grove-Line finder to Seeeduino as below.

SeeeduinoGrove-Line finder
5VRed
GNDBlack
Not ConenctedWhite
D3Yellow

Software

  • Step 1. Copy the code into Arduino IDE and upload.
//------------------------------------------------------------
//Name: Line finder digital mode
//Function: detect black line or white line
//Parameter: When digital signal is HIGH, black line
// When digital signal is LOW, white line
//-------------------------------------------------------------
int signalPin = 3; // connected to digital pin 3
void setup() {
pinMode(signalPin, INPUT); // initialize the digital pin as an output:
Serial.begin(9600); // initialize serial communications at 9600 bps:
}
// the loop() method runs over and over again,
// as long as the Arduino has power
void loop()
{
if(HIGH == digitalRead(signalPin))
Serial.println("black");
else Serial.println("white"); // display the color
delay(1000); // wait for a second
}
  • Step 2. Open the serial port and we will see "black" when put the sensor on top of black lines and "white" when on white area.
white
white
white
black
black
black
black
black

Play with Codecraft

Hardware

Step 1. Connect a Grove - Line Finder to port D3 of a Base Shield.

Step 2. Plug the Base Shield to your Seeeduino/Arduino.

Step 3. Link Seeeduino/Arduino to your PC via an USB cable.

Software

Step 1. Open Codecraft, add Arduino support, and drag a main procedure to working area.

note

If this is your first time using Codecraft, see also Guide for Codecraft using Arduino.

Step 2. Drag blocks as picture below or open the cdc file which can be downloaded at the end of this page.

Upload the program to your Arduino/Seeeduino.

success

When the code finishes uploaded, you will see line found or not in Serial Monitor.

Play With Raspberry Pi

Hardware

  • Step 1. Prepare the below stuffs:
Raspberry piGrovePi_PlusGrove - Line Finder
Get ONE NowGet ONE NowGet ONE Now
  • Step 2. Plug the GrovePi_Plus into Raspberry.
  • Step 3. Connect Grove-Line Finder to D7 port of GrovePi_Plus.
  • Step 4. Connect the Raspberry to PC through USB cable.

Software

  • Step 1. Follow Setting Software to configure the development environment.
  • Step 2. Git clone the Github repository.
cd ~
git clone https://github.com/DexterInd/GrovePi.git

  • Step 3. Excute below commands.
cd ~/GrovePi/Software/Python
python grove_line_finder.py

Here is the grove_line_finder.py code.

import time
import grovepi

# Connect the Grove Line Finder to digital port D7
# SIG,NC,VCC,GND
line_finder = 7

grovepi.pinMode(line_finder,"INPUT")

while True:
try:
# Return HIGH when black line is detected, and LOW when white line is detected
if grovepi.digitalRead(line_finder) == 1:
print ("black line detected")
else:
print ("white line detected")

time.sleep(.5)

except IOError:
print ("Error")
  • Step 4. We will see black line detected when the sensor is on top of black line.
pi@raspberrypi:~/GrovePi/Software/Python $ python grove_line_finder.py 
black line detected
black line detected
white line detected
white line detected

Grove-Line Finder Schematic V1.0

Grove-Line Finder Schematic V1.1

Resources

Tech Support & Product Discussion

Upgradable to Industrial Sensors

With the SenseCAP S2110 controller and S2100 data logger, you can easily turn the Grove into a LoRaWAN® sensor. Seeed not only helps you with prototyping but also offers you the possibility to expand your project with the SenseCAP series of robust industrial sensors.

The IP66 housing, Bluetooth configuration, compatibility with the global LoRaWAN® network, built-in 19 Ah battery, and powerful support from APP make the SenseCAP S210x the best choice for industrial applications. The series includes sensors for soil moisture, air temperature and humidity, light intensity, CO2, EC, and an 8-in-1 weather station. Try the latest SenseCAP S210x for your next successful industrial project.

Loading Comments...