8 Replies Latest reply on Jun 9, 2016 1:30 PM by Intel Corporation

    stepper library not Edison compatible ?

    bennnn

      Hi,

       

      I am trying to run a stepper.h arduino library based sketch that compiles / runs well on arduino R3.

       

      I can use any pins for the controller. Its not a shield.

       

      I have Edison set to default PWM jumpers. Swizzling jumpers ? strange name

       

      I have stepper library pins like this,

       

      Stepper myStepper(stepsPerRevolution, 3, 5, 6, 9);

       

      I have this in void setup()

       

      setPwmSwizzler(3,5,6,9);

       

      Nothing,

       

      I'm new to edison and this is my first try at running a sketch appart from blink which upploads and works.

       

      I'm using the stepper.h arduino library.

       

      Is there something i'm missing here? or am i beter off sticking with arduino R3 !

      Is the Edison half Uno R3 compatible ?

       

      ben

        • 1. Re: stepper library not Edison compatible ?
          Intel Corporation
          This message was posted on behalf of Intel Corporation

          Hi bennnn,

          I've tested the Stepper.h library (the example stepper_oneRevolution) and it didn't work on Edison. I tested the same example with an Arduino UNO and it worked. It seems that the Stepper.h library is not compatible with Edison.

          If you want to use a stepper motor I recommend you to check the following document, it's a shield testing report. You will find a test report using a motor shield that you could try to use in order to attach the stepper motor: https://downloadcenter.intel.com/download/24342/Intel-Edison-Galileo-Galileo-Gen-2-Shield-Testing-Report

          I hope you find it useful.

          Regards,
          Diego

          • 2. Re: stepper library not Edison compatible ?
            bennnn

            Hi, thank you for the link to the arduino shields document.

             

            I tried example 1 ( no library )  with the PWM jumpers as in example.

             

            Arduino* Motor Shield R31

             

            Nothing.. I have PUL+ PUL- DIR+ DUR- on the controller so this should work ?

             

            I have used pin 3 & 11 for PUL +- and pins 5 & 10 for DIR+ DUR-

             

            Is there a library I should try ? maybe the Adafruit one ?

             

            Thanks, Ben

             

             

             

             

             

            • 3. Re: stepper library not Edison compatible ?
              Intel Corporation
              This message was posted on behalf of Intel Corporation

              Hi bennnn,

              I don't have the Arduino Motor Shield to test it, so I'm not sure why it is giving you issues. I checked the test report of this shield and there is an important note for Edison that states you should cut the "Vin Connect" jumper if an external power supply is used. Did you check this note? Additionally, the example code provided is for a DC motor, not for a stepper motor.

              I'm not aware of any library you could use for stepper motors. In the Shield Testing Report, there is a test report of the Adafruit Motor Shield. You could give it a try to see if you get better results. This test uses a library from Adafruit and there is a code example for a stepper motor.

              Regards,
              Diego

              • 4. Re: stepper library not Edison compatible ?
                bennnn

                Hi Diago, I am not using a shield so there is no Vin Connect to set. I am using edison, no Vin jumper as on Galalao.

                 

                Yes sorry your correct, that example is for DC motor running with PWM.

                 

                I tried AccelStepper: AccelStepper library for Arduino  which allows me to selct Edison default PWM pins 3,5,6,9. I have the edison PWM jumpers in the default position.

                I run very simple forward demo as in this code.

                 

                #include <AccelStepper.h>

                 

                AccelStepper stepper(AccelStepper::FULL4WIRE, 3, 5, 6, 9); // Defaults to AccelStepper::FULL4WIRE (4 pins) on 2, 3, 4, 5

                 

                void setup()

                   stepper.setMaxSpeed(1000);

                   stepper.setSpeed(50);   

                }

                 

                void loop()

                   stepper.runSpeed();

                }

                 

                 

                Nothing.

                 

                I guess I'll have to hook up my edison to the scope and see what is actually comming out of those pins.

                 

                Will upload this now on both arduino uno and due and confirm this works.

                 

                ben

                • 5. Re: stepper library not Edison compatible ?
                  bennnn

                  above example working on arduino Uno / Due.

                   

                  Should I be using differnt pins in the library ?

                   

                  Cant see why this library would not work with Edison ?

                  • 6. Re: stepper library not Edison compatible ?
                    Intel Corporation
                    This message was posted on behalf of Intel Corporation

                    Hi bennnn,

                    There are Arduino libraries that don't work on Edison because there are architecture differences between the platforms. You cannot expect to take an Arduino library that works on Arduino UNO and use it with Edison in the same way. You will get compilation errors or behaviors that aren't expected like in this case.

                    Some time ago, another user tried to use this library (AccelStepper) with Galileo and it didn't work because it wasn't compatible with the Galileo architecture, you can check the following thread for additional information: https://communities.intel.com/message/336931#336931. I'd say the same thing is happening here with the Edison module.

                    You don't need to use the PWM for the stepper motors, and I don't think that changing the pins will have any effect. I'd say the library is not supported by Edison and that's why you are not getting the same behavior as with the Arduino UNO. What you can try to do is to check if there is actually any activity in the pins you are using.

                    I don't have a stepper motor to test it, but I tested the Stepper.h library which is the one used in the Arduino examples available in the IDE, and I didn't get any activity in the pins used.  That's why I recommended you to check the Shield Testing Report because there is a test with a stepper motor, but the stepper was attached to a shield, and the shield was the one controlled by the Edison board through I2C.

                    Regards,
                    Diego

                    • 7. Re: stepper library not Edison compatible ?
                      bennnn

                      Hi Diago,

                       

                      Thanks for your reply,

                       

                      It seams the Stepper Libraries are dependent on the clock speed / architecture of the individual MC.

                      I had originaly thought this was not relevent since the AccelStepper works on both Arduino Uno and Due. AVR and ARM !!

                       

                      I can see I will have to get a SPI or I2C compatible Stepper motor controller and asociated library such as the adafruit to use steppers with Edison until Intel write

                      a stepper controller library for arduino.. Is there a list of arduino librarys that do work for Edison anywhere?

                       

                      I think I'm maybe better off just coding the edison from the Intel XDK. Are there working libraries for I2C and SPI for intel XDK like wire.h and SPI.h in arduino  ?

                      If there are , are they included by default in the Yokto linux disto ?

                       

                      Can you recomend a good tutorial for SPI & I2C use with edison / intel IOT XDK

                       

                      If I2C SPI libs are not included , do I have to re-build the Yokto distro to include them as for instance you need to for usb audio support in alsa?

                       

                      Thanks

                       

                      ben

                      • 8. Re: stepper library not Edison compatible ?
                        Intel Corporation
                        This message was posted on behalf of Intel Corporation

                        Hi bennnn,

                        Unfortunately, there isn't a list of Arduino libraries compatible with Edison. As you may know, there are a lot of libraries and shields for Arduino and it's not possible to test every one. The Shield Testing Report I mentioned above is a document that will help you to know which libraries and shields have been tested with Edison. 

                        Regarding the I2C and SPI question, you can use the MRAA library for this purpose. The MRAA library will help you to manage the Edison's IO, including SPI and I2C interfaces. You can find additional information about this library in the following site: https://github.com/intel-iot-devkit/mraa. The use of this library is already included in the Yocto image, but you might need to update the library version. Anyhow, the instructions about how to use the library are detailed in the link above.

                        I also recommend you to check the getting started guide of the XDK in the following site: https://software.intel.com/en-us/getting-started-with-the-intel-xdk-iot-edition. You will also find useful examples there.

                        Regards,
                        Diego