@mfalkvidd said:
@gvorster 868 is the default so you don't need to do anything. If you want to change it, add
#define MY_RFM69_FREQUENCY
Great, thanks!
@mfalkvidd said:
@gvorster 868 is the default so you don't need to do anything. If you want to change it, add
#define MY_RFM69_FREQUENCY
Great, thanks!
@gloob said:
How are the leds connected to the arduino? Are the LEDs connected to ground or 5V?
Ah, sorry my bad. That's it. I had it turned around.
Should have rtfm:
"Each LED is connected by its anode (long leg) to +5V. The cathode (short leg) is connected through a resistor to one of the following digital pins of the Arduino:"
@siod said in Serial Protocol - 2.x:
@gvorster Thank you for explanation!
One more thing: I wanted to implement a sendHeartbeat() into a Repeater node (which should never sleep!), where should I put this function and how? When putting it just into the loop it is of course spamming my gateway with heartbeat messages...Is it possible anyway?
There are many examples code how to do this. One Timer library I use myself is this https://playground.arduino.cc/Code/Timer
e.g. for a repeater you could use this:
#include "Timer.h"
Timer t;
void setup() {
t.every(60000, sendImAlive);
}
void loop() {
t.update();
}
void sendImAlive() {
sendHeartbeat();
}
@manutremo said in Connecting the Radio:
I have one question regarding the length of the 868MHz antenna. According to the theory, a the wavelength of a 868Mhz signal is 300/868 = 34.6 mm, so a quarter wave antenna should be 8.6mm long. The table above indicates 8.2mm. May someone confirm the correct figure, and also indicate how critical is that difference in terms of range?
I tried 3 types of antennas with RFM69HCW 868mhz.
Just a 8.6 cm wire
helical antenna
Indoor in my appartement (one floor) it doesn't matter which one I use. All is working fine.
I tried 2 nodes in my metal mailbox 10 meters below which has 2 tiny holes.
One with helical antenna, one with sma antenna.
Gateway (using sma antenna) receives no data.
Testing two repeater nodes (1 helical, 1 sma antenna) near a window I receive data via both repeaters. Sometimes the repeater with sma antenna is not relaying messages for the node with the sma antenna.
In my situation, the helical antenna works better for me. I just buy them on ebay.
@Carywin Thanks for the instructions!!
I followed it and just got it working on a Leonardo clone. I am receiving messages from nodes on the Mosquitto broker on a Raspberry Pi.
0;255;3;0;9;TSF:MSG:SEND,0-0-51-213,s=213,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=OK:10280
0;255;3;0;9;Sending message on topic: sensors-out/213/213/1/0/23
0;255;3;0;9;TSF:MSG:READ,213-51-0,s=213,c=1,t=23,pt=2,l=2,sg=0:10281
0;255;3;0;9;TSF:MSG:ACK REQ
0;255;3;0;9;TSF:MSG:SEND,0-0-51-213,s=213,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=OK:10281
0;255;3;0;9;Sending message on topic: sensors-out/213/213/1/0/23
0;255;3;0;9;TSF:MSG:READ,207-51-0,s=207,c=1,t=23,pt=2,l=2,sg=0:21655
0;255;3;0;9;TSF:MSG:ACK REQ
0;255;3;0;9;TSF:MSG:SEND,0-0-51-207,s=207,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=OK:21655
0;255;3;0;9;Sending message on topic: sensors-out/207/207/1/0/23
0;255;3;0;9;TSF:MSG:READ,213-51-0,s=213,c=1,t=23,pt=2,l=2,sg=0:10282
0;255;3;0;9;TSF:MSG:ACK REQ
mosquitto_sub -v -t 'sensors-out/#' -u XXXXXXX -P XXXXXXX
sensors-out/0/255/0/0/18 2.1.1
sensors-out/0/255/0/0/18 2.1.1
sensors-out/213/213/1/0/23 10217
sensors-out/208/208/1/0/0 24.69
sensors-out/213/213/1/0/23 10218
sensors-out/213/213/1/0/23 10219
sensors-out/213/213/1/0/23 10220
sensors-out/213/213/1/0/23 10221
sensors-out/213/213/1/0/23 10222
sensors-out/213/213/1/0/23 10223
sensors-out/208/208/1/0/0 24.69
sensors-out/213/213/1/0/23 10224
I am using Mysensors 2.1.1. and didn't need to do anything on the nodes.
Never worked with a Leonardo and spend a lot of time getting the serial port working on Win7. Also need to press reset everytime right before uploading a sketch.
Also need to add:
void setup() {
while (!Serial) {;}
}
otherwise Serial monitor shows nothing.
@siod said in Serial Protocol - 2.x:
@gvorster Thank you for explanation!
One more thing: I wanted to implement a sendHeartbeat() into a Repeater node (which should never sleep!), where should I put this function and how? When putting it just into the loop it is of course spamming my gateway with heartbeat messages...Is it possible anyway?
There are many examples code how to do this. One Timer library I use myself is this https://playground.arduino.cc/Code/Timer
e.g. for a repeater you could use this:
#include "Timer.h"
Timer t;
void setup() {
t.every(60000, sendImAlive);
}
void loop() {
t.update();
}
void sendImAlive() {
sendHeartbeat();
}
@siod said in Serial Protocol - 2.x:
how can I handle sendheartbeat() messages in my controller? What payload will be sent? 1 or 0, True or False...?
ps Iยดm using openhab
I just tested this using a Serial gateway.
Sending sendHeartbeat()
from node displays this on my Serial gateway:
...
214;255;3;0;22;73
214;255;3;0;22;108
214;255;3;0;22;143
...
3=internal message
0=nack
22=I_HEARTBEAT_RESPONSE
In MyTransport.cpp I found
uint32_t transportGetHeartbeat(void)
{
return transportTimeInState();
}
---
uint32_t transportTimeInState(void)
{
return hwMillis() - _transportSM.stateEnter;
}
So the payload is some elapsed time in milliseconds.
Where can I find the structure for the payload of the internal command I_LOG_MESSAGE ? e.g. payload "TSF:MSG:SEND,211-0-220-220,s=211,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=OK:69"
I know I'm sending a value from node 211 to node 220 with the value 69. What does c=1, t=23, pt=2, l=2, sg=0,ft=0 mean?
I am using MySensors 2.1.1 and see a lot of these messages
0;255;3;0;9;!TSF:MSG:SIGN VERIFY FAIL
As a test I use 2 nodes with this same sketch:
#include "arduino.h"
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 5
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
#define MY_DEBUG
#define MY_RADIO_RFM69
#define MY_IS_RFM69HW
#define MY_NODE_ID 11 // node 1
//#define MY_NODE_ID 12 // node 2
#define MY_DEFAULT_ERR_LED_PIN 9
#define MY_DEFAULT_RX_LED_PIN 8
#define MY_DEFAULT_TX_LED_PIN 7
#define MY_DEFAULT_LED_BLINK_PERIOD 20
#define MY_SIGNING_SOFT
#define MY_SIGNING_SOFT_RANDOMSEED_PIN 3
#define MY_SIGNING_REQUEST_SIGNATURES
#include <MySensors.h>
MyMessage msg(MY_NODE_ID, V_TEMP);
void presentation()
{
sendSketchInfo("Test temperature node", "1.0");
present(MY_NODE_ID, S_TEMP);
}
void setup()
{
sensors.begin();
}
void loop()
{
sensors.requestTemperatures();
send(msg.set(sensors.getTempCByIndex(0), 2));
sleep(1000);
}
I use this serial gateway:
#define MY_DEBUG
#define MY_SIGNING_SOFT
#define MY_SIGNING_SOFT_RANDOMSEED_PIN 3
#define MY_SIGNING_REQUEST_SIGNATURES
#define MY_RADIO_RFM69
#define MY_IS_RFM69HW
#define MY_GATEWAY_SERIAL
#define MY_DEFAULT_LED_BLINK_PERIOD 10
#define MY_DEFAULT_ERR_LED_PIN 5
#define MY_DEFAULT_RX_LED_PIN 6
#define MY_DEFAULT_TX_LED_PIN 7
#include <SPI.h>
#include <MySensors.h>
void setup() {}
void presentation() {}
void loop() {}
If I comment this line in the gateway everything works fine:
//#define MY_SIGNING_REQUEST_SIGNATURES
I only see these error messages when I turn on both nodes.
If I use either Node 1 or Node 2 and turn the other off, I don't see any of these error messages.
The nodes and gateway are on my workbench close next to each other.
For each I use a bare ATMEGA328P burned with bootloader Pro Mini 3.3v 8 mhz
@catcher Thanks, I tried this Perl script and it is working out of the box with OpenHAB2! And I'm sending with MySensors 2.
@catcher bit late, but do you have this serial to mqtt bridge working?
I would like to use RFM69 radio's which I think don't have a direct MySensors MQTT gateway.
I have the serial gateway working and can see data on a RasPi 3 via serial0.
Would like to publish to OpenHab2 via MQTT so this bridge would be great if it works.
@pepson said:
Now any problem. I only need info how write sketch to use radio RFM69HW.
Try the MockMySensors.ino sketch and enable a few sensors.