Libelium CTO, David Gascón, attended as keynote speaker at DevOSS Azure Days, 11 December, 2014, in Madrid, Spain. David's keynote was entitled "Recogida de datos con sensores (HL) a través de Waspmote y conexión con Azure Service Bus".
The complete video here: http://www.libelium.com/david-gascon-libelium-cto-keynote-talk-devoss-azure-days/
For more information about Libelium visit http://www.libelium.com
29. 29
- S.O: Debian + APT management package tools
- Run Time Environments: Java, PHP, Python, C++, Ruby,... [Any]
- 8GB – Compact Flash storage system
- Web Management System + MySQL for Data Storage
- CPU: 500MHz (x86)
- RAM: 256MB
- Power Over Ethernet
- Radio Interfaces:
+ WiFi (2.4GHz / 5GHz)
+ 3G (Quadband)
+ ZigBee / 802.15.4 / Sub GHz bands
+ Bluetooth
Meshlium: Internet of Things Gateway
31. 31
- Frames estructure sent by Waspmote:
ASCII-382540406-trackertest-128-194-,TIME:20141207134218+0100,GPS:41.647240;-
0.905457,SOILT:8.92,TCB:15.90,HUMB:44.6,BAT:0,RSSI:-77,IN_TEMP:17.42
ASCII-382540406-trackertest-128-195-,TIME:20141207134518+0100,GPS:41.647240;-
0.905455,SOILT:9.07,TCB:16.14,HUMB:44.4,BAT:0,RSSI:-71,IN_TEMP:17.65
ASCII-382540406-trackertest-128-196-,TIME:20141207134818+0100,GPS:41.647243;-
0.905450,SOILT:9.23,TCB:16.44,HUMB:44.0,BAT:0,RSSI:-71,IN_TEMP:17.77
Meshlium: Internet of Things Gateway
32. 32
- A Java application reads the Frames coming from the Wireless Interfaces
(ZigBee, WiFi, 3G, 868/900MHz, etc) and parse them. Then they are
inserted in a MySQL DB:
CREATE TABLE IF NOT EXISTS `sensorParser` (
`id` int(11) NOT NULL auto_increment,
`id_wasp` text character set utf8 collate utf8_unicode_ci,
`id_secret` text character set utf8 collate utf8_unicode_ci,
`frame_type` int(11) default NULL,
`frame_number` int(11) default NULL,
`sensor` text character set utf8 collate utf8_unicode_ci,
`value` text character set utf8 collate utf8_unicode_ci,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
...
PRIMARY KEY (`id`)
)
Meshlium: Internet of Things Gateway
33. 33
- Sensor ID's:
ID ASCII ID Fields Type
0 CO 1 float
1 CO2 1 float
2 TMP 1 float
3 HMD 1 float
...
53 GPS 2 float
...
63 ACC 3 int
…
67 MWIFI 1 string
Meshlium: Internet of Things Gateway
34. 34
1º – Get a namespace + credentials (ACS authentication)
2º – Needed to start the program
public static void AzureSetup(){
config = ServiceBusConfiguration.configureWithWrapAuthentication(
AZURE_NAMESPACE,
AZURE_OWNER,
AZURE_KEY,
".servicebus.windows.net",
"-sb.accesscontrol.windows.net/WRAPv0.9");
service = ServiceBusService.create(config);
}
Connecting Meshlium to Azure Bus Service
36. 36
3º – Get from Azure service the queues already created in the
namespace. We store this queues in order to avoid creating an already
existent queue.
public static void AzureGetQueues(){
try {
queue_list_result = service.listQueues();
queue_list = queue_list_result.getItems();
...
}
…
}
Connecting Meshlium to Azure Bus Service
37. 37
4º – Then we read from our internal Data Base (MySQL) the sensor data
bufferized. e.g: 100 registers
SELECT id,id_wasp,id_secret,sensor,value,timestamp,sync FROM LOCAL_TABLE WHERE
sync^SYNC_MASK ORDER BY timestamp DESC LIMIT 100;
Connecting Meshlium to Azure Bus Service
38. 38
5º – Then we create the JSON files with the next format
{
"id_wasp": "SmartWater",
"id_secret": "366360762",
"sensor": "ORP",
"value": "0.380",
"datetime": "02/12/2014T12:18:57+0000"
}
Connecting Meshlium to Azure Bus Service
39. 39
6º – Just send each file to the opened queue
public static int AzureSendToQueue(String queuename, String data) {
try{
appendToLogFile("Sending message to queue: "+queuename, 1, 2);
appendToLogFile("Data: "+ data, 1, 2);
message = new BrokeredMessage(data);
message.setProperty("Queue", queuename);
service.sendQueueMessage(queuename, message);
...
}
catch (ServiceException e){
...
}
}
Connecting Meshlium to Azure Bus Service