💬 Building a Serial Gateway
-
This thread contains comments for the article "Building a Serial Gateway" posted on MySensors.org.
-
I have two questions ...
one) this sketch only works with version mysensors_v2.0 it?
two) all the old skeck are no longer usable?
thank you
-
one) this sketch only works with version mysensors_v2.0 it?
Correct
two) all the old skeck are no longer usable?
They are still usable. All nodes in a sensor network need to run the same major MySensor version. If you want to stay on version 1.5, you can continue using the 1.5 sketches.
-
you have been very kind, you also tell me, where can I find the old serial sketches compatible for mysensors version 1.5?
-
@Michel---It you're welcome
Download 1.5.4 from https://www.mysensors.org/download or select the 1.5.4 tag on Github, https://github.com/mysensors/MySensors/tree/1.5.4
-
@mfalkvidd I wanted to see if you were ready It can help someone
-
I have 2 gateways : one with 1.5.4 and one with 2.0 :
I have tested with 2 temp nodes : one with 1.5.4 version and one with 2.0 : the 2 gateways can see the 2 nodes !
-
This post is deleted!
-
If i want to update the gateway to 2.1, do i just need to download the master and reupload this scetch to it?
Do i need to do that to all my sensors aswell?
i am on 2.0 right now
-
@meanmrgreen yes re-uploading after updating the MySensors library is all you need to do. I recommend updating through the Library Manager (if you use the Arduino IDE) instead of manually downloading from github though.
You can mix nodes with 2.0 and 2.1 so there is no immediate need to update your nodes.
See https://forum.mysensors.org/topic/5691/upgrade-to-2-1-0/2 and https://forum.mysensors.org/topic/5651/mysensors-2-1-0-released for more information.
-
I don't seem to be able to get it to work when loading the SerialGateway sketch onto a Mega 2560 board... I have tried to find out where to change the pins for the SPI connection, as the pin location is different than on the Nano, but can't seem to find it. Does the library autodetect which pins to use on various boards?
-
@agtig no it does not autodetect. The instructions for SPI on the Mega are linked from the connecting the radio page.
-
Is it possible to update the article with a code example for a gateway that also uses NodeManager?
-
Is it possible to use an Arduino Mini Pro instead of a UNO? I did try with a Mini + FTDI232 (the red card) but cannot see nothing on PI serial. Thank you!
-
@sineverba I had issues incorporating the Sensebender Gateway, as originally planned so used one a Pro-mini as a stopgap gateway to the Pi, and it hasn't skipped a beat... It is a 3.3v 16MHz version however, you would need a level shifter on the serial if you were to use a 5v Pro-mini...
-
@zboblamont It is a 3.3v 8mhz. So do you mean use It connected via GPIO of PI? How do you power It?
-
@sineverba Serial Tx to Rx and vice versa, ground and 3.3 from Pi...
-
@zboblamont ok, and PI can safely Power It with his radio? If right Remember, max of PI are 50mA .... From a GPIO.....
Another question, please, what the port serial name? Pi recognises It out of the box?
-
@sineverba You are not powering the gateway from the Pi's data pins, you are tapping off the 3v3 power on the Pi's power supply.
On the Pi3 (same as the Pi2), the 3v3, gnd, tx, and rx are grouped on the outside row making it all neat.
-
@sineverba I forgot to add, this gateway has a RFM69, so powers it no problem.
If I remember correctly the input was selected on the Pi in Domoticz as ttyS0...
-
@zboblamont ok. I did not know cause I have a PI1. Btw, what about serial port name and out of the box working? Or need some edit on PI config?
Edit: I did read your answer late
-
Is MY_RX_MESSAGE_BUFFER_FEATURE auto enabled for a gw using serial or do I need to add #define MY_RX_MESSAGE_BUFFER_FEATURE in the sketch before uploading?
I have looked this page + https://www.mysensors.org/build/connect_radio + https://www.mysensors.org/download/sensor_api_20#configuration and still not sure.....Anyone know?
-
@skywatch it is not enabled by default.
https://www.mysensors.org/apidocs-beta/group__RF24SettingGrpPub.html#gafe2f4565dfa8473846dfc82d417c8147The default value is in parenthesis after the name, if there is a default value. Example:
means that the default value for MY_RF24_PA_LEVEL is RF24_PA_HIGH
There is nothing after
which means it is not set by default.
-
Thanks for reply. Maybe I wasn't too clear, so here is more info.
Today I made a serial gw with a pro mini as the nrf24 attached to pi directly is suspected of problems with MyController.
In the wiring diagram on the build page it shows the IRQ from the nrf24 to the promini as connected. But this is not enabled by default in the MYSGW code.
So, to make the NRF24 IRQ work, I need to add #define MY_RX_MESSAGE_BUFFER_FEATURE and #define MY_RF24_IRQ_PIN.......Or is it #define MY_RX_MESSAGE_BUFFER_FEATURE(ENABLED) #define MY_RF24_IRQ_PIN(D2) ???
I just want to enable the irq from the nrf24 to help with message flow.
-
@skywatch thanks for clarifying.
Use
#define MY_RX_MESSAGE_BUFFER_FEATURE
to enable the RX buffer feature
Use
#define MY_RF24_IRQ_PIN 2
to set the irq pin to pin 2.
-
Perfect - Just what I needed to know!
Thanks!
-
This post is deleted!
-
@mntlvr you have now posted variants of the same questions in three places. This means efforts to help you will be split into three places. People will waste time helping you in one thread, not knowing the discissions in the other threads. This will waste people's time. Please only post your question in one place.
-
@mfalkvidd
Well I thought since you wrote this you could answer the question
I have searched entire site for answer and can not find one and since you posted the build last year you would be the one who could answer it
-
@mntlvr sorry, I have no experience with Vera.
-
Hi I'm new to MySensors, I've installed openHAB as my controller and installed the Add-on MySensors to it. But now that I have uploaded GatewaySerial.ino to a Nano with an nRF24L01+, I've noticed that there was no code to drive the setup and loop functions. And how do I verify that it is working? from the Karaf console?...
-
Please disregard my question, I got it working, turn out there was no need to have some code in the setup and loop functions, suprisingly.
-
Hello,
im kind of lost, i need to install a distance sensor buried in a well of water, and will need a lot of tweaking and reprogramming until i get the desired correct measurements.
so i need OTA, extremely low power (battery powered, sleeps most of time), so i went to ultrasonic sensor HC04 which is even powered through GPIO of pro mini, and an nrf24l01+. the main problem is OTA. My concerns are:- should i burn MYSBOOTLOADER on sensor and Serial GW ?
- if bootlader burnt, any sketch can do the OTA?
- should I use only MySensors GW SW, or can i have my own sketch.
Any ideas are welcome.
Thanks a lot
-
Is there a way to make a serial2mqtt gateway (e.g. a NodeMCU is getting MySensor data on the serial interface and should just bridge that to MQTT)?
-
@siouxme there is a direct mqtt gateway that you can build, so you don't need the serial step inbetween. See the list of gateways.
-
Is it possible to get a list of all attached nodes? I'd like to attach a TFT screen to the gateway that shows all the connected devices.
-
@alowhum there is no such thing as an attachment in a MySensors network.
Nodes send messages whenever they like. The nodes may go to sleep at any time, which would make them unavailable.
The gateway does not store information about when a node last communicated, nor about which child sensors have been presented.
-
@mfalkvidd Thanks. Would it be possible to generate that list somehow? Perhaps by listening to what nodes connect to it?
It doesn't matter if they are offline or not, it doesn't have to be perfect.
-
@alowhum yes. That's how a controller learns about the nodes
-
But could the gateway itself do it too? If so, do you have any suggestions on where I should start? How can I "hook into" the gateway to find out what devices are communicating with it? Is there example code of this?
-
@alowhum yes you could build a controller into the gateway.
The receive function will be called for each incoming message. You can react to the messages inside receive().
-
These threads might be useful
https://forum.mysensors.org/topic/1973/esp8266-as-wifi-gateway-controller-node
https://forum.mysensors.org/topic/4528/esp8266-as-a-gateway-and-controller
-
Thanks!!
-
After 3 years of using RADIO_RF24 i replaced my all sensors with espeasy. It was just big battle with lost transmissions, disconnections, every day problems. Now for many days silence...Everything works.I still use mysensors in diferrent setup but NRF Radio is asking for trouble.
-
I tried building a serial gateway using an Arduino Nano, but it never worked (both gateway and node start, but node keeps saying NO REPLY). I used the same NRF24 module directly on the Raspberry Pi, and built a Raspberry Pi gateway, it worked perfectly. Any idea on what might be going on? Thanks!
-
@maaaaaaaaaartin most common problem is that the power source is not stable enough for the nrf24.
-
Can serial gateway be build on Atmel 168 chip instead of 328 in terms of memory? It compiles fine, but leaves little extra memory for variables.
-
@APL2017 how much is left?
-
Sketch uses 13634 bytes (95%) of program storage space. Maximum is 14336 bytes. Global variables use 731 bytes (71%) of dynamic memory, leaving 293 bytes for local variables. Maximum is 1024 bytes.
I noticed parsing error in my controller log and switched to 328P. I bought 168P by mistake and wondering how I can use it. Does simple mySensors node require less ROM/RAM than gateway?
-
@APL2017 a very simple node, yes. But a node using a sensor library can often need more flash and ram than a gateway. I have tried to fit things into the atmega168 (I also bought wrong devices) but gave up. Unless you think it is a fun and interesting challenge, it will not be worth the time.
-
@mfalkvidd Thank you, I will donate 168P to some other Arduino enthusiast.
-
Why would the gateway send a NACK to any node? The node only received one OK and then just NACK
17764 ?TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=1,st=OK:
22773 !TSM:FPAR:NO REPLY
22775 TSM:FPAR
29779 ?TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=NACK:
34789 !TSM:FPAR:NO REPLY
34791 TSM:FPAR