Welcome to EnviroDIY, a community for do-it-yourself environmental science and monitoring. EnviroDIY is part of WikiWatershed, a web toolkit designed to help citizens, conservation practitioners, municipal decision-makers, researchers, educators, and students advance knowledge and stewardship of fresh water. New to EnviroDIY? Start here

MayFly Capability with Northern Widget Walrus Sensor

Home Forums Environmental Sensors MayFly Capability with Northern Widget Walrus Sensor

Tagged: 

Viewing 38 reply threads
  • Author
    Posts
    • #14726
      Tom Schanandore
      Participant

        Hello,

        I have been working a company called Northern Widget out of St. Paul Minnesota regarding their water pressure sensor named the Walrus. It is connected via. a I2C port and they say it should work on any basic Arduino based board at 3.3 to 5.5 volts. We had so much trouble getting it to work that we had to abandon using it. The sensor works when connected to the MayFly directly, but does not work when connected by the 3m cable.

        I have connected a MPL115A pressure sensor and that works both directly connected and connected via. the 3m cable.

        Has there been anyone else that has worked with Northern Widget on utilizing their sensors?

      • #14727
        Sara Damiano
        Moderator

          Bobby Shultz or Northern Widget did some of the work to incorporate the MPL115A into ModularSensors, but I haven’t followed what they’ve been doing.

          It looks like this Walrus thing has an on-board processor that in between the Mayfly and the MPL115A.   So you need to use whatever protocol they’ve developed for themselves not the MPL’s I2C protocol.  It looks like they have both I2C and RS485 firmware available and some instructions on how to upload the firmware to said on-board processor.  Do you know which you have?  Their demo code, true to it’s warning, is based on a library that doesn’t yet exist.  Have you tried contacting Northern Widget directly to ask for help?

           

        • #14728
          Tom Schanandore
          Participant

            Thanks Sara,

            I have been working with Bobby and Andy Wickert over there on this and they gave me sensors with the appropriate firmware installed already. I did not have to install any firmware. It was just suppose to be hooked up and ready to work. I didn’t know if anyone in the community here was able to get a walrus sensor to work on the MayFly?

            Honestly they have been unwilling to work that in depth with me on this and we are currently parting ways on the venture.

          • #14729
            Sara Damiano
            Moderator

              Someone has to dig through their firmware file and reverse engineer the communication protocol.

            • #14730
              Tom Schanandore
              Participant

                Honestly my understanding of all this is pretty basic, but I understand that the firmware is very important. I left it up to Northern Widget to upload the appropriate firmware to the sensor before they sent the sensors, so that that process would be streamlined. I did read through their documentation on the firmware and, as you stated before, they have two; I2C and RS485. I am pretty sure the one that is uploaded is the I2C. I am curious to see if the RS485 would work or if there would need to be some revision of the firmware somehow. They didn’t talk about trying different firmware.

                Yes maybe someone else has tried this also and can comment.

                Thanks Sara,

              • #14731
                Sara Damiano
                Moderator

                  I2C and RS485 are two different communication protocols.  They specify what change marks a 1 or a 0 when transferring information.  I2C also (mostly) specifies the question-and-answer format.  So knowing you have I2C firmware gets you some of the way there, but not very far.  You need to know what question to ask the board and what it’s response will be.

                  I’m guessing this is the firmware they gave you:  https://github.com/NorthernWidget-Skunkworks/Project-Walrus/blob/master/Firmware/Walrus_I2C_5BA/Walrus_I2C_5BA.ino.  That would be the program the microcontroller on the Walrus itself is running, not what the Mayfly needs to run to talk to it.

                • #14732
                  Tom Schanandore
                  Participant

                    I am assuming that the firmware also has something to do with making the sensor signal work over the length of the 3m cable? The sensor does work when attached directing to the I2C port (via. grove cable) on the Mayfly at 3.3v. That’s great, but as you know, I need to run that sensor into the stream.

                  • #14733
                    Sara Damiano
                    Moderator

                      WRT to the wire distance, yes and no.

                      RS485 is a two-wire protocol where 0’s and 1’s are differentiated by the difference in voltage between the two wires.  Electrically, this means it can be used over long distances (ie, up to 4,000 feet).  To use RS485 the processors that are talking each need to have their own internal clocks and each separately need to be told the speed at which they will send the bits and how many bits make up one letter.  The processors also need to agree on a way to determine whose turn it is to talk and whose turn it is to listen.  Modbus is a common choice, but there are many others.

                      I2C is also a two-wire protocol, but the 0’s and 1’s are based on the voltage of a single wire and the second wire works as the clock.  This configuration does not lend itself to long wires; I2C is usually used between chips on the same circuit board.  It’s theoretical limit is only about 1m, but, as you’ve seen when using the MPL directly, 3m can sometimes be managed.

                    • #14734
                      Sara Damiano
                      Moderator

                        I’m sorry, I’m looking through their firmware and trying to figure something out for you.  I hate half-answering a question.

                      • #14735
                        Sara Damiano
                        Moderator

                          post deleted

                        • #14736
                          Tom Schanandore
                          Participant

                            Much appreciated. There are a few trouble shooting things that I did that may be difficult to explain over the forum. If you would like to discuss my phone is 701-390-2040. These trouble shooting thing did show some interesting results. Any help to get them to work would be great, since I have four ready to go that they sent and I was planning to deploy in the field this November. Been trouble shooting the sensor since August.

                            Thanks Sara,

                          • #14737
                            Tom Schanandore
                            Participant

                              I only paid for the one, which was not housed. That one I will keep. The other four they just sent, without first figuring out the problem. If they don’t work I will simply send the four back. Yes, frustrating. Two months of not getting anywhere and now I need to make the decision to figure this out on my own or switch to a different sensor. Maybe something raw that I can house/encapsulate myself.

                            • #14739
                              Sara Damiano
                              Moderator

                                Alright, here’s something.  I can’t promise it *works*, but I’d like to see the results.

                                 

                              • #14740
                                Tom Schanandore
                                Participant

                                  I am assuming that this is a firmware to be uploaded to the sensor?

                                • #14741
                                  Sara Damiano
                                  Moderator

                                    No, no, that’s for a Mayfly talking to a sensor with the firmware Northern Widget posted on GitHub.

                                  • #14742
                                    Tom Schanandore
                                    Participant

                                      I see. Do I simply upload to the mayfly with the sensor attached? Or is this code to be added in somewhere in my overall code (PlatformIO)?

                                    • #14743
                                      Sara Damiano
                                      Moderator

                                        That’s the full code, you should upload it to the mayfly with the sensor powered and attached to the I2C on the Mayfly.  Then start a serial terminal at 9600 and you should see output.

                                      • #14744
                                        Tom Schanandore
                                        Participant

                                          I uploaded the code and the serial output is attached.

                                           

                                          Attachments:
                                        • #14746
                                          Tom Schanandore
                                          Participant

                                            It’s reading something, which is a lot better than before, as it read nothing before.

                                          • #14747
                                            Sara Damiano
                                            Moderator

                                              No, it’s just *printing* something.  I don’t think the sensor’s responding.

                                            • #14748
                                              Sara Damiano
                                              Moderator

                                                Ok, here’s new code for the Mayfly.  This should be much more verbose and show more clearly if the sensor’s responding.

                                                 

                                              • #14749
                                                Sara Damiano
                                                Moderator

                                                  If (when) that fails, you can try an I2C scanner program on the Mayfly to see if the sensor has a different address.

                                                • #14750
                                                  Sara Damiano
                                                  Moderator

                                                    Also try flipping the SCL and SDA pins if you’re getting nothing.  Some versions of the Mayfly had them labeled backwards.

                                                    Also on a Mayfly you should always be finding a device at 0x48 and at 0x68.  Those are the clock and the extra ADC.  If the Walrus is responding, it should show up as a third device.

                                                    Scanner code for the Mayfly:

                                                     

                                                  • #14751
                                                    Tom Schanandore
                                                    Participant

                                                      Ran the second bit of code and the scanner code. The scanner codes serial output is at the end.

                                                      See attached

                                                      Attachments:
                                                    • #14754
                                                      Sara Damiano
                                                      Moderator

                                                        So it is there and responding, but there’s something wrong with my code because it’s not giving data.  Do you know if the firmware on your device *is* that code on github?  Otherwise, I don’t see in that code what I have to do to get it to start reporting values.

                                                      • #14758
                                                        Sara Damiano
                                                        Moderator

                                                          I’m sorry; I’ve spent a lot of time reading through that firmware and if there’s something you have to do to get it to start taking readings, I don’t know what it is.  So either I’m just not understanding the firmware or that’s not the firmware that’s actually on your device.  I don’t think there’s any other way I can help you if you cannot get a summary of the commands and registers from Northern Widget.  The problem is definitely NOT your Mayfly.

                                                        • #14759
                                                          Tom Schanandore
                                                          Participant

                                                            I will contact Northern Widget to see if they will send the firmware that they uploaded for verification on this end.

                                                          • #14760
                                                            Sara Damiano
                                                            Moderator

                                                              You don’t need the whole firmware; actually I’d prefer not to get the firmware, but instead to get a short breakdown of the required I2C registers and commands.  All I would be doing with the full firmware is trying to decode what the registers are anyway.

                                                            • #14762
                                                              Tom Schanandore
                                                              Participant

                                                                See the link below to the firmware that they say is on the sensor. It is probably the same firmware you are looking at. I am requesting also the I2C registers and commands.

                                                                https://github.com/NorthernWidget-Skunkworks/Project-Walrus/tree/master/Firmware/Walrus_I2C_5BA

                                                                 

                                                              • #14763
                                                                Sara Damiano
                                                                Moderator

                                                                  That’s the firmware I’ve been looking at.

                                                                  You know what, I don’t think this firmware even functional.  It won’t ever take a sample.  Well, it should sample 1 time at the beginning, and then never again.  Ugh.  I wasted a lot of time parsing the I2C bits of the firmware and writing code for you and didn’t ever question that that sampling part of the firmware worked.  I’m pretty sure it doesn’t.

                                                                  I created an issue on GitHub for them:  https://github.com/NorthernWidget-Skunkworks/Project-Walrus/issues/14.  Basically, every 100ms the firmware sets a timeout value and then immediately after setting the value, checks if the same value is more than 5 seconds old.  But, obviously, since it just set that value, the value will never be more than a few ticks old and the “start sampling” flag will never, ever be set to true.

                                                                  So.. yeah, you need them to write and give you new firmware.  And, then you need to figure out how to write said firmware onto your sensor.  They have instructions on how to do that here:  https://github.com/NorthernWidget-Skunkworks/Project-Walrus#upload-the-firmware, but you need an ISP of some sort.  I don’t even have one of those.

                                                                  It’s still not clear to me why it’s not sampling exactly one time when first booted up, but I don’t think it’s worth anyone spending any more time with it until you’ve been given new firmware and a way to program it.

                                                                • #14764
                                                                  Tom Schanandore
                                                                  Participant

                                                                    Is there anything strange about the fact that the walrus sensor does output good values when I have it connected directly (via grove connector) to the MayFly? And of course it is only when I connect it via the 3m cable that the values do not output.

                                                                    It sounds as if Northern Widget is not willing at this time to do any more trouble shooting with me, so this may be the end of the line with the sensor. It’s just to bad, since I was ready to deploy these and the MayFly is working great with the barometric sensor I was deploying as well.

                                                                    Thank you for all the help and I’ll let you know what happens on this.

                                                                    • #14765
                                                                      Sara Damiano
                                                                      Moderator

                                                                        Does it output good value*S* or one single good value over and over?  If the former, then..I just don’t know how to read this firmware.  If the latter, then, no that’s what I expect.

                                                                        3m is beyond the maximum expected transmission length for I2C, so, no, it’s not at all strange that it wouldn’t work over that long a distance.  If you need that distance, you need to use RS485 or some other protocol.  I2C is only really intended to work across very short distances.  The limitation is based on the voltage ranges and the amount of signal loss over real wires.  You might get lucky with some cables and configurations, but you shouldn’t expect it.  RS485 can travel much farther because the voltage differences between the wires is much larger.

                                                                    • #14766
                                                                      Tom Schanandore
                                                                      Participant

                                                                        They are good values and slightly vary. I have verified the output with the MPL115A2 sensor that I have and the values are the same.

                                                                        They said that the 3m cable works great with their data loggers on I2C protocol, but yes it would make sense to use an RS485 to just be sure that the signal won’t be lost over the length.

                                                                      • #14768
                                                                        Sara Damiano
                                                                        Moderator

                                                                          What code are you running to get the values?  The results you shared with me based on the code I gave you didn’t have any good values at all.  I thought you didn’t have any working code for communication.

                                                                        • #14769
                                                                          Tom Schanandore
                                                                          Participant

                                                                             

                                                                             

                                                                          • #14770
                                                                            Tom Schanandore
                                                                            Participant

                                                                              The previous is the code that they gave me to begin with. It does work when directly connected to the MayFly and Arduino Uno. IT does also work on the Arduino Uno (5v) when using the 3m cable.

                                                                            • #14772
                                                                              Sara Damiano
                                                                              Moderator

                                                                                You had a working library and code this whole time.

                                                                                ?!?

                                                                                Well I feel really, really stupid.

                                                                              • #14773
                                                                                Tom Schanandore
                                                                                Participant

                                                                                  I apologize for not saying that from the get go. My knowledge with all of this is rather limited, to be honest. I thought you were just trying to talk between the Sensor and the MayFly. The current library that I am using is on GitHub at <https://github.com/NorthernWidget-Skunkworks/Walrus_Library&gt;

                                                                                   

                                                                                • #14774
                                                                                  Sara Damiano
                                                                                  Moderator

                                                                                    <!–more–>Yeah, so 99.99% of what I’ve said on this thread can be completely disregarded. Obviously the sensor and firmware work just fine and there never was any problem with them.  The biggest problem was my understanding of the problem.

                                                                                    If everything is perfect except the 3m cable, then it’s just the 3m length that is the problem. It’s apparently too far for I2C at 3.3V.  Signal doesn’t travel forever over real wires. Larger voltage differences can help signals to travel farther. An Uno or other 5V Arduino has an extra 1.7V range the Mayfly doesn’t have. The operating voltage of the Mayfly cannot be changed.

                                                                                  • #14775
                                                                                    Tom Schanandore
                                                                                    Participant

                                                                                      So I think that I’m out of luck on this sensor, based upon what you just said. I’ll have to abandon this sensor.

                                                                                      thank you for all your help and sorry again for the miscommunication.

                                                                                  Viewing 38 reply threads
                                                                                  • You must be logged in to reply to this topic.