WEEK 5: JACK CORDERY & KEIRAN DEVLIN – Touch Operated Laser Trip Switch With Servo

This week we will be changing our approach slightly  by using 2 separate Arduino units to accomplish our goal, which is autonimous servo movement to open a door/gate via light-dependant logic.


2 x Arduino

1 x Laser

1 x Touch capacitive switch

1 x Photoresitor

2 x 2k Omhs resistor

15 x Wires

1 x Servo


This is the wiring for the first Arduino. It is important to not that we will be using a laser rather than the LED however as long as the positive and negative are connected to the same place it will function the same.

Arduino 1:

touch laser fritzing.png

The Second Arduino looks like this.

Arduino 2:

2nd Arduino.JPG

It is worth noting the resistor, this added resistance in the circuit will force the majority of the signal through the easiest route which now becomes the wire connected to A5, this helps when we are monitoring it.

We will be setting up the two circuits such that the laser points directly into the photo-resistor. This is how they look in the real world, 1 & 2 respectivley.

Arduino 1:


Arduino 2:28458815_2333886053303688_1186511326_n.jpg

Pseudocode (needs editing):

Arduino 1:

laser control pseudo.jpg

Arduino 2:

servo control pseudo.jpg



Arduino 1:

Here we have introduced a small peice of code that detects what the previous state of the touch capacitor was. This allows us to turn our momentary switch into a toggle.


Serial Monitor:da6b197031a9245a25f093c3c65a947a.png

Arduino 2:


Serial Monitor:



Laser Transmitter Module Blog 2

// Moving as posed it as a separate page.

In this blog post I will investigate the possible uses for the module.


The module is most commonly used as either an input stimulus or an output reaction to a stimulus.

This video shows the module being used in coercion with a receiver, this allows the module to work as a switch enabling you to cause an action when the transmitter-receiver connection is broken.


Adding mirrors can alter the shape of your switch area to surround a room or object.

This allows you to use the module for things like security alarms, it works effectively as a trip switch as lasers can only be seen if interacting with either an object or under thick atmospheric conditions i.e. smoke.111111

This leads to another of the most common uses for lasers, as the visual effect of a beam of light through a smoke filled area is one of the live performance industries most recognizable traits.

Another of the most common uses is as a pointer, either for drawing attention to something or aligning things. This can be achieved via a touch sensor to activate the laser. I will attempt this in my next blog post.


Week 4 – Combining a Touch Sensor and a PIR Motion Sensor – Josh Milkins

We decided that the most logical and useful application of our two sensors was an intruder alarm.

The alarm consisted of a PIR sensor which was used to detect movement in a room, it also had a touch switch which could be used to reset the alarm once is had been tripped. When the alarm is tripped, LED’s flash and a buzzer is sounded to deter intruders from continuing.

This was the fritzing diagram which shows all of the components used;

fritzing combined

Photo Capture Alarm sys

And the code;

The debouce used in the previous weeks code was also used in this one and this code also used clock cycles to flash the LED instead of;

digitalWrite(LED_BUILTIN, HIGH);
digitalWrite(LED_BUILTIN, LOW);

We used;

if (alarm){
unsigned long currentMillis = millis();
if(currentMillis – previousMillis > interval) {
previousMillis = currentMillis;
if (ledState == LOW)
ledState = HIGH;
ledState = LOW;

This allows us to put more parameters into the if statement like seeing whether the led is currently high or low.

The video shows that when i put my hand in front of the sensor it will trigger although we found the motion sensor has a very wide detectable angle of 170 degrees and so it was hard to find position that didn’t trigger it.

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

Flame Sensor Project




How does this thing work. How do people use it. How to use it within a concept. How sensitive really is it.



Literature Review:

After two weeks of research into the ins and outs of this module, I learnt a lot. The most obvious place to start as I believe most people do is to find out what components are all in the sensor and what they do to contribute to its abilities.

Initial look – 4 Pins

VCC – 3.3V (Digital) or 5V (Analog)

A0 – Analog pin

D0 – Digital Pin

GND – Ground

The analog pin always the a real-time output of the thermal resistance through the voltage signal.

The digital pin uses the sensor to read the temperature threshold, giving a high and low output which can be adjusted due to the potentiometer.


I learnt a lot researching this. A potentiometer is just a fancy resistor, however the reason a potentiometer is used in this case instead of just a resistor is because it gives the user the ability to alter the amount of resistance within the module, either making it more or less sensitive.



IR Infrared

The IR sensor reads light between 760- 1100 nm. The IR sensor also has a range of 60 degrees in which it can receive the light wave within. Sensitivity can be changed using the potentiometer.


This module could be used in a very effective way to keep people save from a flame or even just to detect flames if they were in a danger range of someone.


Testing this module was very simple in terms of the circuit as soon below. The code was a little more tricky to get it correct to match the lighting within the room and the sensitivity of the IR sensor.



Click here to view the video of the test.

To view the code for this test you can refer to my previous blogs. Click here to view.


The sensor is pretty difficult to try and set it up so that it allows reads it there is a flame to be detected and emit a warning through the use of an LED. The ability of the sensor is amazing though, just needs to be set up with great precision, or the code changed each time to adjust for the setting it is in.


In conclusion, this module was great fun to have played with. I have gained greater knowledge surrounding coding and the use of the Arduino board, which I can now continue to develop.

Close Flame, Blow it out! – Jack Gormley & Emily Mortimore -Project


How can we produce something that incorporates both the RGB and Flame sensor module.

Literature Review:

After both Jack and I did our individual research into our given modules, we had to combine the two.

RGB Module

As an overview, this module can be used to emit different colours wanted by changing the code to suit. The module itself only has four pins to connect to the circuit; red, green,blue and ground.

These three primary colours, allow the operator to code in any colour on the RGB spectrum by altering the values sent to the diodes.

The module emits light within a range of 0-255. 0 being no light and 255 being full light. So within the code if you wanted the light to emit a primary colour then it would be –

setColour(255, 0, 0); //for red

setColour(0, 255, 0); //for green

setColour(0, 0, 255); //for blue

This module allows you to play with the light colour of light emitted instead of just having a number of different colour LEDs within the circuit.

Flame Sensor

This module is very clever in the way that it works. It also has four pins; Analog, Ground, VVC and Digital.

The analog pin always the a real-time output of the thermal resistance through the voltage signal.

The digital pin uses the sensor to read the temperature threshold, giving a high and low output which can be adjusted due to the potentiometer.

Obviously the remaining two; ground and VVC. Ground pin goes to ground on the Arduino board and the VVC is the voltage going into the module which can be 3.3V (Digital) or 5V (Analog), which we used.

The module works using an IR Infrared sensor at the front. It will sense wavelengths between 760 nm – 1100 nm light. It also has a range of 60 degrees in which is detects light.


We believe that by coding these two modules together, if the flame were to be varying in distance from the sensor, then once the flame is within a certain proximity then we will have something there to remove the flame. Incorporating the change in colour into it also to show the distances even before it gets into a close proximity.



We tested using the two modules together, firstly by having the change in colour between red, green and blue depending on distance.

Click here to view.

Fritzing Diagram RBG Flame

Secondly we tested the flame sensor, with the RGB varying in brightness depending on distance from the module.

Click here to view.

We then decided to include both a stepper motor and a DC motor. The stepper motor to operate a belt drive to operate the distance the flame was from the module. The DC motor we used to operate a fan to blow out the flame once in a close proximity.

Click here to view.

Fritzing Diagram

Code used for this circuit. Click here.


After reviewing the work we have done overall from this project, we agreed that we had both strong and weak points.

For example, the research we did gave us a good background to then use the modules in a way we wished. The model which we produced to present our findings was a neat and effective way of displaying the concept.

On the other hand we do have things we would have done differently also, when assembling the model we should have put the DC motor and fan closer than it was. This would have therefore had a higher impact when blowing out the flame. Reliability was definitely one that needed a little refinement.



In conclusion our RGB & Flame Module model had a few issues with reliability. While performing some tasks sometimes as expected, like bringing the flame closer when it detects it, and activating the DC motor to blow out the flame, other times it seemingly did not want to cooperate. We found out later that these strange behaviours may be linked to the fact that it is all run off the power from a single USB 3.0 port.

Upon reflection, using a separate power supply such as a 9v battery would have possibly given us more reliable results.

The video below demonstrates the strange behaviour. In this test the step motor would advance the candle (represented by the lighter) but only for a certain amount of time. When the flame is reproduced it would continue to advance for again a short while. Based on previous tests this is aberrant behaviour. Towards the end of the video the sensor requires the flame to be brought even closer in order to activate the DC motor fan, which even then only runs for a few seconds.

Click here to view the video.



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

Sesh’o’meter – Using tilt sensor and humidity sensor to display messages based on movement and sweatiness


What can I do with my DHT11 temp and humidity sensor?

I have been looking online for projects involving this sensor, but all the projects I found revolved around using the sensor in automatic garden care devices

I wanted to do something different…

It dawned on me that I could use the sensor to monitor skin humidity…                            aka sweatiness. With this in mind, me and Chris thought about what we could do with this information and settled on trying to produce a funny piece of wearable tech.

Since Me and Chris are both fans of Dub, DnB and other bass heavy types of music, we thought it would be funny to make a device reacted to how hard the wearer was SKANKING.

Chris had selected a tilt sensor which we decided would work well with the DHT11.

Literature Review:

The basic premise of using the DHT sensor to measure skin humidity hasn’t been covered before but I had read generally about the sensor, as well as displaying it’s output on a LCD screen.

The Guide I read was:

I also used this for the LCD code.

On top of this, I read and re-read the reference section of the arduino website in order to familiarise myself with the programming language.



Following my previous investigations using various displays with the DHT sensor, I felt it would be easy enough to use the LCD in the project. I expected the hardest part to be dealing with two completely seperate input variables and deciding how to use them.

The plan was to create a headband which could measure the movement of the wearer’s head as well the sweatiness. It would then display a funny message on an lcd on the front of the headband.


My experiments were based around trying to integrate the two sensors into a cohesive circuit.

I had to find a proper minimum value for the humidity, since it would be next to someones skin. I tested it by holding it next to my skin and waiting for the value to stabilise.

The circuit I built was as follows:

Sesh'o'meter diagram_bb



After some successful test code, I went onto develop the code by adding IF ELSE statements and manipulating the input variables into a form that we could use.

This part was actually much easier than I had thought, I got the code working without any bugs pretty much straight away.

Here is a video showing the circuit in action:

*NB.   The reason the display goes blank at some points is that since the humidity sensor is not next to human skin, it’s value can go lower than the minimum I had set in the code.


The code I wrote can be found here:


Unfortunately, I ran out of time to make an enclosure for it, but will be working on one and will upload it to the blog soon!



Using tilt sensor to determine rate of movement.


Welcome to another blog post about my arduino projects. This week, me and chris decided to investigate tilt sensors. The idea is that coupled with the DHT11 temperature and humidity sensor we can produce a device which can detect the wearer’s level of movement and excursion. We would use the DHT11 to detect the sweat levels of the user and the tilt sensor to detect their movement.

Chris has done a blog post about the general workings of the tilt sensor here.


In order to use the tilt sensor to determine level of movement, I decided that if I could take an average of it’s position over a fixed time period, this could give me a rough idea, the closer the average was to 0.5, the better the level of the users movement. Obviously this is only a very rough estimation and can only really be described as detecting whether or not they passed to either side of an equilibrium point an equal number of times.

The sensor would have to be mounted on its side somewhere on the user’s head, such that it read HIGH when they leaned one way and LOW when they leaned the other.

My first go at writing the code for this was as follows:


This sort of worked, it gave me an average value. However, the FOR statement cycled so fast that the value of the average could only be 0 or 1. This would not do.

Also, viewing through the serial monitor, the value was refreshing so fast that it was impossible to read.

I needed to make sure the sample rate of the tilt sensor was reasonable enough to give me a full range of averages. The idea here was to sample every 10 millisecs, to combat the display problem, I decided to print to serial monitor only every 5 seconds and to reset the average at the same time.


My next go at the code was this:


This was a much closer approximation to what I wanted, here’s what it displayed on the serial monitor:

ScreenShot tilt sensor time delay serial mon 01

The values displayed are:

average of the tilt switch

currentmillis (the count value for the sampling)

currentmillis2 (the time value for the display)

the total (at time of printing)


when shaken around violently, I hoped the average would be somewhere around 0.5 but it seemed to jump around from around 0.3 to 0.7 when i was shaking it at a constant rate.

I discovered a number of problems, which could be causing this:

even though I was refreshing the display every 5 seconds, sometimes the total was only sampling 49 times. I thought that this was causing the problem but, when I held the sensor so that there was a constant HIGH value it would still average to 1 or 0.98 which is close enough to be acceptable.

Next I tried holding it to give a constant low value, what I found was that it averaged to around 0.6 and the total (which should be 0) was around 32, which meant it was sampling HIGH over half the time.

Obviously something was up, some noise is clearly being generated causing it to read high 50% of the time.

After re-reading chris’ blog post I realised that I had forgotten to set the internal pull-up resistor. I added a line into the setup code to do just that and the average read as 1 or 0 correctly.

After evaluating the successive averages, I found that it was very difficult to get  it close to 0.5 as I needed. I experimented with different sample rates and found that sampling every 500 allowed me to get a reasonable range of averages including 0.5.

With this finished, It was time to build the circuit.

Sesh'o'meter diagram_bb

Once I am sure that the circuit and coding works, I will build the circuit on an arduino nano and replace the brightness potentiometer  with a resistor.

I then needed to test the circuit before trying to write the code to do what I wanted. I took the earlier code used for displaying ouput from the DHT on an LCD and combined it with the new code I had written for the tilt sensor.

Here’s the code:

Everything worked correctly!

Now I could try to write some code to add more functionality. My goal was to take the inputs from the two sensors and use them to generate a score which would flash up a corresponding message on the LCD screen.

I decided that the easiest way to use the two inputs was to make them comparable and take an average. To begin with the humidity had a range of 0-100 and the tilt sensor average had a range of 0-1 (where 0 and 1 were no movement and 0.5 was max).

First, I needed to adjust the range of the humidity, since although its range is 0 to 100, the actual minimum humidity of a human forehead would be way above 0. I tested this by placing the sensor against my own head, allowing it to stabilize and then taking this as the new minimum value, luckily this ended up being 49, which I rounded to 50, giving me a range of 50 to 100. I subtracted 50 from this to give a range of 0 to 50.

Next I addressed the tilt sensor average by subtracting 0.5, giving it a range of -0.5 to 0.5. Then I took the absolute value, giving a range of 0 to 0.5, with a max of 0.5. I then noticed that I could save myself some work by changing this line:

average = total / 10;

to this:

average = total * 10;

This meant that the range for tilt sensor average was now 0 – 50.

With both having the same range I took a mean average and called this the Party Value (PV). I then produced a series of IF ELSE statements for various PV values and corresponding  funny messages for the display.

Here’s the code I used: