Go Down

Topic: Smartec SMT172 temperature sensor library (Read 2888 times) previous topic - next topic

EdwinCroissant

I wanted to use two SMT172 sensors with one timer so I used a 4051 multiplexer to switch between the two sensors. Now these sensors run on different frequencies so the minimum amount of required clock cycles to obtain a certain sensor error are different for each individual sensor.

To get around this the library now calculates the required minimum clock cycles on the fly after the first complete cycle of the sensor. The sensor error is now passed as an argument of startTemperature.

EdwinCroissant

After a couple of weeks testing this code seems to be pretty stable.

The SMT172 sensors need a stable power supply when connected to an Arduino with a 3 meter cable.
I had to decouple the power supply with a small signal diode and a 100uF and a 100nF capacitor. I also connected a 220 ohm resistor in series. Please note that the SMT172 draws only 70 uA current.

A 100nF ceramic capacitor is needed near the sensor between VCC and GND. I managed to solder a small capacitor between the legs of the sensor. I tested if the SMT172 would function when the 100 nF capacitor is positioned further from the sensor and I can confirm that the sensor work when there is 20 cm between the sensor and the capacitor. So Arduino --> 3 meter cable --> capacitor --> 20 cm wires --> sensor works.

daandree

Hi Edwin, thanks for the nice work. Works very well for me. Now I have a question. I'm new to Arduino and I'm supposed to have 3 sensors of these working to measure air temp at different points in a tube.

My signal output of the sensor is hooked up to pin 8 of my UNO and it won't work on any other somehow. Is it possible to run multiple sensors with your code?

Best regards,
Andre

EdwinCroissant

Hi Edwin, thanks for the nice work. Works very well for me. Now I have a question. I'm new to Arduino and I'm supposed to have 3 sensors of these working to measure air temp at different points in a tube.

My signal output of the sensor is hooked up to pin 8 of my UNO and it won't work on any other somehow. Is it possible to run multiple sensors with your code?

Best regards,
Andre
The Uno got only one 16 bit timer available, so you need to use a multiplexer like the 4051. If you use a 5052 you can use the second channel to switch the power to the SMT172 as well. This prevents internal heating. Success!

daandree

Thanks for the hint. I will try that!

Dirk67

thanks Edwin, for your good work !

Do you know if this library works on the 32U4 based boards (Leonardo / micro) as well without changes ?
arduino powered car relais / car "micro PLC" / with USB --> http://goo.gl/ofWFW3

EdwinCroissant

thanks Edwin, for your good work !

Do you know if this library works on the 32U4 based boards (Leonardo / micro) as well without changes ?
Thank you :)

I got a couple of these sensors working with this library on a Micro Pro clone which is a 32U4 based board :)

EdwinCroissant

The SMT172 library can now be found at Github.
Added support for Timer4 and Timer5 for the Arduino/Genuino Mega2560.

avitos

Dear EdwinCroissant,

I'm would like to use your library for My project with Arduino Due but I get errors . It looks like TCCRx are procesor specific. Can you be so kind to give some suggestions what I have to do to make it work with Due?

Arduino: 1.7.11 (Windows Server 2012), Board: "Arduino Due (Programming Port)"

WARNING: library SMT172 claims to run on [avr] architecture(s) and may be incompatible with your current board which runs on [sam] architecture(s).
SMT172_demo.pde: In function 'void setup()':
SMT172_demo.pde:35:2: error: 'TCCR2A' was not declared in this scope
SMT172_demo.pde:35:15: error: 'COM2A1' was not declared in this scope
SMT172_demo.pde:35:21: error: '_BV' was not declared in this scope
SMT172_demo.pde:35:29: error: 'COM2B1' was not declared in this scope
SMT172_demo.pde:35:43: error: 'WGM20' was not declared in this scope
SMT172_demo.pde:37:2: error: 'TCCR2B' was not declared in this scope
SMT172_demo.pde:37:15: error: 'CS21' was not declared in this scope
SMT172_demo.pde:38:2: error: 'OCR2A' was not declared in this scope
SMT172_demo.pde:39:2: error: 'OCR2B' was not declared in this scope
Error compiling.


EdwinCroissant

Hi avitos,

The code uses the timers to measure the duty cycle and is only for the 8 bit AVR micro-controllers as used in the Uno, Micro and Mega. The Due use a 32 bit processor at 80 MHz. There are three 32 bit timers in the Due so measuring the duty cycle should be possible. As the timers are 32 bit and the processor runs at 80 MHz the code should be a lot simpler.

So the compiling warning and errors are as they should.

I have no Due and I have no intension to write a library for the Due at the moment , I noticed however that Smartec now supplies a SMT172 to I2C interface. Maybe you can use that.

I hope this is useful.   

JoE1205

#25
Jun 19, 2017, 11:37 am Last Edit: Jun 19, 2017, 11:50 am by JoE1205
Hello,

is it right to connect the output of smt172 (hec version) to pin 8 on an arduino pro mini? thats it? Im using EdwinCroissants example code.
Im asking because Im getting temperaturevalues of 2°C. furthermore the reactionspead of the sensor seems to be pretty low since it takes the sensor alot of time to reach the new temperaturevalue.


EdwinCroissant

#26
Jun 19, 2017, 05:08 pm Last Edit: Jun 19, 2017, 05:14 pm by EdwinCroissant
Pin 8 of the Pro Mini is indeed the ICP1 pin.
To be sure you can connect pin 8 to the pins 3 and 11 as mentioned in the example sketch.

The SM172 needs some filtering on the power-lines:

See: https://github.com/EdwinCroissantArduinoLibraries/SMT172/tree/master/extras

The 100 nF capacitor near the SMT172 should be present on the HEC version.

I have no experience with the HEC version but the TO18 version can sense the heat of you hand from a short distance  :)   

JoE1205

Hi,

i have a huge problem: I have to implement a SMT172 in a project using a ATMega664P-MU. The main problem is that I cant solder the output pin of SMT172 with the ICP1 of the ATMega since the ATMega is soldered to a printed board and there is no way to reach ICP1. Is there a solution to use a different pin?

Pins of ATMega 644p which would be available for soldering:
PD2-3 (no connection)
PC0 (SCL, specific sensors)
PC1 (SDA, specific sensors)
PB5-7(MISO,SCK,MOSI, used for Wifi)
PA0,PA1 (used for dropout regulation)



EdwinCroissant

Sorry to hear that, but the ICP1 and the 16 bit timer are required to make this work. 

Go Up