How does Sparki sense lines?

So I wrote a post previously about Sparki and his line following abilities:

Over the weekend I plan to upload a code that uses a similar principle but actually avoids lines to stay within particular confines. This is a cool idea but was tricky to implement so I thought Id use this post to talk about how Sparki actually senses lines.


Underneath Sparki are 5 infrared reflectance sensors like this:


An infrared reflectance sensor is made up of two parts- an infrared LED and a phototransistor.

The infrared LED emits an infrared light onto the surface below and the phototransistor calculates how much of that has been reflected from the surface. The more light reflected, the higher the voltage Sparki reads.

A bright white piece of paper is likely to be read as a 1000 whereas a black line will be read as around 500/600.


Infrared reflectance sensors are great but there are considerations to be made when planning to use these.

Firstly, there is a lot going on and a lot of information to be processed depending on how you want the robot to respond to the black lines. This means it is important to add a delay. However, adding a delay does mean that Sparki’s response time to the change in reflectance will be longer.

Secondly, the lines you are going to use need to be thick/wide enough for Sparki to take the reading and process the change, even factoring in the delay. This is more important for line avoiding rather than line following.

Hope this was helpful, and will help my next post make more sense 🙂 🙂

One comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s