====== Documentation Camel V1 ====== ---- tags: camel, camel V1 {{:products:camel:camel_2021-nov-12_16h33.png?400|}} ===== - Fichier de configuration json ===== Configuration avec communication radio en LoRa: { "rtc_type": "am1805", "time_between_measures_s": 600, "number_measures_before_write_sd": 18, "number_writes_in_interval_file": 8, "lora_active": true } Configuration sans communication radio: { "rtc_type" : "am1805", "time_between_measures_s" : 600, "number_measures_before_write_sd" : 18, "number_writes_in_interval_file" : 8, "lora_active" : false } ===== - Manuel utilisateur ===== {{ :products:camel:camelv1_user_manual_fr.pdf |}} ===== - Javascript Codec to decode LoRaWAN frames ===== The function used to parse the bytes transmitted in LoRaWAN // Decode decodes an array of bytes into an object. // - fPort contains the LoRaWAN fPort number // - bytes is an array of bytes, e.g. [225, 230, 255, 0] // The function must return an object, e.g. {"temperature": 22.5} var TEMP_BYTE_0_IDX = 0; var TEMP_BYTE_1_IDX = 1; var RH_BYTE_0_IDX = 2; var RH_BYTE_1_IDX = 3; var VOLT_BYTE_0_IDX = 4; var LORA_MIN_BATT_VAL = 1; var LORA_MAX_BATT_VAL = 254; var LORA_BATT_RANGE = LORA_MAX_BATT_VAL - LORA_MIN_BATT_VAL; var LORA_BATT_ERROR = 255; var BATT_VOLTAGE_LOW = 3.0; var BATT_VOLTAGE_HIGH = 4.2; function Decode(fPort, bytes) { var temperature_code = 0; var humidity_code = 0; var temperature = 0.0; var humidity = 0.0; var voltage_code = 0; var voltage = 0.0 temperature_code = (bytes[TEMP_BYTE_0_IDX] << 8 ) + bytes[TEMP_BYTE_1_IDX]; humidity_code = (bytes[RH_BYTE_0_IDX] << 8 ) + bytes[RH_BYTE_1_IDX]; voltage_code = bytes[VOLT_BYTE_0_IDX]; temperature = ((175.72 * temperature_code) / 65536.0) - 46.85; humidity = ((125.0 * humidity_code) / 65536.0) - 6.0; var data = {}; if (voltage_code != LORA_BATT_ERROR) { voltage = (((voltage_code - LORA_MIN_BATT_VAL) * (BATT_VOLTAGE_HIGH - BATT_VOLTAGE_LOW))/LORA_BATT_RANGE) + BATT_VOLTAGE_LOW; data = { "temperature": temperature, "humidity": humidity, "voltage" : voltage, "raw": bytes, }; } else { data = { "temperature": temperature, "humidity": humidity, "raw": bytes, }; } return data; }