Skip to content

Commit 78680f7

Browse files
authored
Merge pull request #3 from SolderedElectronics/dev
Add BMP280 MicroPython module and update README
2 parents 2c9cb49 + a7a6b62 commit 78680f7

19 files changed

Lines changed: 616 additions & 0 deletions

File tree

Actuators/DS3234/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# How to install
2+
3+
---
4+
5+
After [**installing the mpremote package**](https://docs.micropython.org/en/latest/reference/mpremote.html), flash a module to the board using the following command:
6+
7+
```sh
8+
mpremote mip install github:SolderedElectronics/Soldered-Micropython-modules/Actuators/DS3234
9+
```
10+
Or, if you're running a Windows OS:
11+
12+
```sh
13+
python -m mpremote mip install github:SolderedElectronics/Soldered-Micropython-modules/Actuators/DS3234
14+
```

Actuators/MCP23017/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# How to install
2+
3+
---
4+
5+
After [**installing the mpremote package**](https://docs.micropython.org/en/latest/reference/mpremote.html), flash a module to the board using the following command:
6+
7+
```sh
8+
mpremote mip install github:SolderedElectronics/Soldered-Micropython-modules/Actuators/MCP23017
9+
```
10+
Or, if you're running a Windows OS:
11+
12+
```sh
13+
python -m mpremote mip install github:SolderedElectronics/Soldered-Micropython-modules/Actuators/MCP23017
14+
```

Communication/RFID/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# How to install
2+
3+
---
4+
5+
After [**installing the mpremote package**](https://docs.micropython.org/en/latest/reference/mpremote.html), flash a module to the board using the following command:
6+
7+
```sh
8+
mpremote mip install github:SolderedElectronics/Soldered-Micropython-modules/Communication/RFID
9+
```
10+
Or, if you're running a Windows OS:
11+
12+
```sh
13+
python -m mpremote mip install github:SolderedElectronics/Soldered-Micropython-modules/Communication/RFID
14+
```

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,42 @@ Each module in the library is designed to be lightweight, readable, and compatib
1616

1717
---
1818

19+
## Currently available MicroPython modules
20+
21+
### Sensors
22+
- [AD8495](Sensors/AD8495/)
23+
- [APDS9960](Sensors/APDS9960/)
24+
- [BME280](Sensors/BME280/)
25+
- [BME680](Sensors/BME680/)
26+
- [BME688](Sensors/BME688/)
27+
- [BMP180](Sensors/BMP180/)
28+
- [BMP280](Sensors/BMP280/)
29+
- [BMP388](Sensors/BMP388/)
30+
- [HallEffect](Sensors/HallEffect/)
31+
- [LaserDistanceSensor](Sensors/LaserDistanceSensor/)
32+
- [LTR507](Sensors/LTR507/)
33+
- [ObstacleSensor](Sensors/ObstacleSensor/)
34+
- [PirSensor](Sensors/PirSensor/)
35+
- [RotaryEncoder](Sensors/RotaryEncoder/)
36+
- [SHTC3](Sensors/SHTC3/)
37+
- [TMP117](Sensors/TMP117/)
38+
- [UltrasonicSensor](Sensors/UltrasonicSensor/)
39+
40+
### Actuators
41+
- [DRV8825](Actuators/DRV8825/)
42+
- [DS3234](Actuators/DS3234/)
43+
- [MCP23017](Actuators/MCP23017/)
44+
- [WS2812](Actuators/WS2812/)
45+
46+
### Communication
47+
- [RFID](Communication/RFID/)
48+
49+
### Displays
50+
- [LCD-I2C](Displays/LCD-I2C/)
51+
- [SSD1306](Displays/SSD1306/)
52+
53+
---
54+
1955
## Installation
2056
You can install a specific module using mpremote or manually downloading specific files onto the board using an IDE such as [Thonny](https://thonny.org/)
2157

Sensors/AD8495/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# How to install
2+
3+
---
4+
5+
After [**installing the mpremote package**](https://docs.micropython.org/en/latest/reference/mpremote.html), flash a module to the board using the following command:
6+
7+
```sh
8+
mpremote mip install github:SolderedElectronics/Soldered-Micropython-modules/Sensors/AD8495
9+
```
10+
Or, if you're running a Windows OS:
11+
12+
```sh
13+
python -m mpremote mip install github:SolderedElectronics/Soldered-Micropython-modules/Sensors/AD8495
14+
```

Sensors/BME688/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# How to install
2+
3+
---
4+
5+
After [**installing the mpremote package**](https://docs.micropython.org/en/latest/reference/mpremote.html), flash a module to the board using the following command:
6+
7+
```sh
8+
mpremote mip install github:SolderedElectronics/Soldered-Micropython-modules/Sensors/BME688
9+
```
10+
Or, if you're running a Windows OS:
11+
12+
```sh
13+
python -m mpremote mip install github:SolderedElectronics/Soldered-Micropython-modules/Sensors/BME688
14+
```
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# FILE: bmp280-forcedMode.py
2+
# AUTHOR: Josip Šimun Kuči @ Soldered
3+
# BRIEF: One-shot measurements in forced mode with custom sampling
4+
# WORKS WITH: Pressure & Temperature sensor BMP280 Breakout
5+
# LAST UPDATED: 2025-01-15
6+
7+
from machine import Pin, I2C
8+
from bmp280 import BMP280
9+
10+
# Import constants from separate file to keep examples stable if defaults change.
11+
from bmp280_constants import (
12+
FORCED_MODE,
13+
OVERSAMPLING_X8,
14+
OVERSAMPLING_X2,
15+
IIR_FILTER_2,
16+
)
17+
import time
18+
19+
# If you aren't using the Qwiic connector, manually enter your I2C pins
20+
# i2c = I2C(0, scl=Pin(22), sda=Pin(21))
21+
# bmp280 = BMP280(i2c)
22+
23+
# Initialize sensor over Qwiic
24+
bmp280 = BMP280()
25+
26+
# Configure sampling rates and filter
27+
bmp280.setOversampling(
28+
presOversampling=OVERSAMPLING_X8, tempOversampling=OVERSAMPLING_X2
29+
)
30+
bmp280.setIIRFilter(IIR_FILTER_2)
31+
bmp280.setMode(FORCED_MODE)
32+
while True:
33+
temperature, pressure, altitude = bmp280.getMeasurements()
34+
print("{:.2f}*C {:.2f}hPa {:.2f}m".format(temperature, pressure, altitude))
35+
time.sleep(1)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# FILE: bmp280-normalMode.py
2+
# AUTHOR: Josip Šimun Kuči @ Soldered
3+
# BRIEF: Continuous measurements in normal mode with custom sampling
4+
# WORKS WITH: Pressure & Temperature sensor BMP280 Breakout
5+
# LAST UPDATED: 2025-01-15
6+
7+
from machine import Pin, I2C
8+
from bmp280 import BMP280
9+
10+
# Import constants from separate file to keep examples stable if defaults change.
11+
from bmp280_constants import (
12+
NORMAL_MODE,
13+
OVERSAMPLING_X4,
14+
OVERSAMPLING_X2,
15+
IIR_FILTER_4,
16+
STANDBY_1000MS,
17+
)
18+
import time
19+
20+
# If you aren't using the Qwiic connector, manually enter your I2C pins
21+
# i2c = I2C(0, scl=Pin(22), sda=Pin(21))
22+
# bmp280 = BMP280(i2c)
23+
24+
# Initialize sensor over Qwiic
25+
bmp280 = BMP280()
26+
27+
# Configure sampling rates and filter
28+
bmp280.setOversampling(
29+
presOversampling=OVERSAMPLING_X4, tempOversampling=OVERSAMPLING_X2
30+
)
31+
bmp280.setIIRFilter(IIR_FILTER_4)
32+
bmp280.setStandbyTime(STANDBY_1000MS)
33+
bmp280.setMode(NORMAL_MODE)
34+
35+
while True:
36+
temperature, pressure, altitude = bmp280.getMeasurements()
37+
print("{:.2f}*C {:.2f}hPa {:.2f}m".format(temperature, pressure, altitude))
38+
time.sleep(1)
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# FILE: bmp280-sleepMode.py
2+
# AUTHOR: Josip Šimun Kuči @ Soldered
3+
# BRIEF: Sleep mode example with manual wake for a single measurement
4+
# WORKS WITH: Pressure & Temperature sensor BMP280 Breakout
5+
# LAST UPDATED: 2025-01-15
6+
7+
from machine import Pin, I2C
8+
from bmp280 import BMP280
9+
10+
# Import constants from separate file to keep examples stable if defaults change.
11+
from bmp280_constants import (
12+
SLEEP_MODE,
13+
FORCED_MODE,
14+
OVERSAMPLING_X1,
15+
IIR_FILTER_OFF,
16+
)
17+
import time
18+
19+
# If you aren't using the Qwiic connector, manually enter your I2C pins
20+
# i2c = I2C(0, scl=Pin(22), sda=Pin(21))
21+
# bmp280 = BMP280(i2c)
22+
23+
# Initialize sensor over Qwiic
24+
bmp280 = BMP280()
25+
26+
# Configure low-power sampling
27+
bmp280.setOversampling(
28+
presOversampling=OVERSAMPLING_X1, tempOversampling=OVERSAMPLING_X1
29+
)
30+
bmp280.setIIRFilter(IIR_FILTER_OFF)
31+
bmp280.setMode(SLEEP_MODE)
32+
33+
while True:
34+
# Wake up for a single measurement
35+
bmp280.setMode(FORCED_MODE)
36+
time.sleep(0.05)
37+
38+
temperature, pressure, altitude = bmp280.getMeasurements()
39+
print("{:.2f}*C {:.2f}hPa {:.2f}m".format(temperature, pressure, altitude))
40+
41+
# Back to sleep between samples
42+
bmp280.setMode(SLEEP_MODE)
43+
time.sleep(2)

0 commit comments

Comments
 (0)