Skip to content

An electronic thermostat based on the Pocket C.H.I.P. computer

Notifications You must be signed in to change notification settings

buzzert/Chipotherm

Repository files navigation

Chipotherm

Chipotherm is a electronic thermostat for the Pocket C.H.I.P. computer.

Picture of the CHIP running Chipotherm

It supports automatic temperature monitoring, a temperature graph of past measurements, and a cool futuristic UI.

You can also control it remotely, either via a TCP socket or by installing the Chipotherm Server.

Building

Make sure to build with clang for C++14 support. (Ensure default c++ compiler with update-alternatives --config c++)

mkdir build && cmake .. && make

Building for Pocket C.H.I.P.

Easy way (Docker)

  1. Run build_device.sh
  2. The built product will be extracted to build_device

Hard way (Manual)

The best way to build for the Pocket C.H.I.P. is via a QEMU root using Debian Jessie (the distribution the CHIP is using).

Here's how to set that up:

  1. Make sure you're building on a 32-bit Debian-based system (in a VM for instance)
  2. mkdir /var/jessie_armhf
  3. Bootstrap an ARM Debian Jessie instance using qemu-debootstrap

    qemu-debootstrap --arch armhf jessie /var/jessie_armhf http://deb.debian.org/debian/

  4. Copy the qemu interpreter to the new root

    cp /usr/bin/qemu-arm-static /var/jessie_armhf/usr/bin

  5. chroot to the newly created debian root and install build dependencies in there. (See "Requirements" section)

Installing

  1. Copy the chipotherm executable to the Pocket C.H.I.P.
  2. Setup a systemd job so chipotherm runs when the CHIP boots up [optional]

Hardware Installation

  1. Attach a electronic relay (such as this one) to the CHIP.
    • Connect +3.3V to the VIN pin on the relay
    • Connect ground to ground on the CHIP
    • Connect S or whatever the signal pin is to the CHIP's GPIO 1 pin
  2. Attach the "hot" and "neutral" wires to the relay, such that when the relay is closed it completes the circuit between the two wires. It might be a good idea to test with a multi-meter before installing. A correct installation would be +240V (in the US) from the hot wire and +0V from the neutral wire. It is important that you do not connect these directly to the Pocket CHIP! You must use a relay!

Remote Control

Chipotherm can be controlled remotely, either via messaging the UNIX socket it creates (located in /run/user/[your uid]/chipotherm/socket) or by running a command-and-control server such as Chipotherm Server.

To have Chipotherm connect to a command-and-control server, start the server on another box (such as a VPS), and start chipotherm providing the command-and-control server as the first argument. For example: chipotherm 'http://myserver.local:43001'

Control via the socket

In the future, I'd like to provide a nicer interface for doing this, but for now you can message the socket using the socat command on Linux: echo "set_enabled 1" | socat - UNIX-CONNECT:/var/run/user/1000/chipotherm/socket

Sounds

Sounds make using this a lot more fun. Unfortunately the Pocker CHIP's sound driver does this annoying power-saving thing that makes it so all the sounds are super delayed. To fix this, I had to make a systemd unit to play silence continuously so the sound card doesn't go to sleep.

[Unit]
Description=Continuous silence

[Service]
ExecStart=/usr/bin/play -qn

[Install]
WantedBy=default.target

Requires sox package for play. Even worse than that, ALSA is so old it doesn't do software mixing by default. You have to enable that by editing /etc/asound.conf. This configuration file is located in this project under utils/asound.conf.

Submodules

bubbles is used for the user interface for this project.

Requirements

libtempered bubbles boost hidapi-hidraw libsoup-2.4 pangocairo threads

About

An electronic thermostat based on the Pocket C.H.I.P. computer

Resources

Stars

Watchers

Forks

Packages

No packages published