Difference between revisions of "Msemtd HomeAuto"

From Nottinghack Wiki
Jump to navigation Jump to search
m (Danspencer101 moved page Project:Msemtd HomeAuto to Msemtd HomeAuto over redirect)
 
(20 intermediate revisions by 5 users not shown)
Line 23: Line 23:
 
* IC2: LP816A
 
* IC2: LP816A
  
{{#widget:Flickr gallery|mode=photoset|id=72157626970362296}}
+
{{#widget:Flickr|photoset=72157626970362296}}
  
  
Line 31: Line 31:
 
== The Nanode - Xino 4-wire Bus ==
 
== The Nanode - Xino 4-wire Bus ==
  
Using a Nanode at my internet gateway router and communicating with and powering multiple Xinos on a 4-wire bus...
+
Using a Nanode at my internet gateway router and communicating with and powering multiple slave Xinos on a 4-wire bus...
 +
 
 +
[[Category:Projects]]
 +
[[Category:Projects (in progress)]]
 
   
 
   
 
http://wiki.hackspace.org.uk/wiki/Project:Nanode/Applications#Using_the_Local_Serial_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
  
  
Line 41: Line 46:
  
 
   MAC Address Read Test
 
   MAC Address Read Test
 
 
   MAC address is 00:04:A3:03:DD:C7
 
   MAC address is 00:04:A3:03:DD:C7
  
Line 49: Line 53:
  
 
http://www.instructables.com/id/Garduino-Gardening-Arduino/
 
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:
 +
* Listed in stores as "Future Electronics B4090K Thermistor 47k 5%"
 +
* I think it may be this one
 +
** http://uk.futureelectronics.com/en/Search.aspx?dsNav=Ny:True,Ro:0,Nea:True,N:477-4294920237
 +
** http://uk.futureelectronics.com/en/Technologies/Product.aspx?ProductID=NTCLE100E3473JB0VISHAY8666240
 +
* however, the Vishay product may be obsolete and the tolerance is listed as 1.5% rather than 5%
 +
 +
<code>
 +
  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
 +
</code>
 +
 +
Some Google digging reveals...
 +
* http://www.vishay.com/docs/29049/ntcle100.pdf
 +
* these thermistors are colour coded
 +
** Yellow Violet Orange Gold
 +
*** B25/85-VALUE = 4090K (+/- 5%) (the gold means 5%)
 +
 +
The simplest circuits and Arduino code...
 +
* http://arduino.cc/playground/Main/InterfacingWithHardware#envtture
 +
** http://arduino.cc/playground/ComponentLib/Thermistor
 +
** http://arduino.cc/playground/ComponentLib/Thermistor2
 +
** http://arduino.cc/playground/ComponentLib/Thermistor3
 +
 +
This is the best code I have found so far - from Thermistor2 but allows us to have our own parameters definition...
 +
 +
  #define NOTTINGHACK_47K 4090.0f,298.15f,47000.0f  // B,T0,R0
 +
 +
<div style ="height:200px;overflow-x:hidden;overflow-y:auto;border: 4px solid green;">
 +
<syntaxhighlight lang="cpp" line="GESHI_FANCY_LINE_NUMBERS">
 +
 +
#include <math.h>
 +
// enumarating 3 major temperature scales
 +
enum {
 +
  T_KELVIN=0,
 +
  T_CELSIUS,
 +
  T_FAHRENHEIT
 +
};
 +
 +
// manufacturer data for episco k164 10k thermistor
 +
// simply delete this if you don't need it
 +
// or use this idea to define your own thermistors
 +
#define EPISCO_K164_10k 4300.0f,298.15f,10000.0f  // B,T0,R0
 +
#define NOTTINGHACK_47K 4090.0f,298.15f,47000.0f  // B,T0,R0
 +
 +
// Temperature function outputs float , the actual
 +
// temperature
 +
// Temperature function inputs
 +
// 1.AnalogInputNumber - analog input to read from
 +
// 2.OuputUnit - output in celsius, kelvin or fahrenheit
 +
// 3.Thermistor B parameter - found in datasheet
 +
// 4.Manufacturer T0 parameter - found in datasheet (kelvin)
 +
// 5. Manufacturer R0 parameter - found in datasheet (ohms)
 +
// 6. Your balance resistor resistance in ohms 
 +
 +
float Temperature(int AnalogInputNumber,int OutputUnit,float B,float T0,float R0,float R_Balance)
 +
{
 +
  float R,T;
 +
 +
  R=1024.0f * R_Balance / float( analogRead(AnalogInputNumber) ) - R_Balance;
 +
  T=1.0f/(1.0f/T0+(1.0f/B)*log(R/R0));
 +
 +
  switch(OutputUnit) {
 +
    case T_CELSIUS :
 +
      T-=273.15f;
 +
    break;
 +
    case T_FAHRENHEIT :
 +
      T=9.0f*(T-273.15f)/5.0f+32.0f;
 +
    break;
 +
    default:
 +
    break;
 +
  };
 +
 +
  return T;
 +
}
 +
// example of use #1
 +
// reading from analog input 1, using episco k164 definition
 +
// and 10k balance, getting result in celsius
 +
 +
void setup() {
 +
Serial.begin(9600);
 +
}
 +
 +
void loop() {
 +
 +
Serial.println("*************************");
 +
Serial.println("10k Balance");
 +
Serial.println(Temperature(1,T_CELSIUS,NOTTINGHACK_47K,10000.0f));
 +
Serial.println("*************************");
 +
 +
delay(500);
 +
}
 +
 +
</syntaxhighlight>
 +
</div>
 +
 +
 +
 +
 +
I certainly would like one of these data logger devices...
 +
* http://www.nuelectronics.com/estore/index.php?main_page=product_info&cPath=7&products_id=20
 +
* http://www.nuelectronics.com/download/projects/sensor_shield_v1.0.pdf
 +
* usage; http://sheepdogguides.com/arduino/ar3ne1tt.htm
 +
 +
 +
A Processing sketch to receive a number of sensor values on the serial line and do something with them...
 +
<div style ="height:200px;overflow-x:hidden;overflow-y:auto;border: 4px solid green;">
 +
<syntaxhighlight lang="java" line="GESHI_FANCY_LINE_NUMBERS">
 +
 +
 +
int sensorCount = 5;  // max number of values to receive
 +
float[] sensorValues = new float[sensorCount];  // array to hold the incoming values
 +
 +
import processing.serial.*;
 +
Serial myPort;                // The serial port
 +
 +
int BAUDRATE = 9600;
 +
//int BAUDRATE = 115200;
 +
char DELIM = ','; // the delimeter for parsing incoming data
 +
 +
PFont fontA;
 +
 +
void setup()
 +
{
 +
  size(200, 200);
 +
  smooth();
 +
  noStroke();
 +
  frameRate(3);
 +
  myPort = new Serial(this, "COM10", BAUDRATE);
 +
  // clear the serial buffer:
 +
  myPort.clear();
 +
 +
  fontA = loadFont("AlbaSuper-48.vlw");
 +
  // Set the font and its size (in units of pixels)
 +
  textFont(fontA, 48);
 +
 +
}
 +
 +
float x, z;
 +
 +
void draw()
 +
{
 +
  background(100);
 +
 +
  fill(255, 204, 0);
 +
  text(""+sensorValues[0], 20, 50);
 +
 +
 +
  float diameter = min(width, height) * 0.75;
 +
  float lastAng = PI;
 +
  // scaling factor on sensor values...
 +
  float val = sensorValues[0] * 2.5;
 +
  fill(204, 102, 0);
 +
  arc(width/2, (height/2 + 50), diameter, diameter, lastAng, lastAng+radians(val));
 +
 
 +
 
 +
}
 +
 +
 +
void serialEvent(Serial myPort) {
 +
  String serialString = myPort.readStringUntil('\n');
 +
  if (serialString == null)
 +
    return;
 +
  String[] vals = split(serialString, DELIM);
 +
  for (int i = 0; i < vals.length; i++) {
 +
    vals[i] = trim(vals[i]);
 +
    if (i >= sensorCount)
 +
      break;
 +
    println("vals["+i+"] = '"+vals[i]+"'");
 +
    float f = float(vals[i]);
 +
    if(!(""+f).equals("NaN"))
 +
      sensorValues[i] = f;
 +
  }
 +
}
 +
 +
</syntaxhighlight>
 +
</div>

Latest revision as of 11:55, 5 February 2019

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


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...

 #define NOTTINGHACK_47K 4090.0f,298.15f,47000.0f  // B,T0,R0
 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 #define NOTTINGHACK_47K 4090.0f,298.15f,47000.0f  // B,T0,R0
14 
15 // Temperature function outputs float , the actual
16 // temperature
17 // Temperature function inputs
18 // 1.AnalogInputNumber - analog input to read from
19 // 2.OuputUnit - output in celsius, kelvin or fahrenheit
20 // 3.Thermistor B parameter - found in datasheet
21 // 4.Manufacturer T0 parameter - found in datasheet (kelvin)
22 // 5. Manufacturer R0 parameter - found in datasheet (ohms)
23 // 6. Your balance resistor resistance in ohms  
24 
25 float Temperature(int AnalogInputNumber,int OutputUnit,float B,float T0,float R0,float R_Balance)
26 {
27   float R,T;
28 
29   R=1024.0f * R_Balance / float( analogRead(AnalogInputNumber) ) - R_Balance;
30   T=1.0f/(1.0f/T0+(1.0f/B)*log(R/R0));
31 
32   switch(OutputUnit) {
33     case T_CELSIUS :
34       T-=273.15f;
35     break;
36     case T_FAHRENHEIT :
37       T=9.0f*(T-273.15f)/5.0f+32.0f;
38     break;
39     default:
40     break;
41   };
42 
43   return T;
44 }
45 // example of use #1
46 // reading from analog input 1, using episco k164 definition
47 // and 10k balance, getting result in celsius
48 
49 void setup() {
50  Serial.begin(9600);
51 }
52 
53 void loop() {
54 
55  Serial.println("*************************");
56  Serial.println("10k Balance");
57  Serial.println(Temperature(1,T_CELSIUS,NOTTINGHACK_47K,10000.0f));
58  Serial.println("*************************");
59 
60  delay(500);
61 }



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


A Processing sketch to receive a number of sensor values on the serial line and do something with them...

 1 int sensorCount = 5;  // max number of values to receive
 2 float[] sensorValues = new float[sensorCount];  // array to hold the incoming values
 3 
 4 import processing.serial.*;
 5 Serial myPort;                // The serial port
 6 
 7 int BAUDRATE = 9600; 
 8 //int BAUDRATE = 115200; 
 9 char DELIM = ','; // the delimeter for parsing incoming data
10 
11 PFont fontA;
12 
13 void setup() 
14 { 
15   size(200, 200);
16   smooth();
17   noStroke();
18   frameRate(3);
19   myPort = new Serial(this, "COM10", BAUDRATE);
20   // clear the serial buffer:
21   myPort.clear();
22 
23   fontA = loadFont("AlbaSuper-48.vlw");
24   // Set the font and its size (in units of pixels)
25   textFont(fontA, 48);
26 
27 } 
28 
29 float x, z;
30 
31 void draw() 
32 { 
33   background(100);
34 
35   fill(255, 204, 0);
36   text(""+sensorValues[0], 20, 50);
37 
38  
39   float diameter = min(width, height) * 0.75;
40   float lastAng = PI;
41   // scaling factor on sensor values...
42   float val = sensorValues[0] * 2.5;
43   fill(204, 102, 0);
44   arc(width/2, (height/2 + 50), diameter, diameter, lastAng, lastAng+radians(val));
45   
46   
47 } 
48 
49 
50 void serialEvent(Serial myPort) {
51   String serialString = myPort.readStringUntil('\n');
52   if (serialString == null)
53     return;
54   String[] vals = split(serialString, DELIM);
55   for (int i = 0; i < vals.length; i++) {
56     vals[i] = trim(vals[i]);
57     if (i >= sensorCount)
58       break;
59     println("vals["+i+"] = '"+vals[i]+"'");
60     float f = float(vals[i]);
61     if(!(""+f).equals("NaN"))
62       sensorValues[i] = f;
63   }
64 }