Using MLX90640 with Pico

Is it possible to use the MLX90640 with a Pico?

yes, sure. There are C and python implementations available.

Thanks, but I would need more information. Everything I have found so far seems to be heavily based on Linux. I am running Thonny under Windows. Is there anything “ready to go” for the Pico and microPython?

if I ask google about “mlx90640 micropython”, I get tons of hits.

Not a very helpful (or friendly) reply. I had of course done this (see my earlier post), with indeed “tons of hits” - most of them adverts for thermal cameras, unclear YouTube videos, or Linux based posts assuming the use of Raspberry Pi rather than Pico.
Still I made another search and found (only) one post by David Gaude which looks as if it could be useful. I will try and take it further from there.

I have tried everything I could find or think of, but without success. Very disappointed with your (lack of) support on this. Not what I expect from Pimoroni. I must regard this as an expensive wasted purchase.

Hi Bobha - sorry that none of us spotted this one, it’s been a very busy couple of weeks!

There’s no support for MLX90640 in our C++/MicroPython yet (there’s a list in the pimoroni-pico readme of which breakouts are currently supported: GitHub - pimoroni/pimoroni-pico: Libraries and examples to support Pimoroni Pico add-ons in C++ and MicroPython. ).

I tried David Glaude’s CircuitPython code for this sensor plus a display some time ago and it seemed to work for me (albeit slowly). CircuitPython in general might be the easiest way to go for this sensor as I think Adafruit’s MLX90640 breakout is pretty similar to ours.

Alternatively, there’s a couple of proof of concept PRs on pimoroni-pico that might be worth a look at, though I think they’re C/C++ only:

Hi Hel,
Thanks for your reply. I can imagine that it was pretty hectic recently.
I didn’t get anywhere with David Glaude’s script and CircuitPython, probably due to insufficient knowledge on my part. C/C++ is probably also beyond me. Is the situation for Pi Zero or 3B+ any better than for Pico?
I am still surprised and disappointed though that Pimoroni sells a product that “works with all versions of the Raspberry Pi”, but without adequate support.
Bob

There’s instructions here for using this sensor with a Raspberry Pi computer if you want to give it a go: GitHub - pimoroni/mlx90640-library: Python library for the MLX90640 thermal camera

I am still surprised and disappointed though that Pimoroni sells a product that “works with all versions of the Raspberry Pi”

Ah, yeah - I think this copy was written when “all versions of the Raspberry Pi” were single board computers, and no Raspberry Pi microcontrollers existed! Everything that’s Pico-compatible should explicitly say so on the relevant shop pages, but I’ll tweak this wording on this one so it’s less ambiguous.

If you want to return the sensor so you can buy something more suitable, drop support a message with a link to this thread and they should be able to help you out.

Thanks. I’ll give it a go with a Pi first though, using the link you gave.

Having MLX90640 library for MicroPython will be great.

I have used tufty2040 + vl53l5cx — it was a lovely experience. With 20–30 lines of code in MicroPython, I was able to get data from vl53l5cx and draw a distance heatmap on the tufty2040’s screen.

Pairing tufty2040 with MLX90640 will give a super nice compact thermal camera. It’s achievable now with a C/C++ library (pimoroni-pico/drivers/mlx90640 at main · pimoroni/pimoroni-pico · GitHub), but it has a much steeper learning curve and harder to play with overall.