boltwood/Protocol.md
2017-03-03 17:55:13 +03:00

7.5 KiB

Boltwood CS || protocol

================

Sensor as receiver

  • 0x01 - REQUEST_POLL - say that there's someone waiting for data
  • 0x02 - FRAME_START - data frame start (ending with '\n')

Without getting REQUEST_POLL, sensor will send data for 5 times and sleep.

All given symbols go after FRAME_START:

  • 'a' - ACK (should be sent by computer after each good data portion)
  • 'm' - next text is command sequence following by CRC16 ('m' not used in CRC)
  • 'n' - NACK (should be sent by computer after each bad data portion)

Commands (ending with CRC16\n)

  • 'b' - close Roof
  • 'c' - get calibration
  • 'l' - get wetness calibration
  • 't' following by 5 integers - set thresholds
  • 't' without data - set default thresholds

After sending command wait a little for getting ACK ('A'). If none (or NACK), try again. All received data will be sent back in 'Q' frame type.

Sensor as sender

  • 0x02 - FRAME_START
  • '!' - PURGE_START
  • '|' - MEMORY_DUMP_START
  • '^' - BOOT_LOADER_START

All given commands go after FRAME_START:

  • 'A' - ACK
  • 'M' - report data frame
  • 'N' - NACK
  • 'P' - poll request (before FRAME_START there's one 0x00 byte)

Report data frame types

  • 'C' - termopile calibration
  • 'D' - sensor report
  • 'I' - reset
  • 'K' - wetness calibration
  • 'Q' - report a command received from the PC
  • 'R' - roof close
  • 'T' - thresholds
  • 'W' - wetness data

debugging???

  • 'X' - "X rhr %d %f", rhr, rainheatt (control of the rain heater)
  • 'Y' - "Y %f %d %d", rainheatt, suppressrh, suppressrrh (direct setting of the rain heater target temperature)
  • 'Z' - "Z %d %d %d", rainheatt, suppressrh, suppressrrh (direct setting of the rain heater PWM hardware value)

Data parameters and fields

Set thresholds ("t 1 2 3 4 5")

(integer values)

  1. cloudy threshold *10
  2. very cloudy threshold *10
  3. windy threshold *10
  4. rain threshold (equal)
  5. wet threshold (equal)

Termopile calibration ('C')

"C %d %lf %lf %lf"
  1. eThermopileCal (1)
  2. eBestK (-6.571e-7)
  3. eBestD (0.371)
  4. eBestOffs (-2.00)
  5. ? (10.1)

Sensor report ('D')

D %u %u %u %u %u %u %lf %lf %lf %c %c %d %lf %lf %d %lf %d %lf %lf %d %d %d %d %d %u %u %u %u %u %u %lf %d %d %u %u"
  1. humidstatTempCode - humidity and ambient temperature sensor code (0)

0 = OK; 1 - write failure for humidity; 2 - measurement never finished for humidity; 3 - write failure for ambient; 4 - measurement never finished for ambient; 5 - data line was not high for humidity; 6 - data line was not high for ambient.

  1. cloudCond - cloud conditions (3)

(dT = skyMinusAmbientTemperature) 0 - unknown; 1 - clear (dT > eCloudyThresh); 2 - cloudy (dT <= eCloudyThresh); 3 - very cloudy (dT <= eVeryCloudyThresh)

  1. windCond - wind conditions (1)

0 - unknown (e.g., sensor wet); 1 - ok (windSpeed < eWindyThresh); 2 - windy (windSpeed >= eWindyThresh); 3 - very windy (windSpeed >= eVeryWindyThresh).

  1. rainCond - rain sensor conditions (1)

0 - unknown; 1 - not raining; 2 - recently raining; 3 - raining.

  1. skyCond - sky sensor conditions (3)

0 - unknown; 1 - clear; 2 - cloudy; 3 - very cloudy; 4 - wet.

  1. roofCloseRequested =0 normally, =1 if roof close was requested on this cycle (1)
  2. skyMinusAmbientTemperature - Tsky-Tamb (-3.1)

Tsky: 999.9 saturated hot; -999.9 saturated cold; -998.0 if sensor is wet.

  1. ambientTemperature - ambient temperature (29.3)

if -40 and humidity is 0 there is a problem with communication to those sensors (likely water where it shouldn't be).

  1. windSpeed - wind speed (0.0)

-1 - still heating; -2 - wet; -4 - not heating; -5 - shortened circuit; -6 - no probe

  1. wetSensor - wet sensor value (N)

'N' when dry, 'W' when wet now, 'w' when wet in last minute

  1. rainSensor - rain sensor value (N)

'N' when no rain, 'R' when rain drops hit on this cycle, 'r' for drops in last minute

  1. relativeHumidityPercentage - relative humidity in % (22)
  2. dewPointTemperature - dew point temperature (5.2)
  3. caseTemperature - thermopile case temperature(41.2)

999.9 saturated hot, -99.9 saturated cold

  1. rainHeaterPercentage - PWM percentage for rain heater (0)
  2. blackBodyTemperature - calibration black body temperature (factory only) (-99.9)

999.9 - saturated hot, -99.9 - saturated cold.

  1. rainHeaterState - state of rain sensor heater (0)

0 if too hot; 1 if at or nearly at requested temp; 2..5 if too cold; 6 if cannot control due to a saturated case temperature (causes shutdown); 7 is used by firmware (tmain) to indicate that normal control is being used instead of direct use of this.

  1. powerVoltage - voltage actually on the +24V line at the sensor head (24.4)
  2. anemometerTemeratureDiff - anemometer tip temperature difference from ambient, limited by reducing anemometer heater power when 25^o C is reached (24.6)
  3. wetnessDrop - maximum drop in wetness oscillator counts this cycle due to rain drops(3)
  4. wetnessAvg - wetness oscillator count difference from base dry value (162)
  5. wetnessDry - wetness oscillator count difference for current dry from base dry value (213)
  6. rainHeaterPWM - rain heater PWM value (000)
  7. anemometerHeaterPWM - anemometer heater PWM value (039)
  8. thermopileADC - thermopile raw A/D output (0106)
  9. thermistorADC - thermopile thermistor raw A/D output (0352)
  10. powerADC - power supply voltage monitor raw A/D output (0959)
  11. blockADC - calibration block thermistor raw A/D output (1023)
  12. anemometerThermistorADC - anemometer tip thermistor raw A/D output (0138)
  13. davisVaneADC - Davis vane raw A/D output (only for factory calibration) (0141)
  14. dkMPH - external anemometer used (only for factory calibration) (0.0)
  15. extAnemometerDirection - external anemometer wind direction (only for factory calibration) (049)
  16. rawWetnessOsc - raw counts from the wetness oscillator (12990)
  17. dayCond - day conditions value (3)

3 full daylight; 2 twilight; 1 night; 0 unknown.

  1. daylightADC - daylight photodiode raw A/D output (0502)

0 means no light, 1023 max light.

Reset ('I')

"I %u %u 0x%x %u 0x%x %u"
  1. serialNumber - sensor's serial number
  2. version - firmvare version
  3. mcucsrv - ???
  4. crashCode - ?
  5. lastCyc - ?
  6. eSendErrs - (error counter?)

Wetness calibration ('K')

"K %d %lf %u %lf %lf %u %d %d"
  1. eWetCal (1)
  2. eWetOscFactor (1.001)
  3. eRawWetAvg (13228)
  4. eCaseT - wetness sensor case temperature (max?) (30.9)
  5. eshtAmbientT - ambient (termopile in bottom part of sensor) temperature (to turn on heater?) (24.4)
  6. enomOsc (13209)
  7. oscDry (213)
  8. minWetAvg (161)

Thresholds ('T')

"T %u %u %u %lf %lf %lf %lf %d %d %d %d %d  %d %d %d %d %d"
  1. serialNumber - sensor's serial number (00794)
  2. version - firmvare version (00062)
  3. eSendErrs - (error counter?) (02603)
  4. eCloudyThresh - cloudy threshold (-25.0)
  5. eVeryCloudyThresh - very cloudy threshold (-10.0)
  6. eWindyThresh - windy threshold (15.0)
  7. eVeryWindyThresh - very windy threshold (WTF?) (30.0)
  8. eRainThresh - rain threshold (12)
  9. eWetThresh - wet threshold (100)
  10. eDaylightCode - daylight code (1)
  11. eDayThresh - day threshold (132)
  12. eVeryDayThresh - very much light threshold (220)
  13. ? Ty (5)
  14. ?SNBot (0)
  15. ?SNTop (65535)
  16. ?EV (0)
  17. ?WCC (1)

Wetness data ('W')

"W %lf %lf %u %u %u %u %u"
41.2 29.3 13157 13266 13134 12990   162
  1. caseVal - current case temperature ? (41.2)
  2. ambT - current ambient temperature ? (29.3)
  3. wAvgW - ? (13157)
  4. wAvgC - ? (13266)
  5. nomos - ? (13134)
  6. rawWT - ? (12990)
  7. wetAvg - ? (162)