Skip to content
Heating for a Raspberry Pi powered Allsky Cam
Branch: master
Clone or download

Latest commit

Latest commit e4584e8 Feb 9, 2020


Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE Initial commit Feb 9, 2020 Update Feb 9, 2020
Raspi.jpg Add files via upload Feb 9, 2020
Relay.jpg Add files via upload Feb 9, 2020
Relay_Resistors.jpg Add files via upload Feb 9, 2020 Add files via upload Feb 9, 2020
allskyheating.service Create allskyheating.service Feb 9, 2020


Heating for a Raspberry Pi powered device, e.g. an Allsky Cam.

The purpose of this repository is to provide a cheap and simple way to heat any device powered by a Raspberry Pi, e.g. if it is operated in cold or dewy environments. My use case is to keep dew from building up on the acrylic dome of an allsky cam - specifically this one:

Design principles:

  • low power consumption, e.g. when the Raspberry is powered via PoE
  • as few parts as possible, e.g. no extra piHATs or similar
  • coming with the point above, as low cost as possible, only a 5v relay and some resistors needed
  • integration into smart home / IoT environment using MQTT

Hardware Installation

Bill of Materials

For assembly, simply solder the resistors in parallel onto the breadboard. Connect the breadboard and the 5v relay to the GPIO pins:

PIN 2 (5V) ------ Relay VCC
PIN 4 (5V) ------ Relay NO
PIN 6 (GND) ----- Relay GND
PIN 9 (GND) ----- breadboard -
PIN 11 (GPIO17)-- Relay IN
Relay COM ------- breadboard +

Software Installation on your Raspberry Pi

sudo apt-get install python-dev python-pip
sudo pip install wiringpi
sudo pip install paho-mqtt

Adapt script to your environment.

MQTT Server --> enter your MQTT Server address (line 49)
MQTT topics --> define the topics (lines 23, 29), e.g. /sternwarte/allskyheating/#
MQTT payloads --> define payload (lines 31, 38), e.g. "on" "off"

Copy to /home/pi on your Raspberry Pi. Copy allskyheating.service to /lib/systemd/system

sudo chmod 644 /lib/systemd/system/allskyheating.service
sudo systemctl daemon-reload
sudo systemctl enable allskyheating.service
sudo reboot

Now you can turn heating of your Raspberry Pi on and off using mqtt commands or have it done automatically based on time or current weather conditions.


  • Topic: /sternwarte/allskyheating
  • Payload: on / off


Raspberry Pi


Relay and Resistors

Comparison before and after:

On Youtube, you can see the effect of this heating. The first video is a timelapse of the night from February 6th-7th, 2020 with no heating:

In the second video, the heating is turned on during the next night (Feb 7th-8th, 2020), both nights had similar conditions with temperatures below 0°C (minimum: -5°C).

You can’t perform that action at this time.