Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TMP006 Temperature Sensor
07-07-2016, 07:37 PM,
#1
TMP006 Temperature Sensor
Hello,

I've got a problem with a TMP006 Temperature Sensor. I am working on Windows 10, x4-easy-rev999 IDE and with a PIC32MX440F256H.
I think I did the right connections between the sensor and the Pinguino card, I took example on it : https://learn.sparkfun.com/tutorials/tmp...okup-guide. So for me, VCC sensor on 5V card, GND on GND, SDA sensor on A4 and SCL sensor on A5.

I would like to get back the data of this sensor but I can't compile the program.

I downloaded all the files necessary with this link : https://github.com/adafruit/Adafruit_TMP006
I put all the files in the same directory : D:\Stage_Technique\x4-easy-rev999\.temp

So, my main program is the following :

#include <stdint.h>
#include <math.h>
#include <Wire.h>
#include <I2C_16.h>
#include <TMP006.h>

uint8_t sensor1 = 0x40; // I2C address of TMP006, can be 0x40-0x47
uint16_t samples = TMP006_CFG_1SAMPLE; // # of samples per reading, can be 1/2/4/8/16

void setup() {
  Serial.begin(9600);
  Serial.println("TMP006 Example");

  config_TMP006(sensor1, samples);
}

void loop()
{
  float object_temp = readObjTempC(sensor1);
  Serial.print("Object Temperature: ");
  Serial.print(object_temp); Serial.println("*C");

  float sensor_temp = readDieTempC(sensor1);
  Serial.print("Sensor Temperature: ");
  Serial.print(sensor_temp); Serial.println("*C");

  delay(1000); // delay 1 second for every 4 samples per reading
}

When I compile, I've got this error : D:\Stage_Technique\x4-easy-rev999\.temp/Print.h:23:21: fatal error: WString.h: No such file or directory
And then, I downloaded WString.h and I put it in the same directory as the other ones.
But I have the same error each time because I had to download the missing file.
Someone has the solution ? Have I to download all the files until the end, if there is an end ?


Attached Files Thumbnail(s)
   
08-07-2016, 10:20 AM,
#2
RE: TMP006 Temperature Sensor
Hello,
Don't imagine it is so easy to transfer/convert Arduino programs to Pinguino ones.
What programs from Github.com/adafruit/Adafruit_TMP006 do you put in tmp ?
If you use TMP_006.cpp, TMP_006.h without changes it does not work : The Pinguino IDE cannot compile a cpp file.
Furthermore in your sketch I see
#include <stdint.h>
#include <math.h>
#include <Wire.h>
#include <I2C_16.h>
The 2 last files do not exist in the P32 libraries.
You have errors relating Print.h Wstring.h. Obviously !!! These are Arduino files, not Pinguino files.
Everything is to review. I am going to try to propose you a solution but ... be patient !
Kenavo
André
08-07-2016, 11:04 AM,
#3
RE: TMP006 Temperature Sensor
Yes, I understand why I have those erros when I compile.
But I don't find how to do on Pinguino board, so that's why I used the Arduino, thinking it was about the same.
There aren't any tutorials to get back data with the TMP0006 sensor for Pinguino, just for Arduino..
I put in attachment the files which are in the directory tmp.
I hope u will be able to help me.


Attached Files Thumbnail(s)
   
08-07-2016, 11:21 AM,
#4
RE: TMP006 Temperature Sensor
Where can I find I2C_16 library ?
is config_TMP006( ) a function written by you ? If yes would you attach it ?

I think I can build the requested I2C functions with our I2C lib but I have to know exactly the ones that you use.

André
08-07-2016, 11:44 AM,
#5
RE: TMP006 Temperature Sensor
No, I don't modify anything because I don't know what to modify. So, I didn't write the function config_TMP006( ).
I just download the code and put it in the folder tmp and I tried to compile.
I send you in attachment I2C_16.h that I am using.


Attached Files
.h   I2C_16.h (Size: 207 bytes / Downloads: 2)
08-07-2016, 01:53 PM,
#6
RE: TMP006 Temperature Sensor
Before you can use Pinguino P32 I2C lib I have to add some Wire functions. Now the P8 lib would be OK but not the P32 one.
I think the addition + debugging can be done enough rapidly.
See you soon.
André
08-07-2016, 03:14 PM, (This post was last modified: 08-07-2016, 03:19 PM by walk_porto.)
#7
RE: TMP006 Temperature Sensor
If you can do that, it would be just amazing.
I found an i2c file in this folder : D:\Stage_Technique\x4-easy-rev999\p32\include\pinguino\core
See you soon Smile


Attached Files
.c   i2c.c (Size: 24.24 KB / Downloads: 2)
10-07-2016, 10:03 AM,
#8
RE: TMP006 Temperature Sensor
Demat!
I finished to complete our P32 i2c library and I succeeded to compile a new version of TMP006.pde.
Unfortunately when I try to read PCF8593 data (it is an I2c module giving time and date) I find erroneous data.

I have not much practice of the Pic32s. Anyway I continue my research.
Kenavo
André
10-07-2016, 05:06 PM,
#9
RE: TMP006 Temperature Sensor
Demat,

Is it possible that you send me the P32 i2c library and maybe the new version of TMP006.pde please ?
I will try to compile with PIC32MX440F256H.
Someone on another forum told me that I have to convert in C all the programs from Arduino (in C++)  : https://www.olimex.com/forum/index.php?t...icseen#new

That seems strange to me to do that.

Kenavo
10-07-2016, 07:17 PM,
#10
RE: TMP006 Temperature Sensor
Would you try the attached sketch i2cscannerP32.pde ? It allows to detect an i2c device as your TMP006.
The very last i2c.c is attached too; with it replace yours in P32\include\pinguino\core folder.
Connect the TMP006 SDA and SCL pins to Olimex SDA1 and SCL1. If you use a Pinguino Micro with Uext connector SCL1 is pin5 and SDA1 is pin6. Power the TMP006 as requested (3.3V ?)

I successfully done this test with a pinguino Micro and a PCF8574. It has been detected with 0x27 address.
It will be a great step if your test succeed.

Kenavo
André


Attached Files
.pde   i2cscannerP32.pde (Size: 799 bytes / Downloads: 3)
.c   i2c.c (Size: 25.51 KB / Downloads: 7)


Forum Jump:


Users browsing this thread: 1 Guest(s)