• 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

    Chinese brand PSU_monitoring rs485 and Mango

    How-To
    3
    63
    43.4k
    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.
    • phildunlapP
      phildunlap
      last edited by phildunlap

      I forgot to discuss reading values. For that you'll have the script issue the set() to the COMMAND point on its regular cron, in the form of a hexadecimal string. This is where you may need to encode the ASCII into the hex before setting the point, since your protocol is expecting something like "7F0DAAABBBCCCDDDEEEFFF123456" but you'll have to be able to encode the checksum and length fields, or you can hardcode a bunch of queries.

      READ_QUERY_1 = "7F0DXXXXXXXXXXXXXXXXXXXXXCRC0D";
      COMMAND.set(READ_QUERY_1);
      

      If you want the user to be able to query for something easily, you can have an alphanumeric point using a point link to set the COMMAND point and constructing the protocol overhead for you in 'setting' the query point to get information from the device.

      1 Reply Last reply Reply Quote 0
      • H
        hengst
        last edited by hengst

        WOW, my head is spinning. thnx Phil. love to dive into this.

        strange it is not a common protocol. why would someone create something different....

        so far i cant find the device/node with the modbus scan , probably because of the protocol difference.

        i do have reactions on the device when sending random bits with Mango. so i know there can be communication over the wire.

        back to the learning books..

        1 Reply Last reply Reply Quote 0
        • phildunlapP
          phildunlap
          last edited by phildunlap

          One can have quite a bit of fun with Mango!

          It may have more than one communication mode, but I do not believe the document you posted describes a modbus implementation. The Modbus scan tool doesn't always work, so you're better off testing with the point locator test tool or the range read tool.

          A hardware developer may choose to write a custom protocol because it is easiest for them, but judging from the size of the document there's quite a bit of commands to fully implement it.

          1 Reply Last reply Reply Quote 0
          • H
            hengst
            last edited by hengst

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • H
              hengst
              last edited by

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • phildunlapP
                phildunlap
                last edited by

                I would get started with the Serial Data source COMMAND and RESPONSE points. That way you can send any example hexidecimal from the document by setting the command point to that value (from anywhere in Mango that you can set points) and see the response in the response point.

                1 Reply Last reply Reply Quote 0
                • H
                  hengst
                  last edited by

                  so far i got :

                  0_1477605011307_upload-c8d81ab0-00e0-4b6d-9864-d9eea6885769


                  0_1477605112543_upload-69887503-73a5-4fe9-966c-ed5c360fa576


                  0_1477605151292_upload-bf84e49b-72cc-45f6-81fb-a2bc582d7a3b


                  0_1477605207735_upload-b90619f1-e2db-4274-8617-d1bcbba6b90f


                  0_1477605237897_upload-af423953-ae5f-4c8b-aca0-e317ff60767a

                  i am no programmer, can read some code. but think i can start to create a first COMMAND at this point from the Hex code thats in the manual ?

                  1 Reply Last reply Reply Quote 0
                  • phildunlapP
                    phildunlap
                    last edited by phildunlap

                    I would make the Message Queue point on the scripting data source (it also has data points) as an alphanumeric. You won't need RESPONSE in your script context.

                    I think if you have the COMMAND and RESPONSE points configured you should be able to test setting the command and getting a response, without having to worry about parsing the response at all. That way you won't go too far into getting a message parsing script working before learning how a few messages behave.

                    I should also have noted you could use the Serial Data source's regex fields to parse out the values, removing the need for the script except for polling the data. But, I didn't recommend that because the payload is ASCII so I figured you would need to do some conversion anyway.

                    1 Reply Last reply Reply Quote 0
                    • H
                      hengst
                      last edited by

                      i think i need a simple query to start, so requesting the module ID should be a good start ( which is 2 at the moment ) .

                      i am struggling to make a code out of the manual data, can take a while when i have figured that out.

                      0_1477607004363_upload-993a113b-a8d0-401c-b993-ea9a84e3d6a0

                      1 Reply Last reply Reply Quote 0
                      • H
                        hengst
                        last edited by

                        almost a whole day , still no clue what is should put in for VER ADR LENGHT COMMAND_INFO CHKSUM

                        I look for a reference for learn how to read it.....

                        1 Reply Last reply Reply Quote 0
                        • phildunlapP
                          phildunlap
                          last edited by

                          There is an example data frame provided in the document, item 3.5. It's not the most impressive or elucidating explanation, though.

                          Looks to me like the version is 02 but transmitted as 3032 (so in setting the hex COMMAND point you'd use 3032, I am guessing, as well as the whole upper row. ADR appears to be the address of the device-1 (they say they're using address 3, but encode 30303032 (0002)!) LENGTH will depend on your command, as will the value for COMMAND_INFO. CHKSUM will require adding up the bytes of the message and doing a remainder operation, it's stated what it is in 3.3, but it's a one byte checksum, and perhaps the internet will describe that to you better than this document, if required.

                          While implementing this will teach you a lot about Mango and this device, I can't help but wonder if it'll save you time and money to use a device that has a standard protocol?

                          1 Reply Last reply Reply Quote 0
                          • phildunlapP
                            phildunlap
                            last edited by phildunlap

                            Also something is clearly wrong about my understanding of that, since the data length of sending a 3032 is two bytes (0b00110000 0b00110010) but it's clearly stated to be one byte for the version number. Then, why is 02 on the lower row? This is why i don't get over involved in every protocol that comes by... they aren't always easy to make sense of. So is it sending the 7F [LOWER ROW] 0D? Then what is the point of the top row?

                            1 Reply Last reply Reply Quote 0
                            • H
                              hengst
                              last edited by

                              I tracked down the software engineer of the device ( how about that , gehehe ) he is writing a excel sheet for frame calculation Monday.

                              1 Reply Last reply Reply Quote 0
                              • H
                                hengst
                                last edited by

                                playing and gambling, ( couldn't wait till Monday ) i found the command :

                                7e 30 32 30 30 30 31 34 32 30 30 30 30 30 32 30
                                30 30 31 36 43 0d

                                ( request node ID command )

                                will result in :

                                ~02000142040000AD or

                                7e 30 32 30 30 30 31 34 32 30 34 30 30 30 30 41 44

                                I found this with the tool : https://sourceforge.net/projects/scriptcommunicator/
                                as i almost work all the time with Linux, this was a golden tool to play around with the commands.

                                i used these settings for the usb-rs485 communication :

                                0_1477734194513_upload-8ce15371-5806-4a16-9939-b21806928882

                                1 Reply Last reply Reply Quote 0
                                • H
                                  hengst
                                  last edited by

                                  "
                                  While implementing this will teach you a lot about Mango and this device, I can't help but wonder if it'll save you time and money to use a device that has a standard protocol? "

                                  I know,
                                  i ordered it with the idea to use it as with a build in SNMP agent ( as most network devices have these days ) but i didn't look good at the specs, as a result i cant add it to my ( LibreNMS ) monitoring, because its a "dumb" device.

                                  The device is sold as width TCP/IP connection option and default rs485. ( i bought width both )
                                  as i also added a Kwh meter to the setup, ( see topic SDM120-ModBus ) which is also rs485(ModBus) i needed another monitoring tool. and it looks like Mango is filling the gap here, as it does SNMP and rs485(modbus) etc..

                                  As its a VERY cool thing to build and learn, and by posting the results ( in the end as a HOW TO summary ) i am contributing my part to the community's , i am convinced it will help others.

                                  When i got it running it also benefits "Mango" , as then we are going to use it at customers for monitoring anything the want.
                                  Anyway i love it already very much.

                                  so, back to lab.

                                  1 Reply Last reply Reply Quote 0
                                  • H
                                    hengst
                                    last edited by

                                    alright. i got everything complete.

                                    at the point i had figured out how the frame structure functioned, i got some explanation from the other side of the world.

                                    it was in Chinese language, but i have translated it with big brother google.

                                    0_1477746072797_io-codes-recti_translated.pdf

                                    So i think its time to get something done in Mango,

                                    1 Reply Last reply Reply Quote 0
                                    • phildunlapP
                                      phildunlap
                                      last edited by phildunlap

                                      Nice! You should be able to test the examples in that document by simply setting 'COMMAND' to the hex (without the spaces, I would think) and checking the RESPONSE point. Then you can experiment with either parsing the values out through regex serial points or implementing the extractMessageInformation function in the point link. You can still use regex in the script, doing the regular JavaScript syntax:

                                      var messageData = /7E(.*)0D/.exec(RESPONSE.value); //source.value in the actual point link script
                                      var messageBody = messageData[1];
                                      
                                      1 Reply Last reply Reply Quote 0
                                      • H
                                        hengst
                                        last edited by

                                        Jup, that works :

                                        0_1477748487474_upload-8158d6a8-465a-4c8c-9254-380c6c316944

                                        "
                                        implementing the extractMessageInformation function in the point link. You can still use regex in the script, doing the regular JavaScript syntax:

                                        that is new for me.. but banging my head on the desk and grabbing a cold beer and we are good to go another few hours gehehe.

                                        Thanks for the pointers Phil.

                                        1 Reply Last reply Reply Quote 0
                                        • phildunlapP
                                          phildunlap
                                          last edited by

                                          Nice! That looks like the ASCII (since it doesn't begin with HEX) payload perhaps? Maybe it would be better to just do the regex parsing on the Serial Data source points, then, if you don't have to do any of the conversion to or from hex.

                                          1 Reply Last reply Reply Quote 0
                                          • H
                                            hengst
                                            last edited by hengst

                                            I had a little throwback....

                                            after i did get this response i was lost in how everything worked in Mango,
                                            so i thought it would be good to start over from scratch.

                                            also i changed the source from "serial data source" to " tcp/ip" data source ( as that is what i need to use in the end )
                                            ( the PSU happens to have both options to get the information )

                                            that shouldn't make a big difference in the working flow of mango i think.

                                            i tested the commands over tcp/ip with SerialComm program to confirm and it works just like Serial.

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