Announcement

Collapse
No announcement yet.

Rocker no longer functions when adding a temp senser.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Rocker no longer functions when adding a temp senser.

    Hello,

    I made a custom rocker switch which I verified by toggling the LED on the Arduino LED on pin 13, which worked fine. I then added a Dallas serial temperature sensor on pin 2 and once I did that I lost the rocker switch control to the LED. Both work fine when they are in separate sketches but once they are together the rocker switch stops turning on the LED however the temp sensor still seems to work fine changing the temp on the LCD thermometer display. If I remove the temp sensor (with the Arduino un-powered and then powered back up) the rocker switch works again. If I remove the temp sensor when the Arduino is hot it does not change the functionality, I need to power down the Arduino. It seems like I am having some sort of contention.

    Have you seen this before?

    Thanks,
    -Erik

  • #2


    Hi Erik

    Personally I haven't seen this issue, no.
    But it may come down to your code...
    Can you post your Arduino code so we can take a look.

    Regards
    James

    Comment


    • #3


      Sure. Thanks for taking a look. pond_control_test.zip is the arduino code and test.zip is the Genie code. There seems to be some interference between the handler and the temp code, if I comment out the temp function the rocker works.

      -Erik

      Comment


      • #4


        Hi Erik

        hmm.
        You are writing a float in your temp function, to the display, which typically only takes an int.
        If you try putting in a dummy int variable in your temp function and send that dummy variable to the display, does it work correctly?

        If that does work, just reformat the float into an int and then send that, and see if that works better.

        Regards
        James

        Comment


        • #5


          Hello James,

          I tired replacing the float with int but I am still having the same problem, however if I comment out the request temperature (sensors.requestTemperatures()) the rocker switch works fine. If I just comment out the genieWriteObject(GENIE_OBJ_THERMOMETER, 0x00, tempoff); it works too but the response time from the toggle of the rocker switch to the LED is much slower.

          Sorry forgot to try the dummy int value... let me give that a shot.

          No the dummy int did not make a difference it really seems like there is some contention issue with the sensor temp request.

          Thanks for the help.

          -Erik

          Comment


          • #6


            Hi Erik

            Ok let me know how that goes.

            Regards
            James

            Comment


            • #7


              Hi James,

              Sorry that post was a bit confusing since I edited it a few times but in the end the dummy int did not make a difference it seems like it is linked to some contention between the 32PTU and the temp request (sensors.requestTemperatures()) function form the Dallas library. I am drawing a blank as to what to try next.

              Thanks,
              -Erik

              Comment


              • #8


                What Arduino are you using?
                What version of the IDE are you using?
                What version of the genieArduino library are you using?

                At this stage I also am not sure. I will be able to test this early next week as I am not in the office currently, but I dont see how it could be an issue to be honest as I have seen this working with 1 wire sensors before.

                There is for example this post on the Arduino website, http://forum.arduino.cc/index.php?PHPSESSID=87svuiieotjva5e7v9t4vlblv4&topic=213712.msg1576385#msg1576385 which would suggest it is also OK, the person having problems doesnt appear to have responded to this guy. Might be worth asking on the Arduino forum too.

                Our library only uses the serial port, and I am not aware of any conflicts.
                If you can wait until early next week, I can test this with a 1 wire sensor I have and make sure all is OK.

                Regards
                James

                Comment


                • #9


                  Hello James,

                  What Arduino are you using? Mega 2560
                  What version of the IDE are you using? 1.0.5
                  What version of the genieArduino library are you using? From genieArduino.h: #define GENIE_VERSION "GenieArduino 09-Jan-2014"

                  Yes I had read that Arduino post but it did not fit too well since I have no issues reading the temp sensor and displaying it on the Picasso, my problem is that I am losing functionality of the rocker switch when the temp sensor code is active. So even thought the rocker switch does not seem to work the temp gauges continues to work fine, the temp sensor is not affected if there is contention.

                  If you could verify it on your side it would be greatly appreciated. I too agree this should have been found by now I am just at a loss as to how to debug this since the only device that I can display the issue with is the Picasso, so I was looking for some expertise that could help me narrow down the search. Like can I verify that the rocker switch code is sending the toggle request to the Arduino and that possibly the Arduino is ignoring it, or the like?

                  Thanks James,
                  -Erik

                  Comment


                  • #10


                    Hi Erik

                    You could try the latest version of the library and see if that helps, 31 Jan 2014.
                    https://github.com/4dsystems/ViSi-Genie-Arduino-Library

                    Other than that, I can have a look on Monday.

                    If you plug your display into your computer and use the GTX tool which is in the Tools menu when you have your ViSi-Genie project open, you can query the rocker switch and touch the rocker switch and see the comms etc.

                    Regards
                    James

                    Comment


                    • #11


                      Hi James,

                      I will try the new library.

                      Yes I have tested it in the GTX environment and I know it works there I was more looking for something that I could use to view it in the failing case, that is when it is connected to the Arduino. I guess I could use a logic analyzer and monitor the TX signal for the passing data.

                      Thanks for taking a look on Monday.

                      -Erik

                      Comment


                      • #12


                        Hi Erik

                        That test code you sent for Genie in WS4, is the rocker you are talking about on Form0?

                        You need to ZIP the project from the File menu, you just saved the visi-genie file, so your custom rocker wasn't available for me.
                        It was substituted automatically by WS4, but is now a 4DButton rather than a Rocker.
                        Just making sure it is actually a Rocker for you, or if its a 4DButton, as that requires a different object type to do the genieWriteObject to.
                        James

                        Comment


                        • #13


                          Hi again Erik

                          I did some testing and have it working here.

                          Few things.
                          Your thermometer0 you had scaled as 50 to 90, and you were writing tempoff to it, which is the degrees F reading - 70. Not 100% sure what this is, but for me it was never in range and the thermometer had a X through it.
                          Yours may be fine, but you should constrain the output so the value being written to the Display is always what it expects. in this case, a value from 50 to 90.

                          I changed the gettemp() function so it had this at the bottom
                          HTML Code:
                          int tempDec = constrain(tempc, 0, 90);
                          genieWriteObject(GENIE_OBJ_THERMOMETER, 0x00, tempDec);
                          
                          So it was displaying the tempc instead and constrained it between 0 and 90 degrees. I then edited the WS4 app so the scale was 0 to 90 also.
                          
                          You were also running gettemp() every loop, which I think is the main issue and what was stopping your code from working.
                          I put that in another non blocking delayed if statement, and away it went.
                          
                          void loop() 
                          {
                            // Do this without a delay() function, therefore not blocking
                            if (millis() >= waitPeriod) 
                            {
                              // Read from the Rocker Switch  every 100ms
                              // The results of this genieReadObject call will be available to myGenieEventHandler() after the display has responded
                              // Do a manual read from the Rockerswitch object
                              genieReadObject(GENIE_OBJ_4DBUTTON, 0x00);
                          
                              waitPeriod = millis() + 100;
                            }
                            
                            if (millis() >= waitPeriod1) 
                            {
                              gettemp();  
                              waitPeriod1 = millis() + 500;
                            }
                            
                            genieDoEvents(); 
                          }
                          So yes, confirmed there is no conflict. Seems you were just overloading the Arduino by getting it to try and read the temperature every single loop.

                          Regards
                          James

                          Comment


                          • #14


                            Thanks James,

                            Yes I just noticed today at work that I was beating up the temp request and was going to try and move it to a wait routine. Did you see the same loss of the rocker switch before you delayed the temp function? Yes I figured the temp function was incorrect and I was going to fix it as soon as I resolved the rocker switch issue interesting though I did not get the red box the scale changed when I put my fingers on the sensor. As soon as I get home I will try your changes, thanks again for taking a look it is greatly appreciated.

                            -Erik

                            Comment


                            • #15


                              Hello James,

                              That worked, thanks again.

                              -Erik

                              Comment

                              Working...
                              X