Monday, October 10, 2011

Machine To Machine (M2M) Communication with Nimbits in the Cloud

You can use Nimbits to do much more than record sensor readings to the cloud. You can create a data point and store a history of data objects in them in any format that can be serialized into a string i.e JSON or XML.  A Nimbits data point can be used to relay data between software systems, or hardware devices such as arduino, using the cloud as a back end.

You can create streams of data objects, and store them in a data point series. The data can then be accessed from anywhere, and used to shape the behavior of connected devices and software.

In other words, you can serialize a class containing any sort of data, feed it into a data point on the cloud, and then read that data from anywhere to drive software systems, or devices connected to Nimbits data points.

This tutorial shows you how I use the Nimbits SDK to relay the tell a robot how to feel. Take, for example this class called Robot - it contains three emotional states, happy, sad and angry.

public class Robot {
    Emotion emotion;

    enum Emotion {
        happy,sad,angry
    }
    
    public Robot() { //don't forget a no arg constructor
    }
    
    public Emotion getEmotion() {
        return emotion;
    }

    public void setEmotion(Emotion emotion) {
        this.emotion = emotion;
    }  
}


I have a data point on Nimbits call MyRobot. I want to transmit an emotional state to the robot, as well as GPS Coordinates of where it is, a number value ranking the level of that state, and an instance of the class above:

public void sendData() throws Exception {
 Robot robot = new Robot();
 robot.setEmotion(Robot.Emotion.happy);
 Value value = ValueModelFactory
    .createValueModel(40.111, -75.146,10, 
    "I'm a happy robot", robot);

 client.recordValue(pointName, value);
}



Let's imagine somewhere else in the world, the robot is connected to the internet and is monitoring this data point on Nimbits. It can get the latest value being sent to it, recieving the robot class and the emotion being sent to it:

public void getData()  {
  
 Robot robot = (Robot) client.getCurrentDataObject(pointName, Robot.class);
 if (robot.getEmotion() == Robot.Emotion.angry) {
   destroyAllHumans();
 }
 else {
   eatHerringSandwiches();
 }


Our Robot downloads the current emotional state from the cloud and carries out it's instructions. In this case, the robot is happy so the human race is lucky.

What's happened here is this:

  • The data was recorded to the cloud
  • All of the things Nimbits does when it gets a new value in a Point is available, such as alerts, compression, calculations and so on. 
  • The stored value is instantly accessible from anywhere
  • The current value can be tied into other systems to trigger behavior.
Learn more at nimbits.com 




2 comments:

  1. Thanks for this blog!!
    your blog is very informative.
    Machine to machine SIM

    ReplyDelete
  2. You can also request to receive an email from the CRM server when processing is complete. This option is available if the user account you use has an email address saved in the user profile CRM.
    Email Marketing Program

    ReplyDelete