Giter Club home page Giter Club logo

esp32-paxcounter's Introduction

ESP32-Paxcounter

logo

Wifi & Bluetooth driven, LoRaWAN enabled, battery powered mini Paxcounter built on cheap ESP32 LoRa IoT boards

Tutorial (in german language): heise.de

CodeFactor PlatformIO CI


Ready-to-go Hardware: LILYGO® Paxcounter LoRa

Documentation: https://cyberman54.github.io/ESP32-Paxcounter

Source Code: https://github.com/cyberman54/ESP32-Paxcounter


Use case

Paxcounter is an ESP32 MCU based device for metering passenger flows in realtime. It counts how many mobile devices are around. This gives an estimation how many people are around. Paxcounter detects Wifi and Bluetooth signals in the air, focusing on mobile devices by evaluating their MAC adresses.

Intention of this project is to do this without intrusion in privacy: You don't need to track people owned devices, if you just want to count them. Therefore, Paxcounter does not persistenly store MAC adresses and does no kind of fingerprinting the scanned devices.

Data can either be stored on a local SD-card, transferred to cloud using LoRaWAN network (e.g. TheThingsNetwork or Helium) or MQTT over TCP/IP, or transmitted to a local host using serial (SPI) interface.

You can build this project battery powered using ESP32 deep sleep mode and reach long uptimes with a single 18650 Li-Ion cell.

License

Copyright 2018-2022 Oliver Brandmueller [email protected]

Copyright 2018-2022 Klaus Wilting [email protected]

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

NOTICE: Parts of the source files in this repository are made available under different licenses, see file LICENSE.txt in this repository. Refer to each individual source file for more details.

Credits

Thanks to

esp32-paxcounter's People

Contributors

augustqu avatar caskerra avatar chopmann avatar chrschultz avatar cyberman54 avatar davidex720 avatar der-ambi avatar drasek avatar florianludwig avatar gregorwolf avatar hallard avatar houzuoguo avatar hpsaturn avatar lifezoned4 avatar make-iot avatar mariusgripp avatar michatrautweiler avatar nerdyscout avatar nordominus avatar nuthub avatar octoate avatar oliverbrandmueller avatar oseiler2 avatar psscout avatar sauttefk avatar scholliyt avatar spmrider avatar t-huyeng avatar td-er avatar tomrottler avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esp32-paxcounter's Issues

setup continuous integration

run build on very commit:

cp src/loraconf.sample.h src/loraconf.h
pip install platformio==3.6.0a1
platformio run -e heltec -e ttgov1 -e ttgov2 -e ttgov21 -e ttgobeam -e fipy -e lopy -e lopy4 -e lolin32lite -e lolin32

maybe even check for code guideline violations.

I would like to go with gitlab-ci as a ci system. This would (more long term) allow for a custom runner that does not just build but also deploys on a board and does some simple checks if it still works.

Bluetooth scan sometimes interrupts Wifi scan

Bluetooth scan sometimes starts before wifi channel scan cycle is completed.
No obvious reason to see for me. Maybe a side effect?

[I][main.cpp:269] wifi_sniffer_loop(): Wifi set channel 1
[I][main.cpp:269] wifi_sniffer_loop(): Wifi set channel 2
[I][main.cpp:269] wifi_sniffer_loop(): Wifi set channel 3
[I][main.cpp:269] wifi_sniffer_loop(): Wifi set channel 4
[I][main.cpp:269] wifi_sniffer_loop(): Wifi set channel 5
[I][main.cpp:269] wifi_sniffer_loop(): Wifi set channel 6
[I][main.cpp:269] wifi_sniffer_loop(): Wifi set channel 7
[I][main.cpp:269] wifi_sniffer_loop(): Wifi set channel 8
[I][main.cpp:269] wifi_sniffer_loop(): Wifi set channel 9
[D][BLEScan.cpp:192] start(): >> start(duration=15)
[D][BLEUtils.cpp:1091] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_PARAM_SET_COMPLETE_EVT
[D][BLEUtils.cpp:1229] dumpGapEvent(): [status: 0]
[D][BLEUtils.cpp:1091] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_START_COMPLETE_EVT
[D][BLEUtils.cpp:1305] dumpGapEvent(): [status: 0]
E (2138986) BT: btc_search_callback  BLE observe compl [...]

rcommand 0x0E Bluetooth on/off not working properly

  1. Switching off seems not to stop adding BT adresses to array, "Pax" display counter still increases
  2. Switch has no influence on hardware radio on/off [probably not possible, because radio needed for wifi?]
  3. Switch has no influence on collecting BT MACs -> callback handler should be unregistered when switching off, and re-registered when switching on

Rework sniffing parser

On esp32.com forum i found some posts where packet loss is reported, while capturing packets in promiscuous mode. We should validate that our code doesn't have this problem, or, if there is a packet loss, we should try to calculate the quote. Setup could be a surrounding with defined Wifi traffic in the air, then capturing with paxcounter and parallel on a PC with wireshark, then compare results.

Post packet loss 1
Post packet loss 2

W (565) wifi: ap start fail

Hi

I just got the TTGO T-Beam, and did the changes in the config files, but when the board boots up I keep getting W (565) wifi: ap start fail

Is there a place I must specify the wifi?
Thanks

[I][main.cpp:622] setup(): Starting Lora task on core 1
[I][main.cpp:627] setup(): Starting Wifi task on core 0
I (194) wifi: wifi firmware version: 2fc15c0
I (197) wifi: config NVS flash: disabled
I (200) wifi: config nano formating: disabled
I (206) wifi: Init dynamic tx buffer num: 32
I (209) wifi: Init data frame dynamic rx buffer num: 64
I (214) wifi: Init management frame dynamic rx buffer num: 64
I (219) wifi: wifi driver task: 3ffdac68, prio:23, stack:4096
I (225) wifi: Init static rx buffer num: 10
I (228) wifi: Init dynamic rx buffer num: 0
I (560) wifi: set country: cc=EU␀ schan=1 nchan=13 policy=1

W (565) wifi: ap start fail



Brownout detector was triggered

Error during BLEDescriptor.cpp compile

I'm trying to build this project, but building process fails with this error:

.piolibdeps/ESP32 BLE Arduino_ID1841/src/BLEDescriptor.cpp: In member function 'void BLEDescriptor::handleGATTServerEvent(esp_
gatts_cb_event_t, esp_gatt_if_t, esp_ble_gatts_cb_param_t*)':
.piolibdeps/ESP32 BLE Arduino_ID1841/src/BLEDescriptor.cpp:158:53: error: 'struct esp_ble_gatts_cb_param_t::gatts_add_char_des
cr_evt_param' has no member named 'descr_uuid'

I hope I haven't missed some instructions. This is what I've done so far:

I've created loraconf.h as instructed.

I've enabled TTGOv2 (which I have) in platformio.ini:

; ---> SELECT TARGET PLATFORM HERE! <---
[platformio]
;env_default = heltec_wifi_lora_32
;env_default = ttgov1
env_default = ttgov2

I've done platformio upgrade on Mac Os X 10.13.4:

You're up-to-date!
PlatformIO 3.5.3a9 is currently the newest version available.

I've done platformio update:

...
Platform Espressif 32
--------
Updating espressif32                     @ 0.12.0         [Up-to-date]
Updating tool-esptoolpy                  @ 1.20100.0      [Up-to-date]
Updating framework-arduinoespressif32    @ 1.4.0          [Up-to-date]
Updating tool-espotapy                   @ 1.1.0          [Up-to-date]
...

After all this trying to build raises this output:

[Mon Apr 16 09:15:13 2018] Processing ttgov2 (framework: arduino; platform: espressif32; board: esp32dev)
--------------------------------------------------------------------------------
PackageManager: Installing toolchain-xtensa32 @ ~2.50200.0
Downloading...
Unpacking...
Verbose mode can be enabled via `-v, --verbose` option

PLATFORM: Espressif 32 > Espressif ESP32 Dev Module
SYSTEM: ESP32 240MHz 288KB RAM (1.25MB Flash)
...
Compiling .pioenvs/ttgov2/lib54a/ESP32 BLE Arduino_ID1841/BLERemoteService.cpp.o

.piolibdeps/ESP32 BLE Arduino_ID1841/src/BLEDescriptor.cpp: In member function 'void BLEDescriptor::handleGATTServerEvent(esp_
gatts_cb_event_t, esp_gatt_if_t, esp_ble_gatts_cb_param_t*)':
.piolibdeps/ESP32 BLE Arduino_ID1841/src/BLEDescriptor.cpp:158:53: error: 'struct esp_ble_gatts_cb_param_t::gatts_add_char_des
cr_evt_param' has no member named 'descr_uuid'
m_bleUUID.equals(BLEUUID(param->add_char_descr.descr_uuid)) &&
^
*** [.pioenvs/ttgov2/lib54a/ESP32 BLE Arduino_ID1841/BLEDescriptor.cpp.o] Error 1
.piolibdeps/ESP32 BLE Arduino_ID1841/src/BLEClient.cpp: In member function 'bool BLEClient::connect(BLEAddress)':
.piolibdeps/ESP32 BLE Arduino_ID1841/src/BLEClient.cpp:115:2: error: too many arguments to function 'esp_err_t esp_ble_gattc_o
pen(esp_gatt_if_t, uint8_t*, bool)'
);
^
In file included from .piolibdeps/ESP32 BLE Arduino_ID1841/src/BLEClient.cpp:13:0:
/Users/arista/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/bluedroid/esp_gattc_api.h:293:11: note: decl
ared here
esp_err_t esp_ble_gattc_open(esp_gatt_if_t gattc_if, esp_bd_addr_t remote_bda, bool is_direct);
^
*** [.pioenvs/ttgov2/lib54a/ESP32 BLE Arduino_ID1841/BLEClient.cpp.o] Error 1
========================== [ERROR] Took 13.24 seconds ==========================

I guess this might be some library mismatch issue, but my knowledge of PlatformIO isn't very strong so I can't say for sure.

Byte Swap

You need to do it for both.. DEVEUI and APPEUI

Integrate GPS

  • Add GPS data, if present, to paxcounter data
  • Generate fields on TTN console needed for ttnmapper integration

FAILURE lib/arduino-lmic-1.5.0-arduino-2-tweaked/src/lmic/radio.c:694

If we use the serial montior we geht this:

ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 188777542, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:812
load:0x40078000,len:0
load:0x40078000,len:11584
entry 0x40078a60
[I][main.cpp:490] setup(): Starting PAXCNT 1.3.82
[I][main.cpp:507] setup(): This is ESP32 chip with 2 CPU cores, WiFi/BT/BLE, silicon revision 1, 4MB embedded Flash
[I][main.cpp:508] setup(): ESP32 SDK: v3.1-dev-661-gf586f5e6
[I][configmanager.cpp:173] loadConfig(): Reading settings from NVS
[I][configmanager.cpp:54] open_storage(): Opening NVS
[I][configmanager.cpp:59] open_storage(): Done
[I][configmanager.cpp:187] loadConfig(): NVRAM settings version = 1.3.82
[I][configmanager.cpp:204] loadConfig(): lorasf = 9
[I][configmanager.cpp:212] loadConfig(): txpower = 15
[I][configmanager.cpp:220] loadConfig(): adrmode = 1
[I][configmanager.cpp:228] loadConfig(): screensaver = 0
[I][configmanager.cpp:236] loadConfig(): screenon = 1
[I][configmanager.cpp:244] loadConfig(): countermode = 0
[I][configmanager.cpp:252] loadConfig(): sendcycle = 120
[I][configmanager.cpp:260] loadConfig(): wifichancycle = 50
[I][configmanager.cpp:268] loadConfig(): wifiantenna = 0
[I][configmanager.cpp:276] loadConfig(): vendorfilter = 1
[I][configmanager.cpp:284] loadConfig(): rgbluminosity = 30
[I][configmanager.cpp:292] loadConfig(): blescantime = 8
[I][configmanager.cpp:300] loadConfig(): BLEscanmode = 1
[I][configmanager.cpp:308] loadConfig(): rssilimit = 0
[I][configmanager.cpp:316] loadConfig(): GPSmode = 1
[I][configmanager.cpp:323] loadConfig(): Done
[I][main.cpp:603] setup(): Features: LED OLED PAYLOAD_CAYENNE
[I][lorawan.cpp:89] printKey(): DevEUI: xxxxxxxx
[I][lorawan.cpp:89] printKey(): AppEUI: xxxxxxxxx
[I][lorawan.cpp:89] printKey(): AppKey: xxxxxxxxx
FAILURE
lib/arduino-lmic-1.5.0-arduino-2-tweaked/src/lmic/radio.c:694

Problem remains that the device shows: Pax: 0, BLTH: 0, WIFI: 0 and RLIM: off

Byte Swap Code for keys

you may want to add this to your code base to support byte swapping of keys... This allow direct use of TTN keys...

// Function to do a byte swap in a byte array
void RevBytes(unsigned char* b, size_t c)
{
  u1_t i;
  for (i = 0; i < c / 2; i++)
  {
     unsigned char t = b[i];
    b[i] = b[c - 1 - i];
    b[c - 1 - i] = t;
  }
}

Example:


/* ************************************************************************************** */
// LoRaWAN DevEUI, unique device ID (LSBF)
//static const u1_t DEVEUI[8]  = { 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
static const u1_t DEVEUI[8]  = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07 };



/* ************************************************************************************** */
// provide device ID (8 bytes, LSBF)
void os_getDevEui (u1_t* buf) {
    memcpy(buf, DEVEUI, 8);
    RevBytes(buf, 8);      // TTN requires it in LSB First order, so lets swap byte's
}

Persist LoRaWAN keys after OTAA join

HowTo:

After an OTAA Join has finished, your node has the very same details you’d have for an ABP device. So: store the DevAddr and the secret session keys NwkSKey and AppSKey, and keep track of both frame counters. After deep sleep, configure your node as an ABP node using LMIC_setSession(...), and set the frame counters to their last stored values, using LMIC.seqnoUp = ... and LMIC.seqnoDn = ....

For LMiC, these session details have different names (which originate from the early days where LoRaWAN was still called LoRaMAC). The documentation shows:

2.5.4 void LMIC_setSession (u4_t netid, devaddr_t devaddr, u1_t* nwkKey, u1_t* artKey)

Set static session parameters. Instead of dynamically establishing a session by joining the network, precomputed session parameters can be provided. To resume a session with precomputed parameters, the frame sequence counters (LMIC.seqnoUp and LMIC.seqnoDn) must be restored to their latest values.

And so does the code:

void LMIC_setSession (u4_t netid, devaddr_t devaddr, xref2u1_t nwkKey, xref2u1_t artKey);
Indeed, the global LMIC variable provides access to properties such as LMIC.nwkKey for NwkSKey, LMIC.artKey for AppSkey and LMIC.devaddr for DevAddr, which you should be able to retrieve and persist in case EV_JOINED.

Beware that you might also need to store and set the frequency and RX2 details that you get in the Join Accept, or after subsequent ADR commands…

(I have not used this.)

BLE crashes while scanning MACs in a dense environment #464

Paxcounter v1.2.95 crashes while scanning Bluetooth MACs in highly dense environments (> 150 Bluetooth MACs around, e.g. in areas where beacons are deployed like shopping malls). The crash happenes in the BLE stack. Currently i have no idea how to solve this.

I raised an issue in ESP32 BLE code repository.

DEVEUI parsing from loraconf.h broken

This maybe an issue...

In main.c you do a: #ifdef DEVEUI To see if DEVEUI is defined in you
config file...
A quick test of this by defining DEVEUI, shows it’s not working by sending
the generated DEVEUI.

No time to investigate this today....

void os_getDevEui (u1_t* buf) {
#ifdef DEVEUI
memcpy(buf, DEVEUI, 8);
RevBytes(buf, 8); // TTN requires it in LSB First order, so we swap bytes
#else
gen_lora_deveui(buf);
#endif
}

MAC container is cleared after a while

After some hours of operation, the mac counter is reset to zero. Sinc this does not happen due to a device reset, this seems to happen on application level.
Assumption: In v1.3.34 a low memory threshold was newly implemented in the main loop in main.cpp, which clears macs set container if heap memory is lower than MEM_LOW threshold. For some strange reason this seems to trigger way to early.

// check free memory

if (ESP.getFreeHeap() <= MEM_LOW) {

do_send(&sendjob); // send count

reset_counters(); // clear macs container and reset all counters

reset_salt(); // get new salt for salting hashes

}


TTN Console Payload Format Decoder

Thanks for the very nice project. For small tests and checking the pax count in the TTN console without converting the payload every time by hand, I've used these two functions for the Custom Payload Format settings:

decoder

function Decoder(bytes, port) {
  // Decode an uplink message from a buffer
  // (array) of bytes to an object of fields.
  var decoded = {};

  if (port === 1) {
    decoded.wifi = (bytes[0] << 8) | bytes[1];
    decoded.ble = (bytes[2] << 8) | bytes[3];
  }

  return decoded;
}

converter

function Converter(decoded, port) {
  // Merge, split or otherwise
  // mutate decoded fields.
  var converted = decoded;

  if (port === 1) {
    converted.pax = converted.ble + converted.wifi;
  }

  return converted;
}

Feel free to improve/put them in the readme/whatever :)

Low power support [enhancement]

  • Enable a configurable low-power mode, in which the device only wakes up after a set interval in order to scan for MACs and BSSIDs (that would be great for indoor location), get a location fix from the GPS, transmit everything and then sleep again.

  • Add support for a flag set by the gateway that prevents the device from sleeping for a set period (for on-demand scanning).

Add LPP payload option for Cayenne

For integration of Paxcountet in Cayenne add a payload format LPP option.

Either as compile time option, or as runtime switchable option.

counter can become negativ

I found another issue regarding the "*100 bug" (Cayenne LPP payload):
If count is set to 1 (continuous counting without reset of the counter), the counter can become negativ. In display it is shown correctly but Cayenne payload is wrong. It's the same for WiFi and BLE counting.

Pack device configuration answer format

Use bits instead of bytes for configuration answer (rcommand 0x80), this saves 5 bytes payload

byte 1: LoRaWAN tx settings

bit 0: Lora ADR (1=on, 0=off)
bits 1..3: Lora SF modulo 7 (7..12) -> (0..5)
bits 4..7 Lora TXpower (2..15)
byte2: Device settings

bit 0: Screensaver status (1=on, 0=off)
bit 1: Display status (1=on, 0=off)
bit 2: Wifi scanning (1=on, 0=off)
bit 3: BLE scanning (1=on, 0=off)
bits 4..5: Counter mode (0=cyclic unconfirmed, 1=cumulative, 2=cyclic confirmed)
byte 3: RSSI limiter threshold value (0..255 negative)
byte 4: Wifi scan cycle duration in seconds/2 (0..255)
byte 5: Wifi channel switch interval in seconds/100 (0..255)
byte 6: BLE scan cycle duration in seconds (0..255)
bytes 7-16: Software version (ASCII format)

"LORA BUSY" error on TTGO T-Beam

On TTGO T-Beam "LORA BUSY" error persists after first packet sent out.
Same code runs on TTGO v2 without this problem.
Problem occurs on T-Beam as well GPS is compiled as not compiled.
Console log shows that event "EV_TX_COMPLETE" is missing. But DIO1 is cabled.
No idea currently what's the root cause here. It worked a while before.
Could be an hardware error - not sure.

"Lora Busy" on TTGO T-Beam

TTGO T-Beam runs in "Lora Busy" endless loop, causing sending no data.
This happenes because for some unknown reason the lmic event TX_COMPLETE is missing.
DIO1 is wired.

Problem is reproducable with code as well from master and as development branch.

define code guidelines

The project is missing code guidelines leading to several inconsistencies.

Starting with the simple stuff like spacing, new line characters, etc. I would like to suggest to follow some existing guide and run a reformatting tool like clang-format on the project. This will disrupt the development once since all work-in-progress patches might have some simple merge conflicts afterwards but we reach a clean state.

Add support for TTGOv1 board after testing it with this code

Hi,
I am using a TTGO v1 board, but I ma unable to use it with the current version of the Paxcounter, because it seems not to be able to use WiFi. Here is the log of it:

Rebooting...
ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:812
load:0x40078000,len:0
load:0x40078000,len:11404
entry 0x40078a28
[I][main.cpp:327] setup(): Starting PAXCNT 1.2.0
[I][main.cpp:341] setup(): This is ESP32 chip with 2 CPU cores, WiFi/BT/BLE, silicon revision 1, 4MB external Flash
[I][configmanager.cpp:130] loadConfig(): Reading settings from NVS
[I][configmanager.cpp:41] open_storage(): Opening NVS
[I][configmanager.cpp:46] open_storage(): Done
[I][configmanager.cpp:143] loadConfig(): NVRAM settings version = 1.2.0
[I][configmanager.cpp:159] loadConfig(): lorasf = 9
[I][configmanager.cpp:167] loadConfig(): txpower = 15
[I][configmanager.cpp:175] loadConfig(): adrmode = 1
[I][configmanager.cpp:183] loadConfig(): screensaver = 0
[I][configmanager.cpp:191] loadConfig(): screenon = 1
[I][configmanager.cpp:199] loadConfig(): countermode = 0
[I][configmanager.cpp:207] loadConfig(): wifiscancycle = 120
[I][configmanager.cpp:215] loadConfig(): wifichancycle = 50
[I][configmanager.cpp:223] loadConfig(): blescancycle = 30
[I][configmanager.cpp:231] loadConfig(): BLEscanmode = 0
[I][configmanager.cpp:239] loadConfig(): rssilimit = 0
[I][configmanager.cpp:246] loadConfig(): Done
[I][lorawan.cpp:56] printKey(): DevEUI: xxxxx
[I][lorawan.cpp:56] printKey(): AppEUI: yyyyy
[I][lorawan.cpp:56] printKey(): AppKey: zzzzz
I (8750) wifi: wifi firmware version: 403db1d
I (8750) wifi: config NVS flash: enabled
I (8750) wifi: config nano formating: disabled
I (8755) wifi: Init dynamic tx buffer num: 32
I (8756) wifi: Init data frame dynamic rx buffer num: 64
I (8756) wifi: Init management frame dynamic rx buffer num: 64
I (8759) wifi: wifi driver task: 3ffdbef4, prio:23, stack:4096
I (8765) wifi: Init static rx buffer num: 10
I (8769) wifi: Init dynamic rx buffer num: 0
I (8773) wifi: wifi power manager task: 0x3ffe1054 prio: 21 stack: 2560
I (17641) wifi: set country: cc=EU schan=1 nchan=13 policy=0

W (17648) wifi: sta start fail

E (17650) tcpip_adapter: tcpip_adapter is not initialized!
I (17673) wifi: mode : null
abort() was called at PC 0x40189f37 on core 0

Backtrace: 0x4008af28:0x3ffd64a0 0x4008b027:0x3ffd64c0 0x40189f37:0x3ffd64e0 0x4012b3cd:0x3ffd6520 0x4012b671:0x3ffd6540 0x40129c41:0x3ffd6560

Rebooting...
ets Jun 8 2016 00:22:57

Any idea, what's going on here?

Btw, I also added a TTGO v1 configuration file and changed the platformio.ini to support it. I have attached them to this posting.

platformio.ini.txt
ttgov1.h.txt

Implement field validation in rcommand.cpp

It is possible to break a device by sending rcommands with wrong parameters, e.g. set a bluetooth scan window which is too wide causes timing problems.

We need testing parameter ranges for each rcommmand and a strong field validation in rcommand.cpp !

OTAA JOIN not working

Hi,
I've compiled and uploaded latest code on an Heltec Lora 32 but although a JOIN packet is sent to Gateway and the server replies on the node there is no EV_JOINED and on display I have:

Join wait
PACKET QUEUED

But from code I would expect JOINING

Display DEVEIU as QR code when device has display while starting

Show DEVEUI, APPEUI and APPKEY as QR code on OLED-Display when device starts, for easy copy & paste to LoRaWAN server. Maybe even with embedded URL that points to automatic import in TTN.

Perhaps by using QRduino library and drawXBM function of u8g2 Library

void drawPic() {                          // show QR-Code
  // picture loop
  u8g2.clearBuffer();
  u8g2.firstPage();  
  do {
      u8g2.drawXBM( 0, 0, qr_code_width, qr_code_height, qr_code_bits);
  } while( u8g2.nextPage() );
}

We want to cooperate with you

Hello, Mr. cyberman54. We are a manufacturer of TTGO T3 VI.0 and V2.0. Given your previous project, we want to further cooperate with you. Correspondingly, we will pay you accordingly. If you are interested, please email [email protected] to discuss details with us.

paxcounter SENSOR: implement I2C and/or SPI interface

Make a paxcounter SENSOR variant (besides paxcounter LORA): Make it usable for integration in devices and sensor appliances.

  • implement I2C and/or SPI interface to connect paxcounter sensor to a wired host
  • I2C uses same set/get commands as in rcommand.cpp
  • Make I2C devices address configurable by hardware: reading hardwired binary settings from 3 GPIOs
  • SPI using simple data structure: Data out = port -> payload / data; Data In = port -> rcommand
  • Using SPI for firmware update OTA

Missing DR_SF11, DR_SF12 definitions when using US915 freq band

If you select the USA freq band, you get case 11 and 12 as DR_SF11, "DR_SF12 was not declared in this scope"

In lorabase.h they are defined as DR_SF11CR and DR_SF12CR with a note: // Devices behind a router: Need to investigate why this is.

In the remote command interpreter....



// help function to assign LoRa datarates to spreadfactor values
void switch_lora (int sf, int tx) {
    if ( tx > 20 ) return;
    cfg.txpower = tx;
    switch (sf) {
        case 7: LMIC_setDrTxpow(DR_SF7,tx); cfg.lorasf=sf; break;
        case 8: LMIC_setDrTxpow(DR_SF8,tx); cfg.lorasf=sf; break;
        case 9: LMIC_setDrTxpow(DR_SF9,tx); cfg.lorasf=sf; break;
        case 10: LMIC_setDrTxpow(DR_SF10,tx); cfg.lorasf=sf; break;
        case 11: LMIC_setDrTxpow(DR_SF11,tx); cfg.lorasf=sf; break;
        case 12: LMIC_setDrTxpow(DR_SF12,tx); cfg.lorasf=sf; break;
        default: break;
    }
}

can't compile for TTGO V.2.1, mac, atom

So we installed platform.io on atom, configured to ttgo v2.1.
When building using the platform.io plugin we get the following error message:

src/blecsan.cpp:15:22: fatal error: bt_types.h: No such file or directory

what should we do?

time based pax counter reset

Currently the counter is reset after a successful (but not acknowledged) transmission of the counter values. This means that the time frame in which for a counting cycle is not constant making it harder to interprete the results. Therefor I like to suggest decoupling the sending of counter values and resetting the counter.

Integrate Time Sync from GPS and other sources

  • Use RTC of esp32 to keep precise time on board
  • Use GPS, if present, for time sync
  • Use other source, e.g. LoRa, for time sync
  • Generate DCF77 output signal on serial port or current loop port to feed external clock

Building errors in BLEDescriptor.cpp and in BLEClient.cpp

I get the following errors when trying to build on Platformio:

.piolibdeps/ESP32 BLE Arduino_ID1841/src/BLEDescriptor.cpp: In member function 'void BLEDescriptor::handleGATTServerEvent(esp_gatts_cb_event_t, esp_gatt_if_t, esp_ble_gatts_cb_param_t*)':
.piolibdeps/ESP32 BLE Arduino_ID1841/src/BLEDescriptor.cpp:158:53: error: 'struct esp_ble_gatts_cb_param_t::gatts_add_char_descr_evt_param' has no member named 'descr_uuid'
m_bleUUID.equals(BLEUUID(param->add_char_descr.descr_uuid)) &&
^
.piolibdeps/ESP32 BLE Arduino_ID1841/src/BLEClient.cpp: In member function 'bool BLEClient::connect(BLEAddress)':
.piolibdeps/ESP32 BLE Arduino_ID1841/src/BLEClient.cpp:115:2: error: too many arguments to function 'esp_err_t esp_ble_gattc_open(esp_gatt_if_t, uint8_t*, bool)'
);
^
In file included from .piolibdeps/ESP32 BLE Arduino_ID1841/src/BLEClient.cpp:13:0:
/Users/henkdebruijn/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/bluedroid/esp_gattc_api.h:293:11: note: declared here
esp_err_t esp_ble_gattc_open(esp_gatt_if_t gattc_if, esp_bd_addr_t remote_bda, bool is_direct);

I use the following configuration:

[env:lopy]
platform = espressif32
board = esp32dev
framework = arduino
monitor_baud = 115200
upload_speed = 921600
lib_deps = 
    U8g2@>2.21.7
    ESP32 BLE Arduino@>=0.4.9
    SmartLeds
build_flags = 
;set log level, we need build_flag for this, otherwise we can't use ESP_LOGx in arduino framework
    -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_INFO
;   -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE
;   -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_NONE
;needed for ESP32 BLE Ardunio v0.4.9
    -fexceptions
    -std=c++11
;override lora settings from LMiC library in lmic/config.h and use main.h instead
    -Dlopy
    -D_lmic_config_h_
    -include "src/main.h"
    -include "src/hal/lopy.h"
;FreeRTOS single core operation, switches off core 1 (see arduino-esp32/cores/esp32/main.cpp)
;   -DCONFIG_FREERTOS_UNICORE

Migrate software to Espressif32 core version 1.1.x

Migrate software from Espressif32 core v1.0.2 to version 1.1.x

  • some prerequsits already done, code compiles

  • check code warnings / error logs

  • to be done: bugfixing an upcoming i2c interrupt error, which crashes performance on i2c bus used for OLED display. This is an Arduino-Espressif32 related problem, issue was raised here:
    espressif/arduino-esp32#1588

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.