How to use SoftwareSerial Library?

  • Hi,
    first of all thank you very much for the great forum and all the futures built in mySensors!
    Although I ve read up and down the forums and information, I am not really clear how to use the SoftwareSerial instead of AltSoftSerial lib. There are some comparison why the one might be better than the other but I didn't grab a sketch sample to go from there.
    The reason why I am asking is that I had established an rs485 network with custom designed nodes on arduino nano with rs485 shield. The system is a little bit like mySensors, it works with the ICSC lib, but unfortunately I came across mySensors too late. So all my PCBs are done and the parts are soldered and the rs485 module is connected like this:
    DI = Pin 2
    DE/RE = Pin 3
    RO = Pin 4
    The only option I have now to "upgrade" to my sensors is to get the SoftwareSerial lib running.
    Time is not an issue for me, so it would be totally sufficient to run at a speed of 19200 or 57600 Bauds.

    Is there anyone with a similar problem giving me a hint how to get along with it? That would be very nice.
    Best regards,

  • I think there is couple things you need to tweak if you want to use SoftwareSerial instead of AltSoftSerial since its quite well baked in the default solution.

    See these:

  • Admin

    No problem,

    You should be able to use soft serial by defining:

    #define MY_RS485_HWSERIAL yoursoftserial

    It'll fallback to AltSoftSerial if undefined.

  • Hi,
    Thank you very much for the solution @hek: this sounds pretty straightforward ;-) and was what I was looking for.
    I will check it out this weekend.
    It would be fantastic to switch the hole system to mysensors! Since a lot of developing is already done.

    I will come back to post my results.

    Best regards

  • Hi
    Before I was able to go testing I was wondering if the gateway would be much easier (but more dirty) to realize with two stacked arduinos. One is operating the rs485 to serial connection and sends it via serial to the second arduino which in turn is connected to udp or http.
    I know it would be neater to go with software but as far as I know this is realized within some hours.
    By the way in this case it turns into a good platform adapter since the second arduino can be virtually connected to anything.
    What do you think?

    Have a nice weekend. Kduino

  • Hi @kduino
    I think my problem is similar, what I want to do is to send the received sensor data on the serial gateway to a GSM modem for insertion into a Cloud server, but I have no idea of how to capture the data on the serial gateway, IE I can see the sensor values, but how would I trap the data for sending to the GSM modem? Any advice would be appreciated please

Log in to reply

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.