Making the Thirsty Flower Pot

Week beginning 19/01/2018

From last week we had a working IR line following circuit and a working moisture sensor. However, the two were not connected and neither were mounted to a prototype.

Having bought different motors, that connected easily to wheels, I needed to slightly adapt the circuit we had previously made to cater for the extra power these DC motors required.  To do this I took out the voltage regulator and added in a battery pack containing 4 AA batteries. Here is a video of the more powerful DC motor reacting to my TCRT5000

Using the line tracking code from before, we needed to turn the moisture sensor into a switch controlling the rest of the code. To do this we created an ‘if’ statement, that if the moisture sensor was wet the code wouldn’t run and if it was dry the robot would track the line towards the sink; to do this I took the basis from a code found at 

code with the moisture 2

Above, you can see the ‘if’ statement for when the moisture sensor is wet, followed by the ‘else’ statement which triggers the start of the line tracking code. Although this worked, we found that once the sensor was dry and the IR code had started, even if the moisture sensor got wet again the line tracker would continue to run.

We realised that this was because there was no function to be performed when the sensor was wet. Therefore the motors had no other instructions after they had started acting on the IR sensor code. To solve this we added that all 4 motor pins would be low during the ‘if’ statement.

code with the moisture 1

After adding all of this our circuits worked together and the IR circuit was controlled by the moisture sensor, here is a video of our circuit working. As you can see, when the probes are in the mug of water the IR sensor has no impact on the motor.

Earlier on in our testing we had noticed that one of our IR sensors was giving us opposite readings to the other, therefore the left sensor was somehow reversing data it was receiving. As we were short on time, instead of properly trying to understand why this was happening, we changed the (! – logical not) part of the left sensor code. This means that it reverses what it does with the data received.

After fixing all of these issues it was time to start building our robot. Because our IR sensors came from different suppliers they have different ranges, therefore they had to be at different heights away from the floor. The left sensor had to be 20mm away from the ground and the right sensor had to be 38mm away, any deviations in this height would mean that the sensors would not function.

sensors difference.jpg

Here you can see the different heights in which the sensors are placed.

When we first tried our robot tracking the black line it didn’t work, as you can see in this video (

This was because we had positioned our sensors at the back of the car, therefore, by the time the sensors were noticing they had to turn the middle of the car had already passed way over the corner. To change this we swapped what was the front and what was the back of the car, this also meant that we had to change the direction of the wheels. It would be possible ( and not too difficult) to do this by swapping around the HIGH and LOW values on the motors in the code; however, as they are DC motors we also were able to switch the positive and negative wires, thus, changing the direction.

After all these alterations, we had a working prototype!!!

Here are some pictures and videos of the ‘Thirsty Flower Pot’


By Lizzie Spinks


Research Project 1 – IR Optical Tracking Sensor (TCRT5000)


My first project was to research and become ‘an expert’ on an ‘Infra-red optical tracking sensor’, lesser known as the TCRT5000. So, the questions I challenged myself to answer were;

  • What is Infra-Red light?
  • How does the TCRT5000 ‘track’ this light?
  • Why, and how, is this utilised?

Literature Review

In an article by J.S. Sweitzer called “What is Infra-Red light?”, (‘’)  infra-red light is described as “one type of light that is invisible to us”. All types of light are made up of electromagnetic energy and the different types of light are defined by the frequency of their wavelengths. “Light with wavelengths from 0.7 micron to about 0.1 millimeter is called infrared light.” This is the type of light that the TCRT5000 measures , we can also feel infra-red light, with longer wavelengths, in the form of heat.

This article also taught me how our eyes perceive different colours, this is because the light bouncing off a surface will have a different wavelength to light bouncing off the same material but in a different colour. “Every color has a distinct wavelength. For example, violet light can be seen at light wavelengths of around 0.4 micron(*) and yellow light is made up of waves that are 0.6 microns long.” Therefore, the TCRT5000 can sense the colour of a material due to it’s wavelength.

I also found this tutorial online ( where I learnt all about how the sensor actually functioned. The sensor contains both an LED and a photo diode, the LED sends out a signal (in the form of infra-red light) which bounces off the surface in front of it, bounces back and is read by the photo-diode. This can measure wavelength of the returning signal and send information to the Arduino.


The Infra-Red tracking sensor will be able to tell if a surface is black or white.


If my hypothesis is correct, my sensor should be able to tell when I have drawn on paper in black pen. To test this, I found a short tutorial online to turn an LED on when the sensor is reading a reflection (

fritz for line tracking I followed the above ‘fritzing’ diagram and the code found on the website to create an experiment for myself. The TCRT5000 has a built-in LED which lights up when a reflection is being read. Therefore, on a dark surface, such as black pen, the LED will be off as there is no reflection being read.

Here is a video of my experiment. .  As you can see, the LED turns off as a pass the sensor over the black pen.


As you can see from my experiment, as my hand moves slightly in height from the paper, the light no longer reads the difference between the light and dark paper. However, when my hand was a steady height it was very accurate at picking up the colour of the paper below.



The IR tracking sensor can very accurately pick up the colour of the surface through the refection wavelength, although it has to be kept at an exact height from the surface. From the data-sheet I discovered this was 12-30mm. This could have many applications, commonly used in line-tracking robots, which appear in printers and many other common appliances.

By Lizzie Spinks

Line Following Flower Pot, The Beginning

I teamed up with my course mate, who had a moisture sensor, to create a small circuit using both of our sensors. (Mine being the TRCT500 – IR tracking sensor). For our ‘mini-robot’ we will be making a flower pot that, when in need of a drink, drives itself to the sink. The idea being that, the owner of said flower pot, would be reminded to water the flower as it would suddenly appear at the sink whilst they were washing their hands.

We found this website, which gave us a good basis to start writing our code and figuring out how to compile our circuit for the mini-robot.


line trackin code.,..

To the right here, is the code that this website had used on their line following robot. For this project we need 2 IR sensors, so we ordered another one off the internet.


Although these 2 sensors look very different, the only actual difference in them is that one does not have a ­sensitivity adjustor.moisture-sensor1.jpg



Combined with Liam’s moisture sensor we started looking at how we were going to build our robot.

Above is the moisture sensor we are using, as you can see it has two large prongs that will stick into the soil of our plant pot. To save ourselves some time we decided to buy an already build robot car from the internet

From the code, found above, we added an ‘if’statements to meant that the robot will only move when there is no moisture detected in the plant pot.  if (digitalRead(sensor_pin) == HIGH).  Then the code for the IR sensor and motor will run.

We then did a small sketch of what our circuit would look like and made a start at putting it together whilst we waited for some of the other parts to arrive. To connect out motor driver to the circuit we also had to look up what all the pins mean. I found an explanation on


sketch fritz_preview









A video of our circuit tour can be found here

We then tried our circuit out, testing when the motors turned on and off using paper as our reflective surface. We videoed these first tests. After adding in our motor driver we made a hand drawn fritzing of the circuit.



We had some problems with the coding of the moisture sensor activating the IR code, therefore, we decided to get the IR working with the motors perfectly before adding in the moisture sensor. Here is a video of one of our sensors using the circuit seen here.

Linear Voltage Regulator and Project Ideas

Week Beginning 05.02.18

This week we were given a linear voltage regulator, with the task to get it working as start to understand how it works. There are two types of DC/DC converters; switching and liner. We have a Linear Regulator. “As its name suggests, a linear regulator is one where a linear component (such as a resistive load) is used to regulate the output.”

linear voltage regulator pos.neg.png

To understand how to use voltage regulators, we recreated this circuit and wrote the code for it ourselves


Here you can see the ‘Fritzing’ diagram we were given to work with, the circuit we created from that diagram and the code we wrote to get the LVR working. We videoed the circuit in action

I started to look at ideas of projects I could do using my TCRT5000; I found a lot of previous projects on ‘line following robots.’ Joining with a moisture sensor we decided to make a robot that takes a flower towards a water source when the soil is dry.

I found this tutorial online for a line following robot.

I also found this website which gave me a range of project ideas using the TCRT5000

First look at the Infra-Red Tracking sensor (TCRT500)

Week beginning 29.01.18

My first point of call to properly understand this sensor was to get a better understanding of what ‘Infra-red light’ really was. I found this website ‘’ which quoted an abstract From “What is Infrared Light?” by J.S. Sweitzer, dated 11/22/94.

Sweitzer described thermal infra-red light as what we feel when we feel heat from the sun or from fire, light is described scientifically as “waves of electromagnetic energy that can travel though space”. Although we mostly perceive light as what we can see with our eyes, there are many different types that we cannot see, “Infrared light is one type of light that is invisible to us”

“Light with wavelengths from 0.7 micron to about 0.1 millimeter is called infrared light. The band of infrared light is a thousand times wider than that of visible light. All of it is invisible to our eyes.”

“Longer wavelength infrared light is emitted by hot objects in our world. So, although we can’t see the thermal infrared light from a hot piece of metal like a soldering iron, we can feel it on our skin when we bring our hand close.”

The TCRT5000 – Infra-red optimal tracking sensor

IR SENSOR W LABELSFrom first just looking at my sensor I noticed some things I didn’t understand. I had seen some versions on the internet that only had the blue and black dot part of the sensor. close up of LEDS


This means that that part of the sensor is the bit that actually does all the reading (emits the light and reads its return). Therefore I needed to work out what the rest of my board had on it.

The blue and white knob, in the centre of the board, is the sensitivity adjustment


And the prongs at the end link to the ground, the power and the desired output.


To get a first look at how this sensor worked, I found a basic code and tutorial on to get the sensor controlling an LED.

This picture is the ‘Fritzing’ found on that tutorial and here is my interpretation of the circuit.

fritz LEDpic of LED on and off circut

This was the code I copy and pasted from the website. From my knowledge of how code works, I was able to change whether the LED turned on or off when an object was detected by the sensor.

code for LED turning on TCRT5000.JPG

I took a video of my functioning circuit and code (following the instructions I found) – As you can see from this video, the LED turns on when my hand is close to the sensor.

A lot more data can be collected from this sensor than just turning a light on and off, I attempted to read this data from using the function in Arduino. My results were not as I expected so to further my research I would need re-do this trying different codes.

Here is a video of my attempt.

From looking online, I was expecting more of a steady graph.

I thought this might be because of the noise in the room that I was doing this experiment, so I found a tutorial online to get rid of the noise reading on the serial plotter.

This tutorial also taught me a lot about how the sensor worked. The sensor sends out a (light) signal which bounces off the target and sends back a signal onto the photodiode which reads various information from the signal. Unfortunately, unless it is used in perfect conditions there will be a lot of ‘noise’ disrupting the signal.

Therefore, to see the reading without the noise value, turn off the LED transmitting the signal (this will give you just the noise value in the room) and then take the value without the LED on away from the value with the LED on.

led-and-potodiode.pngremvoing noise


DeNoised Value = (signal+noise) – (noise)

Using this code – copied from the video I linked earlier – I attempted to create this

code for LED turning on TCRT5000

noiseless value. This also did not come out with the same results as on the video. With more research and following more examples next week I aim to figure out why my readings are a lot less clear. Video of my attempt.

my reading for noise reduction.png






Further into my research I found that, due to the reflective properties, the sensor could tell whether infra-red was bouncing of a white surface or a black one. I found some code online ( and a fritzing to advise in the best way to set up my circuit.

fritz for line trackingline tracking code

Here is a video of my how I managed to make my sensor react to black pen on white paper. As you can see in this video, the LED turns off when the sensor is hovering above the black surface. It then turns back on once it is over a white surface. This is because black objects are less reflective than white ones.

Going back to the research I found from ‘What is Infrared Light’ on infra-red light this can be explained “Every color has a distinct wavelength. For example, violet light can be seen at light wavelengths of around 0.4 micron(*) and yellow light is made up of waves that are 0.6 microns long.”