freetronics / IRTemp

Infrared non-contact thermometer module driver for Arduino
www.freetronics.com/irtemp
7 stars 4 forks source link

Strange problem with IR Sensor #1

Open kami83 opened 10 years ago

kami83 commented 10 years ago

Hi,

i am using a Zytemp TN168 (http://www.zytemp.com/products/tn168.asp). As shown on the Picture i connected it to a Mega 2560 Arduino Board. i used your new libs:

https://github.com/freetronics/IRTemp

to read out the 3 data pins.

At the first time everything works fine.I uploaded this code:

/*

static const byte PIN_DATA = 2; static const byte PIN_CLOCK = 3; // Must be either pin 2 or pin 3 static const byte PIN_ACQUIRE = 4;

static const TempUnit SCALE=CELSIUS; // Options are CELSIUS, FAHRENHEIT

IRTemp irTemp(PIN_ACQUIRE, PIN_CLOCK, PIN_DATA);

void setup(void) { Serial.begin(9600); Serial.println("IRTemp example"); Serial.println("~~~~~~"); }

void loop(void) { float irTemperature = irTemp.getIRTemperature(SCALE); printTemperature("IR", irTemperature);

float ambientTemperature = irTemp.getAmbientTemperature(SCALE); printTemperature("Ambient", ambientTemperature);

delay(1000); }

void printTemperature( char *type, float temperature) {

Serial.print(type); Serial.print(" temperature: ");

if (isnan(temperature)) { Serial.println("Failed"); } else { Serial.print(temperature); Serial.println(SCALE == FAHRENHEIT ? " F" : " C"); } }

After this i get good values from the sensor.

But if i disconnect the Board from the USB i always get FAILURE. The only way to repair it is, to change all pins for example to 7,8,9 than i upload the data and the Controller is working. but if i disconnect USB i get the same problem. If i only reset the Board. There is no Problem. Only the Power Up makes this problem. Here is a picture of my Wiring:

http://picpaste.com/Foto-navNvrWt.JPG

Please help me.

cu kami83

boxalljohn commented 10 years ago

Our library is for a different module, the TN9. Nevertheless, if you remove the USB from the board, how are you powering it - and monitoring the results from your sensor?

kami83 commented 10 years ago

Hi,

i know that this library is for the TN9. But my TN168 has the same pins and under the first uploading i get the right data from the sensor. If i remove i just reconnect the USB to the board. i watch the result in the serial terminal.

Cu kami