🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    4-20 mA Unit with wemos S2 mini ESP32

    Modules
    3
    17
    1.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.
    • O
      obstbauer
      last edited by

      it seems that I still have a problem....
      I have a current reading but the value is wrong,
      I get soemthing around 7.2 mA instead of 4 mA.
      I can measure the 4 mA with a multimeter in the circuit and the sensor should send 4 mA, so this is ok, but the M5Stack unit shows 7.2 mA and I don't understand why ? Any ideas ?
      My sensor is passive, I connected 24 V to the 4-20mA unit and all three jumpers are installed
      What is the meaning of the function "getCalCurrent" ? It is neessary for the current measurement ? It is necessary to set a "ref current" ?

      Thank you!

      robskiR 1 Reply Last reply Reply Quote 0
      • robskiR
        robski @obstbauer
        last edited by

        @obstbauer try calibration function based on what you see with multimeter

        M5StickC, M5StickCPlus, M5StickCplus2,M5GO, M5Core, M5Tough, M5Core2, M5 Demo Board, M5Dial, M5Paper, M5Atom, M5Cardputer, M5StampS3, CoreMP135, StamPLC, AirQ

        O 1 Reply Last reply Reply Quote 0
        • O
          obstbauer @robski
          last edited by

          @robski thanks for the answer

          so you mean if I measure with multimter 4.0 mA (which is true for the sensor) and the unit shows me 7.2 mA I should set the calibrated value to 4.0 ?

          Because this is not mentioned anywhere in a readme file or manual or in the description of the device, and it is not made in the example file at github
          but I am a beginner....

          robskiR 1 Reply Last reply Reply Quote 0
          • robskiR
            robski @obstbauer
            last edited by

            @obstbauer thats what i did with mine initially, calibrate with known current value

            M5StickC, M5StickCPlus, M5StickCplus2,M5GO, M5Core, M5Tough, M5Core2, M5 Demo Board, M5Dial, M5Paper, M5Atom, M5Cardputer, M5StampS3, CoreMP135, StamPLC, AirQ

            O 1 Reply Last reply Reply Quote 0
            • O
              obstbauer @robski
              last edited by

              @robski ok I think I found it:

              thank you I will try tomorrow

              0d731077-cf0a-4752-ae2d-318aa42b8f92-grafik.png

              robskiR 1 Reply Last reply Reply Quote 0
              • robskiR
                robski @obstbauer
                last edited by

                @obstbauer yeah thats the registers table, I used Uiflow2 with calibration block but you are using not M5Stack controller I see

                M5StickC, M5StickCPlus, M5StickCplus2,M5GO, M5Core, M5Tough, M5Core2, M5 Demo Board, M5Dial, M5Paper, M5Atom, M5Cardputer, M5StampS3, CoreMP135, StamPLC, AirQ

                O 1 Reply Last reply Reply Quote 0
                • O
                  obstbauer @robski
                  last edited by

                  @robski what value do you take for "index" in the function

                  void MODULE_4_20MA::setCalCurrent(uint8_t index, uint16_t value)
                  
                  robskiR 1 Reply Last reply Reply Quote 0
                  • robskiR
                    robski @obstbauer
                    last edited by

                    @obstbauer haven't used index value

                    in uiflow2 ..ain4_20ma_0.set_cal_current(10) to set 10mA
                    ain4_20ma_0.set_cal_current(20) to set 20mA

                    M5StickC, M5StickCPlus, M5StickCplus2,M5GO, M5Core, M5Tough, M5Core2, M5 Demo Board, M5Dial, M5Paper, M5Atom, M5Cardputer, M5StampS3, CoreMP135, StamPLC, AirQ

                    O 1 Reply Last reply Reply Quote 0
                    • O
                      obstbauer @robski
                      last edited by

                      @robski yes maybe in uiflow2 but the function for the c program asks for an index and a value

                      O 1 Reply Last reply Reply Quote 0
                      • O
                        obstbauer @obstbauer
                        last edited by

                        I see really strange behaviour and I don't know the reason and I get no answers from the support.....
                        The example code from M5Stack say that the currentvalue should be divided by 100:

                        canvas.printf("Current:%.2fmA", (float)(meter.getCurrentValue(0)) / 100.0);
                        

                        The values I get I have to divide by 10 to get the right current in mA.... and the other issue is that I can only use half of the measurement range, at 12.5 mA the ADC sends 65520...

                        maybe someone has an idea ?

                        O 1 Reply Last reply Reply Quote 0
                        • O
                          obstbauer @obstbauer
                          last edited by

                          change to a raspberry PI4 seems to be no solution too.....
                          it woud be nice if there would be a better documentation for people who want to use the units outside the m5stack universum....

                          robskiR 1 Reply Last reply Reply Quote 0
                          • robskiR
                            robski @obstbauer
                            last edited by robski

                            @obstbauer this is uiflow example with raw value and float too

                            ain21.PNG ain20.jpgain22.PNG

                            M5StickC, M5StickCPlus, M5StickCplus2,M5GO, M5Core, M5Tough, M5Core2, M5 Demo Board, M5Dial, M5Paper, M5Atom, M5Cardputer, M5StampS3, CoreMP135, StamPLC, AirQ

                            1 Reply Last reply Reply Quote 1
                            • O
                              obstbauer
                              last edited by

                              thank you, but I am still not able to read out or to set the cal current
                              M5Stack support doesn`t answer my mails... and it seems that there is nobody from the company around here, I think I will change to another board with better support

                              robskiR 1 Reply Last reply Reply Quote 0
                              • robskiR
                                robski @obstbauer
                                last edited by

                                @obstbauer TBH if you are using M5Stack modules/units with not M5Stack controllers maybe its worth to have at least one M5Controller (atom?stick? )to be able to check module functionality

                                M5StickC, M5StickCPlus, M5StickCplus2,M5GO, M5Core, M5Tough, M5Core2, M5 Demo Board, M5Dial, M5Paper, M5Atom, M5Cardputer, M5StampS3, CoreMP135, StamPLC, AirQ

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