Outils pour utilisateurs

Outils du site


divers_elec:mlx90614:mlx90614

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
divers_elec:mlx90614:mlx90614 [05/2018] – [liens] freddivers_elec:mlx90614:mlx90614 [07/2019] (Version actuelle) – [cablibration] fred
Ligne 4: Ligne 4:
     * http://bildr.org/2011/02/mlx90614-arduino/     * http://bildr.org/2011/02/mlx90614-arduino/
     * https://www.raspberrypi.org/forums/viewtopic.php?t=17738     * https://www.raspberrypi.org/forums/viewtopic.php?t=17738
 +    * S_DATA\electronique\arduino\code\weethermos  contient aussi une petite doc sur les shields utilisé 
  
              
 ====== cablage ====== ====== cablage ======
 ===== mlx90614 ===== ===== mlx90614 =====
-{{:divers_elec:mlx90614:temperature_mlxclose.jpg|}} +
-[[https://learn.adafruit.com/using-melexis-mlx90614-non-contact-sensors/wiring-and-test|source]]+
   * Part No. MLX90614  [[https://github.com/arduinolearning/Datasheets/blob/master/MLX90614.pdf|datasheet ]]   * Part No. MLX90614  [[https://github.com/arduinolearning/Datasheets/blob/master/MLX90614.pdf|datasheet ]]
   * Temperature Code E (-40°C...85°C)    K (-40°C…125°C)    * Temperature Code E (-40°C...85°C)    K (-40°C…125°C) 
Ligne 34: Ligne 34:
   * Standard part -000    * Standard part -000 
   * Packing form -TU    * Packing form -TU 
 +
 +{{:divers_elec:mlx90614:temperature_mlxclose.jpg|}}
 +[[https://learn.adafruit.com/using-melexis-mlx90614-non-contact-sensors/wiring-and-test|source]]
  
 ===== Pi ===== ===== Pi =====
Ligne 52: Ligne 55:
 |    |      |  0v      25  |  26  |  CE1    |  11  |    |  |    |      |  0v      25  |  26  |  CE1    |  11  |    | 
  
 +    * https://www.raspberrypi.org/documentation/hardware/raspberrypi/schematics/
 +      * Pi 3 Model B+ rev 1.0 : 1.8k pull on  SDA SCL (R23 GPIO2) (R24 GPIO3)
 +      * Pi 3 Model B rev 1.2 : 1.8k pull on  SDA SCL (R23 GPIO2) (R24 GPIO3)
 +      * Pi 2 Model B rev 1.2 : 1.8k pull on  SDA SCL (R23 GPIO2) (R24 GPIO3)
 +      * Pi Model B+ rev 1.2 :  1.8k pull on  SDA SCL (R23 GPIO2) (R24 GPIO3)
 +      * Pi Model A+ rev 1.1 :  1.8k pull on  SDA SCL (R23 GPIO2) (R24 GPIO3)
 +      * Pi Zero rev 1.3 : 1.8k pull on  SDA SCL (R23 GPIO2) (R24 GPIO3)
 +      * Pi Zero W rev1.1 : ? pas de BCM2835 sur le schéma ?
 +===== code =====
 +<code c>
 +//gcc mlx90614.c -o mlx90614 -l bcm2835
 +#include <stdio.h>
 +#include <bcm2835.h>
 +#include <stdlib.h>
 +#include <fcntl.h>
 +#include <string.h>
 +#include <sys/types.h>
 +#include <sys/stat.h>
 +#include <unistd.h>
 +#include <time.h>
 +#define AVG 1   //averaging samples
 + 
 +# include <termios.h>
 + char getch(){
 + char buf=0;
 + fflush(stdout);
 + if(read(0,&buf,1)<0)   perror("read()");
 + return buf;
 +
 + 
 +int main(int argc, char **argv)
 +{
 +    unsigned char buf[6];
 +    unsigned char i,reg;
 +    double temp=0,calc=0, skytemp,atemp,sky_temp_average_double,sky_temp_sum_double=0;
 + unsigned int G_nb_sample_uint16=0;
 + char c_command;
 +
 + //pas d'attente et pas d'echo sur getch
 + struct termios old={0};
 + if(tcgetattr(0, &old)<0) perror("tcsetattr()");
 + old.c_lflag&=~ICANON;
 + old.c_lflag&=~ECHO;
 + old.c_cc[VMIN]=0;
 + old.c_cc[VTIME]=0;
 + if(tcsetattr(0, TCSANOW, &old)<0) perror("tcsetattr ICANON");
 +
 +    bcm2835_init();
 +    bcm2835_i2c_begin();
 +    bcm2835_i2c_set_baudrate(25000);
 +    // set address
 +    bcm2835_i2c_setSlaveAddress(0x5a);
 +    printf("x : exit\nr : RAZ moyenne\nconnected to MLX90614 \n");
 + 
 + while(c_command != 'x')
 + 
 +     calc=0;
 +     reg=7;
 +     for(i=0;i<AVG;i++)
 +     {
 +        bcm2835_i2c_begin();
 +        bcm2835_i2c_write (&reg, 1);
 +        bcm2835_i2c_read_register_rs(&reg,&buf[0],3);
 +        temp = (double) (((buf[1]) << 8) + buf[0]);
 +        temp = (temp * 0.02)-0.01;
 +        temp = temp - 273.15;
 +        calc+=temp;
 +     }
 +     skytemp=calc/AVG;
 +    
 +     calc=0;
 +     reg=6;
 +     for(i=0;i<AVG;i++){
 +        bcm2835_i2c_begin();
 +        bcm2835_i2c_write (&reg, 1);
 +        bcm2835_i2c_read_register_rs(&reg,&buf[0],3);
 +        temp = (double) (((buf[1]) << 8) + buf[0]);
 +        temp = (temp * 0.02)-0.01;
 +        temp = temp - 273.15;
 +        calc+=temp;
 +     }
 +    atemp=calc/AVG;
 +
 +    if (c_command == 'r') {sky_temp_sum_double=0; G_nb_sample_uint16=0;}
 +    sky_temp_sum_double += skytemp;
 +    G_nb_sample_uint16++;
 + sky_temp_average_double = sky_temp_sum_double/G_nb_sample_uint16;
 +
 +    printf("Ambient Temp=%04.2f  Object Temp=%04.2f  Moyenne Object Temp=%04.2f\r", atemp,skytemp,sky_temp_average_double);
 + c_command = getch();
 +    sleep(1);
 + }
 +    //restore setting of getch
 +    old.c_lflag|=ICANON;
 +    old.c_lflag|=ECHO;
 + if(tcsetattr(0, TCSADRAIN, &old)<0) perror ("tcsetattr ~ICANON");
 +    printf("\r\n");
 +    return 0;
 +}
 +
 +</code>
 +
 +====== cablibration ======
 +
 +<code C>
 +données
 +Gris    mlx(IR)     mlx(internal)
 +20      21.8        21.65
 +21.8    24.76       24.42
 +18.5    21.2        19.72
 +25.6    28.4        26.9
 +29.2    31.30       31
 +11      9.6         9.6
 +
 +amb_temp_f = ((amb_temp_f_ar[0]+amb_temp_f_ar[1]+amb_temp_f_ar[2])/3)-1.6;  //1.6 correctif : moyenne sans MIN et MAX
 +obj_temp_f = ((obj_temp_f_ar[0]+obj_temp_f_ar[1]+obj_temp_f_ar[2])/3)-2.5;   //2.5 correctif : moyenne sans MIN et MAX
  
 +</code>
  
divers_elec/mlx90614/mlx90614.1525942514.txt.gz · Dernière modification : 05/2018 de fred