Msemtd HomeAuto

From Nottinghack Wiki
Revision as of 15:01, 16 December 2011 by Msemtd (talk | contribs) (→‎Temperature)
Jump to navigation Jump to search

Michael's Home Instrumentation

  • New porch doors have required me to rethink my doorbell!
  • We can't hear people knocking on the door
  • The people at the door don't know if the old doorbell actually rang
  • The old wireless doorbell often didn't ring because the batteries were flat!
  • The wireless doorbell didn't require drilling holes in the doorframe - this is a plus
  • the 12V battery in the wireless doorbell pushbutton was expensive!

I want to do something simple with the old wireless doorbell and start to develop an extensible home automation/instrumentation project. I have a Nanode and a number of Xinos which I intend to connect on a 4-wire bus around the house.


The old doorbell

Push-button:

Chime unit:

  • PCB labelled "RL-09B 04.02.27"
  • Batteries 4.5V, 3xAA
  • IC2: LP816A
Error in widget Flickr gallery: Unable to load template 'wiki:Flickr gallery'


http://www.alldatasheet.com/view.jsp?Searchword=HCF4069UBE

The Nanode - Xino 4-wire Bus

Using a Nanode at my internet gateway router and communicating with and powering multiple slave Xinos on a 4-wire bus...

http://wiki.hackspace.org.uk/wiki/Project:Nanode/Applications#Using_the_Local_Serial_Bus

http://sustburbia.blogspot.com/2010/08/wired-network-for-arduinos.html


Read nanode MAC address: -

https://gist.github.com/1020951#file_nanode_mac.pde

 MAC Address Read Test
 MAC address is 00:04:A3:03:DD:C7

The soil moisture tester

Do these plants need watering?

http://www.instructables.com/id/Garduino-Gardening-Arduino/

Temperature

I have a bag of surplus 47k thermistors (about 500) and I intend to build a number of circuits to measure temperature starting with the very simplest and culminating in a teachable HackSpace project with reasonable accuracy. We will put these devices in fridges, near heat sources, near doors, windows, indoors, outdoors, you name it.

The component:

  VISHAY 
   NTCLE100 Series NTC 47 kOhm ±1.5 % Radial Leaded Standard Precision Thermistor
   Mfr Part#:  NTCLE100E3473JB0
   Packaging : BAG 
   Std Packaging Qty: 500
   Min Order Qty: 1
   As low as:  £0.1751  (GBP)
   In Stock:  No
   Type: 
   NTC
   Resistance: 
   47 kO
   Tolerance (%): 
   ±1.5 %
   B-constant: 
   4090 °K
   Temperature Range: 
   -40 to +125 °C

Some Google digging reveals...

The simplest circuits and Arduino code...

This is the best code I have found so far - from Thermistor2 but allows us to have our own parameters definition...

 1 #include <math.h>
 2 // enumarating 3 major temperature scales
 3 enum {
 4   T_KELVIN=0,
 5   T_CELSIUS,
 6   T_FAHRENHEIT
 7 };
 8 
 9 // manufacturer data for episco k164 10k thermistor
10 // simply delete this if you don't need it
11 // or use this idea to define your own thermistors
12 #define EPISCO_K164_10k 4300.0f,298.15f,10000.0f  // B,T0,R0
13 
14 // Temperature function outputs float , the actual
15 // temperature
16 // Temperature function inputs
17 // 1.AnalogInputNumber - analog input to read from
18 // 2.OuputUnit - output in celsius, kelvin or fahrenheit
19 // 3.Thermistor B parameter - found in datasheet
20 // 4.Manufacturer T0 parameter - found in datasheet (kelvin)
21 // 5. Manufacturer R0 parameter - found in datasheet (ohms)
22 // 6. Your balance resistor resistance in ohms  
23 
24 float Temperature(int AnalogInputNumber,int OutputUnit,float B,float T0,float R0,float R_Balance)
25 {
26   float R,T;
27 
28   R=1024.0f*R_Balance/float(analogRead(AnalogInputNumber)))-R_Balance;
29   T=1.0f/(1.0f/T0+(1.0f/B)*log(R/R0));
30 
31   switch(OutputUnit) {
32     case T_CELSIUS :
33       T-=273.15f;
34     break;
35     case T_FAHRENHEIT :
36       T=9.0f*(T-273.15f)/5.0f+32.0f;
37     break;
38     default:
39     break;
40   };
41 
42   return T;
43 }
44 // example of use #1
45 // reading from analog input 1, using episco k164 definition
46 // and 10k balance, getting result in celsius
47 
48 void setup() {
49  Serial.begin(9600);
50 }
51 
52 void loop() {
53 
54  Serial.println("*************************");
55  Serial.println("10k Balance");
56  Serial.println(Temperature(1,T_CELSIUS,EPISCO_K164_10k,10000.0f));
57  Serial.println("*************************");
58 
59  delay(500);
60 }
61 
62 //example of use #2
63 // using numbers instead of episco k164 definition
64 // this time reading from analog input 2
65 // getting result in fahrenheit
66 
67 void setup() {
68  Serial.begin(9600);
69 }
70 
71 void loop() {
72 
73  Serial.println("*************************");
74  Serial.println("10k Balance");
75  Serial.println(Temperature(2,T_FAHRENHEIT,4300.0f,298.15f,10000.0f,10000.0f));
76  Serial.println("*************************");
77 
78  delay(500);
79 }



I certainly would like one of these data logger devices...