-
Notifications
You must be signed in to change notification settings - Fork 19
New example of mlx90640 on PyGamer #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This example does the following: 1) Create a color gradient into a palette of 64 colors ( using code from http://www.andrewnoske.com/wiki/Code_-_heatmaps_and_color_gradients ) In Loop: 2) Scan the mlx90640 at 4HZ (works for me with a refresh ever 0.4x seconds) 3) Map the temperature to palette index in a min to max range (anything below min goes to index 0 and above max to index 63) 4) While mapping the color, compute a new min and a new max for adjusting the color scale.
I don't have access to that hardware for the moment... There are a lot of possible enhancement for this code to fully use the PyGamer capabilities:
|
hey @dglaude , awesome work! This is a great example. I'm happy to test this when my MLX90640 arrives if someone doesn't beat me to it. I'll go ahead and test on the PyBadge/Edge Badge and HalloWing M4 as well as I think it should work on them. Regarding the PyLint errors, it's just a bit of formatting that needs to be tweaked. No rush on our end; you can work on fixing them when you've got access to hardware again. The warning messages are fairly self explanatory. We've got a great guide on PyLint that you can refer to: Additionally feel free to ask any questions here and I'm glad to help. |
Hi @siddacious, No doubt this would work on PyBadge and Edge Badge as it is the same resolution. But that was not leaving enough space for displaying min and max. That fit on a HalloWingM0 kind of screen 128x128 (this is what I have used in the past on a PiZero. Here are my original source code (various version with enhancement and link to video/image on Twitter where I do microblogging): https://gist.github.com/dglaude/2d21262b1c776e7279f39258876d32d6 However be aware that there is competition on the PyBadger and Eduardo has shown his own version on "Show and Tell" of 2020/1/1: https://www.youtube.com/watch?v=ENVEeFbJBQ8&t=925 |
Make pylint happy ?
pylint will never like my use of global for min and max computation...
Remove the use of global to compute mini and maxi. Require a1 and a2 as parameter and moving the min/max computation. Also b1=0 to use all the color.
remove one more global
Sorry, my local install of pylint was reporting more than the one running here... so it took a few try to pass the test (and it still work on the hardware). |
Awesome, thanks @dglaude . Unfortunately I make a mistake and didn't order the mlx when I thought I did so there may be a delay in testing unless I can find someone else to test. |
I mentioned on Discord that I'd made something similar but it looks like @dglaude 's is more polished. I'll grab it and take a look this evening. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great on my pygamer with the 110° FOV thermal camera. It could clearly be made more sophisticated, but that's not what examples are for.
Updating https://github.com/adafruit/Adafruit_CircuitPython_HT16K33 to 2.6.0 from 2.3.1: > Merge pull request adafruit/Adafruit_CircuitPython_HT16K33#47 from makermelissa/marquee > Merge pull request adafruit/Adafruit_CircuitPython_HT16K33#49 from makermelissa/matrix_scroll > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_HT16K33#41 from vdehors/master > Merge pull request adafruit/Adafruit_CircuitPython_HT16K33#46 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_LSM6DS to 2.0.0 from 1.0.0: > Update README.rst > Update README.rst > Merge pull request adafruit/Adafruit_CircuitPython_LSM6DS#2 from adafruit/lsm6ds_refactor > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_LSM6DS#1 from adafruit/dherrada-patch-1 > added additional rates & sensor identifier Updating https://github.com/adafruit/Adafruit_CircuitPython_MLX90640 to 1.0.2 from 1.0.1: > Merge pull request adafruit/Adafruit_CircuitPython_MLX90640#7 from dglaude/patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_MLX90640#8 from caternuson/iss2 > Merge pull request adafruit/Adafruit_CircuitPython_MLX90640#5 from dglaude/patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_MLX90640#4 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_FeatherWing to 1.9.4 from 1.9.3: > Merge pull request adafruit/Adafruit_CircuitPython_FeatherWing#51 from makermelissa/master > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_FeatherWing#50 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_MotorKit to 1.3.3 from 1.3.2: > Merge pull request adafruit/Adafruit_CircuitPython_MotorKit#24 from caternuson/iss23 Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA: > Added the following libraries: Adafruit_CircuitPython_LSM6DS
This example does the following:
In Loop:
2) Scan the mlx90640 at 4HZ (works for me with a refresh ever 0.4x seconds)
3) Map the temperature to palette index in a min to max range (anything below min goes to index 0 and above max to index 63)
4) While mapping the color, compute a new min and a new max for adjusting the color scale.
5) Display the min and max temperature and the color scale below the image