Cloud Robotics Hackathon

My 1st Robotics Hackathon!!!

I believe it was the 1st ever Robotics Hackathon. Never heard of Robot Hackathon before!

The Hackathon was organized and lead primarily by the RobotShop to promote the Robot Cloud MyRobots. But in Santa Clara it was hosted by the Robot Launchpad and Citrix Start-up Accelerator. (Thanks Andra and Michael).

Team iRoboticist:  Myself, Jake McMohan, Srihari and Eric

Mission:

Do something with the cloud 😛 … well we started very ambitiously to make a Android voice controlled robot, however, none of us had nay experience in Android Programming.

So we decided to 1st test the connectivity to cloud. (That was prety much all we did throughout the Hackathon)

We were handed a Bluetooth module (not a XBee with ethernet connector 😦 )

So the challenge was to get the bluetooth to communicate serially to PC and them upload the Data to Cloud from PC.

Well when mentioned separately both seemed easy to do, and actually was, the challenge was to connect the data were seeing serially to be uploaded to the cloud.

However, don’t want to get in too much details but here’s the Arduino Code and the Python Code we used.

Arduino Code

/*
iRoboticist Cloud Connect App
Built for DFRobot Rover
*/

#define READ ‘\x00’
#define WRITE ‘\x01’
#define STARTBYTE ‘\x06’
#define STARTBYTE2 ‘\x85’

String apikey = “E2BA76C4019649D5”;
int LightValue = 0;
int TemperatureValue = 0;
int sensor3;
int sensor4;
int sensor5;
int sensor6;
int sensor7;
int sensor8;

int lat = 0;
int lon = 0;
int elev = 0;
int stat = 0;
int packet_size = 44;

void setup() {
Serial.begin(9600);
}

void loop() {
LightValue = analogRead(A0);
TemperatureValue = analogRead(A1);
Serial.write(STARTBYTE);
Serial.write(STARTBYTE2);
Serial.write(packet_size);
Serial.write(WRITE); // Command
Serial.print(apikey);
// Serial.print(“0”); // Trailing 0 for apikey needed to fit 17 byte format
Serial.print(LightValue);
Serial.print(TemperatureValue);
// Serial.print(“000000000000”);
for(int i = 0; i < 22; i++)
{
Serial.print(“0”);
}
/*Serial.print(lat, HEX);
Serial.print(lon, HEX);
Serial.print(elev, HEX);
Serial.print(stat, HEX);*/
delay(100);
}

Python Code: (To get stuff on the cloud)

import httplib, urllib

class Robot:
“””Robot Class defines the parameters of a robot
and MyRobots.com sync function”””
# Latest robot data is stored in parameters dictionary
parameters = {}

def __init__(self, key):
“””Initialises parameters dictionary and sets teh robot key.”””
self.parameters = {‘field1’: 0, ‘field2’: 0, ‘field3’: 0, ‘field4’: 0,
‘field5’: 0, ‘field6’: 0, ‘field7’: 0, ‘field8’: 0,
‘key’:’000000000000000′, ‘status’:’operational’,
‘lat’:0, ‘long’:0, ‘elevation’:0, ‘location’:’RobotLand’}
self.parameters[‘key’] = key

def write(self):
“””Syncs your robot information and prints teh server response.”””
params = urllib.urlencode(self.parameters)
print params
headers = {“Content-type”: “application/x-www-form-urlencoded”,”Accept”: “text/plain”}
print headers
conn = httplib.HTTPConnection(“bots.myrobots.com”)
conn.request(“GET”, “/update?”, params, headers)
response = conn.getresponse()
print response.status, response.reason
data = response.read()
conn.close()

Advertisements
%d bloggers like this: