Skip to content

Commit 0365dcf

Browse files
committed
update to v1.1.0
1 parent 4b0b9f9 commit 0365dcf

File tree

4 files changed

+46
-52
lines changed

4 files changed

+46
-52
lines changed

README.md

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,44 @@ This driver depends on:
99

1010
This is easy to install with the following command.
1111
```
12+
1213
curl -sL https://github.com/Seeed-Studio/grove.py/raw/master/install.sh | sudo bash -s -
14+
1315
```
1416

1517
## Installing from PyPI
1618

1719
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:
1820

1921
```
22+
2023
pip3 install seeed-python-mlx90640
24+
2125
```
2226

2327
To install system-wide (this may be required in some cases):
2428

2529
```
30+
2631
sudo pip3 install seeed-python-mlx90640
32+
33+
```
34+
35+
if you want to update the driver locally from PyPI. you can use:
36+
37+
```
38+
pip3 install --upgrade seeed-python-mlx90640
2739
```
2840

2941
## Usage Notes
3042

3143
First, Check the corresponding i2c number of the board:
44+
3245
```
46+
3347
(.env) pi@raspberrypi:~ $ ls /dev/i2c*
3448
/dev/i2c-1
49+
3550
```
3651

3752
Check if the i2c device works properly, 0x33 is the MLX90640 i2c address.
@@ -56,13 +71,13 @@ Initialize the sersor object and config the sersor refresh rate.
5671

5772
```python
5873
import seeed_mlx90640
59-
sensor = seeed_mlx90640.grove_mxl90640()
60-
sensor.SetRefreshRate(0x04)
74+
mlx = seeed_mlx90640.grove_mxl90640()
75+
mlx.refresh_rate = seeed_mlx90640.RefreshRate.REFRESH_8_HZ # The fastest for raspberry 4
6176
# 0x00 0.5HZ
6277
# 0x01 1HZ
6378
# 0x02 2HZ
64-
# 0x03 4HZ(recommend for raspberry)
65-
# 0x04 8HZ
79+
# 0x03 4HZ
80+
# 0x04 8HZ(recommend for raspberry)
6681
# 0x05 16HZ
6782
# 0x06 32HZ
6883
# 0x07 64HZ
@@ -73,27 +88,18 @@ sensor.SetRefreshRate(0x04)
7388
To read from the sensor:
7489

7590
```python
76-
Pixel = [0]*801
77-
for i in range(0,801):
78-
Pixel[i] = sensor.getCompensatedPixData(i//32,i%32)
79-
del Pixel[0:33]
80-
print(len(Pixel)) #24x32 pixel
81-
print(Pixel)
91+
try:
92+
mlx.getFrame(frame)
93+
except ValueError:
94+
continue
8295
```
8396

84-
If you're just using the MLX90640 on iic.You can add content that below to the config.txt.
85-
86-
```bash
87-
dtparam=i2c_arm=on,i2c_arm_baudrate=1000000
88-
```
89-
90-
This will give you a framerate of - at most - 32FPS.
91-
92-
and If you have other iic device ,maybe you can add content that below to the config.txt to get the fastest rate recommended for compatibility
97+
maybe you can add content that below to the config.txt to get the fastest rate recommended for compatibility
9398

9499
```bash
95100
dtparam=i2c_arm=on,i2c_arm_baudrate=400000
96101
```
102+
97103
This will give you a framerate of - at most - 8FPS.
98104

99105
## Contributing

examples/BasicReadings.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
import seeed_mlx90640
22
import time
33
def main():
4-
sensor = seeed_mlx90640.grove_mxl90640()
4+
mlx = seeed_mlx90640.grove_mxl90640()
5+
frame = [0] * 768
56
while True:
6-
Pixel = [0]*801
7-
for i in range(0,801):
8-
Pixel[i] = sensor.GetCompensatedPixData(i//32,i%32)
9-
print(Pixel[i])
10-
7+
start = time.time()
8+
try:
9+
mlx.getFrame(frame)
10+
except ValueError:
11+
continue
12+
print(frame)
13+
end = time.time()
14+
print("The time: %f"%(end - start))
1115
if __name__ == '__main__':
1216
main()

examples/MaxRefreshRate.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
import seeed_mlx90640
22
import time
33
def main():
4-
sensor = seeed_mlx90640.grove_mxl90640()
5-
sensor.SetRefreshRate(0x04)
6-
# 0x00 0.5HZ
7-
# 0x01 1HZ
8-
# 0x02 2HZ
9-
# 0x03 4HZ(recommend for raspberry)
10-
# 0x04 8HZ
11-
# 0x05 16HZ
12-
# 0x06 32HZ
13-
# 0x07 64HZ
4+
mlx = seeed_mlx90640.grove_mxl90640()
5+
mlx.refresh_rate = seeed_mlx90640.RefreshRate.REFRESH_8_HZ # The fastest for raspberry 4
6+
frame = [0] * 768
147
while True:
15-
Pixel = [0]*801
16-
for i in range(0,801):
17-
Pixel[i] = sensor.GetCompensatedPixData(i//32,i%32)
18-
print(Pixel[i])
8+
start = time.time()
9+
try:
10+
mlx.getFrame(frame)
11+
except ValueError:
12+
continue
13+
print(frame)
14+
end = time.time()
15+
print("The time: %f"%(end - start))
1916
if __name__ == '__main__':
2017
main()

examples/Visualization.py

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)