Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
livebox:hah_hahnode [2013/12/27 04:12] – [Disabling / Renaming endpoints] brett | livebox:hah_hahnode [2014/01/20 09:04] – [The Nodules] brett | ||
---|---|---|---|
Line 197: | Line 197: | ||
-- Keyed by NODE ID | -- Keyed by NODE ID | ||
local nodes = { | local nodes = { | ||
- | [3] = RoomNode{base="dbzoo.livebox.jeenode: | + | [3] = RoomNode{instance |
- | [4] = OutputNode{base="dbzoo.wombat.jeenode: | + | [4] = OutputNode{instance |
} | } | ||
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 '' | + | By default the target used for xap-serial will be '' |
- | In this example we have assumed you have called your instance | + | In this example we have assumed you have set the hostname to '' |
< | < | ||
local jeemon={ | local jeemon={ | ||
- | target=" | + | target=" |
port="/ | port="/ | ||
baud=57600, | baud=57600, | ||
Line 231: | Line 231: | ||
< | < | ||
-- [ID] = NodeType | -- [ID] = NodeType | ||
- | [2] = RoomNode{base="dbzoo.livebox.jeenode: | + | [2] = RoomNode{instance=" |
</ | </ | ||
Line 260: | Line 260: | ||
If a Node defines multiple endpoints these will be appended to this base SOURCE description. | If a Node defines multiple endpoints these will be appended to this base SOURCE description. | ||
< | < | ||
- | [ID] = RoomNode{base="dbzoo.livebox.jeenode: | + | [ID] = RoomNode{instance=" |
</ | </ | ||
{{ : | {{ : | ||
Line 324: | Line 324: | ||
<code lua> | <code lua> | ||
[ID] = RoomNode | [ID] = RoomNode | ||
- | { base = "dbzoo.livebox.jeenode: | + | { instance=" |
endpoints = {temp=" | endpoints = {temp=" | ||
ttl=300 } | ttl=300 } | ||
Line 347: | Line 347: | ||
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 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. | ||
- | ====== The Nodules ====== | ||
- | ===== Room Node Twin ===== | ||
- | Identical to Room Node but has an additional 1wire sensor for Temperature on JeePort2 (PD.5) See [[# | ||
- | Exposes the additional endpoint | ||
- | * temp2 - Temperature | ||
- | |||
- | < | ||
- | RoomNodeTwin = require(" | ||
- | |||
- | [3] = RoomNodeTwin{base=" | ||
- | </ | ||
- | |||
- | 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. | ||
- | |||
- | {{: | ||
- | |||
- | ===== Room Node ===== | ||
- | |||
- | {{ : | ||
- | 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 [[/ | ||
- | |||
- | 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:// | ||
- | Or if you feel up to it you can download the [[http:// | ||
- | |||
- | For example we have a battery powered unit configured as a RoomNode to monitor temperature using a DS18B20 1wire device. | ||
- | |||
- | {{: | ||
- | |||
- | This unit would be minimally configured to expose the following xAP endpoints; | ||
- | <code lua> | ||
- | [ID] = RoomNode{base=" | ||
- | </ | ||
- | |||
- | <note tip> | ||
- | </ | ||
- | |||
- | 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. | ||
- | |||
- | {{: | ||
- | |||
- | The DS18B20 temperature sensor must be plugged into Port 1 - Legend P1 on the PCB and it uses the following connection ' | ||
- | |||
- | <note important> | ||
- | </ | ||
- | |||
- | The LDR light sensor fits onto Port 4, legend P4 on the PCB. One leg of the LDR goes to pin ' | ||
- | |||
- | 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 = " | ||
- | </ | ||
- | |||
- | The RoomNode2 sketch will also support the DHT11 sensor which is a drop in replacement for the DS18B20 and adds temperature and humidity; with change in the code to select this device instead. | ||
- | |||
- | {{: | ||
- | |||
- | ===== Output Node ===== | ||
- | |||
- | The OutputNode sketch, and matching Lua class, exposes the digital ports 1-4 as I/O controllable xAPBSC endpoints. | ||
- | |||
- | {{: | ||
- | |||
- | Snippet of configuration information needed in the jeenodeApplet.lua source. | ||
- | < | ||
- | OutputNode = require(" | ||
- | |||
- | local nodes = { | ||
- | [ID]=OutputNode{base=" | ||
- | } | ||
- | </ | ||
- | |||
- | So now we can simply use a xAPBSC.cmd class message to control these newly created endpoints. | ||
- | < | ||
- | xap-header | ||
- | { | ||
- | v=12 | ||
- | hop=1 | ||
- | uid=FF000F00 | ||
- | class=xAPBSC.cmd | ||
- | source=dbzoo.livebox.demo | ||
- | target=dbzoo.livebox.jeenode: | ||
- | } | ||
- | output.state.1 | ||
- | { | ||
- | id=* | ||
- | state=on | ||
- | } | ||
- | </ | ||
- | |||
- | Controlling an OutputNode from the Joggler in this video we simply toggle 4x LEDs on/off. | ||
- | |||
- | [[http:// | ||
- | |||
- | This node provides the following endpoints (p1, | ||
- | < | ||
- | dbzoo.livebox.jeenode: | ||
- | dbzoo.livebox.jeenode: | ||
- | dbzoo.livebox.jeenode: | ||
- | dbzoo.livebox.jeenode: | ||
- | </ | ||
- | |||
- | We can rename them like this to produce '' | ||
- | < | ||
- | local nodes = { | ||
- | [ID]=OutputNode{base=" | ||
- | } | ||
- | </ | ||
- | |||
- | ===== Infrared Receiver node ===== | ||
- | |||
- | Block diagram of how the IRnode fits into the system | ||
- | |||
- | {{: | ||
- | |||
- | {{ : | ||
- | |||
- | Typical configuration in the JeeNodeApplet.lua | ||
- | < | ||
- | IRNode = require(" | ||
- | ... | ||
- | local nodes = { | ||
- | [2] = IRNode{base=" | ||
- | } | ||
- | </ | ||
- | |||
- | 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. | ||
- | |||
- | < | ||
- | xap-header | ||
- | { | ||
- | uid=FF08DBFE | ||
- | source=dbzoo.livebox.jeenode: | ||
- | hop=1 | ||
- | class=IR.Comms | ||
- | v=12 | ||
- | } | ||
- | ir.received | ||
- | { | ||
- | value=550717623 | ||
- | type=1 | ||
- | bits=32 | ||
- | } | ||
- | </ | ||
- | |||
- | Note that this configuration is better suited to a JeeNode that is not battery powered. | ||
====== Nodule I/O pins ====== | ====== Nodule I/O pins ====== |