Page 1
Welcome! Thank you for purchasing our AZ-Delivery GY-906 Infrared Temperature Module. On the following pages, you will be introduced to how to use and set-up this handy device. Have fun!
Page 2
Areas of application Education and teaching: Use in schools, universities and training institutions to teach the basics of electronics, programming and embedded systems. Research and development: Use in research and development projects to create prototypes and experiments in the fields of electronics and computer science. Prototype development: Use in the development and testing of new electronic circuits and devices.
Page 3
consult a doctor. Caution: Keep the product out of the reach of children and pets to avoid accidental contact and swallowing of small parts. Note: Store the product in a safe, closed container when not in use. Attention: Avoid contact of the product with food and drinks.
Table of Contents Introduction....................3 Specifications....................5 The pinout.....................6 How to set-up Arduino IDE................7 How to set-up the Raspberry Pi and Python..........11 Connecting the screen with Atmega328P Board.........12 Library for Arduino IDE................13 Sketch example..................14 Connecting the screen with Raspberry Pi...........18 Enabling the I2C interface...............19 Python script....................21 - 2 -...
Introduction In the heart of the GY-906 module, there is the MLX90614 infrared sensor. It is an infrared thermometer for contactless temperature measurements. Both the IR sensitive thermopile detector chip and the signal conditioning ASIC are integrated into the same TO-39 can package. A low noise amplifier, 17- bit ADC and powerful DSP unit, that are integrated into the MLX90164, provide high accuracy and resolution of the thermometer.
Page 6
So, each object emits infrared light depending on its heat, and the light is detected using a thermopile which gets hotter and hotter, at the same time converting the excess heat to electricity. The sensor measures infrared light that gets emitted by objects so it can sense temperature without having to touch the objects physically.
Specifications » Operating voltage range: from 3.3V to 5V DC » Max current » Communication protocol: » Range for ambient temperature: from -40°C to 125°C [-40 to 257°F] » Range for object temperature: from -70 to 380°C [-94 to 716°F] »...
The pinout The GY-906 infrared temperature module has four pins. The pinout is shown in the following image: The pins of the module can be connected to a 3.3V or 5V power supply without danger to the sensor itself. The module has the 3.3V voltage regulator on-board.
How to set-up Arduino IDE If the Arduino IDE is not installed, follow the link and download the installation file for the operating system of choice. For Windows users, double click on the downloaded .exe file and follow the instructions in the installation window. - 7 -...
Page 10
For Linux users, download a file with the extension .tar.xz, which has to be extracted. When it is extracted, go to the extracted directory and open the terminal in that directory. Two .sh scripts have to be executed, the first called arduino-linux-setup.sh and the second called install.sh.
Page 11
Almost all operating systems come with a text editor preinstalled (for example, Windows comes with Notepad, Linux Ubuntu comes with Gedit, Linux Raspbian comes with Leafpad, etc.). All of these text editors are perfectly fine for the purpose of the eBook. Next thing is to check if your PC can detect a microcontroller board.
Page 12
If the Arduino IDE is used on Windows, port names are as follows: For Linux users, for example, port name is /dev/ttyUSBx, where x represents integer number between 0 and 9. - 10 -...
How to set-up the Raspberry Pi and Python For the Raspberry Pi, first the operating system has to be installed, everything has to be set-up so that it can be used in Headless mode. The Headless mode enables remote connection to the Raspberry Pi, without the need for a PC screen Monitor, mouse or keyboard.
Connecting the screen with Atmega328P Board Connect the GY-906 module with the microcontroller board as shown on the following connection diagram: MLX90164 pin Microcontroller pin Wiring color Red wire Black wire Green wire Blue wire - 12 -...
Library for Arduino IDE To use the module with microcontroller board it is recommended to download an external library for it. The library that is used in this eBook is called Adafruit_MLX90614. To download and install it open Arduino IDE and go to: Tools >...
Sketch example The following sketch example is modified sketch from the Adafruit MLX90614 Library: File > Examples > Adafruit MLX90614 > mlxtest #include <Wire.h> #include <Adafruit_MLX90614.h> Adafruit_MLX90614 itemp = Adafruit_MLX90614(); void setup() { Serial.begin(9600); Serial.println("Adafruit MLX90614 test"); itemp.begin(); void loop() { Serial.print("\nAmbient = ");...
Page 17
Upload the sketch to the microcontroller board and open Serial Monitor (Tools > Serial Monitor). The result should look like the output in the following image: - 15 -...
Page 18
sketch begins with including libraries: Wire Adafruit_MLX90614. The first one is used for I2C communication and the second one is used for functions to control the sensor. Next, the object called itemp is created with the following line of code: Adafruit_MLX90614 itemp = Adafruit_MLX90614;...
Page 19
To read the ambient temperature in Fahrenheit, use the following line of code: itemp.readAmbientTempF() To read the object temperature in Fahrenheit (object that is in front of the sensor) use the following line of code: itemp.readObjectTempF() At the end of the loop() function there is a delay pause of 2.5 seconds (2500 milliseconds) which can be changed in the following line of code: delay(2500);...
Connecting the screen with Raspberry Pi Connect the GY-906 module with the Raspberry Pi as shown in the following connection diagram: MLX90164 pin Raspberry Pi pin Physical pin No. Wire color Black wire Red wire GPIO3 Blue wire GPIO2 Green wire...
Enabling the I2C interface In order to use the module with Raspberry Pi, the I2C interface on the Raspberry Pi has to be enabled. To do so, go to: Application Menu > Preferences > Raspberry Pi Configuration When a new window opens, find the Interfaces tab. Then enable the I2C radio button and click OK, as shown in the following image: - 19 -...
Page 22
To detect the I2C address of the module, the i2ctools has to be installed on the Raspbian, if it is not installed, open the terminal and run the following commands: sudo apt-get update sudo apt-get install i2c-tools Then, open the terminal and run the following command: i2cdetect -y 1 The result should look like the output in the following image: Where 0x5a is the I2C address of the sensor.
Python script import time import smbus u'\xb0' # UTF-8 degree sign i2c_address 0x5a # I2C address of the GY-906 sensor # Temperature registers addresses MLX90614_TA 0x06 # Ambient temp MLX90614_TOBJ1 0x07 # Object temp # Read temperature registers and calculate Celsius ambC(): bus.read_i2c_block_data(i2c_address, MLX90614_TA, 2)
Page 24
ambF(): return ambC() 32.0 objF(): return objC() 32.0 # Initialize I2C (SMBus) smbus.SMBus(1) print('[Press CTRL + C to end the script!]') try: while True: print('Ambient: {:.1f}{}C\tObject: {:.1f}{}C'. format(ambC(), ds, objC(), ds)) print('Ambient: {:.1f}{}F\tObject: {:.1f}{}F'. format(ambF(), ds, objF(), ds)) time.sleep(1) except KeyboardInterrupt: print('\nScript end!')
Page 25
Save the script by the name gy906.py. To run the script open the terminal in the directory where the script is saved and run the following command: python3 gy906.py The result should look like the output in the following image: To stop the script press CTRL + C on the keyboard.
Page 26
The script starts with importing two libraries: time and SMBus. The time library is used for time functionality and the SMBus (System Management Bus) is used for reading/writing information on the I2C interface. Next, the variable ds is created. The UTF degree sign value is stored here. It is needed to display the result accurately.
Page 27
The second function is called objC(). It has no arguments and returns a float value. The function reads the register that holds the object temperature data and converts raw data into readable temperature in Celsius. The returned float value represents the object temperature data in Celsius. To convert temperature from Celsius to Fahrenheit, two functions called ambF() and objF() are created.
Page 28
If you are looking for the high quality microelectronics and accessories, AZ-Delivery Vertriebs GmbH is the right company to get them from. You will be provided with numerous application examples, full installation guides, eBooks, libraries and assistance from our technical experts.
Need help?
Do you have a question about the GY-906 and is the answer not in the manual?
Questions and answers