livebox:hah_hahnode

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
livebox:hah_hahnode [2013/02/07 13:48] – [Integration with JeeNodes] minerva9livebox:hah_hahnode [2014/02/15 11:52] (current) – [Building your own] minerva9
Line 9: Line 9:
 Block diagram of how the JeeNodes are integrated into the [[HAH]] [[livebox]] Block diagram of how the JeeNodes are integrated into the [[HAH]] [[livebox]]
  
-You will need a minimum of TWO nodes, one is tethered to the LIVEBOX via a [[USB attach cable|http://www.homeautomationhub.com/content/ttl-connectionprogramming-cable]] and acts as the RF/Serial gateway (HAHcentral).  The others will be scattered about your environment acting as remote nodes.+You will need a minimum of TWO nodes, one is tethered to the LIVEBOX via a [[http://www.homeautomationhub.com/content/ttl-connectionprogramming-cable|USB attach cable]] and acts as the RF/Serial gateway (HAHcentral).  The others will be scattered about your environment acting as remote nodes.
 ===== Architecture ===== ===== Architecture =====
  
Line 64: Line 64:
   * HAHnode PCB    * HAHnode PCB 
   * ATMega328P chip (pre-programmed)   * ATMega328P chip (pre-programmed)
-  * RFM12B - RF Transceiver module+  * {{:livebox:rfm12b.pdf|RFM12B}} - RF Transceiver module
   * Voltage regulator IC   * Voltage regulator IC
   * 16MHz ceramic resonator   * 16MHz ceramic resonator
Line 113: Line 113:
 </code> </code>
  
-Hit the return key a acouple of times. You should see the following menu of commands.+Hit the return key a couple of times. You should see the following menu of commands.
  
 <code> <code>
Line 150: Line 150:
  
  
-<note>Unlike the baseNode, the roomNodes do not transmit anything on the serial port. So there is no point in soldering up that 6way molex connector & plugging a roomNode into the HAH (this is why this part is not supplied with a roomNode kit). They only transmit via RF. Amongst other things, this saves precious battery power. Just use your baseNode hardware to program all the AVR chips (and, to avoid confusion, label the chips as you go!).</note>+<note>Unlike the baseNode, the roomNodes do not transmit anything on the serial port. So there is no point in soldering up that 6way molex connector & plugging a roomNode into the HAH (this is why this part is not supplied with a roomNode kit). They //only// transmit via RF. Amongst other things, this saves precious battery power. Just use your baseNode hardware to program all the AVR chips (and, to avoid confusion, label the chips as you go!).</note>
 ===== From scratch ===== ===== From scratch =====
  
Line 197: Line 197:
 -- Keyed by NODE ID -- Keyed by NODE ID
 local nodes = { local nodes = {
-   [3] = RoomNode{base="dbzoo.livebox.jeenode:3", endpoints={temp=1,lobat=1}, ttl=900}, +   [3] = RoomNode{instance = "jeenode:3", endpoints={temp=1,lobat=1}, ttl=900}, 
-   [4] = OutputNode{base="dbzoo.wombat.jeenode:bedroom",endpoints={p1="light",p2="heater",p3="amp",p4=0}},+   [4] = OutputNode{instance = "jeenode:bedroom",endpoints={p1="light",p2="heater",p3="amp",p4=0}},
 } }
  
Line 212: Line 212:
 These settings are used internally to send a message to xap-serial to initialise the port. These settings are used internally to send a message to xap-serial to initialise the port.
  
-By default the target used for xap-serial will be ''dbzoo.livebox.serial'' if however you are running an INSTANCE livebox and you want to use the xap-serial message from that box then you need to additionaly supply a ''target=''+By default the target used for xap-serial will be ''dbzoo.livebox.serial'' if however you are running an INSTANCE livebox and you want to use the xap-serial message from that box then you need to additionally supply a ''target=''
  
-In this example we have assumed you have called your instance ''1'' substitute for your instance name.+In this example we have assumed you have set the hostname to ''livebox2''.
 <code> <code>
 local jeemon={ local jeemon={
-      target="dbzoo.livebox.1.serial",+      target="dbzoo.livebox2.serial",
       port="/dev/ttyUSB0",       port="/dev/ttyUSB0",
       baud=57600,       baud=57600,
Line 231: Line 231:
 <code> <code>
 -- [ID] = NodeType  -- [ID] = NodeType 
-[2] = RoomNode{base="dbzoo.livebox.jeenode:attic", endpoints={temp=1}}+[2] = RoomNode{instance="jeenode:attic", endpoints={temp=1}}
 </code> </code>
  
Line 260: Line 260:
 If a Node defines multiple endpoints these will be appended to this base SOURCE description.  For example if the roomNode was configured like this If a Node defines multiple endpoints these will be appended to this base SOURCE description.  For example if the roomNode was configured like this
 <code> <code>
-[ID] = RoomNode{base="dbzoo.livebox.jeenode:attic", endpoints={lobat=1,temp=1,light=1}}+[ID] = RoomNode{instance="jeenode:attic", endpoints={lobat=1,temp=1,light=1}}
 </code> </code>
 {{ :livebox:jeenode-attic.png|}} {{ :livebox:jeenode-attic.png|}}
Line 269: Line 269:
 dbzoo.livebox.jeenode:attic.light dbzoo.livebox.jeenode:attic.light
 </code> </code>
 +
 +See [[livebox/hah_hahnode/nanode_gateway]] for advanced integration concepts.
  
 ===== Disabling / Renaming endpoints ===== ===== Disabling / Renaming endpoints =====
Line 279: Line 281:
 <code lua> <code lua>
 [ID] = RoomNode [ID] = RoomNode
-    { base = "dbzoo.livebox.jeenode:bedroom1",+    { instance= "jeenode:bedroom1",
       endpoints = {temp=1,lobat=1,light=1,humi=0,moved=0} }       endpoints = {temp=1,lobat=1,light=1,humi=0,moved=0} }
     }     }
Line 289: Line 291:
 <code lua> <code lua>
 [ID] = RoomNode [ID] = RoomNode
-    { base = "dbzoo.livebox.jeenode:bedroom1",+    { instance = "jeenode:bedroom1",
       endpoints = {temp=1,lobat=1,light=1} }       endpoints = {temp=1,lobat=1,light=1} }
     }     }
Line 303: Line 305:
 <code lua> <code lua>
 [ID] = RoomNode [ID] = RoomNode
-    { base = "dbzoo.livebox.jeenode:bedroom1",+    { instance = "jeenode:bedroom1",
       endpoints = {temp="temperature",lobat=1,light=1} }       endpoints = {temp="temperature",lobat=1,light=1} }
     }     }
Line 324: Line 326:
 <code lua> <code lua>
 [ID] = RoomNode [ID] = RoomNode
-    { base = "dbzoo.livebox.jeenode:bedroom1",+    { instance="jeenode:bedroom1",
       endpoints = {temp="temperature",lobat=1,light=1},       endpoints = {temp="temperature",lobat=1,light=1},
       ttl=300 }       ttl=300 }
Line 347: Line 349:
 So 120 is too small... 180 is fine - Personally I would make the TTL at least 2x the reporting cycle, this way you can miss ONE event and it won't time out as the 2nd one will reset things.  So I would use a TTL of 300 seconds. So 120 is too small... 180 is fine - Personally I would make the TTL at least 2x the reporting cycle, this way you can miss ONE event and it won't time out as the 2nd one will reset things.  So I would use a TTL of 300 seconds.
  
-====== The Nodules ====== 
  
-===== Room Node Twin ===== 
  
-Identical to Room Node but has an additional 1wire sensor for Temperature on JeePort2 (PD.5) See [[#nodule_io_pins]] for wiring. 
- 
-Exposes the additional endpoint 
-  * temp2 - Temperature 
- 
-<code> 
-RoomNodeTwin = require("xap.roomnodetwin").RoomNode 
- 
-[3] = RoomNodeTwin{base="dbzoo.livebox.jeenode:3", endpoints={temp=1,temp2=1}, ttl=900}, 
-</code> 
- 
-This Decoder and Sketch is handy if you have Node in a room with temp sensor on an extension cable and want to monitor another room, an heating/air conditioning duct output for the room or simple a sensor outside the window. 
- 
-{{:livebox:cimg3892.jpg|}} 
- 
-===== Room Node ===== 
- 
-{{ :livebox:hah_hahnode:6929394483_150611e518_q.jpg}} 
-The room node is a sensor unit that can monitor the following environmental conditions. 
-  * temp - Temperature 
-  * humi - Humidity (Note; available with a jeenode and the SHT11 sensor board) 
-  * moved - PIR - for movement detection 
-  * light - Light 
-  * lobat - Low Battery 
- 
-<note tip>For something that looks really slick you can put this inside an [[/livebox/hah_hahnode/airwick]] case.</note> 
- 
-The Arduino sketch has been designed for low power. It's ideal for running from batteries\\ 
-A precompiled sketch ready for flashing can be found on the [[http://code.google.com/p/livebox-hah/downloads/list|HAH google project download page]].\\ 
-Or if you feel up to it you can download the [[http://livebox-hah.googlecode.com/svn/trunk/userapps/arduino/|source code]] for the sketch and compile your own. 
- 
-For example we have a battery powered unit configured as a RoomNode to monitor temperature using a DS18B20 1wire device. 
- 
-{{:livebox:cimg3822-sm.jpg|}} 
- 
-This unit would be minimally configured to expose the following xAP endpoints;  temp, lobat 
-<code lua> 
-[ID] = RoomNode{base="dbzoo.livebox.jeenode:bedroom2", endpoints = {temp=1,lobat=1}} 
-</code> 
- 
-<note tip>Using the [[http://jeelabs.com/products/room-board|room board]] from JeeLabs you can optionally use the SHT11 which has both Temperature and Humidity however this is a rather more pricey option. 
-</note> 
- 
-In this configuration we have fitted a board with light sensor and temperature sensor but it will be powered from a 5v USB power supply using its programming cable. 
- 
-{{:livebox:roomnode2_orig.jpg?640|With LDR and Temperature sensor attached}} {{:livebox:18b20-front.png|}} 
- 
-The DS18B20 temperature sensor must be plugged into Port 1 - Legend P1 on the PCB and it uses the following connection 'P' (Power), 'D' (Data), 'G' (Ground).  As the temp sensor uses a 1-wire bus you need (4.7k) pullup resistor between 'D' and 'P'. 
- 
-<note important>The temperature sensor is powered directly by the battery (or USB) supply. So, don't use a battery that has a voltage greater than 5.5V (we use 3xAA cells) 
-</note> 
- 
-The LDR light sensor fits onto Port 4, legend P4 on the PCB. One leg of the LDR goes to pin 'A' (Analogue) the other goes to 'G' (Ground) 
- 
-If the above board was configured as ID 2 - we could use the following configuration setting to enable just the Temperature and Light endpoints, there is no point in reporting on Low Battery as this unit would be permanently powered. 
-<code lua> 
-[ID] = RoomNode{ base = "dbzoo.livebox.jeenode:bedroom2", endpoints = {temp=1,light=1} } 
-</code> 
-===== Output Node ===== 
- 
-The OutputNode sketch, and matching Lua class, exposes the digital ports 1-4 as I/O controllable xAPBSC endpoints.  If not all ports are not being used they can be individually disabled by leaving them out of the endpoint definition or by setting their value to 0 (zero). 
- 
-Snippet of configuration information needed in the jeenodeApplet.lua source. 
-<code> 
-OutputNode = require("xap.outputnode").OutputNode 
- 
-local nodes = { 
-  [ID]=OutputNode{base="dbzoo.livebox.jeenode:attic"},endpoints={p1=1,p2=1,p3=1,p4=1}} 
-} 
-</code> 
- 
-So now we can simply use a xAPBSC.cmd class message to control these newly created endpoints.  Here is an example of turning on JeeNode Port 1 from the above configuration. 
-<code> 
-xap-header 
-{ 
-v=12 
-hop=1 
-uid=FF000F00 
-class=xAPBSC.cmd 
-source=dbzoo.livebox.demo 
-target=dbzoo.livebox.jeenode:attic.p1 
-} 
-output.state.1 
-{ 
-id=* 
-state=on 
-} 
-</code> 
- 
-Controlling an OutputNode from the Joggler in this video we simply toggle 4x LEDs on/off. 
- 
-[[http://www.youtube.com/watch?v=5JBmlpjOBqw|HAH remote control of JeeNodes using a Joggler]] 
- 
-This node provides the following endpoints (p1,p2,p3,p4) for example: 
-<code> 
-dbzoo.livebox.jeenode:attic.p1 
-dbzoo.livebox.jeenode:attic.p2 
-dbzoo.livebox.jeenode:attic.p3 
-dbzoo.livebox.jeenode:attic.p4 
-</code> 
- 
-We can rename them like this to produce ''dbzoo.livebox.jeenode:attic.port1'' etc.. 
-<code> 
-local nodes = { 
-  [ID]=OutputNode{base="dbzoo.livebox.jeenode:attic",endpoints={p1="port1",p2="port2",p3="port3",p4="port4"}} 
-} 
-</code> 
- 
-===== Infrared Receiver node ===== 
- 
-Block diagram of how the IRnode fits into the system 
- 
-{{:livebox:irnode-block-diagram.png}}  
- 
-{{ :livebox:35200_pv.jpg?200}} By attaching a Infrared receiver to a JeeNode unit we can relay the signal transmitted from the Remote Control to the HAH and produce an xAP message.  This message then becomes the hook for //User Applet// scripts to attach and take action. 
- 
-Typical configuration in the JeeNodeApplet.lua 
-<code> 
-IRNode = require("xap.irnode").IRNode 
-... 
-local nodes = { 
-   [2] = IRNode{base="dbzoo.livebox.jeenode:ir"}, 
-} 
-</code> 
- 
-This configures the JeeNode with ID of 5 and with an attached IR sensor to relay messages, via RF, to the HAH unit. 
- 
-The IR sensor data pin is connected to 
-^^ Port ^^ Type ^^ Arduino ^^ Signal ^^ Chip ^^ 
-|| Port 2 || DIO || Digital 5 || PD5 || pin 11 || 
- 
-Once the IRnode.pde sketch is loaded onto your jeenode and the HAH is correctly configured, pressing a button on your remote control should produce a message like this. 
- 
-<code> 
-xap-header 
-{ 
-uid=FF08DBFE 
-source=dbzoo.livebox.jeenode:ir 
-hop=1 
-class=IR.Comms 
-v=12 
-} 
-ir.received 
-{ 
-value=550717623 
-type=1 
-bits=32 
-} 
-</code> 
  
-Note that this configuration is better suited to a JeeNode that is not battery powered. 
  
 ====== Nodule I/O pins ====== ====== Nodule I/O pins ======
  • livebox/hah_hahnode.1360244895.txt.gz
  • Last modified: 2013/02/07 13:48
  • by minerva9