# Home Automation Project

#### Doruk öztürk

Joined Aug 7, 2017
7
Hello all,

I have a to do a project my Control System Design study. So my aim was to make few smart home systems and merge all these to make a basic home automation project. In general my purpose is to be able to control my home with my phone app therefore I need to connect my Arduino Uno to internet via Arduino Ethernet Shield, and then by getting an API key from Teleduino and by connecting to my Arduino, furthermore by using App Inventor program I create an app that I can use it to control my system such as setting desired degree on my phone will result in my arduino to receive this information from my phone and give power to fan or heater depending on the desired degrees. I will list down my goals and what I figured out so far.

My goals are ;
1. To put a PIR(HC-SR501) or Ultrasonic distance sensor(HC-SR04) to see how mant people goes in or out therefore count the people inside the house and also if the count goes down to minus (Someone leaves when people count is 0, meaning there is a big chance a theft occured).
2. To put a fan (5V) and a stone resistance to make a basic airconditioning system. I am measuring degress in the room with LM35 sensor.
3. To light some lights(LEDs in our case)
4. To use a servo motor to open/close/lock the outer door of the house
5. And last but most important one is to be able to do all these via using an app that I can download to my phone and being able to control my system from wherever I want via internet.

For Basic Air Conditioning System,

Measurement Error
I have mesaured room temp with arduino;

Code.1

C++:
float temp;        //Define the temp float variable
int sensor = 0;     // sensor middle pin on analog pin 0

void setup()
{
Serial.begin(9600);  //start the serial monitor
}

void loop()
{
temp = analogRead(sensor);        //assigning the analog output to temp
temp = temp * 0.48828125;         //converting volts to degrees celsius ----- 0.48828125 = [(5V*1000)/1024]10

//print information on the serial monitor
Serial.print("The temperature is :");
Serial.print(temp);
Serial.println("deg. Celsius");

//wait 1 second
delay(1000);
}
And I get 22 - 23 degrees which is reasonable. Although I need to be able to measure and then be able to send this data to internet. This is done via Teleduino which then I read analog data that by;

and then I get these messages which is the data that is sent by the LM35 Mesarument; (I have refreshed the page a few times to get few results.)

{"status":200,"message":"OK","response":{"result":0,"time":0.22406101226807,"values":[100]}}
{"status":200,"message":"OK","response":{"result":0,"time":0.22406101226807,"values":[110]}}
{"status":200,"message":"OK","response":{"result":0,"time":0.22406101226807,"values":[108]}}
{"status":200,"message":"OK","response":{"result":0,"time":0.22406101226807,"values":[123]}}

Although this data should be wrong, because we can say that if the value I read from LM35 is say 100 then when I do the math to find out th degrees it equals to something aroun 48ish degrees which is too high. I have tried 3 different LM35 sensors but all of them are giving me those results. The weird thing is that when I try to measure with arduino IDE it just gives me the right degrees. I can't figure out why when I try to some analog data from the same pin by teleduino it gives me different results that are not logical and wrong. So my question is why could it be? and is there any other easyly understandable platform or code that I can use to transfer information from arduino to web, instead of Teleduino.

I though maybe I can do this by writing analog data to a pin and then read it from that pin by Teleduino. For example after I write Code 1., I return 23 degrees celcius to a pin that I want and then read that info and send it to my phone. But I didn't really get how to use analogwrite() from the guide and not even sure if I can read or write analog data to/from a pin to then transfer that info to Web via Teleduino.

Fan Not Working When Connected to Arduino

So one another thing is when I connect my fan to 5v it spins just fine (Although it needs some push sometims dunno why?) but when I try to make it work via arduino with teleduino, when I set my fan digitaloutput pin to 1 it doesnt work, when I connect a serial led to the same circuit and set Diigtal Output to 1 led lights but fan not works, I though this might be a low voltage problem maybe ? I also tried connecting a ressistor to the circut to set the Ampere to given ampere on the fan (Though maybe the fan doesnt have its own resistance?) but it doesnt work as well.

And this is most of the issues about heating cooling part.

I will use 2 of the distance sensors to count peope that have entered the room or exit. That is kinda fine although I have the same problem of sending the information to my application bcs I can't find the way to connect it to Teleduino.

LEDs are ok, I have managed to light them up as I wish from my app (App Inventor) and also servos are undermy control as well .

If you can help me with the issues that I have addressed I would be very happy and would appritiate it!
If there is anything that you want me to clarify or that you didn't understand because of my flawed english, I would be more then happy to explain further.

Hope to seesome responds,
Regards.

#### ci139

Joined Jul 11, 2016
1,696
12V fans draw some 400mA about 5W they might be more powerful and at startup use 3x or more of that
(put it on a separate supply aided with capacitors if it won't provide enough incident current for the fan to start from that supply)
https://www.maximintegrated.com/en/design/technical-documents/app-notes/3/3530.html
(+ very bad and questionably practical motor startup aid simulation)
the arduino I/O specs are found in it's documentation or it's related web sites thay are likely limited to tens of mA