7 Replies Latest reply on Feb 10, 2016 2:49 PM by PabloM_Intel

    Intel Edison crashing and reboot while using mraa library with node.js

    NishankSingla

      Initially I used mraa with python to run one servo motor, It worked fine.

      But, when I tried to run 2 servo's, (one for horizontal motion and one for vertical motion) Intel Edison gets crashed and goes into reboot and this thing keeps happening whenever I run the program.

       

      Then I used mraa library with Node server, one servo works fine for few minutes and after that it got burnt(never happend this with Arduino Code and python code).

      Then I connected another servo and run the node program, as soon as I run the program Edison crashed and goes to reboot. Now I am unable to control servo using Node and mraa.

       

      Can anyone help me with this issue ?

      Why Edison is crashing?

        • 1. Re: Intel Edison crashing and reboot while using mraa library with node.js
          PabloM_Intel

          Hi NishankSingla,

           

          Which Edison Platform are you using to do this? The Arduino Expansion board or the Mini-breakout board? In case you’re using the Mini-breakout board, how are you powering the board? If you’re not using an external supply it’s possible that there’s not enough current to provide to all the circuit. Share some details on how you’re supplying your board.

          However, we would still like to see your code. Just to check that there’s nothing wrong.

          Which image are you using?

           

          Regards,

          Pablo

          • 2. Re: Intel Edison crashing and reboot while using mraa library with node.js
            NishankSingla

            Hi Pablo

            I am using Arduino Break out board with external power source(AC to DC power adapter 12V 2A). Edison is flashed with latest Yocto Image.

            Main code is

            var cv = require('opencv');

            var mraa = require("mraa");

            var pwm = new mraa.Pwm(6);

            pwm.enable(true);

             

             

            pwm.period_us(2000);

            var value = 0.8;

            pwm.write(value);

             

             

            // camera properties

            var camWidth = 320;

            var camHeight = 240;

            var camFps = 30;

            var camInterval = 1000 / camFps;

             

            var camera = new cv.VideoCapture(0);

             

            camera.setWidth(camWidth);

            camera.setHeight(camHeight);

             

             

            module.exports = function (socket) {

              socket.emit('onConnection', "You are successfuly connected to server");

             

              setInterval(function () {

                camera.read(function (err, im) {

                  if (err) throw err;

                    socket.emit('frame', { buffer: im.toBuffer() });

                  });

              }, camInterval);

             

              socket.on('sliderVal', function (rangevalue) {

                console.log("Value: "+rangevalue);

                rangevalue = parseFloat(rangevalue);

                pwm.write(rangevalue);

              })

            };

            In this program, Camera will be mounted on the servo and there is a slider bar(range 0.0 - 1.0 step 0.05) in index.html page along with the video stream embedded in it using HTML5 canvas. With the change in slider value servo motor should move so that I can see the video of whole area

             

            and also there is one more program to sweep 2 servo's, one for horizontal motion and one for vertical motion

            var mraa = require("mraa");

            var servo1 = new mraa.Pwm(6);

            var servo2 = new mraa.Pwm(9);

            servo1.enable(true);

            servo1.period_us(2000);

            servo1.write(0.0);

             

            servo2.enable(true);

            servo2.period_us(2000);

            servo2.write(0.0);

            var value1=0.0;

            while(value1<=1){

                 servo1.write(value1);

                 value1= value1 + 0.05;

            }

            while(value2<=1){

                 servo2.write(value2);

                 value2= value2 + 0.05;

            }

            • 3. Re: Intel Edison crashing and reboot while using mraa library with node.js
              PabloM_Intel

              Hi NishankSingla,

               

              I apologize for the late reply. The code seems to be fine. Have you tried running it without connecting the servos? Even if you’re using an external power supply I still believe that the power might be the issue. Have you read this thread before, https://communities.intel.com/thread/58816? The user had a similar problem. I would suggest you to try running the script without any servos, that way you’ll determine if the servos consumption is causing the issue.

               

              Regards,

              PabloM_Intel

              • 4. Re: Intel Edison crashing and reboot while using mraa library with node.js
                NishankSingla

                Without servo, it is working. Also I changed the pin of the servo and it works.

                I guess there is some problem with Arduino Breakout Board.

                The Board already has burnt my one servo with the same program and It starts working for other servo when I changed the pin on board.

                Same kind of thing happened with me before. My 2 servos were connected to Pin 9 and 10 and I was running program using arduino IDE and both servos didn't work.

                Then I changed the pin number of one of the servo to 6 and both servo start working.

                Definitely there's problem with arduino board.

                • 5. Re: Intel Edison crashing and reboot while using mraa library with node.js
                  PabloM_Intel

                  Hi NishankSingla,

                   

                  You shouldn’t be getting this behavior, however, it’s possible that it has something to do with the GPIO configuration at boot. As you can see in this post https://communities.intel.com/thread/76935, the GPIO pins of the Edison board sometimes have different states whiles Linux boots, which can produce abnormal behavior on the circuitry. This might not be the case though.

                   

                  Regards,

                  Pablo

                  • 6. Re: Intel Edison crashing and reboot while using mraa library with node.js
                    NishankSingla

                    Thank for the information Pablo.
                    Really appreciate it

                     

                    I am thinking of changing the Operating system of Edison to Ubilinux in hopes of getting better performance.
                    Edison board is good in respect to small size, built in Bluetooth and Wifi Module but it does lag in providing good performance.

                    Pablo, have u tried to run 2 servo's with the NodeJS code.

                    Also, can we create a wifi hotspot in edison, so that I can connect a device to it like laptop or mobile and then I run a local Node server in Edison, I was able to open the webpage in connected device.

                    Basically I want to send instructions to Edison wirelessly with long range from laptop and mobile without any external wifi network

                    • 7. Re: Intel Edison crashing and reboot while using mraa library with node.js
                      PabloM_Intel

                      Hi NishankSingla,

                       

                      To improve the performance of the Edison module, you could build your own image so that it only makes use of the necessary modules for your project. This is just a thought, though, you can always test with different operating systems for your Edison board.

                      Regarding your question about the servos, I’ve only worked with one servo and had no trouble.

                      Here are the instructions to turn your Edison into an Access Point (AP), https://software.intel.com/en-us/getting-started-with-ap-mode-for-intel-edison-board. There are no exact instructions to create a WiFi hotspot, however, you can check this thread to get some ideas https://communities.intel.com/thread/97401.

                       

                      Regards,

                      Pablo