SMART BLINDS 12 – Stepper Motor Integration & Prototype

Setup: Same as last 2 blogs but with motor driver signal pins plugged into logic board (left):

fritzing.PNG

This is our current wiring. Unfortunately we ran into a few problems with our arduino running out of memory. The Arduino on the left is responsible for all the logic, this takes up a substantial amount of code, over 430 lines!! The meant that we hit over 93% memory usage before even integrating the code for the stepper motor. As seen here:memoryerror

our next stage is to try and reduce memory usage so we can add in the stepper motor to our logic board. Even the Simplest motor code takes over 10% of memory to function. We estimate around a further 15% will need to be freed up for our use case.

User interface improvements:

While we were working on this i also changed the code so that when the user changes wither the mode or user temp then it would output this to the LCD. Then when the next set of temps comes round it defaults back to displaying the In and Out temperature readings. This means that after initial set-up the arduino can run quite happily by itself, independent of any PC.

usermodeuser temp

Working prototype:

This is our final Working prototype! We integrated our existing code used in the stepper motor blog before and ran into a few problems, however after some tinkering and adding of some new code:Newcode

We were able to get the motor runing when it was suppose to! as seen here:

The next stage was to mount the motor to our ‘window frame’  and test to see if it could pull the blind. we used a 2nd hand blind found for free on the internet.

Final Model.jpg

Below is the mounting for the motion sensor and the LDR. Thermo sensors were mounted at the top of the frame as shown in picture above.

motion.jpg

Final Code:


 

// First we include the libraries
#include 
#include 
#include 
#include 

#define ONE_WIRE_BUS A5

const int stepsPerRevolution = 360; // Number of steps
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

// Assign the addresses of the 1-Wire temp sensors.
DeviceAddress TempIn = { 0x28, 0xFF, 0x3A, 0xAB, 0xC2, 0x17, 0x04, 0xB3 };
DeviceAddress TempOut = { 0x28, 0xFF, 0x16, 0xA5, 0xC3, 0x17, 0x05, 0x8A };

LiquidCrystal lcd(13, 12, 7, 6, 5, 4);

const int Interval = 10000;
unsigned long previousMillis = 0;

 

#define LDR A0
#define PIR A1
#define LeftSwitch 2
#define RightSwitch 3

int LDRRead = 0;
int PIRRead = 0;

int userTemp = 0;
float InsideTemp = 0;
float OutsideTemp = 0;

bool BlindOpen = true;
int BlindState = 0;
int Set_Mode = 2;
bool SetUpComplete = false;

bool UserInRoom = false;
bool Night = false;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void setup(void)
{
// start serial port
Serial.begin(9600);
Serial.println("Smart Blind Version 0.420");
// Start up the library
sensors.begin();
sensors.setResolution(TempIn, 10);
sensors.setResolution(TempOut, 10);
lcd.begin(16, 2);
lcd.setCursor (0, 0);
lcd.print("SmartBlind v4.20");
lcd.setCursor (0, 1);
lcd.print("Initializing...");
pinMode(LDR, INPUT);
pinMode(PIR, INPUT);
delay(1500);
pinMode(LeftSwitch, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(LeftSwitch), LeftDigit, FALLING);
pinMode(RightSwitch, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(RightSwitch), RightDigit, FALLING);

myStepper.setSpeed(42); // set the speed at 60 rpm:

}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void loop(void) {

if (SetUpComplete == false) {

ModeChoice();
Serial.println();
SetTemp();
Serial.println();
SetUpComplete = true;
}
else {
unsigned long currentMillis = millis();
if (currentMillis - previousMillis > Interval) {
previousMillis = currentMillis;

 

if (Set_Mode == 1) {
Serial.println();
Serial.println("----------------------Start Of Sensing----------------------");
//PIR_Sense();
//NightOrDay();
CallTemp();
AssignTemp();
LcdPrintTemp();
SavingsMode();
ForwardOrBackwards();
}
if (Set_Mode == 2) {
Serial.println();
Serial.println("Smart Mode");
PIR_Sense();
NightOrDay();
CallTemp();
AssignTemp();
LcdPrintTemp();
SmartMode();
ForwardOrBackwards();
}
if (Set_Mode == 3) {
SetUpComplete = false;
}

}
else {
Serial.print("");
}

}
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void ForwardOrBackwards (){
Serial.println(BlindOpen);
Serial.println(BlindState);
if ((BlindOpen == true) && BlindState == 1) {}
if ((BlindOpen == true) && BlindState == 0) {
myStepper.step(stepsPerRevolution);
BlindState = 1;
}
if ((BlindOpen == false) && BlindState == 1) {
myStepper.step(-stepsPerRevolution);
BlindState = 02
231;
}
if ((BlindOpen == false) && BlindState == 0) {}

}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void LeftDigit ()
{ if (SetUpComplete == false) {}
if (SetUpComplete == true) {
Set_Mode = Set_Mode + 1;
Serial.print(Set_Mode);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("User Mode: ");
lcd.print(Set_Mode);
if (Set_Mode > 1 ) {
Set_Mode = 0;
}
else {}
}
}

 

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void RightDigit ()
{
if (SetUpComplete == false) {
}
if (SetUpComplete == true) {
userTemp = userTemp + 1;
Serial.println(userTemp);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("User Temp: ");
lcd.print(userTemp);
if (userTemp > 38) {
userTemp = 10;
}
else {}
}
}

 

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void SmartMode() {

//----------------------------------------Scenario 1: Warming----------------------------------------

if ((((InsideTemp < userTemp) && InsideTemp < OutsideTemp) && UserInRoom == false) && Night == false)
{
Serial.print("Day: Inside is Too Cold, Outside is Warmer - Opening blinds to let in heat");
Serial.println();
BlindOpen = true;
// BlindState = 1;
}
if ((((InsideTemp < userTemp) && InsideTemp < OutsideTemp) && UserInRoom == true) && Night == false)
{
Serial.print("User in room during Day: opening blinds for light");
Serial.println();
BlindOpen = true;
// BlindState = 1;
}
if ((((InsideTemp < userTemp) && InsideTemp < OutsideTemp) && UserInRoom == false) && Night == true)
{
Serial.print("Night: Inside is Too Cold, Outside is Warmer - Opening blinds to let in heat");
Serial.println();
BlindOpen = true;
// BlindState = 1;
}
if ((((InsideTemp < userTemp) && InsideTemp  userTemp) && InsideTemp  userTemp) && InsideTemp  userTemp) && InsideTemp  userTemp) && InsideTemp < OutsideTemp) && UserInRoom == true) && Night == true)
{
Serial.print("Night: User in room: Closing blinds for privacy");
Serial.println();
BlindOpen = false;
// BlindState = 0;
}

//----------------------------------------Scenario 3: Too Cold----------------------------------------

if ((((InsideTemp  OutsideTemp) && UserInRoom == false) && Night == false)
{
Serial.print("Day: Inside is Too Cold, Outside is Cooler: Closing blinds to save heat");
Serial.println();
BlindOpen = false;
// BlindState = 0;
}
if ((((InsideTemp  OutsideTemp) && UserInRoom == true) && Night == false)
{
Serial.print("Day: User in room during Day: opening blinds for light");
Serial.println();
BlindOpen = true;
// BlindState = 1;
}
if ((((InsideTemp  OutsideTemp) && UserInRoom == false) && Night == true)
{
Serial.print("Night: Inside is Too Cold, Outside is Cooler: Closing blinds to save heat");
Serial.println();
BlindOpen = false;
// BlindState = 0;
}
if ((((InsideTemp  OutsideTemp) && UserInRoom == true) && Night == true)
{
Serial.print("Night: User in room: Closing blinds for privacy");
Serial.println();
BlindOpen = false;
// BlindState = 0;
}

//----------------------------------------Scenario 4: Cooling----------------------------------------

if ((((InsideTemp > userTemp) && InsideTemp > OutsideTemp) && UserInRoom == false) && Night == false)
{
Serial.print("Day: Inside is Too Hot, Outside is Cooler: Opening blinds to let out heat");
Serial.println();
BlindOpen = true;
// BlindState = 1;
}
if ((((InsideTemp > userTemp) && InsideTemp > OutsideTemp) && UserInRoom == true) && Night == false)
{
Serial.print("Day: User in room during Day: opening blinds for light");
Serial.println();
BlindOpen = true;
// BlindState = 1;
}
if ((((InsideTemp > userTemp) && InsideTemp > OutsideTemp) && UserInRoom == false) && Night == true)
{
Serial.print("Night: Inside is Too Hot, Outside is Cooler: Opening blinds to let out heat");
Serial.println();
BlindOpen = true;
// BlindState = 1;
}
if ((((InsideTemp > userTemp) && InsideTemp > OutsideTemp) && UserInRoom == false) && Night == true)
{
Serial.print("Night: User in room: Closing blinds for privacy");
Serial.println();
BlindOpen = false;
// BlindState = 0;
}
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void SavingsMode() {
if ((InsideTemp < userTemp) && InsideTemp  userTemp) && InsideTemp < OutsideTemp)
{
Serial.print("*Inside is Too Hot, Outside is Warmer: Closing blinds to reduce heat transfer*");
Serial.println();
BlindOpen = false;
// BlindState = 0;
}
if ((InsideTemp  OutsideTemp)
{
Serial.print("*Inside is Too Cold, Outside is Cooler: Closing blinds to save heat*");
Serial.println();
BlindOpen = false;
// BlindState = 0;
}
if ((InsideTemp > userTemp) && InsideTemp > OutsideTemp)
{
Serial.print("*Inside is Too Hot, Outside is Cooler: Opening blinds to let out heat*");
Serial.println();
BlindOpen = true;
// BlindState = 1;
}
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void ModeChoice () {
if (SetUpComplete == false) {
Serial.println();
Serial.print("Do you want 'Smart' mode [2] Or 'Maximum Savings' mode? [1]... ");

lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Smart / Savings?");

while (Serial.available() == 0) {}
if (Serial.available() > 0) {
Set_Mode = Serial.parseInt();
Serial.print(Set_Mode);
lcd.clear();
}
}
// else {
// if (Set_Mode == 2) {
// Serial.println();
// Serial.println("Manual Mode Enabled:");
// lcd.clear();
// }
if (Set_Mode == 2) {
Serial.println();
Serial.println("Smart Mode Enabled:");
lcd.clear();
}
if (Set_Mode == 1) {
Serial.println();
Serial.println("Savings Mode Enabled:");
lcd.clear();
}
}

 

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void PIR_Sense () {
PIRRead = digitalRead(PIR);
if (PIRRead == HIGH) {

Serial.println("----------------------Start Of Sensing----------------------");
Serial.println("Motion detected!");
UserInRoom = true;

}
else {
Serial.println("----------------------Start Of Sensing----------------------");
Serial.println("Motion stopped!");
UserInRoom = false;
}
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void NightOrDay () {
LDRRead = analogRead(LDR);
if (LDRRead  0) {
userTemp = Serial.parseInt();
Serial.print(userTemp);
lcd.clear();
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void printTemperature(DeviceAddress deviceAddress)
{

float tempC = sensors.getTempC(deviceAddress);

if (tempC == -127.00)
{
Serial.print("Error getting temperature ");
}
else
{
Serial.print(tempC);
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void CallTemp() {
Serial.println();
Serial.println("Getting temperatures... ");
Serial.println();
sensors.requestTemperatures();
Serial.print("Inside Temp in Degrees C: ");
Serial.println();
printTemperature(TempIn);
Serial.println();
Serial.print("Outside Temp in Degrees C: ");
Serial.println();
printTemperature(TempOut);
Serial.println();

}

SMART BLINDS 11: functioning logic & User Modes.

In this blog we will be going through our code so far, and explaining the choices and variables that will affect the output of the code.

Components:

1 x Arduino Uno

1 x l298n stepper motor driver

1 x  Stepper motor (17HD34008-22B)

1 x 9V battery

1 x LCD

1 x PIR sensor

2 x Momentary buttons

2 x Thermisters

1 x LDR

1 x Variable Resistor

Jumper cables.

Diagram:

 

Real World:

 

Code:Variables

Above is the Variables and Initialisation for our Libraries.

  • “OneWire” is responsible for data readings from our Temp sensors. Using OneWire also allows us to run 2 Temp sensors off of the same pin on the Arduino.
  • “DallasTemperature” allows for the conversion of raw data from the Temp Sensors, and outputs in degrees C or F.
  • “LiquidCrystal” Runs our 2 x 16 LCD display.

 

  • Next we start to assign values to our Temp sensor pin A5. Then pas the OneWire values to DallasTemperature for conversion so it knows where to look.
  • We assign DeviceAdresses to each of the Temp sensors, each has its own unique interal callsign. We found these by writing a program stated in an earlier blog.
  • Next is to tell our arduino which pins to output for the LCD display.
  • Finally we get to the integers, floats and boolean variables that make our logic run. The most imprtant is probably “BlindOpen” this is the boolean that will tell the arduino whether or not the blinds are open / clossed.

 

Below is the Setup:

Here we assign the resolution of our temp sensors to 10 bit. We begin our LCD, print our messages to the LCD. And finally define our button interupts to pins 2 & 3. (The only 2 pins on the arduino that can run the interrupt function).setup.jpg

Loop: 

This is the most important part of the code. We have used many different functions (which i will go through in a second) and simply call on them when needed. This way of doing it can save valuable memory space as you don’t have to re-write the same code every time you want to use it. LOOP

Getting Rid of Delay:
There used to be a delay in the loop that would refresh the temps every 6000 millis, however we got rid of this as it hung up the code and made the inputs buggy. Instead we measure time past with current time and if it is over 6000 milliseconds then it will refresh the temps. This frees up the code to do other things and allows multi-tasking.

  • It is worth noting that there are 2 discrete “Modes” functioning in this Code. The first of which is:

Savings Mode: This is the simplest of the 2 modes and allows the decisions that will result in the most energy savings for your house. However it does not take into account whether or not the user is in the Room or if it is Night or day. This mode would be useful if you knew you were going to be out all day. or perhaps went on holiday.Savignsmode

Smart Mode: This mode takes into account 5 different variables in order to make an informed guess as to whether or not the blinds should be open or closed. We measure Inside, Outside and the user desired Temperatures. Then cross reference that with if the user is in the room and if the time of day is say or night. WE feel that this gives us enough information to get the blinds to be fully automated.Smart mode

Smartmode2

smartmode3

Next we have our interrupt code. The top on cycles through the mods and the other adjusts the user temp. This allows of full functionality of the arduino without a connected PC. We were going to use a Keypad but it started outputting characters not in the english language and even when we weren’t touching the pad!! so we opted to simplify the input methods. Also this allowed us to free up 12% of the arduino memory, which is important as we would have run out otherwise.

 

Below is the code that determins if the arduino needs to be set up. If Setup has not been run before the arduino will ask the user which mode they want to be in. else it will output the mode it is currently set to in the serial monitor.

modechoie

Next up we have the USP of our blinds. We measure if the user is in the room or not and then what time of day it is. This allows us to keep the user privacy at night and let in light during the day, but ONLY when there is a user in the room, otherwise it will do whats best for the energy savings.PIRNIGHTDAY

Below we have the code that outputs the Temperatures to the LCD screen, this is important as it allows the user to monitor what is going on with temps and then make an informed decision based on that. Also we have ‘AssignTemp’ here we take the readigns from the tempreature sensors and assign them to variable integers. This allows us to compare them and output decisions. without this code we could not do this as the temp sensors output in weird ways. Next is ‘SetTemp’ this allows the user to input the tempreature they want the room to be. we use the serial monitor for this. If the user inputs nothing this function will not let the arduino do anything until there is a value assigned to this variable.LCDprint ASSIGNTEMP Settemp

Last but not least we have the functions that actually measure and write the temperatures from the sensors. We included an error message when the sensor reads -127 degrees C as this normally means that the wires are not plugged in correct. ‘Call temp’ uses simple comands to output the Temps to the Serial monitor.

Serial monitor:

Here i put my hand on the inside temp sensor to simulate a warm house and in the 2nd set of temps i put my hand over the LDR to simulate night. You can see the outputs change dependent on the variables.

Capture

Video Demonstration:

SMART BLINDS 10 – Stepper Motor and Prototype

The stepper needs to be programmed to be able to both unwind and wind up the blind dependent on the input circumstances.

The motor we have purchased is a two-phase 4 wire stepper motor with 1.8 degree steps (17HD34008-22B)61n4yD2-UjL._SL1024_We have chosen to build a universal blind driving system rather than a custom built curtain as it creates a product that can be fitted to existing curtains and saves on materials and costs, both of which would reduce the sustainability of the product.

Most blinds have balled pull cords, which the standard distance between balls as around 7.5mm, I made a drive wheel which directly transfers the motion from the motor to the blind cord.Picture1

The motor is driven through this Dual H Bridge L298N Stepper Motor Driver.

41CRVQIhIALCoding the motor and driver should have been a simple task as all that we require it to do is to rotate a certain number of steps on command, in both directions. However due to currently unknown reasons, this has proven to be a very difficult task.

This is one of the circuit orientations that we used, none of which would work correctly with even the simplest pieces of code.

30705081_2115131518516107_4013519751245463552_n.jpg

motor.jpg

We have spent hours trying to get the motor to work in many different orientations and with lots of different forms of code and we have managed to get the motor to move, however it kept rocking back and forth, no matter what circumstances we put it under.

Picture2.png

We can only conclude that one of our components is faulty as we feel that we have tried all other options of testing the modules.

Prototype:

We have outsourced a rolling blind from Gumtree to test our product on, we have also built a wooden window frame which has a mountable base for the arduino so that the product can work in

 

Video Demonstration:

SMART BLINDS 9: Energy Efficiency

As this is a sustainability based project it is very important to know the mathematics behind our own products energy usage:

English Heritage reports that heavy curtains/blinds can reduce heat loss through a window by 40%. This number is obviously a ball-park figure as it is completely variable on the temperatures, style of window, quality of window, size of window and many other factors, and therefore we will use 30% as our amount of energy saved.

According to Greenspec.co.uk A typical house loses 10% of its heat through the windows.

Compiling this data with the quote from our first blog that stated ‘Drawing the blinds at dusk can reduce window heat loss by 13-14 per cent per annum’;

‘A ‘typical‘ home in a mild climate uses between 5,000 kWh and 30,000 kWh of energy a year for its heating.’ – OVO Energy UK

Taking the mean data from the margins above we can assume that:

12500 /  = 1250

Average yearly energy lost through windows = 1250kWh

x 0.30

Average yearly energy saved by blinds = 375kWh

UK Average rate of 15.41p/kWh  

Money is the easiest way to change the attitudes of the public towards a concept. Taking the heating energy used as 12500KWh per year that is a £1926 heating bill, with £192 being lost through the windows of the house.

If it had no running costs our product would be able to save the user £57 per year on heating energy through the windows.

It is hard for us to calculate the running costs at the moment as we have no idea how often the 1.5A motor would run per day.

We have used an amp-meter on our Arduino circuit without the inclusion of the motor and have found that it has a 500mA power draw. With a 6V Voltage this gives us a running wattage of 0.3W

This is a yearly power consumption of 2.628Kwh (excluding motor)

Assuming the motor is used 4 times per day, and takes 15 seconds to wind the blind, it will be in use for 6 hours per year.

Power of product (including motor) = 2.75KWh (Rounded up)

A cost of 42p per year.

This is not 100% accurate as we have had to make some estimations due to being unable to test the idea however it shows that the product will easily make sustainable energy savings and will save the user money.

 

SMART BLINDS 8: External Power supply & Daytime Settings

One problem that we have come up against since adding the extra sensors is that there is not enough power available from the 5V USB supply.

To combat this problem we have added another breadboard which has a 9V battery supply, this breadboard will supply some of the more power draining modules.

This circuit uses:

1 x 1uF Capacitor

1 x 22uF Capacitor

1 x Voltage Regulator

6 x wires

1 x 9V Battery

1 x 9V Battery Attachment

frit bat1#

30712768_2113133338715925_6431732719968845824_n

This circuit allows us to power some of the components externally from the original board. We aspire to get all of our pieces onto one board, however for now, we need the extra space.

Next step was to build in the means of determining ‘daytime’ and ‘nighttime’:

Initially we thought that the best way to do this would be to utilize the RTC feature of the arduino’s to allow the user to set their own daytime and nighttime hours, however after looking into coding the issue it became clear that with the current resources available the user would have to programme in the date and time every time before setting their own hours for each setting. As we already have quite a lot of variables that are programmed at the start of use for ease of display we have decided that this setting will be controlled more simply via an LDR, as this still shows that the system is capable of accounting for the variable, and this can display it in a semi-effective way.

Obviously long term there would be drawbacks of using an LDR as there is a lot of grey area which comes with determining what is a night level of light and what is a day one.

It could also cause potential problems depending on the positioning of the LDR and/or the light levels surrounding the window.

The LDR is fitted into A0, Positive and negative.

SMART BLINDS 7: Using 2 temperature sensors at once.

ForeWord: Before starting this project you will need to know the Internal Adress that each of the DS18B20 sensors has stored in its chip. There are a few ways to find this, either read it off the outer casing of the sensor or use a circuit and some code to give you the adress digitally. Details on how to do this can be found here

Components:

1 x Arduino UNO

1 x 5k Ohm resistor

2 x DS18B20 Temperature sensor

15 x Wires

Diagram:2 thermo

Due to limitations in the firtzing software the connections look more complex than they actually are. However as long as both sensors are connected in series to the breadboard and the 5V and the “Data” (middle) wire joined by a 5k Ohms resistor, you should be fine.

Below is how it should look on your breadboard.

20180416_172431

Code:

</pre>
// First we include the libraries #include #include //////////////////////////////////////////////////////////// Data wire is plugged into pin A5 on the Arduino #define ONE_WIRE_BUS A5 //////////////////////////////////////////////////////////// Setup a oneWire instance to communicate with any OneWire devices //////////////////////////////////////////////////////////// (not just Maxim/Dallas temperature ICs) OneWire oneWire(ONE_WIRE_BUS); //////////////////////////////////////////////////////////// Pass our oneWire reference to Dallas Temperature. DallasTemperature sensors(&amp;oneWire); /*-----( Declare Variables )-----*/ // Assign the addresses of your 1-Wire temp sensors. DeviceAddress TempIn = { 0x28, 0xFF, 0x3A, 0xAB, 0xC2, 0x17, 0x04, 0xB3 }; DeviceAddress TempOut = { 0x28, 0xFF, 0x16, 0xA5, 0xC3, 0x17, 0x05, 0x8A }; void setup(void) { // start serial port Serial.begin(9600); Serial.println("Dallas Temperature IC Control Library Version"); // Start up the library sensors.begin(); sensors.setResolution(TempIn, 10); sensors.setResolution(TempOut, 10); } void loop(void) { delay(1000); Serial.println(); Serial.print("Number of Devices found on bus = "); Serial.println(sensors.getDeviceCount()); Serial.print("Getting temperatures... "); Serial.println(); // Command all devices on bus to read temperature sensors.requestTemperatures(); Serial.print("Temp Inside is: "); printTemperature(TempIn); Serial.println(); Serial.print("Temp Outside is: "); printTemperature(TempOut); Serial.println(); } /*-----( Declare User-written Functions )-----*/ void printTemperature(DeviceAddress deviceAddress) { float tempC = sensors.getTempC(deviceAddress); if (tempC == -127.00) { Serial.print("Error getting temperature "); } else { Serial.print("C: "); Serial.print(tempC); Serial.print(" F: "); Serial.print(DallasTemperature::toFahrenheit(tempC)); } }// End printTemperature //*********( THE END )***********
<pre>

2 thermo Serial Print

Motion Sensor Testing

The next step was to figure out the motion sensor, all we need is a detection alert with a timer.

This shows how it works:

Arduino

motion

30724488_2111708625525063_2382136136790179840_n

 

 

 

 

 

 

 

SMART BLINDS 5: Testing the Keypad & LCD

To test the LCD Screen we needed to learn to use the LiquidCrystalDisplay Library.

https://www.arduino.cc/en/Tutorial/LiquidCrystalDisplay

Following this tutorial I managed to get the module to display any message that we wanted.

30530774_2102027026493223_6145115902900699136_o11111 (2)

LCD_Base_bb_Fritz

The next step was to integrate the keypad and connect it to the screen.

This involved learning to use the Keypad Library

http://playground.arduino.cc/Code/Keypad

I used this tutorial and managed to get the input on the keypad showing on the Screen.

30442536_2102107726485153_7384872012621021184_n

333

Next, we will figure out how to program our logic into the keyboard.

SMART BLINDS 6: Kinetic Façade

kinetic facade

After getting all the components talking to each other we decided to start our investigation into the blinds and the materials, shapes and structures that would be optimal for our application.

Material: (quoting from Wikipedia, needs to be re-typed)

Fabric

Blinds made of fabric can either be rolled up thanks to a thin cord and small horizontal slats (Roman blind), folding blinds with no horizontal slats create a bali-fabric-blinds-po17-v1.jpgless structured look (Austrian blinds). Most fabric used to manufacture blinds comes from Norway. Many fabrics are used including cotton, polyester, wool, viscose and silk to create the blinds. A silk cloth can be present or embroidery stitch, which will give tissue varied terrain. If you combine silk and cotton, it is possible to achieve a two-layered fabric, similar to the skin of the animal

Wooden blinds (Venetian blinds):

Wooden blinds are generally known as Venetian blinds. A number of horizontal wooden slats are joined together by corded pulleys which can either gather all the slats at the top of the window to reveal the view or simply angle the slats Wooden-venetian-blinds.jpgwhile allowing some light to travel through the blind yet retaining some level of privacy. Wooden blinds come in a number of finishes (determined by the type of wood used, which ranges from painted to most types of solid oak varieties) and sizes (determined by the width of each slat which is usually available in one of three widths—25 mm, 35 mm or 50 mm). Wooden Venetian blinds are also available as vertical blinds. These are usually made up of wider slats and operate in virtually the same way as their horizontal counterparts (i.e. instead of being drawn upwards to reveal the window, the draw to one side gathering in a vertical bunch).

Pinoleum blinds:

Pinoleum blinds are made up of small wooden twigs laid horizontally which are thV8PAFIZZjoined together by vertical threading. The resulting weave is, as a result, only flexible vertically and can be drawn upwards once manufactured as a roller blind or in a similar fashion to a Venetian blind. Conservatory blinds are often made with Pinoleum.

In Malaysia, an outdoor blind is sometimes called a “chik”. The word was carried over from India by the British during the colonial times.

Faux wood:

Faux wood blinds are an alternative to real wood blinds. Faux wood is also known in some countries as Plaswood (Plastic & Wood). Made of a composite of da46ab60-3f80-4930-99b7-dcdc08f790fe_1000man-made materials and natural wood particles, faux wood can be a less expensive choice than natural wood. These blinds have become more popular as the products have matured, becoming cheaper and more versatile at the same time offering more of a natural wood look. Current faux wood blinds are warp resistant, have UV ratings as high as 500 and come in colors that would be hard to find in natural wood blinds. Because of their resistance to warping, faux wood window blinds are suitable for areas with extreme temperature swings or high moisture, such as bathrooms and kitchens.

 

SMART BLINDS 3: Bought Components & Blind system

Purchased Components:

LCD Display Module (HCMODU0013)

To enable user to set temperatures.

  • use standard LCD library

ZEWSryU4Qzc._UX300_TTW__

http://forum.hobbycomponents.com/viewtopic.php?t=1326&p=3240&hilit=hcmodu0013

4×4 Keypad (BLAA100075)

Allows user to input data and activate blinds.

BLAA100075_4x4_20Matrix_20Membrane_20Black_1_9390804b-e752-41ce-8d5b-03343f400737_x700

https://fluxworkshop.com/products/blaa100075-4×4-matrix-membrane-black

Waterproof Temperature sensor (DS18B20

Senses inside and outside temperature.

1

https://www.terraelectronica.ru/pdf/show?pdf_file=%2Fz%2FDatasheet%2F1%2F1420644897.pdf

IR Infrared Motion Detection Sensor

Detects the presence of someone coming into the room.

11

https://www.tomtop.com/p-c2742.html?currency=GBP&aid=bpagb1&mid=10000019969&utm_source=SEM&utm_medium=Bing+Ads&utm_campaign=TT_GB_PA_BMZ&utm_content=2917&utm_term=4575892518181955#discussions

Blind system:

As designers we aspire to make our solutions interesting as well as effective. For this reason we have decided to steer this aspect of the design away from conventional curtains and blinds.

Research found a number of interesting kinetic designs for light based projects such as this:

However our project is insulation based and therefore we need a design which is effective at keeping the heat inside the house and we have to work within the restraints of a standard window frame, on the inside.

 

 

SMART BLINDS 4: Logic & Thermistor Testing

Psuedocode:

Here is a psuedocode diagram of the decisions we want our project to make and the outcomes that these decisions would produce.

Arduino Logic Diagram: PsuedoCode

Components:

1 x Arduino UNO

2 x 10k Ohm resistor

1 x DS18B20 Temperature sensor

10 x Wires

Diagram:

Take care to include the Resistors in parallel as we are aiming for 5K Ohms of resistance, but our kit does not have this so we have to improvise. This is a pull-up resistor and allows the Arduino to calculate the resistance, and therefore temperature in the sensor.

PROTOTYPE 1

And in the real world it looks like this:

thumbnail (1)

Thermistor Coding:

The learning for this part of the project was mainly learnt from in lectures however in order to supplement this learning we also looking to the internet which has a vast selection of online tutorials on this topic (and many others).

http://www.circuitbasics.com/arduino-thermistor-temperature-sensor-tutorial/

http://www.instructables.com/id/DIY-Arduino-temperature-sensor/

CODE FIRST TEMP SENSOR

This is the code taken from the first link. It will need to be stripped down to its working parts when we start to intergrate the other aspects of our design but for now we have a working thermistor. We have had to include several libraries in order to interpret the signal coming from our sensor (OneWire which is responsible for the data transfer and DallasTemp which calculates all of the data recived and outputs it in degrees).

oUTPUT FIRST TEMP SENSOR

Here is the output of that code in the serial monitor. This scenario is of us holding the sensor, heating it up and then letting go. As you can see this is a very accurate system with consistent results.

Next Step: to start to integrate the keypad and LCD diplay as shown in these examples.

http://www.circuitbasics.com/arduino-thermistor-temperature-sensor-tutorial/

https://create.arduino.cc/projecthub/TheGadgetBoy/making-lcd-thermometer-with-arduino-and-lm35-36-c058f0