• Recent
    • Tags
    • Popular
    • Register
    • Login

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    Sending data from Mango to Arduino board (Modbus)

    User help
    3
    12
    6.3k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      rcopeland
      last edited by

      Hello,

      I currently have my Arduino board sending data to Mango through Modbus. However, I would like to be able to send data from Mango (based on some kind of event) to the board through the Modbus connection, which will light up and LED.

      Obviously there will be some code performing this function in my Arduino program (I already know how to turn on a LED in Arduino using analogWrite() function).

      The part I am missing however is a way to publish data from Mango to the board. Can this be accomplished by linking points, or creating events that will set a point within the same Modbus Data source? Also, what slave ID, register range, etc. values need to be set up?

      Thanks in advance,
      Russ

      1 Reply Last reply Reply Quote 0
      • J
        Jokke
        last edited by

        Hi,

        The sending to mango you refer is reading in mango datasorce. By checking "Settable" in a point details in modbus datasource it can then be written(send data from mango). So you need to define a point for the led.

        Not knowing what is the criteria to turn the led on, you could use point link or event handler.

        BR
        -Jokke

        1 Reply Last reply Reply Quote 0
        • R
          rcopeland
          last edited by

          So far I have created a datasource, modbus serial which runs over COM4. I have 2 points (slave 1 and 2), both holding registers with 2 byte unsigned integers, one of which is settable.

          On my watch list I can see the values coming in from the Adruino which are point 1. Point 2 says "Point value may not be reliable", possibly because no values are coming in under that channel.

          In my Arduino program, the input data that I make is transmitted under regs[MB_REG0], and I assume regs[MB_REG1] should contain the data that comes from mango to the Arduino.

          Does this sound right? I still haven't been able to recieve data on the Arduino.

          1 Reply Last reply Reply Quote 0
          • R
            rcopeland
            last edited by

            This might be a slightly simpler way to ask my question:

            How can I transmit 2 data streams on a single channel from Modbus to Mango? I can do one at a time, (after first calling init_mb_slave() and start_mb_slave() ) by writing to regs[MB_REG0]=value, but it doesn't seem to work for another if I use regs[MB_REG1]=value2.

            I havent been able to use both these values in Mango, I am under the impression that they are under the same data source, same slave ID, so I do not know what differentiates between the two.

            1 Reply Last reply Reply Quote 0
            • J
              jose francisco
              last edited by

              I'll try to help you.

              So far I have created a datasource, modbus serial which runs over COM4. I have 2 points (slave 1 and 2), both holding registers with 2 byte unsigned integers, one of which is settable.

              If you have 2 slaves then you have 2 arduinos. Is that true? Have you got one arduino with two registers?

              If you have one arduino with two register you must add two data points. First with offset 0, second with offset 1. But the two data points must belong to one slave (usually slave 1).

              On my watch list I can see the values coming in from the Adruino which are point 1. Point 2 says "Point value may not be reliable", possibly because no values are coming in under that channel.

              Here you have the clue. Point 2 is not working because you don't have a slave 2. Try to change slave to 1 and offset to 1.

              The structure is:
              Modbus data source-COMX
              -slave id 1
              --offset 0
              --offset 1...
              -slave id m
              --offset 0
              --offset 1...

              To send data to arduino:
              make data point 2 settable
              write a condition in arduino like: if regs[MB_REG1]<5 digitalWrite(13,1)

              What library are you using for modbus?

              1 Reply Last reply Reply Quote 0
              • R
                rcopeland
                last edited by

                Thanks, I just figured it out. I was confusing slave/offset terminology, now I have 1 slave, 1 data point with offset 0 and 1 data point with offset 1 (settable) and it seems to work fine.

                FYI I am using ModbusSlave.h which is included with the Arduino program files.

                Thanks again for the help. My company is starting a new project using Arduino boards and Mango, I can tell this forum will be very useful.

                1 Reply Last reply Reply Quote 0
                • J
                  jose francisco
                  last edited by

                  have tried to send float values?

                  1 Reply Last reply Reply Quote 0
                  • R
                    rcopeland
                    last edited by

                    @jose francisco said:

                    have tried to send float values?

                    Yes, I can send values from Mango > Arduino and Arduino > Mango, haven't tested it thoroughly but I believe it works fine.

                    1 Reply Last reply Reply Quote 0
                    • J
                      jose francisco
                      last edited by

                      I'm using jpmzometa's library and it works very well but only with integers.
                      Are you sure that floats works right?

                      1 Reply Last reply Reply Quote 0
                      • R
                        rcopeland
                        last edited by

                        @jose francisco said:

                        I'm using jpmzometa's library and it works very well but only with integers.
                        Are you sure that floats works right?

                        Yes I believe you are right, values are always converted to integers which is fine for me right now. Have you tried changing the point details (under Mango) from 2 byte unsigned integer to a float?

                        1 Reply Last reply Reply Quote 0
                        • J
                          jose francisco
                          last edited by

                          the problem is not mango. the library can't handle 4 byte types.

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post