Go to file
2023-12-13 11:48:14 +00:00
.gitea Screenshot running on Pi 2023-11-22 15:57:48 +00:00
api wrong json key 2023-12-13 11:46:47 +00:00
config use log 2023-12-13 08:17:16 +00:00
core cleanup 2023-12-13 08:58:39 +00:00
data case 2023-12-13 11:48:14 +00:00
db use log 2023-12-13 08:17:16 +00:00
filter select filter in config file 2023-11-21 18:44:31 +00:00
pcb use log 2023-12-13 08:17:16 +00:00
ports initial version of http/rest API 2023-12-05 17:22:12 +00:00
static simplify websockets 2023-12-13 08:15:23 +00:00
thermocouple first draft cjc 2022-12-05 12:40:07 +00:00
config.toml initial version of http/rest API 2023-12-05 17:22:12 +00:00
go.mod websockets! 2023-12-12 21:07:04 +00:00
go.sum websockets! 2023-12-12 21:07:04 +00:00
main.go use log 2023-12-13 08:17:16 +00:00
Makefile just compile on the pi like this and it'll work. CC'ing is a lot of work 2023-11-21 23:21:29 +00:00
README.md more config options 2023-11-25 10:37:02 +00:00
rest-api-idea.txt initial version of http/rest API 2023-12-05 17:22:12 +00:00

TH7

Seven-channel multiple thermocouple reader and logger HAT for the Raspberry Pi.

This software supports the following thermocouple types:

  • B
  • E
  • J
  • K
  • N
  • R
  • S
  • T

Features not yet implemented but planned:

  • More database logging options than SQLite3 and InfluxDB
  • Advanced filtering, incl. user-selectable filtering stages and sample sizes
  • Several logging options at once, one local, one or more remote
  • Configure any setting via API call either via RESTful JSON API or GRPC
  • A terminal user interface ("TUI") that may be used to remotely monitor/access/configure a TH7 (w/ auth)
  • Ability to act in headless mode
  • Request dumps from filter stages for noise study
  • ... and more!
Note: Most thermocouples that have a coloured and a white lead, usually have the coloured one as the positive.

Alt

Configuring the TH7

This program is controlled with a config file config.toml in which the user can configure each thermocouple channel independently, enable a web view, configure database logging, etc. The TH7 software uses sane default values where possible.

# EXAMPLE TH7 CONFIG
[TH7]
port = 9090   # port used by the web view
LED = true    # enable the blinking lights on the Raspberry Pi Hat
debug = false # if true, the software will use a simulated TH7
nolog = false # debug variable, will simulate a DB
noweb = false # set to true to disable web view and the REST API

# Configure channel 1
[Channel_1]
type = 'K'    # set type to K-type thermocouple
gain = 106.8  # gain is used during signal conversion
offset = -5.6 # offset is added to the final converted value (in °C)
filter.samples = 50 # samples for the filter function
filter.type = 0     # integer representing the filter function type
log = false # do not log this channel to DB (if applicable)

# Filter functions:
# 0: simple alpha-beta filter (default)
# 1: lag filter: old * 0.90 + new * 0.10
# 2: lag filter: old * 0.95 + new * 0.05
# 3: lag filter: old * 0.99 + new * 0.01

# Configure channel 2 to read μV
# this example uses default values for gain, offset and filter.
[Channel_2]
type = 'U' # set thermocouple type to 'U' to just read μV

# Database
# Each database type requires its own set of values
# Below is an example for SQLite3
[DB]
type = "sqlite3"
path = "/home/pi/th7.db" # where to save the database file
freq = 60 # logging frequency. specified in seconds

# InfluxDB example
[DB]
type = "influxdb"
host = "https://influxdb-server.com/"
bucket = "my-th7-bucket"
token = "cGFzc3dvcmQxMjMKcGFzc3dvcmQxMjMK"

Using InfluxDB

The host, bucket and token fields may be specified in the env variables, rather than in the config.toml file. Example:

export INFLUXDB_HOST="https://influxdb-server.com/"
export INFLUXDB_BUCKET="my-th7-bucket"
export INFLUXDB_TOKEN="cGFzc3dvcmQxMjMKcGFzc3dvcmQxMjMK"

In this case, the [DB] field in config.toml can be left empty except for type = "influxdb"

Building on a Raspberry Pi

This code builds without fuss on Raspberry Pi 4 with go version go1.19.3 linux/arm

wget https://go.dev/dl/go1.19.3.linux-armv6l.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.19.3.linux-armv6l.tar.gz

edit $HOME/.profile and add the following, if not already there:

export PATH=$PATH:/usr/local/go/bin

source new profile

. $HOME/.profile

then try to build

make