Mounting the circuit

With this project requiring a simple 4-wire connection as part of this sensor's i2c interface, the mounting of this circuit should be fairly simple for new makers especially, when no breadboard is even needed. Before we start, remove any power from the Arduino or the sensor to prevent any shortage or electrical currents from running through your circuit while it is live. This is important to any connections in any of the projects we have, as it could harm the components or it could even harm you possibly. Now let's get into the wiring by first using a Male-Female jumper wire to connect the VIN (+) pin on the MLX90614 Infrared Temperature Sensor to the 5v (+) pin on your Arduino board. Secondly, use another wire to connect the GND (-) pin on the sensor to any of your GND (-) pins on your Arduino board. Now, we will connect the i2c pins, starting with connecting the SDA (Serial Data) pin on your temperature sensor to the SDA (Serial Data) pin on your Arduino board and the SCL (Serial Clock) pin on the sensor to the SCL (Serial Clock) pin on your Arduino board again. The mounting of this circuit is done!

Arduino MLX90614 Infrared Temperature Sensor Project Code

#include <Wire.h>
#include <Adafruit_MLX90614.h>
Adafruit_MLX90614 mlx = Adafruit_MLX90614();

void setup() {
  Serial.begin(9600);
  Serial.println("Adafruit MLX90614 test");  
  mlx.begin();  
}

void loop() {
  Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempC()); 
  Serial.print("*C\tObject = "); Serial.print(mlx.readObjectTempC()); Serial.println("*C");
  Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempF()); 
  Serial.print("*F\tObject = "); Serial.print(mlx.readObjectTempF()); Serial.println("*F");
  Serial.println();
  delay(500);
}

About the code

With this code consisting of basic functions, arguments and many more aspects of C++, there is nothing which can get easier than this sketch. It is based on simple commands to use this sensor in the Arduino IDE, perfect for any beginner. So, to get into it, the first two lines of this sketch declares libraries which we will use, the Wire library for our sensor's interface, and the Adafruit MLX90614, a library specifically built for reading data from the MLX90614 sensor. The third line is an instance which basically states that we will be using the MLX90614 sensor throughout this sketch. Next, we encounter the standard void setup section, where it starts with stating that the serial communication's rate will be at 9600 bauds. Then, the following command prints out a string, "Adafruit MLX90614 Test" into the serial monitor, for us to know that the code is working well. The next line begins the sensor's communication altogether. At this point, the void setup section is now done, and the void loop section is now present in this sketch. In this section, we print the string, "Ambient =", and then we print the ambient temperature in Celsius directly after that string, using the Serial.print(mlx.readAmbientTempC()); command. The next line is similar, where it prints the string, "Object = ", and then the object temperature in Celsius using a similar command to the one I have said about the ambient temperature's command. This same concept repeats itself to print the ambient and object temperature in Fahrenheit for the next consecutive two lines. This process of repeating this series of data with an interval of 500 milliseconds every time goes on forever until power is disconnected or your sensor is disconnected. Our sketch is finally wrapped up now!

Amazing opportunities

Also, be sure to check out PCBWay, a leading manufacturer and distributor in PCB design and manufacturing. They have amazing prices and excellent quality in their services, so don't miss out on them! Plus, PCBWay has an amazing website, online Gerber viewer function and a gift shop so make sure to check out their links below:

PCBWay Free Online Gerber Viewer Function:  https://www.pcbway.com/project/OnlineGerberViewer.html

PCBWay Gift Shop: https://www.pcbway.com/projects/gifts.html

Make sure you check out the review for this module by clicking here.

Enjoy! Contact us for any inquiries!