Skip to content

MLX90614 I2C communication on Arduino Nano Every #88

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

Closed
omersa opened this issue Dec 1, 2020 · 9 comments · Fixed by #90
Closed

MLX90614 I2C communication on Arduino Nano Every #88

omersa opened this issue Dec 1, 2020 · 9 comments · Fixed by #90
Labels
bug Something isn't working

Comments

@omersa
Copy link

omersa commented Dec 1, 2020

I have bought 6pack of Arduino Nano Every and built a splecial shield plate, so I can connect thermal sensor MLX90614, which communicate over I2C (A4,A5). The sensor was well tested on few Nano devices and on all it's OK. But with Arduino Nano Every it does not work. The device can be found on port I2C (search address), but no communication is going through. No data can be read or write. Tried many libraries and the problem persists with all.

As this device is has different processor then classic Nano, it seems that libraries for megaAVR boards are not OK. Also I am not alone with this problem. I think it persist on all Wire communication with Every.

@alranel
Copy link
Contributor

alranel commented Dec 1, 2020

Hi @omersa, could you provide some more details about your setup?
Which libraries are you using? Did you add pullups? Are you using a "naked" thermal sensor or does it have a breakout?

@omersa
Copy link
Author

omersa commented Dec 1, 2020

Sensor is in a 5V package with SDA and SCL out and is working well on all other Nano boards. The connection of SDA is A4 port and SCL A5 port, as normally. When you query the device on address 0x5A it confirms the connection, but no data is transmitted or received. Normally I am using Adafruit_MLX90614 library, but is also not working with any other wire type library.

I think pull-up resistors are on a sensor's board:
128930899_770627040192051_7426625885471462101_n

@alranel alranel transferred this issue from arduino/Arduino Dec 2, 2020
@omersa
Copy link
Author

omersa commented Dec 4, 2020

I have done some deep search into sources and I have found out that Wire and Twi libraries for megaavr (Arduino Nano Every) are completelly different from avr libraries that work on Nano. They are much older with no timeouts and many other changes. It seems that until somebody renew the libraries for megaavr boards, ther will be no solution. Have tried to take libraries from avr, but does not work, as it seems there is much difference in all other libraries.

@alranel
Copy link
Contributor

alranel commented Dec 4, 2020

@omersa, we are definitely going to check this - give us some time and we'll get back to you :)

@alranel
Copy link
Contributor

alranel commented Dec 6, 2020

I got a GY-906 breakout board like yours and I was able to reproduce the issue. I did these tests:

  • ✅ Arduino Uno: works fine
  • ❌ Arduino Nano Every (with official megaAVR board package, with/without 328 registers emulation): does not work
  • ✅ Arduino Nano Every (with MegaCoreX board package): works fine

@alranel alranel added the bug Something isn't working label Dec 6, 2020
@omersa
Copy link
Author

omersa commented Dec 6, 2020

You right. I manage to make it work with MegaCoreX. Thank you.

@omersa
Copy link
Author

omersa commented Dec 7, 2020

I changed the twi.c and - YES, it works fine now. Thank you for all your help.

@alranel
Copy link
Contributor

alranel commented Dec 7, 2020

Thank you for reporting the issue @omersa!

@Nolan-Walker
Copy link

Hi there @alranel , I am having the same issue as above but the change is not working for me. I have the MLX90614-DCI version of the sensor without the PCB ("naked version"); I have also soldered a 100nF capacitor between VSS and VDD... When using the regular Arduino Nano the sensor works fine, but when I use the Arduino Nano Every, the sensor does not work and returns "nan". I have the updated version of the arduinocore - megaavr board package and I also have tried using MegaCoreX board package and neither of these are fixing the issue for me.

Any help would be greatly appreciated! Thank you for your time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants