This is a project based on chilean renam project for get data from any location with a group of sensors , store and analyze in a remote server , based on Arduino, python, Mysql and php. if you need the source code, please send me an email, I'll share without any problem.
2. Problem
Create a cheap Hw and software tool for remote capture sensor data:
•Temperature
•Co2
•Humidity
•Noise
This tool should be autonomous and with low maintenance, and shoud be working with a
battery for a long time.
Plataform:
Capture data incoming from arduino clients.
Scalable for big data.
Full redundancy.
8. Part of arduino code
// Enter power down state for 8 s with ADC and BOD module disabled
LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
// Do something here
// Example: Read sensor, data logging, data transmission.
sensors.requestTemperatures(); //Prepara el sensor para la lectura
// Serial.print(sensors.getTempCByIndex(0)); //Se lee e imprime la temperatura en grados Centigrados
// Serial.println(" Grados Centigrados");
int temp = int(sensors.getTempCByIndex(0));
itoa(temp,string2,10);
if (millis() > timer) {
timer = millis() + 5000;
//static void sendUdp (char *data,uint8_t len,uint16_t sport, uint8_t *dip, uint16_t dport);
ether.sendUdp((char*)string2, string2 len, srcPort, destip, dstPort );
Serial.println("DATA send by UDP!");
Serial.println(temp);
9. Server python code
#now keep talking with the client
while 1:
# receive data from client (data, addr)
d = s.recvfrom(1024)
data = d[0]
addr = d[1]
print 'IP address %s' % addr[0]
print 'port %s'% str(addr[1])
print 'Message %s'% data
deviceid = data[0:6]
temp = data[12:14]
C02 = data[21:23]
#C02 = '12345'
print 'DeviceID %s'% deviceid
print 'Temperture %s'% temp
print 'C02 %s'% C02
insert = connection.insert_data(deviceid,temp,C02)
if not data:
break
reply = 'OK...' + data
print
s.sendto(reply , addr)
print 'Message[' + addr[0] + ':' + str(addr[1]) + '] - ' + data.strip()
s.close()
10. Next steps:
Remote Sensor:
•Change ethernet card for gsm card.
•Insert arduino sleep library for save battery.
•Store data in sd card if some network issue appears.
•Send keep alive each 10 minutes.
Server:
•Ingress a load balancer.
•Change mysql and python script for kibana software for full redundancy and faster
socket listener and store .
•Make a stress test for measure the HW needed.
11. Contact:
• Joel Urtubia Ugarte.
• Electronic Engineer
• Expert on IPTV.
• Certificated on MongoDB.
• Mail: joelurtubiaugarte@gmail.com