Skip to content

Kotlin/Java (Android Things) Module for MAX6675 Thermocouple-to-Digital Converter

Notifications You must be signed in to change notification settings

omkar-as/max6675-androidthings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

MAX6675-AndroidThings

What it is

MAX6675 is a Cold-Junction Compensated Thermocouple-to-Digital Converter.

Please see the official page for the sensor: MAX6675 Cold-Junction-Compensated K-Thermocouple-to-Digital Converter (0°C to +1024°C)

This project provides a Kotlin module to integrate your MAX6675 sensor device via SPI protocol and read the temperature in °C from it. Inspired from Adafruit MAX6675-library for Arduino and MAX6675 by Troy Dack.

Since it's written in Kotlin, it is interoperable with Java as well. See: Calling Kotlin from Java - Interoperability for more details on how to use this module in Java code.

Usage

// Find the SPI device name for your MAX6675 device.
// For more details on how to do that, see: https://developer.android.com/things/sdk/pio/spi#manage-connection
val SPI_DEVICE_NAME="SPI3.0"

// Initialize and configure the device.
val max6675 = Max6675(SPI_DEVICE_NAME)

// Read and print the temperature 100 times, with 1s delay between reads.
var index = 1
while(index <= 100) {
    val result = max6675.readTempInCelcius()
    Log.i(TAG, "Result: $result")
    Thread.sleep(1000)
    index += 1
}

// Close the device when you're done using it.
max6675.closeSpiDevice()

About

Kotlin/Java (Android Things) Module for MAX6675 Thermocouple-to-Digital Converter

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages