Coder Social home page Coder Social logo

sparkfun_mlx90614_arduino_library's Introduction

SparkFun MLX90614 Arduino Library

SparkFun Infrared Thermometer Evaluation Board

SparkFun Infrared Thermometer Evaluation Board (SEN-10740)

An Arduino library that interfaces with the MLX90614 non-contact infrared thermometer over a 2-wire, I2C-like interface (SMBus).

Repository Contents

  • /examples - Example sketches for the library (.ino). Run these from the Arduino IDE.
    • /src - Source files for the library (.cpp, .h).
  • keywords.txt - Keywords from this library that will be highlighted in the Arduino IDE.
  • library.properties - General library properties for the Arduino package manager.

Documentation

Products that use this Library

Version History

License Information

This product is open source!

The code is released under the MIT license. See the included LICENSE file for more information.

Distributed as-is; no warranty is given.

  • Your friends at SparkFun.

sparkfun_mlx90614_arduino_library's People

Contributors

makin-stuff avatar nseidle avatar rkaczorek avatar uutzinger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sparkfun_mlx90614_arduino_library's Issues

MLX90614 not working with ESP32-S2

Hello,
I've tested MLX90614 with ESP32 (Both Wire and Twowire concept of I2C). It's working fine. But the same thing is not working with ESP32-S2. Please help me out.

Thank you.

ThermoRelay interupt mode

I see the library has the ability to set the Max and Min temperatures. I was wondering if there is a way to set the sensor up to run as a kind of Thermal Relay and if the set temperature is hit then trigger a kind of interupt that would wake the processor up and return to normal i2c mode.

The project I am working on is a batrery powered sensor that needs to sit there checking out the temperature. If the level is hit then it will fire off an alert. It seems that putting the microprocessor in to sleep mode will conserve heaps of power in this case.

No need to wait for data after Wire.requestFrom()

In SparkFunMLX90614.cpp is a while-loop with a delay after the Wire.requestFrom() call. That while-loop is not needed and that delay is not needed.

When the Wire.requestFrom() function returns, the I2C transaction has completely finished and the received data is in the receive buffer in the Wire library. The Wire.read() only reads data from that buffer.

ESP32

I believe the the hardware driver on the esp32 (in Arduino IDE) is called differently, not sure about an equivalent function... I think it'll be easier to just directly talk to the module but I got this error on compilation:

SparkFunMLX90614.cpp:284:7: error: 'class TwoWire' has no member named 'end'
....
\Users\Lauren\Documents\Arduino\libraries\SparkFun_MLX90614_Arduino_Library-master\src\SparkFunMLX90614.cpp: In member function 'uint8_t IRTherm::wake()':

C:\Users\Lauren\Documents\Arduino\libraries\SparkFun_MLX90614_Arduino_Library-master\src\SparkFunMLX90614.cpp:284:7: error: 'class TwoWire' has no member named 'end'

Wire.end(); // stop i2c bus to send wake up request via digital pins

   ^

Using library SparkFun_MLX90614_Arduino_Library-master at version 1.0.2 in folder: C:\Users\Lauren\Documents\Arduino\libraries\SparkFun_MLX90614_Arduino_Library-master
Using library Wire at version 1.0.1 in folder: C:\Users\Lauren\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.2\libraries\Wire
Using library SparkFun_AS726X at version 1.0.3 in folder: C:\Users\Lauren\Documents\Arduino\libraries\SparkFun_AS726X
Using library HX711_ADC at version 1.1.5 in folder: C:\Users\Lauren\Documents\Arduino\libraries\HX711_ADC
Using library EasyTransfer in folder: C:\Users\Lauren\Documents\Arduino\libraries\EasyTransfer (legacy)
exit status 1
Error compiling for board ESP32 Dev Module.

I would add, I'm not even calling the function from my code.

stm32 support?

hello thanks for the work put in this library
im trying to use this with a bluepill but itsnt working. what do i need to change to make it work?

Library not compatible with Arduino 1.7.10

The recent release of Arduino 1.7 appears to change the way Wire.h works. The MLX90614 example sketches work when I compile/upload them using Arduino 1.6.8 or 1.6.9, but I can't get any readings off of my sensors when I use Arduino 1.7.10. I'm sorry I can't provide clearer details; this is my first bug report.

Back up

files.fileexplorer.filemanager.provider/name/storage/emulated/0/Android/data/Dalvik.vm/2F252Fgithub.com.txt.txt/2F252Fgithub.com.txt.txt%23%3A~%3Atext%3D2F252Fgithub.com.txt.txt

ESP8266

Arduino 1.8.13 with Board Manager installed ESP8266 Community 2.7.2 does not understand:

#ifndef SDA
#define SDA (digitalPinToPinName(PIN_WIRE_SDA))
#endif
#ifndef SCL
#define SCL (digitalPinToPinName(PIN_WIRE_SCL))
#endif

If the instructions are removed, it compiles and works.
It appears that #ifndef does not recognize SDA and SCL.
When it tries to define SDA and SCL with digitalPinToPinName it throws an error.

wake up command freezes Wire library

Thanks for this library, works nicely!

I noted an issue though which of course might be a hardware issue but anyway I would like to share it. Hopefully it helps. Please note that this might be an hardware issue and I am also not an I2C expert.

I noticed that my code froze when I was using the sleep() and wake() commands, perhaps this has to do with using other I2C devices as well.

I made the following changes to fix this.

  1. I commented the code on lines 282, 283, and 284 at line 279, the chip goes to sleep without them anyway.

  2. I change line 290 to:
    _i2cPort->endTransmission(false); // stop i2c bus transmission BEFORE sending wake up request
    so instead of setting true, I set false.

  3. I commented line 302 and instead added the code below (I don't think the delay is needed). The reason is, that the wake up command seems to interfere with the normal I2C operation and on my device (a feather M0) the only way to reset it was calling begin again.
    delay(10); _i2cPort->begin();

  4. When the sensor is a sleep and you reset your program without powering down, begin will always return false. So it is not a bad idea upon begin try to wake the sensor if begin returns false. I added a member variable 'bool isResetOnBegin;" (you will probably prefer _isResetOnBegin). Then I do the following to try and wake once:
    ` bool beginSuccess = isConnected();
    if(!beginSuccess && !isResetOnBegin)
    {
    wake();
    isResetOnBegin = true;;
    }

    return beginSuccess;
    `

Hope this information helps other people!

'typedef' ignored in declaration SparkFunMLX90614.h

Hello Sparkfun,

I am just starting with Arduino and I have problems verifying the MLX_Get_ID code. It refers to SparkFun_MLX90614_Arduino_Library/src/SparkFunMLX90614.h and gives the following warning:

In file included from ...\Arduino\libraries\SparkFun_MLX90614_Arduino_Library-master\examples\MLX90614_Get_ID\MLX90614_Get_ID.ino:25:0:

...\Arduino\libraries\SparkFun_MLX90614_Arduino_Library-master\src/SparkFunMLX90614.h:54:1: warning: 'typedef' was ignored in this declaration [enabled by default]

};

^

So, this example didn't work out for me, as well as the other three examples.

What is it that I am doing wrong?

Luc

MLX90614 works with Uno but not Uno WiFi REV2

Hi,
I have your examples and libraries running just fine with the UNO but when I try it with the UNO WiFi REV2 board, it does not work.
I have added pull up resistors to the SDL and SDA lines and use these lines for the control.
It reads a constant value and does the same if the two wires are removed. I also ran the I2C scanner sketch and it does see that the device is there.
Suggestions?
Thanks, Tom

LICENSE.md

cb2b8364142603c134bc0064689f0d57ccb171cc

Esp32 Wifi Remote Control With Sockets #Locking

Hey guys, I'm here trying to fix a bug that is already happening to me several times, I'm trying to make a connection between two esp's32 for a project, but the only connection that worked is crashing after a few minutes of use ... Could someone help and, if possible, provide links to other types of connections and documentation for them.

Let's go to the error, so I'm using this code:
Server:

//Neste arquivo vão os 'includes' e as configurações pincipais
//que são compartilhadas entre os outros arquivos .ino
#include <WiFi.h>

#define SSID "ESP32Server"
#define PASSWORD "87654321"
#define SERVER_PORT 5000
#define PIN_LED 23

//Protocolo que o Server e o Client utilizarão para se comunicar
enum Protocol{
    PIN, //Pino que se deseja alterar o estado
    VALUE, //Estado para qual o pino deve ir (HIGH = 1 ou LOW = 0)
    BUFFER_SIZE //O tamanho do nosso protocolo. IMPORTANTE: deixar sempre como último do enum
};

//Diretiva de compilação que informará qual arquivo que queremos que seja compilado
//Caso queira que o arquivo Client.ino seja compilado, remova ou comente a linha do '#define' abaixo
//Caso queira que o arquivo Server.ino seja compilado, deixe o '#define IS_SERVER' abaixo descomentado
#define IS_SERVER

//Apenas vai compilar o código contido neste arquivo
//caso IS_SERVER esteja definido
#ifdef IS_SERVER

//Cria o server na porta definida por 'SERVER_PORT'
WiFiServer server(SERVER_PORT);

void setup()
{
    Serial.begin(115200);//Inicializa Serial
    pinMode(PIN_LED, OUTPUT);
    //Coloca este ESP como Access Point
    WiFi.mode(WIFI_AP);
    //SSID e Senha para se conectarem a este ESP
    WiFi.softAP(SSID, PASSWORD);
    //Inicia o server
    server.begin();
}
void loop()
{
    //Verifica se tem algum cliente se conectando
    WiFiClient client = server.available();
    if (client) 
    { 
        //Acende led sinalizando a entrada de um cliente
        digitalWrite(PIN_LED, 1);    
        //Se o cliente tem dados que deseja nos enviar
        if (client.available())
        {
            //Criamos um buffer para colocar os dados 
            uint8_t buffer[Protocol::BUFFER_SIZE];
            //Colocamos os dados enviados pelo cliente no buffer
            int len = client.read(buffer, Protocol::BUFFER_SIZE);
            //Printa o valor
            Serial.print("Size Buffer");
            Serial.println(len);
            //Verificamos qual o pino que o cliente enviou
            int pinNumber = buffer[Protocol::PIN];
            Serial.print("PIN ");
            Serial.println(buffer[Protocol::PIN]);
            //Verificamos qual o valor deste pino
            int value = buffer[Protocol::VALUE];
            Serial.print("VALUE ");
            Serial.println(buffer[Protocol::VALUE]);
            //Colocamos o pino em modo de saída
            pinMode(pinNumber, OUTPUT);
            //Alteramos o estado do pino para o valor passado
            digitalWrite(pinNumber, value);
        }

        //Fecha a conexão com o cliente
        client.stop();
    }
}
//Encerra o #ifdef do começo do arquivo
#endif

Client:

//Neste arquivo vão os 'includes' e as configurações pincipais
//que são compartilhadas entre os outros arquivos .ino
#include <WiFi.h>

#define SSID "ESP32Server"
#define PASSWORD "87654321"
#define SERVER_PORT 5000

//Protocolo que o Server e o Client utilizarão para se comunicar
enum Protocol{
    PIN, //Pino que se deseja alterar o estado
    VALUE, //Estado para qual o pino deve ir (HIGH = 1 ou LOW = 0)
    BUFFER_SIZE //O tamanho do nosso protocolo. IMPORTANTE: deixar sempre como último do enum
};

//Diretiva de compilação que informará qual arquivo que queremos que seja compilado
//Caso queira que o arquivo Client.ino seja compilado, remova ou comente a linha do '#define' abaixo
//Caso queira que o arquivo Server.ino seja compilado, deixe o '#define IS_SERVER' abaixo descomentado
//Apenas vai compilar o código contido neste arquivo
//caso IS_SERVER NÃO esteja definido 
//(if n def, atenção para o 'n')
#ifndef IS_SERVER
//Pino que vamos fazer a leitura
#define IN_PIN 23
#define ChangedPIN 2

void setup(){
    Serial.begin(115200);//Inicializa Serial
    //Colocamos o pino em modo de leitura
    pinMode(IN_PIN, INPUT);
    pinMode(ChangedPIN, OUTPUT);
    //Defino como modo estação ()Client
    WiFi.mode(WIFI_STA);
    //Conectamos Access Point criado
    //pelo outro ESP
    WiFi.begin(SSID, PASSWORD);

    //Esperamos conectar
    while (WiFi.status() != WL_CONNECTED){
        delay(500);
    }
}

void loop(){
    //Variável que utlizaremos para conectar ao servidor
    WiFiClient client;
    //Se não conseguiu se conectar então retornamos
    if (!client.connect(WiFi.gatewayIP(), SERVER_PORT)){
        return;
    }
    //Acende Led
    digitalWrite(ChangedPIN, 1);
    //Criamos um buffer para colocar os dados 
    uint8_t buffer[Protocol::BUFFER_SIZE];
    //Fazemos a leitura do pino
    int value = digitalRead(IN_PIN);
    Serial.println(digitalRead(IN_PIN));
    //Colocamos no buffer o número do pino
    //cujo estado queremos enviar
    buffer[Protocol::PIN] = ChangedPIN;
    //Colocamos no buffer o estado atual do pino
    buffer[Protocol::VALUE] = value;
    //Enviamos e finalizamos a conexão
    client.write(buffer, Protocol::BUFFER_SIZE);
    client.flush();
    client.stop();
    
}
//Encerra o #ifndef do começo do arquivo
#endif

What I got from this site:

The problem is that after a few minutes the connection is stuck, I realized that being a socket connection rather than HTTP, it closes and opens the connection to the Server several times; Is this what is causing the failures? I used a delay at the end, but it was no use. I really need help.

Blink leds to show the connection start, sorry if you are wrong.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.