cyberman54 / ESP32-Paxcounter

Wifi & BLE driven passenger flow metering with cheap ESP32 boards
https://cyberman54.github.io/ESP32-Paxcounter/
Other
1.72k stars 402 forks source link

T-BEAM + BM680 #407

Closed oscarmh closed 5 years ago

oscarmh commented 5 years ago

First of all thanks for Paxcounter, Ive it running on a T-BEAM running perfectly with a small display that is connected 3.3v/Ground/21SCL/22SDA I also want to attach a BM680, can it be done ? Thanks in advance

cyberman54 commented 5 years ago

Just attach the BMA680 to the I2C bus, by wiring it to SDA/SCL, and add BME to the hal config file. Example for T-Beam:

// clang-format off
// upload_speed 921600
// board ttgo-t-beam

#ifndef _TTGOBEAM_H
#define _TTGOBEAM_H

#include <stdint.h>

// Hardware related definitions for TTGO T-Beam board
// (only) for older T-Beam version T22_V05 eternal wiring LORA_IO1 to GPIO33 is needed!
//
// pinouts taken from http://tinymicros.com/wiki/TTGO_T-Beam

#define HAS_LED GPIO_NUM_14 // on board green LED, only new version TTGO-BEAM V07
//#define HAS_LED GPIO_NUM_21 // on board green LED, only old verison TTGO-BEAM V05

#define HAS_LORA 1       // comment out if device shall not send data via LoRa
#define CFG_sx1276_radio 1 // HPD13A LoRa SoC
#define BOARD_HAS_PSRAM // use extra 4MB external RAM
#define HAS_BUTTON GPIO_NUM_39 // on board button (next to reset)
#define BAT_MEASURE_ADC ADC1_GPIO35_CHANNEL // battery probe GPIO pin -> ADC1_CHANNEL_7
#define BAT_VOLTAGE_DIVIDER 2 // voltage divider 100k/100k on board

// 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

// enable only if device has these sensors, otherwise comment these lines
// BME680 sensor on I2C bus
#define HAS_BME 1 // Enable BME sensors in general
#define HAS_BME680 SDA, SCL
#define BME680_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 DISPLAY_FLIP  1 // use if display is rotated

// user defined sensors (if connected)
//#define HAS_SENSORS 1 // comment out if device has user defined sensors

//#define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature

#endif
oscarmh commented 5 years ago

thanks a lot for your quick answer.

cyberman54 commented 5 years ago

every BME680 has SDIO and it should not left floating according to Bosch datasheet, since i2c adress is undefined then. But you can try to swap i2c adress 0x76 <-> 0x77 in the hal file and try again.

cyberman54 commented 5 years ago

and remember to use clean function in platformio before rebuilding code, without this changes in the hal file may not be compiled.

oscarmh commented 5 years ago

Must be a new-new BME680 no SDIO but SDL/SDC and 3.3v+GND, it is working now, pretty well !! Thanks BME680

cyberman54 commented 5 years ago

BME680 always has SDIO, but it maybe fixed wired on the PCB to GND or VDD.

oscarmh commented 5 years ago

for sure, next step is to provide power using a Solar Panel I will work on that, thanks for your support.