I am new to Arduino and programming but stil want to make a small application with it.
I have an Arduino uno and have also a MOD-TC-MK2-31855 Sensor interface for type-K temperature probe.
I have tried to use the code provided on the olimex forum @
with all the hints given there and also looked @ the international topic Arduino e MOD-TC-MK2-31855 - Hardware - Arduino Forum
The conncetions are done like shown in the second forum entries:
Analog 4 and 5 connected to Pin 6 and 5 of UEXT and ground and 3.3 V connected to pins 2 and 1 of UEXT.
For whatever reason, I do not get any reaction from my board.
Thank you for your response!
As far as I have understood, I do use the library, but maybe you make your more educated guess:
This is the code:
#include <Wire.h>
#include <TC-MK2.h>
void setup() {
// put your setup code here, to run once:
pinMode(A4, INPUT); // define analog Pin 4 Input
pinMode(A5, INPUT); // define analog Pin 5 Input
Wire.begin(); // initiate the Wire library and join the I2C bus as a master
Serial.begin(115200); // initiate serial communication witg 9600 baud
}
void loop() {
// put your main code here, to run repeatedly:
Wire.beginTransmission(byte(0x48)); // Begin a transmission to the I2C slave device with the given address. Subsequently, queue bytes for transmission
Wire.write(0x01);
Wire.write(0xA0);
Wire.write(byte(0x23));
Wire.endTransmission(); // transmit them
Wire.requestFrom(0x48,4);
byte c[4];
int i=0;
Serial.print("Start geting data");
while(Wire.available())
{
c[i] =Wire.read();
Serial.print(int(c[i]));
i++;
}
delay(1000);
}
My understanding was that I should be able to see what is hapening on the serial monitor, but there is nothing. (The baud rates match)
Edit
By playing around, I have found out that there has to be mybe something related to the wiring:
I have following wiring:
Arduino UEXT
GND Pin 2
3.3 V Pin 1
Pin 5 SCL Pin 5
Pin 4 SDA Pin 6
If i remove the jumpers from Pin 4&5 on the Arduino, I get, at least "Start geting data" on the serial monitor.
If I attach the SDA on Pin 4, there is nothing happening!
Connecting SCL has no influence, "Start geting data" is still comming...
Although you include the header of the library you do not use it but implement some kind of protocol yourself using the Wire library (part of the Arduino core).
As the MOD-TC-MK2 is just a PIC that's programmed as an I2C slave I'm not sure which version of the firemware you are using. Given that the module uses and used always the same default values, you're I2C address is wrong as the Olimex library uses 0x23 as the I2C address of the module.
Where is your code from?
pinMode(A4, INPUT); // define analog Pin 4 Input
pinMode(A5, INPUT); // define analog Pin 5 Input
Remove these lines as you should not use the two I2C pins if you use the Wire library too.
I'm a bit surprised that you don't get the serial output if you connect SDA. I would have expected that you don't get anything other than the "Start getting data" but that line should be printed about once a second.