6 Replies Latest reply on Mar 20, 2015 3:24 PM by ForumMigrationAdmin

    Connecting Beaglebone Black

    ForumMigrationAdmin

      I am having some issues trying to connect my Beaglebone Black to the enableiot.com site. Specifically, it is hanging for the status response from the server when you are registering the device. (STATUS: /server/registration_status)

       

      My current setup is the BBB rev A5C powered by usb cable, and also connected to a computer. Running the os it came with (Angstrom). Ethernet connected to a router, and yes it is able to ping google.com.

       

      Here is what I did to get to the point where agent.js can be started:

       

      ---

       

       

      > cd iotkit

      > ./setup-agent.sh

       

      problem:

      ./setup-agent.sh: line 33: sudo: command not found

       

      replace:

      # if not root, try to use sudo

      if ;

      then

           SUDO=""

      else

           SUDO="sudo"

      fi

       

      with:

      SUDO=""

       

       

      should see:

      npm downloading lots of things

      finally- done

       

       

      > node agent

      2014-03-19T17:05:37.252Z - info: IoT Kit Cloud Agent:  C8-A0-30-AC-DE-FE

      2014-03-19T17:05:37.787Z - info: Cloud client created

      Segmentation fault

       

       

      will find the segfault cause a little later

      copy the cloud agent number

      add it to devices on enableiot.com

       

       

      > shutdown -h now

       

       

      power on the BBB & wait for it to come up

       

       

      > cd iotkit

      > node agent

       

       

      problem:

      seg fault!

       

       

      problem line in agent.js:

      cloud.reg(sensorsList);

       

       

      problem line in lib/cloud.js:

      var doc = msg.getRegMsg(me.deviceId, undefined, undefined, me.sensorsList);

       

       

      right before var msg in lib/cloud-message.js add:

      me.logger.info("hey");

       

       

      run node agent again

       

       

      problem:

      error: UncaughtException: Cannot call method 'info' of undefined

       

       

      add right under var os:

      logger = require('./logger').init();

       

       

      remove the me. infront of logger

       

       

      one of the variables in msg probably doesn’t exist on the BBB, we have to find it.

       

       

      change:

             "hardware_vendor": os.cpus()[0].model,

             "hardware_model": os.platform(),

             "Model Name": os.arch(),

             "Firmware Version": os.release()

       

       

      to:

             "hardware_vendor": "ARM",

             "hardware_model": "Angstrom",

             "Model Name": "Beaglebone Black",

             "Firmware Version": "Rev A5C"

       

       

      > node agent

       

       

      long wait for status /server/registration_status

       

       

      ---

       

      And so this is where it is stuck. It's so close to working though, hopefully.

       

       

       

       

      Any ideas as to why the status is not being received?

        • 1. Re: Connecting Beaglebone Black
          ForumMigrationAdmin

          Quote:


          RobotGrrl wrote:

           

          change:

                "hardware_vendor": os.cpus()[0].model,
                 "hardware_model": os.platform(),
                 "Model Name": os.arch(),
                 "Firmware Version": os.release()

          to:
                 "hardware_vendor": "ARM",
                 "hardware_model": "Angstrom",
                 "Model Name": "Beaglebone Black",
                 "Firmware Version": "Rev A5C"

           

          Thanks for using the iotkit-agent!

           

          The fact you have to do this is not normal. What version of node are you running? On Galileo we're using node 0.10.22, versions after that should work ok too. What's the output of forever.log? Also please use the code tags, makes it much easier to read

          • 2. Re: Connecting Beaglebone Black
            ForumMigrationAdmin

            Node version was 0.8.22. Updated to 0.10.26.

             

            Yes! Now the os variables work!

             

            Running agent again, the device registration was successful. Sending data upstream successfully now

             

            Thanks for the help Brendan.

            • 3. Re: Connecting Beaglebone Black
              ForumMigrationAdmin

              I am trying to get my Galileo to register with the cloud. I upgraded my node on Galileo to 0.10.22 and I am able to fire up agent.js etc. I followed the steps to get the mac addr and registered a device in my enableiot account - All good.

               

              When I reboot galileo, everything fires up fine, but what is happening is that the Status returned for my device is "FALSE".  to be clear, here is the snippet of code from cloud.js:

               

              me.client

               

                  .subscribe(me.topics.status)

               

                  .on('message', function(topic, message) {

               

                    me.logger.info('STATUS: %s', topic, message);

               

                    var regStatus = JSON.parse(message);

               

                    // Check registration status is true and device_id is ours

               

               

               

              if(regStatus !== undefined &&

               

                     regStatus.response !== undefined &&

               

                 regStatus.response.status &&

               

                       regStatus.response.device_id == me.deviceId){

               

              ...

               

              ...

               

               

               

              I am getting the response.status as FALSE. The accountid being returned for my galileo board's mac addr is correct, so it looks like it is looking it up correctly in the cloud, but the status returned is false. What could be the problem ?. Any ideas on how I could proceed ?. Thank

              • 4. Re: Connecting Beaglebone Black
                ForumMigrationAdmin

                Here is some more information on my registration message: I dumped out what was being sent and here it is:

                 

                {"protocol_version":"1.0","timestamp":1398128594081,"sender_id":"98-4F-EE-00-0F-A2","msg_type":"device_registration_msg","properties":{"hardware_vendor":"Intel(R) Quark SoC X1000 CPU @ 339MHz","hardware_model":"linux","Model Name":"ia32","Firmware Version":"3.8.7-yocto-standard"},"peripherals":[{"uuid":"self","type":"gateway","properties":{},"services":[{"name":"98-4F-EE-00-0F-A2-sensor","version":"1.0"}]}],"service_metadata":[{"loaded":true,"capabilities":[],"enabled":true,"name":"98-4F-EE-00-0F-A2-sensor","version":"1.0","metrics":[]}]}

                 

                Note, I hardcoded the "hardware_vendor" string, since os.cpus[0].model is returning "05/09" in my Galileo. See below, when I simply run node from the shell in Galileo:

                 

                > require('os');

                { endianness: [Function],

                  hostname: [Function],

                  loadavg: [Function],

                  uptime: [Function],

                  freemem: [Function],

                  totalmem: [Function],

                  cpus: [Function],

                  type: [Function],

                  release: [Function],

                  networkInterfaces: [Function],

                  arch: [Function],

                  platform: [Function],

                  tmpdir: [Function],

                  tmpDir: [Function],

                  getNetworkInterfaces: [Function: deprecated],

                  EOL: '\n' }

                > os.cpus()

                [ { model: '05/09',

                    speed: 399,

                    times:

                     { user: 457098100,

                       nice: 0,

                       sys: 371869100,

                       idle: 355100,

                       irq: 0 } } ]

                >

                • 5. Re: Connecting Beaglebone Black
                  ForumMigrationAdmin

                  sorry, not completely clear to me: to which cloud do you aim to connect?

                   

                  BTW: pls post codes in code blocks [see description below comment box]

                   

                  e.g. "\[bash\] / \[/bash\]" for bash

                   

                  example - bash "dice game":

                   

                       echo "dice - quit (q)"; while true; do echo $((RANDOM % 6 + 1)); read -t 2 -n 1 -s q; if [ [ $q == "q" ] ] ; then break; fi; done