diff --git a/README.md b/README.md index 77e86dc9..e44aafc1 100644 --- a/README.md +++ b/README.md @@ -140,7 +140,7 @@ Paxcounter generates identifiers for sniffed MAC adresses and collects them temp # Clock controller -Paxcounter can be used to sync a clock which has DCF77 or IF482 time telegram input with an external time source. Use case of this function is to have paxcounter hardware integrated in clocks, and use it for both counting of pax and controlling the clock. Supported external time sources are GPS time, LORAWAN network time (v1.1) and on board RTC time. Precision of the synthetic DCF77 signal depends on precision of on board available time base. Supported are both external time base (e.g. pps pin of GPS chip or oscillator output of RTC chip) and ESP32 internal clock. Selection of time base and clock frequency is done by #defines in the board's hal file, see example in [**generic.h**](src/hal/generic.h). +Paxcounter can be used to sync a clock which has DCF77 or IF482 time telegram input with an external time source. Use case of this function is to have paxcounter hardware integrated in clocks, and use it for both counting of pax and controlling the clock. Supported external time sources are GPS time, LORAWAN network time (v1.1) and on board RTC time. Precision of the synthetic DCF77 signal depends on precision of on board available time base. Supported are both external time base (e.g. timepulse pin of GPS chip or oscillator output of RTC chip) and internal ESP32 hardware timer. Selection of time base and clock frequency is done by #defines in the board's hal file, see example in [**generic.h**](src/hal/generic.h). # Payload format diff --git a/platformio.ini b/platformio.ini index cf7f1ce3..233837e9 100644 --- a/platformio.ini +++ b/platformio.ini @@ -6,7 +6,7 @@ ; ---> SELECT TARGET PLATFORM HERE! <--- [platformio] -;env_default = generic +env_default = generic ;env_default = ebox ;env_default = eboxtube ;env_default = heltec @@ -15,7 +15,7 @@ ;env_default = ttgov2 ;env_default = ttgov21old ;env_default = ttgov21new -env_default = ttgobeam +;env_default = ttgobeam ;env_default = ttgofox ;env_default = lopy ;env_default = lopy4 @@ -30,10 +30,10 @@ description = Paxcounter is a proof-of-concept ESP32 device for metering passeng [common] ; for release_version use max. 10 chars total, use any decimal format like "a.b.c" -release_version = 1.7.152 +release_version = 1.7.2 ; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running! ; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose -debug_level = 4 +debug_level = 0 ; UPLOAD MODE: select esptool to flash via USB/UART, select custom to upload to cloud for OTA upload_protocol = esptool ;upload_protocol = custom diff --git a/src/hal/generic.h b/src/hal/generic.h index 5db463a0..6a787fff 100644 --- a/src/hal/generic.h +++ b/src/hal/generic.h @@ -40,25 +40,28 @@ #define BOARD_HAS_PSRAM // use extra 4MB extern RAM -#define HAS_GPS 1 // use if board has GPS -#define GPS_SERIAL 9600, SERIAL_8N1, GPIO_NUM_17, GPIO_NUM_16 // UBlox NEO 6M or 7M with default configuration +// GPS settings +#define HAS_GPS 1 // use on board GPS +#define GPS_SERIAL 9600, SERIAL_8N1, GPIO_NUM_12, GPIO_NUM_15 // UBlox NEO 6M +#define GPS_INT GPIO_NUM_34 // 30ns accurary timepulse, to be external wired on pcb: NEO 6M Pin#3 -> GPIO34 +#define GPS_CLK (1000) // pulse length 100ms, accuracy +/- 3 *e-8 [nanoseconds] = 0,95sec / year // Pins for I2C interface of OLED Display #define MY_OLED_SDA (4) #define MY_OLED_SCL (15) #define MY_OLED_RST (16) -// Pins for on board DS3231 RTC chip +// Settings for on board DS3231 RTC chip #define HAS_RTC MY_OLED_SDA, MY_OLED_SCL // SDA, SCL -#define RTC_INT GPIO_NUM_34 // interrupt input from rtc -#define RTC_CLK (1000) // frequency of RTC clock signal in ms +#define RTC_INT GPIO_NUM_34 // timepulse with accuracy +/- 2*e-6 [microseconds] = 0,1728sec / day +#define RTC_CLK (1000) // pulse length 1000ms // Settings for IF482 interface -#define HAS_IF482 9600, SERIAL_7E1, GPIO_NUM_12, GPIO_NUM_14 // IF482 serial port parameters +//#define HAS_IF482 9600, SERIAL_7E1, GPIO_NUM_12, GPIO_NUM_14 // IF482 serial port parameters // Settings for DCF77 interface #define HAS_DCF77 GPIO_NUM_1 -//#define DCF77_ACTIVE_LOW 1 +#define DCF77_ACTIVE_LOW 1 // Pins for LORA chip SPI interface, reset line and interrupt lines #define LORA_SCK (5) diff --git a/src/hal/ttgobeam.h b/src/hal/ttgobeam.h index c32994a8..f812e3c9 100644 --- a/src/hal/ttgobeam.h +++ b/src/hal/ttgobeam.h @@ -22,30 +22,27 @@ // GPS settings #define HAS_GPS 1 // use on board GPS -#define GPS_SERIAL 9600, SERIAL_8N1, GPIO_NUM_12, GPIO_NUM_15 // UBlox NEO 6M or 7M with default configuration -// to use -#define GPS_INT GPIO_NUM_34 // 30ns accurary timepulse, to be external wired on pcb: R34 -> GPIO34 -// 1 pulse per second, synchronized at rising edge, pulse length 100ms, accuracy +/- 3 *e-8 [nanoseconds] = 0,95sec / year -#define GPS_CLK (1000) +#define GPS_SERIAL 9600, SERIAL_8N1, GPIO_NUM_12, GPIO_NUM_15 // UBlox NEO 6M +//#define GPS_INT GPIO_NUM_34 // 30ns accurary timepulse, to be external wired on pcb: NEO 6M Pin#3 -> GPIO34 +//#define GPS_CLK (1000) // pulse length 100ms, accuracy +/- 3 *e-8 [nanoseconds] = 0,95sec / year // enable only if device has these sensors, otherwise comment these lines // BME680 sensor on I2C bus -#define HAS_BME SDA, SCL -#define BME_ADDR BME680_I2C_ADDR_PRIMARY // !! connect SDIO of BME680 to GND !! +//#define HAS_BME SDA, SCL +//#define BME_ADDR BME680_I2C_ADDR_PRIMARY // !! connect SDIO of BME680 to GND !! // display (if connected) -#define HAS_DISPLAY U8X8_SSD1306_128X64_NONAME_HW_I2C -#define MY_OLED_SDA SDA -#define MY_OLED_SCL SCL -#define MY_OLED_RST U8X8_PIN_NONE +//#define HAS_DISPLAY U8X8_SSD1306_128X64_NONAME_HW_I2C +//#define MY_OLED_SDA SDA +//#define MY_OLED_SCL SCL +//#define MY_OLED_RST U8X8_PIN_NONE //#define DISPLAY_FLIP 1 // use if display is rotated // Settings for DCF77 interface //#define HAS_DCF77 GPIO_NUM_13 // Settings for IF482 interface -#define HAS_IF482 9600, SERIAL_7E1, GPIO_NUM_12, GPIO_NUM_14 // IF482 serial port parameters - +//#define HAS_IF482 9600, SERIAL_7E1, GPIO_NUM_12, GPIO_NUM_14 // IF482 serial port parameters // user defined sensors (if connected) //#define HAS_SENSORS 1 // comment out if device has user defined sensors diff --git a/src/hal/ttgofox.h b/src/hal/ttgofox.h index 7be3544c..3d29d5f3 100644 --- a/src/hal/ttgofox.h +++ b/src/hal/ttgofox.h @@ -23,18 +23,18 @@ // Settings for on board DS3231 RTC chip #define HAS_RTC MY_OLED_SDA, MY_OLED_SCL // SDA, SCL //#define RTC_INT GPIO_NUM_34 // timepulse with accuracy +/- 2*e-6 [microseconds] = 0,1728sec / day -//#define RTC_CLK (1000) // frequency of RTC clock signal in ms +//#define RTC_CLK (1000) // pulse length 1000ms // Settings for IF482 interface //#define HAS_IF482 9600, SERIAL_7E1, GPIO_NUM_12, GPIO_NUM_14 // IF482 serial port parameters // Settings for DCF77 interface -#define HAS_DCF77 GPIO_NUM_14 -#define DCF77_ACTIVE_LOW 1 +//#define HAS_DCF77 GPIO_NUM_14 +//#define DCF77_ACTIVE_LOW 1 // Settings for external GPS chip -#define HAS_GPS 1 // use on board GPS -#define GPS_SERIAL 9600, SERIAL_8N1, GPIO_NUM_17, GPIO_NUM_16 // UBlox NEO 6M or 7M with default configuration +//#define HAS_GPS 1 // use on board GPS +//#define GPS_SERIAL 9600, SERIAL_8N1, GPIO_NUM_17, GPIO_NUM_16 // UBlox NEO 6M or 7M with default configuration // Pins for LORA chip SPI interface, reset line and interrupt lines #define LORA_SCK (5)