SparkFun Forums 

Where electronics enthusiasts find answers.

General MicroView Support area - You have questions, find your answers here.

Moderators: marcus@geekammo, Help@GeekAmmo

By awardblvr
I have a Microview connected to an MLX90614 Infrared Thermometer (I2C) using

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.
Code: Select all
#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 {
        temp_deg_f =  mlx.readObjectTempF();
        dtostrf(temp_deg_f, 5, 1, disp_str);

        if (temp_deg_f < 20 || temp_deg_f > 212) {
            mlx_present = 0;
            uView.print(" No MLX\n");
        } else {
            mlx_present = 1;
            uView.print(" MLX OK\n");
    while (!mlx_present);
You do not have the required permissions to view the files attached to this post.
By Help@GeekAmmo
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.

long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]