Ed and Jack – Energy Efficient Lighting


To summarise our project, we have produced a light switch module that automatically controls the lighting within a room. The purpose is to not only prevent, but change the behaviour of those who leave the lights on before leaving a room. The context being that it is a common behavioural issue, especially in the UK, that people do not consider the environmental impacts that leaving appliances on has. Leaving lights in wastes a considerable amounts of energy, and can be easily avoided. This automated lighting system is controlled by using a person counter to identify whether people are in the room or not. This is done by using two IR Sensor Modules. When the person count is 0, the lights remain off, when it is 1 or above they turn on. This is when the three way toggle switch is on energy saving mode. When the on or off options have been selected, the light will act as a conventional light. This enables the users to keep the functionality of a standard light, keeping the products use flexible. The other key feature to this product is the gamification. The light switch module recognises if the last person leaving the room has turned the switch off themselves. If they have, they get a point. If the person leaves the room without switching the light off; as they should, the module will get a point. This score will show as an ongoing percentage on the LCD display that features on the front of the product. If the light switch gets a point, a responsive sound will be produced. This will keep as a reminder every time they forget to turn the light switch off. Eventfully, the combination of the gamification and competition along with the reminder will increase the number of times that they will remind to turn the light off before leaving the room. The product heavily relies on the competitive human nature.


Final Design

Our final design consists of a white housing that holds all the electrical components. The aesthetic has been taken from other light switches, as home integration is key in the success of this product. A shiny, metallic silver switch situates at the top left. It contrast clearly enough against the white to make usability as easy as possible. The LCD display keeps central, to be as easily seen as possible from all directions, and the IR Sensor Modules locate at the bottom corners. There must be a space in between these for the directional person count to work effectively. Due to the size of the display, the moving score bar had to be removed. Clarity is significant in achieving the behavioural change, and this feature cramped the display.

Final Prototype


Final Code

The loop function contains a switch case machine which is run off an if statement based on the toggle switch position. Each toggle switch position corresponds to an action, namely:

In the “ON” position, the light is forced on and the lcd.off() function is run. This turns off both the LCD back light and the LCD itself. The automation() code is still called as the personCount needs to be kept count at all times..

In the “AUTO” position, the lcd.on() – turns the LCD back light on, automation(),  lights(personCount) – which allows the lights to be influenced by the number of people in the room, score()  and screen(pPercentage, cpuPercentage). The latter two functions deal with calculating the score percentages and with printing the information on the LCD.

In the “OFF” position, the LCD is turned off, automation(), score() and screen() are all run so that it can accurately increase cpuScore even when the screen is off.

The automation function contains the code that allows personCount to either increase or decrease. This in turn alters boolean variables that trigger the score and subsequent screen functions.

The score function contains an if() statement that only runs when two conditions, isRoomEmpty = true and wasRoomEmpty = false have been met. These two conditions are set in the automation() function inside the if() statement that only runs when the sensors are triggered. This prevents the score() function from getting stuck in a loop once personCount hits zero. Based on the current position of the switch and the two booleans, it will either add a point to playerScore or to cpuScore.

Using these two variables, this function then uses a map() function to work out what percentage of the total times the player and the CPU have won.

The screen function then takes the pPercentage and cpuPercentage from the score() function and prints them in opposite corners of the display followed by a ‘%’ symbol.



Final Circuit Diagram


Buzzer, IR Sensor Module (x2), LED, LCD, 3 Way Switch, Resistor (x2)



Potential Developments

We started this project with lots of ideas regarding how to incorporate different features into the final product. Some of which, have been left as concept due to feasibility, cost and time. Despite this, we have still kept in mind a lot of potential development options, as we believe as an idea, we could take this further.

Player Connectivity

If the product were to be bought, internet connectivity would be a good way of improving the overall interactivity. Doing so, would have a higher chance of enhancing the behavioural change. The website for example could display an overall leader board that links up to different products in different households. Displaying scores between neighbours would be an effective way of increasing the competitive nature of the product. Furthermore, the competition could exaggerate the gamification of the product. Other features that could be added through the use of the internet, include notifications via an app. The occupants of the house would download an app onto their smartphones, which would link up to their performance regarding how many times they have successfully turned the lights off before leaving the room. The app could also implement intra house competition. For example, a light switch module could be installed into every bedroom. Each user would compete, and due to the close proximity, the desire to turn the light off and win would be great. A Wi-Fi shield could be implemented to achieve connectivity to the internet, which is easily incorporated with the Arduino Uno.

Brightness Dimming

Initially we had the aim to use an LDR or another ambient sensor to measure the natural brightness of the room. However, testing the LDR proved that the component is not accurate enough. There are also many light influences in any room. The IR Sensor Modules are very sensitive, and not that tolerable to flashing lights. Another sensor that achieves this function but with more accuracy would be desirable for the consumer product. Another way of achieving automatic dimming, would be to use a spreadsheet that list the times of sunset and sunrise for each day. The Arduino would read the times, and a correlated brightness would be represented through the light. To incorporate this feature into a consumer product, the LDR would need to be calibrated in the situated room. The user would place the sensor in a suitable place within the room, that receives an average natural light brightness. This would be read and stored. The Arduino would be programmed so that the brightness produced by the room lighting would match a luminosity, so the room would remain a constant brightness all the time. This is done by using a Triode AC Switch. This dimming feature would increase the amount of energy the module saves vastly, as our initial research has already stated, “modern dimmer switches cut the supply on and off rapidly at hundreds of times per second – something called a TRIAC switch. This reduces the amount of power reaching the bulb, reducing the brightness. This does reduce the overall amount of power being used and therefore you could call them more efficient.”.

Computer Interaction

If the LCD display is increased in size and resolution, it would give us more opportunities in terms of content and detail. The clarity would be improved, so text would be more legible from a distance. Scrolling messages could be a development to build on the interactivity and competitiveness between the player and CPU. Including playful but taunting messages across the screen would provoke the user in a positive way. Messages that would notify them if they are winning or losing would evoke an emotional response, and their behaviour change would be enhanced further. This can be done by using the scroll function already programmed onto the I2C chip on the LCD.

Self Sufficiency

Another variation that we had in mind at the beginning of the project was to use solar energy. If the light switch module does not use any power from the mains, then the energy efficiency would be increased even further. Self-sufficiency would be a great selling point for product. Moreover, one of the aims for this project is to reduce the consumption of an appliance. Solar energy would not reduce energy consumption, but would eradicate any non-renewably sourced energy, and also any cost to run it. Household lighting tends to be used more when the natural light is low. Therefore, the capacitor connected to the solar cells will be more than likely charged up during the day, when the natural light is at its highest. In theory, if the solar energy is enough to power the module for enough time, it could be self-sufficient. The module could always be connected to both the mains and the solar panels for maximum functionality. If the solar energy produced is not enough to last an evening, the power can be taken from the mains.


In order to prove that this prototype conserves energy, an experiment would need to be conducted over a period of time. Installing it into someones house and recording the information would be good way of doing this. The product is finished and ready to use, so the reliability is not an issue. From clear day to day observations, and reports already written on energy wastage (see blogs), we know that people leave the lights on when leaving a room. So the problem is evident. The fact that the light is automated will reduce the energy wasted by cutting the power to the light when no one is present. This can be proved with simple mathematics. The psychology around gamification has been highlighted. Playing on the users typically competitive nature will trigger some sort of behavioural change. Whether this be due to annoyance or self determination. We strongly believe that this product conserves wasted energy from leaving the lights on when leaving the room.

Blog 10 – Energy Efficient Lighting


This blog entry contains the amalgamation of all of our code so far as well as some additional functions used to display data on the LCD.

Combining our codes for the different components proved to be challenging as our structure required reworking, as well as writing new code to be integrated.

Firstly,  we thought that our automation() function was required to pass the personCount variable to the new score() and screen() functions, in order for them to work out whether they need to be adding and printing scores to either the player or the cpu. This turned out not to be the case.

Secondly, this caused our score to increase continuously as personCount would remain zero after someone left the room. As personCount remained zero the code was stuck in a loop and unable to exit the loop to run the code that changes the value of personCount.

The code with these problems in below:




Further Revelations

After some guidance as to the structure and placement of our boolean flags, the code finally functions as intended.

Our loop() function now runs a couple of if() statements and a switch case: statement to check on the input from the three way switch and run the correct set of functions accordingly.

In the “ON” position, the light is forced on and the lcd.off() function is run, which turns off both the lcd backlight and the lcd itself. The automation() code is still called as we want to always keep track of personCount.

In the “AUTO” position the lcd.on() – turns the lcd back on, automation(),  lights(personCount) – which allows the lights to be influenced by  number of people in the room, score()  and screen(pPercentage, cpuPercentage). The latter two functions deal with calculating the score percentages and with printing the information on the lcd.

In the “OFF” position, the lcd is turned off, automation(), score() and screen() are all run so that it can accurately increase cpuScore even when the screen is off.


This function contains an if() statement that only runs when two conditions, isRoomEmpty = true and wasRoomEmpty = false have been met. These two conditions are set in the automation() function inside the if() statement that only runs when the sensors are triggered. This prevents the score() function from getting stuck in a loop once personCount hits zero. Based on the current position of the switch and the two booleans, it will either add a point to playerScore or to cpuScore.

Using these two variables, this function then uses a map() to work out what percentage of the total times the player and the cpu have won.


This function then takes the pPercentage and cpuPercentage from the score() function and prints them in opposite corners of the display followed by a ‘%’ symbol.


We had mentioned in an earlier blog that we were thinking of including a little piezo element to make a short audible cue when the cpu gains a point, in order to make the user aware when the cpu scored and encourage them to remember they are being scored against and thus turn off the light when they leave a room. This is small function playTune() at the end of the code is called in the score() function after the cpu scores a point.

playTune pic

Revised Code



Circuit Diagram




Blog 11 – Energy Efficient Lighting

Consumer Product

Our final prototype represents how the final product will function, and how it will be presented visually. However, there will need to be some slight alterations. In the home, the product will need to be integrated slightly differently compared to the exhibit.

Difference in Components

  • CFL lighting:

An LED strip with a USB connection has been used to replicate the home lighting. This is convenient, as the Arudino Uno has a 5v pin, and the voltage of the LEDs is 5V. Additionally, LED bulbs are not affected at all by being turned on and off. This characteristic makes LED bulbs a top energy savings lighting choice. They’re a great option, Energy.gov says, when used with sensors that rely on on-off operation. They also turn on at full brightness almost instantly. Additionally, compact fluorescent lamp (CFL) are frequently used by consumers wanting to save money on electricity and reduce their eco footprint. They are more commonly used in for home lighting, so consequently, these will be used for the consumer product.



  • Housing:

The prototype has a cut out section that displays the internal circuitry. This is to show how the Arduino and all the component work together. The consumer product would not feature this. It would sit in the wall like a typical light switch.

Prototype 2


  • Display:

The display we have used if fairly simple in terms of resolution and complexity of available characters. To clearly represent the score to the user, a more detailed bar scoring system would be ideal. Making the screen larger, but keeping the volt usage low would improve the clarity and therefore the overall functionality of the product.


  • Reset Button:

A reset button is commonly found on technological devices, especially on household products. This is due to some malfunctions being inevitable, and not always easily avoidable. Therefore, a reset button to clear all the code would be a good feature. This would reset the score and person count to prevent malfunctions from occurring.


  • Relay

Our home implementation would require the use of relays to control the current to household bulbs. Relays act as switches for mains voltages and are operated electromagnetically, while keeping the 5V control circuit separate from the mains power switch. This would allow us to interface our low power arduino circuit with AC mains voltage.


Difference in Code

  • 15 minute delay:

Since CFL lights are already very efficient, the cost effectiveness of turning them off to conserve energy is a bit more complicated. If we want to be energy efficient, stopping the light from turning off before 15 minutes will prevent the light from turning off and on when someone leaves the room briefly. In the long run, this will conserve more energy than without this feature. Our previous research supports this.


Proof of Concept

From our initial research, we identified the problems regarding the energy that is wasted as a result of leaving the lights on within the home. We need some additional information to support our claims, that a reminder will encouragement the users to switch the lights off when leaving the room, and in the long run, save energy.


A incandescent bulb costs about 0.75cents per hour; and LEDs or CFLs cost only one-sixth of that, so leaving the lights on (either overnight or while you’re at work for the day, say both are about 8 hours) costs you roughly 6 cents for a normal light and a bit over 1 cent for modern bulbs.


Calculating Energy Savings


To calculate the exact value of energy savings by turning a lightbulb off, you need to first determine how much energy the bulb consumes when on. Every bulb has a watt rating printed on it. For example, if the rating is 40 watts, and the bulb is on for one hour, it will consume 0.04 kWh, or if it is off for one hour, you will be saving 0.04 kWh. (Note that many fluorescent fixtures have two or more bulbs. Also, one switch may control an array. Add the savings for each fixture to determine the total energy savings.)

Then you need to find out what you are paying for electricity per kWh (in general and during peak periods). You will need to look over your electricity bills and see what the utility charges per kWh. Multiply the rate per kWh by the amount of electricity saved, and this will give you the value of the savings. Continuing with the example above, let us say that your electric rate is 10 cents per kWh. The value of the energy savings would then be 0.4 cents ($ 0.004). The value of the savings will increase the higher the watt rating of the bulb, the greater the number of bulbs controlled by a single switch, and the higher the rate per kWh.

The most cost-effective length of time that a light can be turned off before the value of the savings exceeds the cost of having to replace bulbs will depend on the type and model of bulb and ballast. The cost of replacing a bulb depends on the cost of the bulb and the cost of labour to do it.

In addition to turning off your lights manually, you may want to consider using sensors, timers, and other automatic lighting controls.

This information has been taken of Energy Gov, the U.S. Department of Energy’s consumer resource on saving energy and using renewable energy technologies at home. This information is very reliable, and supports our claims clearly.

Blog 9 – Energy Efficient Lighting


The LCD that we have, has an additional I2C chip that can control standard character LCDs using just 2 pins. This board has been developed with character LCDs in mind as a means to reduce the pin count required to drive them. This is ideal for our project, as the Arduino Uno has limited pin numbers, especially with the amount of components that we are incorporating.

I2C Scanner

Before we plugged the LCD into our Arduino, we checked the specification of the component. We found out that a reference number or code is required to be able to speak to the I2C chip. We had find the I2C by a scanning code. We found this online on an open source forum.


It identified 0x3f on the serial print. We then downloaded a library called <LiquidCrystal_I2C.h>.


Initial testing code


We connected the LCD to the Arduino; like the following Fritzing diagram. As characters were already programmed onto the I2C, we could type freely into the code and it would display without any problems.

lcd.setCursor(7, 1);

  • This has used the function that directs the cursor of the display. Essentially, it allows us to put the characters where we want, within the 16 by 2 layout.


  • This has used the function that prints what we want (Yiss), at the set cursor position (7,1).

For our prototype we need a moving bar to display a score. This had not been pre-programmed. We needed another way around this. After researching into the subject, we found that writing the characters in binary would allow us to get around the already existing characters.

We achieved this by using ‘B’ at the beginning of the line of code to establish that the values inputted are binary. Each of the 32 blocks (16×2) that make up the screen is 5×8 pixels, therefore, a 5×8 pixel binary input is needed. 1s and 0s are used to differentiate between a pixel and a space.

byte chr1[8] = {




After achieving reliable instructions to perform using the LCD, we incorporated out three way switch. For the final prototype, there are three different light settings; on, off or automatic. Automatic will be the energy saving, computer controlled lighting. For each of these options, a different display will be shown to let the user know which one they have selected.

  • On: ON
  • Off: Display off
  • Automatic: Score bar and percentage value.

For this to work, the screen needs to clear after a different switch has been selected, and show another character layout. Interrupts were the first thing that we could see working effectively, so that is what we tried.

Using Interrupts


This worked well, the text was not repeatedly clearing, and the change was quick and sharp. However, the Arduino Uno only has two interrupt pins, and these pins are needed for the IR sensors. The functionality of these components is heavily reliant on the interrupt function, due to the directional person count feature.

We needed another way of achieving three options on the display, without using interrupts.

Without Interrupts


Prototype Limitations

Due to the size and resolution of the LCD, we are limited to what we can show. The display content needs to be clear from a distance whilst simultaneously showing a score and player information. We concluded that the bar would take up the bottom blocks, of which will be filled and a space will be created to represent the difference of the two values. The percentage values will then be located at each top corner, on the first row of blocks.

Prototype 1

This photo is of our first 3D printed prototype.

prototype 1

  • We have accurately measured the dimensions of the components that need to be visible; both sets of IR sensors, the switch, and the screen, and extruded holes to the suitable sizes.
  • We had oversized the dimensions as we wanted to give the circuitry enough space so it would not be obstructed.
  • For a light switch, the housing a relatively bulky so this will be reduced. The player icons or titles need to be incorporated into the front.
  • The components had nothing to rest on or be supported by, so lips will need to be created for added security.
  • The enclosed housing does not show off the circuit and linked components. For the purpose of the exhibit, we will open this up so it can be easily seen.

CAD Improvements


  • Clear circuitry for exhibit.
  • Lip
  • Screen support
  • Lettering

Blog 8 – Energy Efficient Lighting


As we have been stuck on the sensor part of the code for a while, we decided to have a meeting with our lecturer, the result of which is the following.

Instead of trying to make the code read sequentially, we have used interrupts to trigger certain events in the code instead. When the interrupts are triggered, the Interrupt Service Routines (ISRs) that run are the functions sensor1Flag and sensor2Flag, which set the time1 and time2 variables and, through a boolean operation, allow the if() statement controlling the behaviour in the main loop to run.

We have also added a reset() function that runs after the lights(personCount); line has run, which resets all the time time difference variables to 0 to ensure we don’t see strange behaviour when the loop runs again. This function also ensures that personCount doesn’t go below 0 as that would give us incorrect behaviour.

Here is the code:



Integration with switch

Now that the sensors part of the code is working, we integrated it with our existing code for using a manual override switch. The following code runs much like the original toggle switch code, except when it triggers case 2 it calls the function automation()  which contains all the code we had in the loop for the previous code on this page. case 1 and case 3 now do a digitalWrite() to the ledPin for either HIGH or LOW respectively as well as output to the serial “ON” or “OFF”.




This is the code working on a setup that is a combination of the sensor setup using pins 2 and 3; and the switch using pins 12, 11 and 10.


Blog 7 – Energy Efficient Lighting

Three way toggle switch

We want to incorporate a manual override in our light switch so that a user can manually set the lights to be on or off. To do this we figured a three-way toggle switch would be suitable, as it provides us with a tactile feedback for the user as well as three states: on, automated and off.


Upon receiving our switch we initially had difficulties figuring out how to wire it up. we had assumed that the two separated terminals would take the input current and the switch would route this through one of the three remaining pairs of terminals. While partially correct, after testing for continuity with a multimeter, we discovered that in fact the first set of terminals in the cluster of three pairs was our input. This is illustrated in the diagram below.



After some initial tests with routing current to three separate LEDs, we decided to try and see if we could get the software to recognise when we operated the switch and then assign that to a variable. The following code uses if statements to check which of the three input pins is being turned on by the switch, before assigning a value between 1-3 to the variable state, which is then passed to a switch: case: statement and prints out a corresponding bit of text:


Here is a frizting diagram for the setup used with the above code:


The previous video shows the three switch options being read. The video below shows the development of using the 3 way toggle switch, to have an output. Three different coloured LEDs have been added to show different switch options. The next step will be incorporating the IR sensors.


Blog 6 – Energy Efficient Lighting

Design Description

A modular light switch that fits into the wall. A set of IR sensors will keep a person count to determine whether the lights will be on or off. A 3 way switch is needed for an override on and off, to provide flexible use for the user. An LCD display will show a points system, that incorporates a competition with the computer or another user. The points system will be kept as an ongoing percentage, which avoids having the score to be reset. Consequently, the score will become increasingly more accurate. All components will face the front, towards the room. This allows for a thin product, and clear visibility. The module will also connect to the internet, which will provide data regarding the times of sun set and sun rise. This indicates how bright the room will need to be, acting as an automatic dimming feature.

Prototype Developments

As we mentioned before, the behaviour change is heavily influenced but the level of interaction between the light switch and the user. Now that we know that the gamification aspect will achieve this, we need to think of a way of how to incorporate it into a prototype.

Our initial concept was a simple display using an array of LED lights that represent a points system. This is clear, and can be seen from a distance away. We put together a circuit consisting of 6 LEDS and a shift register. The code assigns an LED to a different pin, allowing us to control when it turns on. Having two rows would work well for a points system, and could be displayed nicely on the outside of the prototype. We played around with different outputs and layouts, but soon realised that it is not engaging enough. We needed something more playful.


A development for this would be an LCD display. This would allow us to program messages, and a moving graphic. The screen would be flush with the shell of the light switch, and would be in clear view.


Design Influences

We have come to a point that we know the structure and layout in mind for the working prototype. The product relies on many other things to enhance function and the behavioural influence it has on the user.

These are as follows;

  • The positioning of the IR sensors
  • The size of the LCD Display
  • The front graphics
  • The positioning of the light switch instalment
  • The number and size of switch(s)


Basic Prototype LayoutLayout

Screen Concept


Graphic Development

The housing could be etched onto, which could be the method of implicating the graphics onto the prototype. Two people pushing a bar towards each other could could be an effective way of representing the points system. The people could be engraved, and a coloured LED could highlight them. This sketch denotes this concept.

Sceen Concept.jpg


Layout Draft



Potential Situations

Human Interaction
Potential Problems
Single person walks into room.
Walk past sensor.
·         Increment personCount variable.
·         LDR detects ambient light.
·         If dark enough, turn on light.
·         The person could stop in between the two sensors.
·         Person turns back on themselves.
·         Person could enter room though another door.
·         Person could leave though another door.
Person stops walking in door way.
The person is going in between rooms, and stops. They could trigger an IR sensor, or turn a light on/off from outside the door.
·         The IR sensors could be triggered, but only one could be.
·         If the sensors are not reliant on each other, then the lights may turn on or off when the user does not need them to be.
Two people walk the  into room.
Single file, two people follow each other into the room. The IR sensors are triggered, and the light switch could be used.
·         The person count will be increased to two, and the light will be turned on according the setting and brightness.
·         The IR sensors will need to be reactive enough to detect two people close to each other.
One person walk in, and one person walks out.
The first person waits while the other walks through the door. They then walk through the doorway.
·         The person count will be increased by 1, and then decreased by 1.
·         The IR sensors will need to be reactive enough to detect two people crossing each other.
One person walks into room, and then through another door.
The person walks into the room, and straight through another. They do not use the light switch, but does trigger the IR sensors.
·         The person count will be increased, and left at that value.
·         If no one else is in the room, the lights will be turned and left on without them needing to be. Another set of IR sensors could solve this.
A child walks into the room.
The IR sensors are triggered.
·         If tall enough, the person count will be increased.
·         The child may not trigger the sensors, due to the height of the light switch. The child may harm themselves in the dark.
A dog walks into the room.
The IR sensors are triggered.
·         If tall enough, the person count will be increased.
·         The dog does not need the light to be on, but if they trigger the sensors, they will turn on automatically. Energy could be lost.
The door is opened and left obstructing the light switch.
The person opens and leaves the door open. They will need to move the door to use the switch.
·         The person count will be increased, but will not be able to change until the obstruction is removed.
·         The lights may not change due to the obstruction.
People are already in the room, and want to watch tv. It’s the evening.
They will want the lights off or dimmed, so an override switch will be needed.
·         The off switch will be triggered, which will stop the code from controlling the light intensity. The person count will remain to count.
·         The people may only want the light to be dimmed, there is not dimming override.
Someone loses something under the sofa, and needs the light bright. It’s in the afternoon.
The override switch will be needed to turn the brightness up.
·         The on switch will be triggered, which will stop the code from controlling the light intensity. The person count will remain to count.
·         Turning on the override switch may cause the person count to go up if the IR sensors are obstructed by their hand.


Blog 5 – Energy Efficient Lighting

Code using millis() VER1

Since our last iteration of code was a bit unreliable in terms of increasing personCount the correct amount, we’ve decided to try and use the millis() function to eliminate our use of delays and make our code more robust.

The following code starts a currentTime variable and assigns it to millis(), giving us a clock of how long our code has been running. When a sensor is triggered, a time variable is assigned the currentTime value. The idea is that when both sensors have been triggered, the operation time1 – time2 (sensor1  and sensor2 readings) would result in either a positive or a negative number, which would correlate to either increasing personCount or decreasing it. Here is this code:




The problem with this Code_Using_millis_VER_1 code is that no matter what direction the motion is going, personCount is increased no matter what. Additionally, the code will increase personCount as quickly as the loop is run, for as long as the sensor is being triggered, resulting in many tens of increases in just fractions of a second.


Code using millis() VER2

To resolve this we attempted to run our code in a for() loop that would only run the code every second:

code with millis snippet



While this provided a slower increment of personCount which was more accurate in testing, it still could only increase personCount and not decrease it.

We do not noe de wey.



Blog 4: Energy Efficient Lighting

Psychology surrounding Gamification

Our idea is to gamify saving energy, and turn off the lights in a room. Playing a computer, giving some sort of incentive by turning things into a game or competition will motivate the user to turn off the lights when leaving a room.

We have realised that on it’s own; automatically turning the lights off,  will not change the users’ behaviour. Therefore, we want to incorporate a level of human interaction.

There are several different ways of achieving this:

  • A points system, playing against the computer. Whenever someone leaves the room the automatic lights will trigger it to turn them off. If the user does not manually turn them off, the computer wins a point. If they turn the lights off themselves as leaving the room, they will gain a point. Different levels and challenges could be introduced to increase the level of entertainment.
  • A trigger; such as a sound of visual stimulant could activate when the user leaves the room. If they do not turn the lights off, they will be reminded by this trigger. Incentives could be incorporated to make this more enjoyable.
  • LED displays could be used, to indicate how the user is doing. Saving energy could be represented in terms how many trees they have saved. On the other hand, at the end of the week, the user could be told how much of an effect they have had on the environment. A negative reminder instead of a positive.
  • Competition between different users in a different household could provide self motivation to beet another player. Social pressure is also a big part of this.

Gamification seems like a viable solution. Increasing interactivity could change the user’s behaviour in terms of turning lights off when leaving the room. However, we need proof before going ahead with this. Finding some in depth research and analysis will help with this.


“The main aim of gamification, i.e. the implementation of game design elements in real-world contexts for non-gaming purposes, is to foster human motivation and performance regarding a given activity. Previous research, although not entirely conclusive, generally supports the hypothesis underlying this aim. However, previous studies have often treated gamification as a generic construct, neglecting the fact that there are many different game design elements which can result in very diverse applications. Based on a self-determination theory framework, we present the results of a randomized controlled study that used an online simulation environment. We deliberately varied different configurations of game design elements, and analysed them regarding their effect on the fulfilment of basic psychological needs. Our results show that badges, leader boards, and performance graphs positively affect competence need satisfaction, as well as perceived task meaningfulness, while avatars, meaningful stories, and teammates affect experiences of social relatedness. Perceived decision freedom, however, could not be affected as intended. We interpret these findings as general support for our main hypothesis that gamification is not effective per se, but that specific game design elements have specific psychological effects. Consequences for further research, in particular the importance of treatment checks, are discussed.”

Blog 3 – Energy Efficient Lighting

Given that we have done some research into our concept and found that it is worth pursuing, this blog entry details our first attempt at creating our first prototype.

The automatic light concept that we have in mind will need to control the number of people within a room. Without using a motion sensor, Infrared Sensor Module are an effective method of doing this. The sketch below is an expected layout of the products environment, a door with a light switch on the right, against a perpendicular wall.





The above is an Infrared Sensor Module which consists of an IR emitter (dark diode) and an IR reciever (clear diode). It has three pins out, which are VCC, hooked up to a 5V rail; GND, going to ground; and OUT, which gives out the reading of the sensor.

Two of these sensors will be used next to each other to determine direction of the movement.


The above is the photo-resistor (LDR) mentioned at the end of the previous blog.


The Setup:


The above image shows the setup with two infrared barriers connected to digital pins 2 and 8. An LED is connected to pin 13 as it has a built in resistor.


The Code:



The code is supposed to work by using if statements to increment the variable personCount based on which sensor is activated first. personCount is then given to the lightCount() function which either turns the LED on or off depending on the value.

In practice we found that the code would increment and decrement the personCount variable and this would either turn on or off the LED, however there were some issues.

First off the personCount variable had the ability to go into the negatives, which could potentially lead to inaccurate counting of people in a room. This was fixed by adding && personCount > 0 in the following line of code that handles decreasing the value of personCount:


The second issue we were having was that if only one of the sensors was triggered it would increase the personCount variable very quickly, often ending up many tens higher or lower than intended. We are still working on this issue, but have had some success with incrementing the personCount variable. By creating the increment command inside of a nested if() statement, we were able to make sure that the variable is only incremented when both sensors are triggered, first sensor 1 and then sensor 2:

nested if

While this made the increment scenario work acceptably, it completely broke the decrement scenario, where the variable would no longer decrement. We tried reverting this if() statement to its original structure of not being nested, which allowed the personCount variable to temporarily be decreased, however it would then return to its previous un-decremented value.

decrement not work.PNG

We think this has to do with it then running the increment scenario if() statement right after the delay, but are not sure.