Hi all,
as the fake NRFs are kind of annoing with ther varying ranges i decied to give the RFMs a try.
Therefore i gut a sensberger gateway with following sketch:
/**
* The MySensors Arduino library handles the wireless radio link and protocol
* between your home built sensors/actuators and HA controller of choice.
* The sensors forms a self healing radio network with optional repeaters. Each
* repeater and gateway builds a routing tables in EEPROM which keeps track of the
* network topology allowing messages to be routed to nodes.
*
* Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
* Copyright (C) 2013-2015 Sensnology AB
* Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
*
* Documentation: http://www.mysensors.org
* Support Forum: http://forum.mysensors.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*
*******************************
*
* REVISION HISTORY
* Version 1.0 - Henrik EKblad
* Contribution by a-lurker and Anticimex,
* Contribution by Norbert Truchsess <norbert.truchsess@t-online.de>
* Contribution by Tomas Hozza <thozza@gmail.com>
*
*
* DESCRIPTION
* The EthernetGateway sends data received from sensors to the ethernet link.
* The gateway also accepts input on ethernet interface, which is then sent out to the radio network.
*
* The GW code is designed for Arduino 328p / 16MHz. ATmega168 does not have enough memory to run this program.
*
* LED purposes:
* - To use the feature, uncomment MY_DEFAULT_xxx_LED_PIN in the sketch below
* - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
* - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
* - ERR (red) - fast blink on error during transmission error or recieve crc error
*
* See http://www.mysensors.org/build/ethernet_gateway for wiring instructions.
*
*/
// Enable debug prints to serial monitor
#define MY_DEBUG
// Enable and select radio type attached
//#define MY_RADIO_NRF24
#define MY_RADIO_RFM69
// Enable gateway ethernet module type
#define MY_GATEWAY_W5100
// W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal)
//#define MY_W5100_SPI_EN 4
// Enable Soft SPI for NRF radio (note different radio wiring is required)
// The W5100 ethernet module seems to have a hard time co-operate with
// radio on the same spi bus.
#if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD)
#define MY_SOFTSPI
#define MY_SOFT_SPI_SCK_PIN 14
#define MY_SOFT_SPI_MISO_PIN 16
#define MY_SOFT_SPI_MOSI_PIN 15
#endif
// When W5100 is connected we have to move CE/CSN pins for NRF radio
#ifndef MY_RF24_CE_PIN
#define MY_RF24_CE_PIN 5
#endif
#ifndef MY_RF24_CS_PIN
#define MY_RF24_CS_PIN 6
#endif
// Enable to UDP
//#define MY_USE_UDP
#define MY_IP_ADDRESS 192,168,1,82 // If this is disabled, DHCP is used to retrieve address
// Renewal period if using DHCP
//#define MY_IP_RENEWAL_INTERVAL 60000
// The port to keep open on node server mode / or port to contact in client mode
#define MY_PORT 5003
// Controller ip address. Enables client mode (default is "server" mode).
// Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere.
//#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254
// The MAC address can be anything you want but should be unique on your network.
// Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
// Note that most of the Ardunio examples use "DEAD BEEF FEED" for the MAC address.
#define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
// Enable inclusion mode
#define MY_INCLUSION_MODE_FEATURE
// Enable Inclusion mode button on gateway
//#define MY_INCLUSION_BUTTON_FEATURE
// Set inclusion mode duration (in seconds)
#define MY_INCLUSION_MODE_DURATION 60
// Digital pin used for inclusion mode button
//#define MY_INCLUSION_MODE_BUTTON_PIN 3
// Set blinking period
#define MY_DEFAULT_LED_BLINK_PERIOD 300
// Flash leds on rx/tx/err
// Uncomment to override default HW configurations
//#define MY_DEFAULT_ERR_LED_PIN 7 // Error led pin
//#define MY_DEFAULT_RX_LED_PIN 8 // Receive led pin
//#define MY_DEFAULT_TX_LED_PIN 9 // Transmit led pin
#if defined(MY_USE_UDP)
#include <EthernetUdp.h>
#endif
#include <Ethernet.h>
#include <MySensors.h>
void setup()
{
}
void loop()
{
}
which seems to work nicely:
thats the only debug i get:
"0;255;3;0;9;MCO:BGN:STP
0;255;3;0;9;MCO:BGN:INIT OK,TSP=1"
for the only node i use this sketch (which worked fine with a nrf), this is a Arduino Nano with some I-button readers:
// Enable debug prints to serial monitor
#define MY_DEBUG
// Enable and select radio type attached
//#define MY_RADIO_NRF24
#define MY_RADIO_RFM69
#define MY_NODE_ID 102
#include <SPI.h>
#include <MySensors.h>
#include <OneWire.h>
// This is the pin with the 1-Wire bus on it
OneWire ds_1(3);
OneWire ds_2(4);
OneWire ds_3(5);
OneWire ds_4(6);
// unique serial number read from the key
byte addr_0[8];
byte addr_1[8];
int addr_1_last;
byte addr_2[8];
int addr_2_last;
byte addr_3[8];
// poll delay (I think 750ms is a magic number for iButton)
int del = 750;
#define CHILD_ID_1 1
#define CHILD_ID_2 2
#define CHILD_ID_3 3
MyMessage ReadMsg_1(CHILD_ID_1, V_VAR1);
MyMessage ReadMsg_2(CHILD_ID_2, V_VAR2);
MyMessage ReadMsg_3(CHILD_ID_3, V_VAR3);
void setup() {
Serial.begin(115200);
}
void presentation() {
sendSketchInfo("iButton Reader", "1.0");
present(CHILD_ID_1, S_CUSTOM);
present(CHILD_ID_2, S_CUSTOM);
present(CHILD_ID_3, S_CUSTOM);
}
void loop() {
byte result;
// search looks through all devices on the bus
ds_1.reset_search();
for( int i = 0; i < 8; ++i )
addr_1[i] = (char)0;
ds_1.search(addr_1);
// Serial.println(ds_1.crc8(addr_1,7));
if(ds_1.crc8(addr_1,7) == 0 && addr_1_last == 0) {
/* Serial.print("Reader 1a: ");
for(byte i=0; i<8; i++) {
Serial.print(addr_1[i], HEX);
Serial.print(" "); }
Serial.print("\n"); */
send(ReadMsg_1.set(0));
addr_1_last = 1;
/* Serial.print("addr_1_last: ");
Serial.print(addr_1_last);
Serial.print("\n"); */
for( int i = 0; i < 8; ++i )
addr_1[i] = (char)0;
}
else if (ds_1.crc8(addr_1,7) >> 0 && addr_1_last == 1){
/* Serial.print("Reader 1b: ");
for(byte i=0; i<8; i++) {
Serial.print(addr_1[i], HEX);
Serial.print(" ");}
Serial.print("\n"); */
send(ReadMsg_1.set(addr_1,HEX));
addr_1_last = 0;
/* Serial.print("addr_1_last: ");
// for(byte i=0; i<8; i++) {
Serial.print(addr_1_last);
// Serial.print(" "); }
Serial.print("\n"); */
}
ds_2.reset_search();
for( int i = 0; i < 8; ++i )
addr_2[i] = (char)0;
ds_2.search(addr_2);
// Serial.println(ds_2.crc8(addr_2,7));
if(ds_2.crc8(addr_2,7) == 0 && addr_2_last == 0) {
/* Serial.print("Reader 2a: ");
for(byte i=0; i<8; i++) {
Serial.print(addr_2[i], HEX);
Serial.print(" "); }
Serial.print("\n"); */
send(ReadMsg_2.set(0));
addr_2_last = 1;
/* Serial.print("addr_2_last: ");
Serial.print(addr_2_last);
Serial.print("\n"); */
for( int i = 0; i < 8; ++i )
addr_2[i] = (char)0;
}
else if (ds_2.crc8(addr_2,7) >> 0 && addr_2_last == 1){
/* Serial.print("Reader 2b: ");
for(byte i=0; i<8; i++) {
Serial.print(addr_2[i], HEX);
Serial.print(" ");}
Serial.print("\n"); */
send(ReadMsg_2.set(addr_2,HEX));
addr_2_last = 0;
/* Serial.print("addr_2_last: ");
// for(byte i=0; i<8; i++) {
Serial.print(addr_2_last);
// Serial.print(" "); }
Serial.print("\n"); */
}
delay(del);
return;
}
where i get this debug:
"0 MCO:BGN:INIT NODE,CP=RRNNA--,VER=2.1.1
3 TSM:INIT
4 TSF:WUR:MS=0
6 TSM:INIT:TSP OK
8 TSM:INIT:STATID=102
10 TSF:SID:OK,ID=102
11 TSM:FPAR
3133 TSF:MSG:SEND,102-102-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
5140 !TSM:FPAR:NO REPLY
5142 TSM:FPAR
8264 TSF:MSG:SEND,102-102-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
10271 !TSM:FPAR:NO REPLY
10273 TSM:FPAR
13395 TSF:MSG:SEND,102-102-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
15403 !TSM:FPAR:NO REPLY
15405 TSM:FPAR
18527 TSF:MSG:SEND,102-102-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
20534 !TSM:FPAR:FAIL
20535 TSM:FAIL:CNT=1
20537 TSM:FAIL:PDT"
a capacitor is already in place on the node.
Am i looking into a Gateway or node issue here? any suggestions?
thanks in advance