Hi!
This is my first post, I ordered online some temperature sensors believing they would have only 3 legs just like the ones in the arduino starter kit,
however I was wrong they have 8 legs, the model is AT30TSE754-SS8-B. The 55-page datasheet is here:
https://www1.elfa.se/data1/wwwroot/assets/datasheets/AT30TSE752_54_58_eng_tds.pdf
I don't know how to connect them to the arduino (how many inputs to use and how to connect them). I am a newbie in electronics but know already some programming
and started learning arduino using the starter kit.
Apparently these sensors also allow to store values in the EEPROM right?
I just want to read temperature from 3 different temperature sensors, if I can store values in the individual EEPROM of each sensor and access them from the arduino it would be
nice but if someone can already help me with the basic task of retrieving the temperature form the sensors to the arduino I would be very grateful.
Don't hesitate to give me details on how to wire all this (which resistances/components to use etc.).
Thank you
Those sensors interface via I2C, which is a synchronous serial protocol. Fortunately it is pretty easy to use as there is a library called Wire library. You can put several of these devices on a single two wire bus. Connect SCL of the chip to pin A5 and SDA to pin A4. Connect a 4.7K resistor to each pin and the other end of the resistor to +5V (Vcc). These "pull up resistors" are necessary. Look at the data sheet and it will tell you how to assign an address to each sensor. There are different registers that you can write to to configure the device and set alarm limits.
Thank you very much for these indications, I have now something to start with :)!
I'll probably ask soon for some more specific questions since those datasheets are pretty obscure to me, I wish I was an electric engineer to understand them... :).
Yes. data sheets can be complicated but, taken a bit at a time can be digested. Usually the default settings are set so that you can use them without changes. Once it works with defaults the fun begins trying different settings and customizing the behavior to your needs.
I looked for a library for the chip but came up dry. Using the Wire library will make using them pretty easy.
Hi!
I wired SDA to pin A4 and SLC to pin A5 directly, I then added a 4.7K resistance from A4 to Vcc on the chip and another 4.7K from A5 to Vcc on the chip (just to be sure that was the thing to do). When I use Serial.print(A4) and Serial.print(A5) I get respectively A4=18 and A5=19 so apparently the two inputs are distinguished.
I tried to integrate the following code (from the library) to my project:
#include <Wire.h>
void setup()
{
Wire.begin(); // join i2c bus (address optional for master)
Serial.begin(9600); // start serial for output
}
void loop()
{
Wire.requestFrom(2, 6); // request 6 bytes from slave device #2
while(Wire.available()) // slave may send less than requested
{
char c = Wire.read(); // receive a byte as character
Serial.print(c); // print the character
}
delay(500);
}
///////////////////////
However once I added this to my code, the Serial.print(A4) or Serial.print(A5) doesn't return anything.
I am not sure about the number of bytes or the slave device number or if it is indeed a char type that is read from the chip.
I read on the arduino website there was a requestFrom() function in the Wire library (SYNTAX Wire.requestFrom(address, quantity) or
Wire.requestFrom(address, quantity, stop) ) but I am not sure if or how I should call that function.
When you say I can put several of these devices on a single two wire bus, could you go more into details (wiring/programming)? I would like to use 3 temperature sensors of this type
but don't know how to wire them in my circuit and what code to use. My final goal is an intelligent watering system for my balcony, so far I got pumps to work on precise times but
I would like to get my system to react to weather (e.g if it's too cold no need to water the plants). But for now I would be glad to get the accurate temperature from just one sensor.
I admit to being a newbie in the electronic field so don't hesitate to put all the details
Thanks again
http://www.gammon.com.au/forum/?id=10896 A very good tutorial on I2C. Lightyears better than I could explain it.
Sounds like your connections are correct. Look at figure 5.1 of the data sheet. It shows the how addresses are made up. Pins A0, A1 and A2 of the sensor chip set the address of that chip. If the address pins are all wired low, the address of that chip would be 0x48 (hex). If A0 were set HIGH and the rest low the address is 0x49. Note that the EEPROM has its own address.
If you want 3 chips on the bus, set each address to a unique number, wire all the SCL lines together, wire all the SDA lines together.
once you have it hooked up and the address set run this I2C scanner (from Nick Gammon's forum. Thanks, Nick). If everything is good the scanner will find the sensor.
#include <Wire.h>
void setup() {
Serial.begin (115200);
// Leonardo: wait for serial port to connect
while (!Serial)
{
}
Serial.println ();
Serial.println ("I2C scanner. Scanning ...");
byte count = 0;
Wire.begin();
for (byte i = 1; i < 120; i++)
{
Wire.beginTransmission (i);
if (Wire.endTransmission () == 0)
{
Serial.print ("Found address: ");
Serial.print (i, DEC);
Serial.print (" (0x");
Serial.print (i, HEX);
Serial.println (")");
count++;
delay (1); // maybe unneeded?
} // end of good response
} // end of for loop
Serial.println ("Done.");
Serial.print ("Found ");
Serial.print (count, DEC);
Serial.println (" device(s).");
} // end of setup
void loop() {}
Thank you for the I2C scanner I found out that my wiring was wrong (I wired the pull up resistors to Vcc on the sensor instead of the Vcc on the chip... I realized that when I read again the name "pull up").
I managed to get the temperature from my sensor but now I am struggling to write/read from the included EEPROM. I am going to make a new post on that issue, thanks again for the help.