MLX90614 IR temperasure sensor with photon

Continuing the discussion from MLX90614 IR Temp sensor:

// This #include statement was automatically added by the Particle IDE.
#include "blynk/blynk.h"

// This #include statement was automatically added by the Particle IDE.
#include "OneWire/OneWire.h"
#include "i2cmaster/i2cmaster.h"

char auth[] = "token";

//#include <Wire.h>

Adafruit_MLX90614 mlx = Adafruit_MLX90614();

void setup() 
{
    Blynk.begin(auth);
    Serial.begin(9600);

    Serial.println("Adafruit MLX90614 test");  

    mlx.begin();  
}

void loop() 
{
    Blynk.run();
    Serial.print("Ambient = "); 
    Serial.print(mlx.readAmbientTempC()); 
    Serial.print("*C\tObject = "); 
    Serial.print(mlx.readObjectTempC()); 
    Serial.println("*C");
    Blynk.virtualWrite(V1, mlx.readAmbientTempC());
    Blynk.virtualWrite(V2, mlx.readObjectTempC());
    //Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempF()); 
    //Serial.print("*F\tObject = "); Serial.print(mlx.readObjectTempF()); 
    //Serial.println("*F");
    //Blynk.virtualWrite(V1, mlx.readAmbientTempF());
    //Blynk.virtualWrite(V2, mlx.readObjectTempF());

    Serial.println();
    delay(500);
}

Before going into your code I’d like to inquire about

These devices should not easily be harmed by flashing code.
Have you tried putting them in Safe Mode and flash some other code to “resurrect” them?

To get top nodge info about the Adafruit_MX90614 state regarding the Photon @peekay123 might be the one to turn to.
Meanwhile you could try to narrow down if it’s the MX90614 or Blynk is causing your trouble be just using one of them at a time :wink:

1 Like

@luckygodswill, I would first test your code without Blynk to make sure you can read your sensor correctly. If you are using the library I posted on my github the I don’t understand why you need the OneWire and i2cmaster libraries. I don’t see any #includes for the sensor library itself! Also, I would read the sensors into a variable first instead of calling the function each time.

So, first get the correct libraries, then change your code to read values into variables before printing and test without Blynk with Serial prints. If it all works, then add Blynk and see if that works. I would not do a delay(500) in loop() and instead replace it with a non-blocking millis() delay so blynk.run(); is not block for 500ms each loop. :smile:

2 Likes

Thanks a lot @ScruffR and @peekay123, great help from you guys :+1: . I tried what you guys said and the photons seem to be working now…It seems that the issue was related to the firmware i was using to flash the photons so i used a lower firmware and it seems to be working now however, I am getting incorrect results. Am using the code provided by @peekay123 on Github. It is displaying the values in the image below.

Please give me a helping hand guys @ScruffR , @peekay123 as am totally new to coding…Thanks a lot

@luckygodswill, those values are maximums. So, let’s go back a bit. Which MLX90614 breakout are you using? How it is powered?

Thanks a lot @peekay123, @ScruffR and others who helped me out. Am very grateful as the first step of what am working on now has been concluded and Am happy to say that I am getting the values I want.

2 Likes

Hi, can you confirm that the MLX90614 work with photon using the libraries from @peekay123? @ScruffR?

We are having a few issues getting data to post using the example codes on photons we have distribute to students for energy research projects.

To clarify- we are using libraries from @peekay123 Github, and the sample code there, but not getting data printed to serial or posted to cloud

We are using firmware 0.4.9 on the Photons

Some more info about the issue would be good - some of the questions were already asked in the posts above:

  • Have you read all comments in this thread?
  • Are you using the bare sensor or a breakout board? (which?)
  • Have you got correct pull-up resistors in place? (which?)
  • Do you get anything at all printed to serial?
  • What does the RGB LED do?
  • Why would you expect anything to be posted to the cloud? There is no such thing happening in the sample.
  • Have you searched the forum for MLX9061 and read the threads?
  • What have you tried?
1 Like

What did you do to get the value to not read out 1037.55?? I am having the same issue?

This post was flagged by the community and is temporarily hidden.