Added BMP280 sensor (like BME280 but without humidity). Updated kicad files to new file standard.

This commit is contained in:
Kai Lauterbach 2022-11-02 19:10:39 +01:00
parent 93114b0f49
commit 94a1e785f1
6 changed files with 2100 additions and 3 deletions

View file

@ -42,6 +42,8 @@
#define BME_CS 10
#define BME_ADDRESS 0x76
#define BMP_ADDRESS 0x76
#define SERIAL_BAUD_RATE 115200
#define WEB_UPDATER_HTTP_PORT 8080

View file

@ -39,9 +39,9 @@ uint32_t update_webserver_cnt = 0;
uint32_t update_windspeed_exceed_cnt = 0;
uint32_t wifi_check_interval_counter = 0;
#ifndef DISABLE_WIFIMANAGER
const String wifiName = "oko-weather-" + DEVICE_NAME;
#ifndef DISABLE_WIFIMANAGER
WiFiManager wifiManager;
#endif
@ -74,7 +74,7 @@ void setup()
{
#if defined(DEBUG) || defined(SERIAL_FEATURE)
Serial.begin(SERIAL_BARD_RATE);
Serial.begin(SERIAL_BAUD_RATE);
#endif
// Pin settings
@ -166,9 +166,14 @@ void initSensors()
#endif
#ifdef SENSOR_BME280
//Temperature + pressure
//Temperature + pressure + humidity
sensor_bme280_begin(BME_ADDRESS);
#endif
#ifdef SENSOR_BMP280
//Temperature + pressure + humidity
sensor_bmp280_begin(BMP_ADDRESS);
#endif
}
//*************************************************************************//
@ -191,6 +196,9 @@ float readSensors(uint8_t s)
case SENSOR_TEMPERATURE:
#ifdef SENSOR_BME280
ret = bme280_temperature();
#endif
#ifdef SENSOR_BMP280
ret = bmp280_temperature();
#endif
break;
@ -203,6 +211,9 @@ float readSensors(uint8_t s)
case SENSOR_PRESSURE:
#ifdef SENSOR_BME280
ret = bme280_pressure();
#endif
#ifdef SENSOR_BMP280
ret = bmp280_pressure();
#endif
break;

View file

@ -0,0 +1,51 @@
#include <Adafruit_BMP280.h> // Install from library manager - sensor board info: https://www.bastelgarage.ch/bmp280-temperatur-luftdruck-sensor
Adafruit_BMP280 _sensor_bmp280;
Adafruit_Sensor *_sensor_bmp280_temp = _sensor_bmp280.getTemperatureSensor();
Adafruit_Sensor *_sensor_bmp280_pressure = _sensor_bmp280.getPressureSensor();
bool sensor_bmp280_begin(uint8_t addr)
{
bool status = _sensor_bmp280.begin(addr);
if (status)
{
debug("BMP280 Connected");
_sensor_bmp280.setSampling(Adafruit_BMP280::MODE_NORMAL, /* Operating Mode. */
Adafruit_BMP280::SAMPLING_X2, /* Temp. oversampling */
Adafruit_BMP280::SAMPLING_X16, /* Pressure oversampling */
Adafruit_BMP280::FILTER_X16, /* Filtering. */
Adafruit_BMP280::STANDBY_MS_500); /* Standby time. */
} else {
debug("Could not find a valid BMP280 sensor, check wiring or try a different address!");
debug("SensorID was: " + String(_sensor_bmp280.sensorID()));
debug(" ID of 0xFF probably means a bad address, a BMP 180 or BMP 085\n");
debug(" ID of 0x56-0x58 represents a BMP 280,\n");
debug(" ID of 0x60 represents a BME 280.\n");
debug(" ID of 0x61 represents a BME 680.\n");
}
return status;
}
float bmp280_temperature()
{
sensors_event_t temp_event, pressure_event;
_sensor_bmp280_temp->getEvent(&temp_event);
return temp_event.temperature * TEMP_FACTOR;
}
float bmp280_pressure()
{
sensors_event_t pressure_event;
_sensor_bmp280_pressure->getEvent(&pressure_event);
return pressure_event.pressure;
}
float bmp280_humidity()
{
return 0 * HUMIDITY_FACTOR;
}

View file

@ -0,0 +1,75 @@
{
"board": {
"active_layer": 0,
"active_layer_preset": "",
"auto_track_width": true,
"hidden_nets": [],
"high_contrast_mode": 0,
"net_color_mode": 1,
"opacity": {
"pads": 1.0,
"tracks": 1.0,
"vias": 1.0,
"zones": 0.6
},
"ratsnest_display_mode": 0,
"selection_filter": {
"dimensions": true,
"footprints": true,
"graphics": true,
"keepouts": true,
"lockedItems": true,
"otherItems": true,
"pads": true,
"text": true,
"tracks": true,
"vias": true,
"zones": true
},
"visible_items": [
0,
1,
2,
3,
4,
5,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
32,
33,
34,
35,
36
],
"visible_layers": "fffffff_ffffffff",
"zone_display_mode": 0
},
"meta": {
"filename": "oko-weatherstation.kicad_prl",
"version": 3
},
"project": {
"files": []
}
}

View file

@ -0,0 +1,325 @@
{
"board": {
"design_settings": {
"defaults": {
"board_outline_line_width": 0.1,
"copper_line_width": 0.2,
"copper_text_size_h": 1.5,
"copper_text_size_v": 1.5,
"copper_text_thickness": 0.3,
"other_line_width": 0.15,
"silk_line_width": 0.15,
"silk_text_size_h": 1.0,
"silk_text_size_v": 1.0,
"silk_text_thickness": 0.15
},
"diff_pair_dimensions": [],
"drc_exclusions": [],
"rules": {
"solder_mask_clearance": 0.0,
"solder_mask_min_width": 0.0
},
"track_widths": [],
"via_dimensions": []
},
"layer_presets": []
},
"boards": [],
"cvpcb": {
"equivalence_files": []
},
"erc": {
"erc_exclusions": [],
"meta": {
"version": 0
},
"pin_map": [
[
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
2,
0,
1,
0,
0,
1,
0,
2,
2,
2,
2
],
[
0,
0,
0,
0,
0,
0,
1,
0,
1,
0,
1,
2
],
[
0,
1,
0,
0,
0,
0,
1,
1,
2,
1,
1,
2
],
[
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2
],
[
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
2
],
[
0,
0,
0,
1,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
2,
1,
2,
0,
0,
1,
0,
2,
2,
2,
2
],
[
0,
2,
0,
1,
0,
0,
1,
0,
2,
0,
0,
2
],
[
0,
2,
1,
1,
0,
0,
1,
0,
2,
0,
0,
2
],
[
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
]
],
"rule_severities": {
"bus_definition_conflict": "error",
"bus_entry_needed": "error",
"bus_label_syntax": "error",
"bus_to_bus_conflict": "error",
"bus_to_net_conflict": "error",
"different_unit_footprint": "error",
"different_unit_net": "error",
"duplicate_reference": "error",
"duplicate_sheet_names": "error",
"extra_units": "error",
"global_label_dangling": "warning",
"hier_label_mismatch": "error",
"label_dangling": "error",
"lib_symbol_issues": "warning",
"multiple_net_names": "warning",
"net_not_bus_member": "warning",
"no_connect_connected": "warning",
"no_connect_dangling": "warning",
"pin_not_connected": "error",
"pin_not_driven": "error",
"pin_to_pin": "warning",
"power_pin_not_driven": "error",
"similar_labels": "warning",
"unannotated": "error",
"unit_value_mismatch": "error",
"unresolved_variable": "error",
"wire_dangling": "error"
}
},
"libraries": {
"pinned_footprint_libs": [],
"pinned_symbol_libs": []
},
"meta": {
"filename": "oko-weatherstation.kicad_pro",
"version": 1
},
"net_settings": {
"classes": [
{
"bus_width": 12.0,
"clearance": 0.2,
"diff_pair_gap": 0.25,
"diff_pair_via_gap": 0.25,
"diff_pair_width": 0.2,
"line_style": 0,
"microvia_diameter": 0.3,
"microvia_drill": 0.1,
"name": "Default",
"pcb_color": "rgba(0, 0, 0, 0.000)",
"schematic_color": "rgba(0, 0, 0, 0.000)",
"track_width": 0.25,
"via_diameter": 0.8,
"via_drill": 0.4,
"wire_width": 6.0
}
],
"meta": {
"version": 2
},
"net_colors": null
},
"pcbnew": {
"last_paths": {
"gencad": "",
"idf": "",
"netlist": "",
"specctra_dsn": "",
"step": "",
"vrml": ""
},
"page_layout_descr_file": ""
},
"schematic": {
"annotate_start_num": 0,
"drawing": {
"default_line_thickness": 6.0,
"default_text_size": 50.0,
"field_names": [],
"intersheets_ref_own_page": false,
"intersheets_ref_prefix": "",
"intersheets_ref_short": false,
"intersheets_ref_show": false,
"intersheets_ref_suffix": "",
"junction_size_choice": 3,
"label_size_ratio": 0.25,
"pin_symbol_size": 0.0,
"text_offset_ratio": 0.08
},
"legacy_lib_dir": "",
"legacy_lib_list": [],
"meta": {
"version": 1
},
"net_format_name": "",
"ngspice": {
"fix_include_paths": true,
"fix_passive_vals": false,
"meta": {
"version": 0
},
"model_mode": 0,
"workbook_filename": ""
},
"page_layout_descr_file": "",
"plot_directory": "",
"spice_adjust_passive_values": false,
"spice_external_command": "spice \"%I\"",
"subpart_first_id": 65,
"subpart_id_separator": 0
},
"sheets": [
[
"3172f2e2-18d2-4a80-ae30-5707b3409798",
""
]
],
"text_variables": {}
}

File diff suppressed because it is too large Load diff