MySensors Serial Gateway minimal example to send data
-
Hello everybody,
I'm just trying the MySensors protocol stack. I thought the easiest way to get it work and understand would be to have to nodes: one serial gateway and one dimmer.
I then thought i could connect the serial gateway to my favorite terminal program and see what the nodes are talking, I also thought that i should be able to send commands.
So I set everything up and I get the incoming messages on the serial terminal program:
0;0;3;0;14;Gateway startup complete.
0;0;3;0;9;read: 3-3-0 s=255,c=0,t=17,pt=0,l=5:1.4.1
3;255;0;0;17;1.4.1
0;0;3;0;9;read: 3-3-0 s=255,c=3,t=6,pt=1,l=1:0
3;255;3;0;6;0
0;0;3;0;9;read: 3-3-0 s=0,c=0,t=4,pt=0,l=5:1.4.1
3;0;0;0;4;1.4.1
0;0;3;0;9;read: 3-3-0 s=255,c=3,t=11,pt=0,l=11:DimmableLED
3;255;3;0;11;DimmableLED
0;0;3;0;9;read: 3-3-0 s=255,c=3,t=12,pt=0,l=3:1.1
3;255;3;0;12;1.1
0;0;3;0;9;read: 3-3-0 s=0,c=2,t=3,pt=0,l=0:
3;0;2;0;3;This looks quite good to me. However now I want to send something so I type
3;0;1;0;3;50;\n
(of cause the \n is sent by the terminal program, i.e. it is the linefeed)I expect this means send to node 3, childid 0, set command (1), no ack (0), V_dimmer type (3); value : 50
Then the DImmer node also seems to receive something because it says
read: 0-0-3 s=0,c=0,t=0,pt=0,l=1:\nHowever I cannot see any changes in the brightness of the conneced LED. I also dont understand why:
3;0;1;0;3;99; does not work??!I think I have something clearly missunderstood about any of the concepts? I hope you can help me.
Thanks
Dirk_H -
Ok I tried to send the suggested messages:
3;0;1;0;4;50 (without semicolon) : nothing happnes, i.e. the gateway does not even try to send (tx led also not blinking, although rx light on ftdi usb->ttl chip is blinking)
3;0;1;0;4;50; (with semicolon) returns "0;0;3;0;9;send: 0-0-3-3 s=0,c=0,t=0,pt=0,l=1,st=ok:" on gateway and "read: 0-0-3 s=0,c=0,t=0,pt=0,l=1:\n" on the dimmer node
Exaclty the same readings for 3;0;1;0;3;50; in case you menat 3 instead of 4 (the latter 3)
3;0;1;1;3;5 does not work (does not work with semicolon at the end and does not work without it)
3;0;1;1;3;50; retruns the same messages as the 3;0;1;0;4;50;
Thanks for your efforts, I really hope that we can find the mistake. However may I assume that in principle it should be possible to send from the serial gateway with a terminal program as I proposed?
-
-
Hmm ok, without the last semicolon nothing works - it does not try to send.
I forgot to mention that I use a Arduino mini pro 3.3V @ 8MHz. Somewhere I read that the gateway should have 16Mhz- but because everything else (i.e. receiving) worked, I thought 8MHz would also work..Because of that I tried an Arduino Nano running on 16MHz -> and THIS WORKS. :smile:
If one changes the MySensors.h Baudrate to e.g. 38400 than everything also works fine with the 8MHz.
However I think it is a very bad behaviour that receive works 100% fine but send not, evil computers :grinning:
BTW, can I also change the lib files when working in a cloned codebender sketch?
Thanks for your support!
-
One last thing I'd like to clarify after re-reading my previous post.
The correct send string I entered in the terminal is without trailing ";" - like it was supposed before. As mentioned, the problem has been the BAUD rate of 156k with 8MHz crystal..
So the correct command which will change the PWM -Dimmer level on node 3 to 50% is:
3;0;1;0;3;50\n
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login