Skip to content

SENSOR SERVER Wiki

pbecchi edited this page Jan 27, 2017 · 23 revisions

SensorServer wiki!

Examples of Applications

Sensor Server control tank swimming pool level

You want to measure the tank or pool level with an Ultrasonic Sensor and turn on a pump or a valve to refill it. You shoudl define a max level to switch off and a min level to switch on.

Hardware

  1. ESP8266(better nodeMCU) with 4MB flash
  2. Power supply (for Nodemcu a simple USB power adapter)
  3. Ultrasonic sensor
  4. 2K Resistors and 3v Zener (for logic level shift)

Board and connections

It is only necessary to connect the Ultrasonic sensor to power (5V) and 1 GPIO (pin 10 in my example) converting the levels to 3v with 2 resistor and one zener.

SW Configuration

Assuming that MINLEVEL is the minimun distance and MAXLEVEL the maxdistance from sensor to surface. The valve or RELAY connected to outGPIO will be on when level reach MAXLEVEL and will be tourned off when get to MINLEVEL(level are inverted because the sensor measure downword).

*logrule

  • 1 measurement interval,record interval,n.measures,,factor,ip1,ip2,ip3,ip4
  • 2 xx,WiFiSSID,WiFiPASSWORD,nDNSmane
  • 3 type=0,pinin*16+pinout+170,1,name=pool,description=level
  • 4 type=10,,1,outputGPIO=5

in my example:

//  ,t_r,t_w,p-ty,n4,pof,ip1,ip2,ip3,ip4,s_w,de_x,nspl,	lat,long,	elev,	pa_el,	pa_az,pa_fact 
18,360,360,10,,12,192,168,001,030,10,3600,	12,,,	,	31,	12, 32
0,170,2,wlev,Dist,LevVar
10,0,3,prova,0,4,5

*rule To control a local GPIO:

if(val("level")>MAXLEVEL&&d5==0)d5=1; else if(val("level")<MINLEVEL&&d5==1)d5=0; 

To control a OpenSprinkler( address 192.168.1.11 valve n.=5,max level=800,min level=400 ):

if(gval("wlev")>800&&b==0){apicom(11,"/cm","&sid=",5,"&en=1&t=3600");b=1;} else { if(gval("wlev")<400&&b==1){apicom(11,"/cm","&sid=",5,"&en=0");b=1;} }

Sensor Server for ET0 computations

Hardware:

  1. ESP8266 (better nodeMCU) with 4MB of flash
  2. Power supply: a simple USB power adapter
  3. A small [Solar Panel] (http://www.banggood.com/2V-0_14W-70MA-40-x-40-x-3_0mm-Polycrystalline-Silicon-Solar-Panels-Epoxy-p-1013199.html?rmmds=search)

Connections:

You need to measure the electrical power produced by the solar panel . It can be done with a simple resistor measuring the voltage drop or with a current sensor like an ACS712ELC . Configuration input Assume that we use the above small Solar panel and a we measure the voltage drop with a divider 15 ohm and a shunt 15 ohm resistors (make sure to adjust resistor to get 1V full scale reading) connected to A0 . Reading will be done every 60 sec and total current will be recorded, been solarradiation proportional to the current. In addition if available Solarradiation is read from a Weather Underground station(logrules line 4). Hourly ET0 is computed from both sources (line 4 and 5). Factor need to be defined for calibration of the solar panel and can be done equating solarradiation coming from WU.

*logrule

  • 1 measurement interval,record interval,n.measures,,factor,ip1,ip2,ip3,ip4,,longitude,latitude,elev,angle,orientation,factor
  • 2 WU api string(up to weather station name), WiFiSSID, WiFiPASSWORD, nDNSmane
  • 3 type=3,,5,name=WUstation,par.descriptions=local_epoch,temp_c,relative_humidity,precip_today_metric,wind_kph
  • 4 //type=3,,2,name=WUstation,par.description=local_epoch,solarradiation
  • 5 type=8,17,1,Sensor,solarradiation
  • 6 type=4,0,3,ET0,fromWU,,total

in my example:

//  ,t_r,t_w,p-ty	,n4	,pof,ip1,ip2,ip3,ip4,s_w,de_x,nspl,	lat,	long,	elev,	pa_el,	pa_az,pa_fact 
18,360,360,10	,	,12	,192,168,001,030,10	,3600,	12, 441247,	82544,	23,		31,		12, 32
4,/api/48dfa951428393ba/conditions/q/Italy/,TP-LINK_C20B,paolo-48,poolESP
2,0,1,Sunpan,Kw
3,0,5,pws:ISAVONAL1,local_epoch,temp_c,relative_humidity,precip_today_metric,wind_kph
3,0,2,SAVONA,local_epoch,solarradiation
4,0,3,ET0,sunrad,sol_pan,day_val
10,0,3,prova,0,4,5

#####note##### 3rd line type 2 i am reading an power meter connected to my roof solar panels 2rd line the WU string is: /api/personalWUkey/conditions/q/country/ that will be followed by station : pws:ISAVONAL1 for most meteo values end station:SAVONA for solarradiation