uView Programmer alters circuit's behavior??

I have a Microview connected to an MLX90614 https://www.sparkfun.com/products/9570 Infrared Thermometer (I2C) using https://github.com/adafruit/Adafruit-MLX90614-Library.

Works great… SOMETIMES: Always when Microview Programmer is in between the host circuit and the Microview. Occasionally it works when the Microview is inserted directly into the host circuit.

There is some characteristic on the Microview Programmer that makes things work… Looking for ideas… Obviously We don’t want to have to have the programmer in place to make things work. (BTW. Doesn’t matter whether the programmer is plugged in to USB or not. Power is coming from my own on-board supply.)

The code snippet here is what I do during setup… Looking for a valid range of values… When it cannot read it, I get values way outside this range. When everything is OK, the read back value is within this range.

#include <MicroView.h>
#include <Time.h>
#include "pitches.h"
#include <Average.h>
#include <Wire.h>
#include <EEPROM.h>
#include <Adafruit_MLX90614.h>

Adafruit_MLX90614 mlx = Adafruit_MLX90614();

<... stuff removed....>

    int startup_trys=0;
    do {
        mlx.begin();
        temp_deg_f =  mlx.readObjectTempF();
        dtostrf(temp_deg_f, 5, 1, disp_str);
        uView.setFontType(0);
        uView.setCursor(0,0);

        if (temp_deg_f < 20 || temp_deg_f > 212) {
            mlx_present = 0;
            uView.print(startup_trys);
            uView.print(" No MLX\n");
            uView.print(disp_str);
            uView.display();
            delay(3000);
        } else {
            mlx_present = 1;
            uView.print(startup_trys);
            uView.print(" MLX OK\n");
            uView.display();
            delay(3000);
            break;
        }
        startup_trys++;
    }
    while (!mlx_present);

Hi awardblvr,

Sorry for the late reply. I gone through your schematic and did not see anything from the USB programmer that will help or affect the operation of your circuits.

The only thing that I could think of are two suspects for your consideration:

  1. When MicroView is connected to the USB programmer, after flashing of code or when plugged into the USB port of a computer, the FTDI will be initialized, depending on your system, this FTDI init will trigger a few times of RESET to the MicroView. This could have given enough time for the MLX91064 to init and get ready.

  2. In your setup, you have a loop that keeps calling mlx.begin(), where it will init the Wire.begin, then init the twi_init() again repeatedly. As soon as you called mlx.begin(), the code called the mlx.readObjectTempF(). I am suspecting the mlx might not be ready to be read yet, then the loop keeps resetting the mlx by calling the mlx.begin(). I would suggest to have the mlx.begin() in setup(), and reading the objecttemp in Arduino’s loop().

Hope this helps.

Cheers

JP