Integrating IoT and Sensor Tags

0 votes

I am trying build a IoT small application, using IBM Bluemix platform. I found a video of Ryan J Baxter's on connecting a Sensor Tag to the IoT Cloud Foundation with a Beagle-bone. Now I'm trying the same procedure with a Raspberry Pi device instead of a Beagle-Bone, facing some issues with the sensor-tag.js file we are not able to get the cfg parameter values like cfg type, cfg org, cfg id from config.properties file.

I got the mac address which I gave when I'm registering the device I gave my Raspberry Pi mac address as it is connected to my Ethernet eth0.

    if(cfg.id != deviceId) {
        console.warn('The device MAC address does not match the ID in the configuration file.');
    }
    //------------- This is where I'm facing  a problem --------

    var clientId = ['d', cfg.org, cfg.type, cfg.id].join(':');

    var client = mqtt.connect("mqtts://" + cfg.org + 
      '.messaging.internetofthings.ibmcloud.com:8883', 
      {
        "clientId" : clientId,
        "keepalive" : 30,
        "username" : "use-token-auth",
        "password" : cfg['auth-token']
      });
    client.on('connect', function() {
      console.log('MQTT client connected to IBM IoT Cloud.');
    });
    client.on('error', function(err) {
      console.log('client error' + err);
      process.exit(1);
    });
    client.on('close', function() {
      console.log('client closed');
      process.exit(1);
    });
    monitorSensorTag(client);
  });
});

function monitorSensorTag(client) {
  console.log('Make sure the Sensor Tag is on!');
Oct 15, 2018 in IoT (Internet of Things) by Matt
• 2,270 points
572 views

1 answer to this question.

0 votes

If you are using raspberry pi, take a look at the recipe for raspberry pi https://developer.ibm.com/iotfoundation/recipes/raspberry-pi/

There is also source code for raspberry pi on GitHub which may be helpful: https://github.com/ibm-messaging/iot-raspberrypi/

Using the recipe, you store the device info in a device.cfg file and it is used by the IoT service when you connect. /etc/iotsample-raspberrypi/device.cfg

Looking at the logs, I see you registered the Raspberry Pi Device with a different ID than what you are using. Please register the device with the correct ID.

answered Oct 15, 2018 by anonymous2
• 4,280 points

Related Questions In IoT (Internet of Things)

0 votes
1 answer
0 votes
1 answer

integrating CoAP and DTLS

Tested with development version 9184a75a21; $ git clone https://github.com/obgm/libcoap ...READ MORE

answered Sep 5, 2018 in IoT (Internet of Things) by lady technopath

edited Sep 5, 2018 by Vardhan 2,145 views
0 votes
1 answer

Setting-up a RFID RC522 chip in Raspberry Pi?

First, let me congratulate you on buying ...READ MORE

answered Jul 10, 2018 in IoT (Internet of Things) by nirvana
• 3,130 points
1,644 views
0 votes
1 answer

Refactoring multi thread program on raspberry pi with sensors

Before re-engineering your application, you should narrow ...READ MORE

answered Sep 11, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,871 views
0 votes
1 answer

Ti-Sensor tag Kura Example

Problem was with firmware on CC2650 TI ...READ MORE

answered Oct 16, 2018 in IoT (Internet of Things) by anonymous2
• 4,280 points
1,017 views
0 votes
1 answer

Display time in a Windows Core IoT app with a clock!

It is possible, but you should understand ...READ MORE

answered Jul 10, 2018 in IoT (Internet of Things) by nirvana
• 3,130 points
1,541 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP