SatarNode - etemu/satar GitHub Wiki
Each hardware node has got:
- A unique nID ($nodeID) which is either set before compiling the SatarNode source, or (by default) read out from the EEPROM adress 0.
- A unique MAC, which is (by default) read out from the EEPROM adress 1-6. The last byte is set to $nodeID.
- A unique IP adress, which is (by default) read out from the EEPROM adress 7-10. The last byte is set to $nodeID, but can be changed easily. Pay attention to your network topology, subnets already have a router present at xxx.xxx.1 and a certain range which is reserved for DHCP clients.
- Open SatarNodeHelpers\NodeEepromWrite\NodeEepromWrite.ino and edit the following lines according to your setup for every Satar hardware node you have at hand, give each one a different nodeID, compile and flash the code to your microcontroller.
static byte nodeID = 42; // Range: 2-254
static byte mac[] = { 0xAD, 0xDE, 0xDE, 0xDE, 0xDE, nodeID }; // choose a unique MAC
static byte ip[] = { 192, 168, 0, nodeID }; // your subnet IP scheme
2. Open SatarNode\SatarNode.ino and edit it according to your taste. It is mandatory to set your SatarServer URL in the line static char website[] = "SatarServer.com"; // remote server, TLD/vHost
. Note that only the SatarServer address with .TLD should be set here - no trailing slash, port, or link to the satar.php file, this parameter is solely for DNS resolution and GET request forging. The exact location of the satar.php on your server can be set at the parameter in the next line and should look somewhat like /SatarServer/satar.php
, obviously with a leading slash.
You may activate the debug mode for testing purposes with #define DEBUG 1 // debug mode with verbose output over serial at 115200 bps
.
Compile and flash the code to your microcontroller. If you open a serial connection to your MCU at 115200 bps and activated the debug mode, there should be plenty of debugging messages be coming in. A successful setup would output something like
=====================
== [SATAR Controller]
== CC-BY-SA-NC 3.0
== nodeID: 11
== ETH: (SPI) Wiznet W5100 (100-baseT).
== SATAR node IP: 192.168.8.250
SD: Interface disabled.
RAM: 42 bytes free.
DEB: Emit heartbeat <3.
DEB: Timer : -30000
DEB: Payload: T=308&E=2&I=0&N=11
DEB: Forged in: 6116 us.
ETH: init...
ETH: W5100 connected.
DEB: Executed in 297944 us.
ACK: Database
ACK: SatarServerAPI
ETH: Reply in 30840 us.
ETH: closing...
ETH: closed.
Note: This is the output of a non-standard node setup: The 4th byte of the IP address does not correlate with the nodeID, the SD card logging is disabled with //#define USE_SD
.
-
(optional) Enjoy a drink, like a ginger beer or some orange juice. I really like fruit smoothies and fruit teas.
-
Connect a trigger device to at least one hardware input. A single node setup would require at least two trigger devices connected to the single SatarNode, while a setup with two or more nodes would be good with a single trigger or more connected to each node.
The hardware interrupts are configured active on low by default, they fire as soon as a falling edge of a signal level change is detected:attachInterrupt(0, trigger_start, FALLING); //let's arm the trigger
//payload mask : 123456789012345678901234567890123456789012 (size= 42)
//payload packet: T=4294967295&E=255&I=4294967295&N=255 (size=<42)