Skip to content

Commit

Permalink
fixed updated calculation and test calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan committed Jan 25, 2016
2 parents 7d67803 + d2d6374 commit cd3dfdc
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 24 deletions.
Empty file.
63 changes: 61 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,61 @@
# BlueRobotics_TSYS01_Library
Arduino library for the TSYS01 temperature sensor.
The sensor is the Measurement Specialties TSYS01, It comes standard with a 4-pin DF13 connector and compatible with most DroneCode compatible boards including the APM2.6, PixHawk, and others.

## Features

* ±0.1°C Accuracy
* Standard DF13 connector for connection to DroneCode boards such as APM, PixHawk, Navio2, etc.
* Sealed in a bulkhead penetrator for easy installation into any 10mm hole

## Compatibility

The Celsius sensor is compatible with any device with 3.3V I<sup>2</sup>C logic. When using with a 5V device, such as an Arduino Uno, it is necessary to use a logic level converter.

##Configuration

The sensor is mounted on a PCB that extends into the water and is sealed from water with a thick layer of thermally conductive epoxy. This mounting method minimizes heat capacitance and ensures a fast time-response.

##Ratings

For further information please see the [TSYS01 Data Sheet](http://meas-spec.com/downloads/TSYS01_Digital_Temperature_Sensor.pdf).

| **Electrical** |
| ------------- | --------- |
| **Item** | **Condition** | **Value** |
| Supply Voltage| -- | 3.3 to 5.5 volts |
| I<sup>2</sup>C Logic Voltage (SDA and SCL) | -- | 3.3 volts |
| Peak Current | -- | 1.4 mA |
| ------------- | --------- |

| **Temperature** |
| ------------- | ------------- | ------------- |
| **Item** | **Condition** | **Value** |
| Operating Temperature | -- | -40 to +125&deg;C |
|Storage Temperature | -- | -55 to +150&deg;C |
|Absolute Accuracy | From -5 to 50&deg;C | +/- 0.1&deg;C |
| | From -40 to 125&deg;C | +/- 0.5&deg;C |
| **Physical** |
| Wire Colors | Green - I<sup>2</sup>C Clock (SCL, 3.3V) |
| | White - I<sup>2</sup>C Data (SDA, 3.3V) |
| | Red - Positive (3.3-5.5V) |
| | Black - Ground |
| ------------|-------------------------|
| Overall Length | 56.1 mm |
| Thread Size | M10x1.5 20 mm threaded |
| Recommended Through Hole Size | 10-11 mm |
| Wrench Flats | 16 mm |
|---------------------------------------------|

##Physical Specifications

* Bulkhead hole size: 10-10.5mm
* Wire length: 11" (280mm)

##License

The Celsius Pressure Sensor Hardware Design is released under the MIT License.

##Revision History

0.0 - Under development
0.1 - First production version (marked with rev3)
0.2 - Minor layout changes (marked with rev4)
14 changes: 7 additions & 7 deletions TSYS01.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void TSYS01::readTestCase() {
C[6] = 0;
C[7] = 0;

D1 = 9378708;
D1 = 9378708.0f;

adc = D1/256;

Expand All @@ -72,12 +72,12 @@ void TSYS01::readTestCase() {
void TSYS01::calculate() {
adc = D1/256;

TEMP = (-2) * float(C[1]) /1000000000000000000000.0f * pow(adc,4) +
4 * float(C[2]) / 10000000000000000.0f * pow(adc,3) +
(-2) * float(C[3]) / 100000000000.0f * pow(adc,2) +
1 * float(C[4]) /1000000.0f * adc +
(-1.5) * float(C[5]) /100.0f;
TEMP = (-2) * float(C[1]) / 1000000000000000000000.0f * pow(adc,4) +
4 * float(C[2]) / 10000000000000000.0f * pow(adc,3) +
(-2) * float(C[3]) / 100000000000.0f * pow(adc,2) +
1 * float(C[4]) / 1000000.0f * adc +
(-1.5) * float(C[5]) / 100 ;

}

float TSYS01::temperature() {
Expand Down
2 changes: 1 addition & 1 deletion TSYS01.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Description: This library provides utilities to communicate with and to
read data from the Measurement Specialties TSYS01 temperature
sensor.
Authors: Rustom Jehangir, Blue Robotics Inc.
Jonathan Newman, Blue Robotics Inc.
Jonathan Newman, Blue Robotics Inc.
Adam Šimko, Blue Robotics Inc.
-------------------------------
The MIT License (MIT)
Expand Down
15 changes: 7 additions & 8 deletions examples/TSYS01_Calculation_Test/TSYS01_Calculation_Test.ino
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@


/* Blue Robotics MS5837 Library Calculation Test Code
/* Blue Robotics TSYS01 Library Calculation Test Code
-----------------------------------------------------
Title: Blue Robotics MS5837 Library Calculation Test Code
Title: Blue Robotics TSYS01 Library Calculation Test Code
Description: This example is only used to test the conversion calculations
from the part datasheet. It does not actually communicate with the sensor.
Expand All @@ -14,7 +12,7 @@ uploaded via the Arduino 1.0+ software.
-------------------------------
The MIT License (MIT)
Copyright (c) 2015 Blue Robotics Inc.
Copyright (c) 2016 Blue Robotics Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -36,9 +34,9 @@ THE SOFTWARE.
-------------------------------*/

#include <Wire.h>
#include "MS5837.h"
#include "TSYS01.h"

MS5837 sensor;
TSYS01 sensor;

void setup() {
Serial.begin(9600);
Expand All @@ -50,7 +48,8 @@ void loop() {
sensor.readTestCase();

Serial.print("Temperature: "); Serial.print(sensor.temperature()); Serial.print(" deg C");
Serial.print("(Should be 19.82 deg C)"); Serial.println();

Serial.print("(Should be 10.58 deg C)"); Serial.println();

delay(10000);
}
10 changes: 4 additions & 6 deletions examples/TSYS01_Example/TSYS01_Example.ino
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

/* Blue Robotics MS5837 Library Example
/* Blue Robotics TSYS01 Library Example
-----------------------------------------------------
Title: Blue Robotics MS5837 Library Example
Title: Blue Robotics TSYS01 Library Example
Description: This example demonstrates the MS5837 Library with a connected
Description: This example demonstrates the TSYS01 Library with a connected
sensor. The example reads the sensor and prints the resulting values
to the serial terminal.
Expand All @@ -14,7 +14,7 @@ uploaded via the Arduino 1.0+ software.
-------------------------------
The MIT License (MIT)
Copyright (c) 2015 Blue Robotics Inc.
Copyright (c) 2016 Blue Robotics Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -63,7 +63,5 @@ void loop() {

Serial.println(" deg C");

Serial.println("---");

delay(1000);
}

0 comments on commit cd3dfdc

Please sign in to comment.