Improved documentation and minor fixes

removed examples compiled with outdated MySensors protocol and instead
included documentation how to add self-compiled sketches
This commit is contained in:
ToSa27
2014-08-23 23:59:49 +02:00
parent 0c5911ce59
commit b5ba0f72ef
7 changed files with 12 additions and 1445 deletions
-71
View File
@@ -1,71 +0,0 @@
:100000000C9461000C947E000C947E000C947E0095
:100010000C947E000C947E000C947E000C947E0068
:100020000C947E000C947E000C947E000C947E0058
:100030000C947E000C947E000C947E000C947E0048
:100040000C949A000C947E000C947E000C947E001C
:100050000C947E000C947E000C947E000C947E0028
:100060000C947E000C947E00000000002400270009
:100070002A0000000000250028002B0000000000DE
:1000800023002600290004040404040404040202DA
:100090000202020203030303030301020408102007
:1000A0004080010204081020010204081020000012
:1000B0000007000201000003040600000000000029
:1000C000000011241FBECFEFD8E0DEBFCDBF11E08E
:1000D000A0E0B1E0E4E5F4E002C005900D92A030AC
:1000E000B107D9F711E0A0E0B1E001C01D92A9303D
:1000F000B107E1F70E9418020C9428020C9400004A
:1001000087E061E00E94C4016AEF70E080E090E067
:100110000E941D0187E060E00E94C4016AEF70E068
:1001200080E090E00E941D01089587E061E00E9458
:10013000850108951F920F920FB60F9211242F93ED
:100140003F938F939F93AF93BF93809104019091BE
:100150000501A0910601B0910701309108010196B7
:10016000A11DB11D232F2D5F2D3720F02D57019696
:10017000A11DB11D209308018093040190930501F6
:10018000A0930601B09307018091000190910101B5
:10019000A0910201B09103010196A11DB11D8093B0
:1001A000000190930101A0930201B0930301BF915C
:1001B000AF919F918F913F912F910F900FBE0F9014
:1001C0001F901895789484B5826084BD84B5816051
:1001D00084BD85B5826085BD85B5816085BDEEE64F
:1001E000F0E0808181608083E1E8F0E0108280812E
:1001F00082608083808181608083E0E8F0E080819C
:1002000081608083E1EBF0E0808184608083E0EBBB
:10021000F0E0808181608083EAE7F0E080818460A3
:1002200080838081826080838081816080838081FF
:10023000806880831092C1000895EF92FF920F931F
:100240001F93CF93DF937B018C013FB7F89480918C
:10025000000190910101A0910201B091030126B526
:10026000A89B05C02F3F19F00196A11DB11D3FBFEE
:10027000BA2FA92F982F8827820F911DA11DB11D7C
:1002800052E0880F991FAA1FBB1F5A95D1F7EC01A6
:1002900030C00E9427023FB7F894809100019091EE
:1002A0000101A0910201B091030126B5A89B05C0F0
:1002B0002F3F19F00196A11DB11D3FBFBA2FA92FE5
:1002C000982F8827820F911DA11DB11D32E0880F44
:1002D000991FAA1FBB1F3A95D1F78C1B9D0B885EF7
:1002E0009340B8F20894E108F10801091109C851D6
:1002F000DC4FE114F1040105110559F6DF91CF91AE
:100300001F910F91FF90EF900895CF93DF93482FA7
:1003100050E0CA0186569F4FFC0134914A575F4F07
:10032000FA018491882369F190E0880F991FFC01FC
:10033000E859FF4FA591B491FC01EE58FF4FC591CC
:10034000D491662351F42FB7F8948C91932F909504
:1003500089238C93888189230BC0623061F42FB785
:10036000F8948C91932F909589238C938881832B7B
:1003700088832FBF06C09FB7F8948C91832B8C93F2
:100380009FBFDF91CF910895482F50E0CA01825559
:100390009F4FFC012491CA0186569F4FFC01949106
:1003A0004A575F4FFA013491332309F440C02223A6
:1003B00051F1233071F0243028F42130A1F02230A3
:1003C00011F514C02630B1F02730C1F02430D9F433
:1003D00004C0809180008F7703C0809180008F7D62
:1003E0008093800010C084B58F7702C084B58F7D64
:1003F00084BD09C08091B0008F7703C08091B000A8
:100400008F7D8093B000E32FF0E0EE0FFF1FEE58DA
:10041000FF4FA591B4912FB7F894662321F48C91E6
:100420009095892302C08C91892B8C932FBF0895BE
:10043000CF93DF930E94E2000E949500C0E0D0E0DD
:100440000E9480002097E1F30E940000F9CF0895F8
:04045000F894FFCF4E
:00000001FF
-71
View File
@@ -1,71 +0,0 @@
:100000000C9461000C947E000C947E000C947E0095
:100010000C947E000C947E000C947E000C947E0068
:100020000C947E000C947E000C947E000C947E0058
:100030000C947E000C947E000C947E000C947E0048
:100040000C949A000C947E000C947E000C947E001C
:100050000C947E000C947E000C947E000C947E0028
:100060000C947E000C947E00000000002400270009
:100070002A0000000000250028002B0000000000DE
:1000800023002600290004040404040404040202DA
:100090000202020203030303030301020408102007
:1000A0004080010204081020010204081020000012
:1000B0000007000201000003040600000000000029
:1000C000000011241FBECFEFD8E0DEBFCDBF11E08E
:1000D000A0E0B1E0E4E5F4E002C005900D92A030AC
:1000E000B107D9F711E0A0E0B1E001C01D92A9303D
:1000F000B107E1F70E9418020C9428020C9400004A
:1001000086E061E00E94C4016AEF70E080E090E068
:100110000E941D0186E060E00E94C4016AEF70E069
:1001200080E090E00E941D01089586E061E00E9459
:10013000850108951F920F920FB60F9211242F93ED
:100140003F938F939F93AF93BF93809104019091BE
:100150000501A0910601B0910701309108010196B7
:10016000A11DB11D232F2D5F2D3720F02D57019696
:10017000A11DB11D209308018093040190930501F6
:10018000A0930601B09307018091000190910101B5
:10019000A0910201B09103010196A11DB11D8093B0
:1001A000000190930101A0930201B0930301BF915C
:1001B000AF919F918F913F912F910F900FBE0F9014
:1001C0001F901895789484B5826084BD84B5816051
:1001D00084BD85B5826085BD85B5816085BDEEE64F
:1001E000F0E0808181608083E1E8F0E0108280812E
:1001F00082608083808181608083E0E8F0E080819C
:1002000081608083E1EBF0E0808184608083E0EBBB
:10021000F0E0808181608083EAE7F0E080818460A3
:1002200080838081826080838081816080838081FF
:10023000806880831092C1000895EF92FF920F931F
:100240001F93CF93DF937B018C013FB7F89480918C
:10025000000190910101A0910201B091030126B526
:10026000A89B05C02F3F19F00196A11DB11D3FBFEE
:10027000BA2FA92F982F8827820F911DA11DB11D7C
:1002800052E0880F991FAA1FBB1F5A95D1F7EC01A6
:1002900030C00E9427023FB7F894809100019091EE
:1002A0000101A0910201B091030126B5A89B05C0F0
:1002B0002F3F19F00196A11DB11D3FBFBA2FA92FE5
:1002C000982F8827820F911DA11DB11D32E0880F44
:1002D000991FAA1FBB1F3A95D1F78C1B9D0B885EF7
:1002E0009340B8F20894E108F10801091109C851D6
:1002F000DC4FE114F1040105110559F6DF91CF91AE
:100300001F910F91FF90EF900895CF93DF93482FA7
:1003100050E0CA0186569F4FFC0134914A575F4F07
:10032000FA018491882369F190E0880F991FFC01FC
:10033000E859FF4FA591B491FC01EE58FF4FC591CC
:10034000D491662351F42FB7F8948C91932F909504
:1003500089238C93888189230BC0623061F42FB785
:10036000F8948C91932F909589238C938881832B7B
:1003700088832FBF06C09FB7F8948C91832B8C93F2
:100380009FBFDF91CF910895482F50E0CA01825559
:100390009F4FFC012491CA0186569F4FFC01949106
:1003A0004A575F4FFA013491332309F440C02223A6
:1003B00051F1233071F0243028F42130A1F02230A3
:1003C00011F514C02630B1F02730C1F02430D9F433
:1003D00004C0809180008F7703C0809180008F7D62
:1003E0008093800010C084B58F7702C084B58F7D64
:1003F00084BD09C08091B0008F7703C08091B000A8
:100400008F7D8093B000E32FF0E0EE0FFF1FEE58DA
:10041000FF4FA591B4912FB7F894662321F48C91E6
:100420009095892302C08C91892B8C932FBF0895BE
:10043000CF93DF930E94E2000E949500C0E0D0E0DD
:100440000E9480002097E1F30E940000F9CF0895F8
:04045000F894FFCF4E
:00000001FF
File diff suppressed because it is too large Load Diff
@@ -1,69 +0,0 @@
// Example sketch showing how to send in OneWire temperature readings
#include <MySensor.h>
#include <SPI.h>
#include <DallasTemperature.h>
#include <OneWire.h>
#define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected
#define MAX_ATTACHED_DS18B20 16
unsigned long WAIT_TIME = 30000; // Wait for feedback from controller after sending and before going to sleep (in milliseconds)
unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
MySensor gw;
float lastTemperature[MAX_ATTACHED_DS18B20];
int numSensors=0;
boolean receivedConfig = false;
boolean metric = true;
// Initialize temperature message
MyMessage msg(0,V_TEMP);
void setup()
{
// Startup OneWire
sensors.begin();
// Startup and initialize MySensors library. Set callback for incoming messages.
gw.begin();
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("Temperature Sensor", "1.0");
// Fetch the number of attached temperature sensors
numSensors = sensors.getDeviceCount();
// Present all sensors to controller
for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
gw.present(i, S_TEMP);
}
}
void loop()
{
// Process incoming messages (like config from server)
gw.process();
// Fetch temperatures from Dallas sensors
sensors.requestTemperatures();
// Read temperatures and send them to controller
for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
// Fetch and round temperature to one decimal
float temperature = static_cast<float>(static_cast<int>((gw.getConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
// Only send data if temperature has changed and no error
if (lastTemperature[i] != temperature && temperature != -127.00) {
// Send in the new temperature
gw.send(msg.setSensor(i).set(temperature,1));
lastTemperature[i]=temperature;
}
}
delay(WAIT_TIME);
gw.process();
gw.sleep(SLEEP_TIME);
}
+2 -2
View File
@@ -11,8 +11,8 @@ const dbAddress = '127.0.0.1';
const dbPort = 27017;
const dbName = 'MySensorsDb';
const fwHexFiles = [ 'BlinkRed.hex', 'BlinkGreen.hex', 'DallasTemperatureSensor.cpp.hex' ];
const fwDefaultType = 2; // index of hex file from array above
const fwHexFiles = [ ];
const fwDefaultType = 0xFFFF; // index of hex file from array above (0xFFFF == none defined)
const FIRMWARE_BLOCK_SIZE = 16;
const BROADCAST_ADDRESS = 255;
@@ -1,5 +1,4 @@
<h1>MySensors with NodeJS Controller and OTA bootloader on RPi</h1>
<p>My RPi runs Arduino to compile and flash sketches and the bootloader. With this setup no separate PC/Mac is needed. Exactly the same could be achieved (faster) using a PC/Mac for all the Arduino compilation and flashing activities – just skip the steps and execute on PC/Mac instead.
<h2>Hardware</h2>
<p>Headless Raspberry Pi model B with wired Ethernet</p>
<p>I'm connecting a monitor only for first time boot to get the IP address and then connect via Putty/xRDP</p>
@@ -140,8 +139,6 @@ export PATH</p>
<li>git checkout development
<li>cd NodeJsController
<li>npm install
<li>nano NodeJsController.js (optional : removing sample firmwares)
<p>const fwHexFiles = <font color="#FF0000">[ ]</font>;</p>
<li><i>to confirm that the NodeJsController is working as expected and connects to the local mongo DB: "node NodeJsController.js" which should start the controller, connect to the database and run into an error connecting to the gateway. Stop node again via Ctrl-c</i>
</ul>
<h2>Start NodeJsController on boot</h2>
@@ -215,7 +212,7 @@ Arduino RESET <-> Raspberry Pi GPIO22 (pin 15)</p>
<font color="#FF0000"><strike>//</strike></font>const gwType = 'Serial';<br/>
<font color="#FF0000"><strike>//</strike></font>const gwPort = '<font color="#FF0000">/dev/ttyAMA0</font>';<br/>
<font color="#FF0000"><strike>//</strike></font>const gwBaud = 115200;</p>
<li>sudo service mysensors restart
<li>sudo service mysensors restart (at this point stop/restart doesn't work. use "sudo killall node" followed by "sudo service mysensors start" instead)
</ul>
<h1>Ethernet Gateway</h1>
@@ -262,7 +259,7 @@ IPAddress myIp (10, 0, 1, 99);</p>
<ul>
<li>nano ~/Arduino/NodeJsController/NodeJsController.js
<p>const gwAddress = '<font color="#FF0000">10.0.1.99</font>';</p>
<li>sudo service mysensors restart
<li>sudo service mysensors restart (at this point stop/restart doesn't work. use "sudo killall node" followed by "sudo service mysensors start" instead)
</ul>
<h1>Sensor Node Bootloader</h1>
@@ -291,12 +288,14 @@ ISP_MCU = m328p</p>
</ul>
<h1>End-to-End Test</h1>
<h2>Add Firmware to Controller</h2>
<h2>Add Firmware to Controller (here: DallasTemperatureSensor)</h2>
<ul>
<li>use Arduino IDE or codebender or whatever other way to compile your sketch
<li>copy the compiled DallasTemperatureSensor.cpp.hex file to the NodeJsController directory (if using the Arduino IDE, enable verbose logging in preferences and then watch the compilation process to find the temp directory where the output is stored)
<li>nano ~/Arduino/NodeJsController/NodeJsController.js
<p>const fwHexFiles = [ 'DallasTemperatureSensor.cpp.hex' ];<br/>
const fwDefaultType = 0;</p>
<li>sudo service mysensors restart
<p>const fwHexFiles = [ <font color="#FF0000">'DallasTemperatureSensor.cpp.hex'</font> ];<br/>
const fwDefaultType = <font color="#FF0000">0</font>;</p>
<li>sudo service mysensors restart (at this point stop/restart doesn't work. use "sudo killall node" followed by "sudo service mysensors start" instead)
</ul>
<h2>Flash Firmware OTA</h2>
<ul>
@@ -305,5 +304,5 @@ const fwDefaultType = 0;</p>
</ul>
<h2>Check functionality</h2>
<ul>
<li>in addition to watching the log file (tail command above) you can connect to the mongo db using a client (e.g. <a href="http://robomongo.org">Robomongo</a>) and check if new values are written to the database as a real end-to-end test
<li>in addition to watching the log file (tail command above) you can connect to the mongo db using a client (e.g. <a href="http://robomongo.org">Robomongo</a>) and check if new values are written to the database as a real end-to-end test once the bootloader finished uploading the firmware
</ul>