Skip to content

Instantly share code, notes, and snippets.

Avatar

Phill Paraphraser

  • Cootamundra NSW Australia
View GitHub Profile
@Paraphraser
Paraphraser / keybase.md
Last active Dec 12, 2019
Keybase proof
View keybase.md

Keybase proof

I hereby claim:

  • I am paraphraser on github.
  • I am paraphraser (https://keybase.io/paraphraser) on keybase.
  • I have a public key ASAEuq9mHBtAWcvqsEvFAC-CtHGqjRDtQU3Ht7YY0MrSJQo

To claim this, I am signing this object:

@Paraphraser
Paraphraser / RPi_local_NTP_servers.md
Last active Jan 18, 2020
Configuring Raspbian to use local time-servers
View RPi_local_NTP_servers.md

Configuring Raspbian to use local time-servers

The case for using local time-servers

Out of the box, Raspbian gets its time from NTP servers in the debian.pool.ntp.org domain. You can confirm this via:

$ timedatectl show-timesync
...
ServerName=0.debian.pool.ntp.org
@Paraphraser
Paraphraser / TheRetainFlag.md
Created Sep 18, 2020
MQTT and the retain flag
View TheRetainFlag.md

Tutorial: MQTT and the retain flag

Assumptions and setup

This tutorial assumes:

  • a single computer (like a Raspberry Pi)
  • MQTT broker (like Mosquitto) running
  • the mosquitto_pub and mosquitto_sub commands are available.
@Paraphraser
Paraphraser / NodeRED_MidnightredTheme.md
Last active Dec 8, 2020
Recipe for installing Node-RED Midnight-red theme under IOTstack
View NodeRED_MidnightredTheme.md
@Paraphraser
Paraphraser / CalculatingBarometricPressureTrend.md
Last active Jan 2, 2021
Calculating barometric pressure trend
View CalculatingBarometricPressureTrend.md

Calculating barometric pressure trend

This gist is a response to a Discord question. It explains my approach to deciding whether barometric pressure is rising, falling or remaining steady.

I do the trend calculation in Arduino (ESP8266) code. I tried to mimic the idea of setting the reference needle on a real barometer, waiting an hour, then seeing which way the pressure needle had moved with respect to the reference. The wrinkle is that "the last hour" is a moving window that updates every 10 minutes.

The BMP085 sensor is polled every 10 minutes. Until there are six observations (eg after a reboot) the code returns "training".

After that, the code does a least-squares regression on the last six observations (ie the last hour of data) to find the linear equation of best fit. In effect, the algorithm assumes that knowing the time (independent variable on the X axis) at some point in the past hour would permit the pressure at that time (dependent variable on the Y axis) to be estimated with some degree of

@Paraphraser
Paraphraser / InfluxDB security under IOTstack.md
Last active Feb 26, 2021
Enabling authentication in InfluxDB for SensorsIot/IOTstack
View InfluxDB security under IOTstack.md

Tutorial: Enabling authentication in InfluxDB

Assumptions:

  • you are running SensorsIot/IOTstack with InfluxDB as one of the containers
  • you want to enable authentication for your InfluxDB databases.

Note: This tutorial is specific to SensorsIot/IOTstack.

Definition:

@Paraphraser
Paraphraser / Mosquitto security under IOTstack.md
Last active Mar 31, 2021
Mosquitto password protection in IOTstack
View Mosquitto security under IOTstack.md

Mosquitto password protection in IOTstack

Setting up passwords for Mosquitto is a topic that comes up fairly frequently in GitHub issues and on the Discord channel, usually as a result of it not working as expected.

The purpose of this gist is to explain the how-to of password setup, as at Feb 16, 2021 when 2.0.7 was the "latest" version of Mosquitto.

Mosquitto underwent some changes between 1.6.x and 2.0, including how passwords were handled. See Migrating to Mosquitto 2.0.

Contents

@Paraphraser
Paraphraser / IOTstackPullRequest.md
Last active Apr 19, 2021
Preparing IOTstack Pull Requests
View IOTstackPullRequest.md

Preparing a Pull Request for IOTstack

If you want to fix a bug or propose an enhancement for IOTstack, you will need to prepare a Pull Request (PR).

Please don't try to do anything in this gist inside an ~/IOTstack folder on a Raspberry Pi that is also being used to run your Docker containers. It's easy to get confused and you could accidentally break your own working IOTstack.

You can do everything on the same Raspberry Pi that is running your IOTstack but it's usually easier to work on a desktop or laptop. If you accept this advice, there's no risk of breaking your running IOTstack.

This guide barely scratches the surface of Pull Requests. There is lots of advice on GitHub and Google will find plenty of hits for any question you might have.

@Paraphraser
Paraphraser / Tutorial - Debugging MQTT traffic flows in IOTstack.md
Last active Apr 19, 2021
Tutorial: Debugging MQTT traffic flows in IOTstack
View Tutorial - Debugging MQTT traffic flows in IOTstack.md

Tutorial: Debugging MQTT traffic flows in IOTstack

You have built an ESP32, ESP8266 or similar project. You are sure it is sending payloads via MQTT but the data doesn't seem to be arriving in Node-Red. You're at a bit of a loss as to what to do next.

This tutorial is specific to IOTstack where Mosquitto and Node-Red are running as Docker containers on a Raspberry Pi. Much of it is probably applicable to other environments but "your mileage may vary".

Related resources

@Paraphraser
Paraphraser / run_RPI4B_from_SSD.md
Last active Apr 30, 2021
Run a Raspberry Pi 4B from an SSD connected to a USB-3 port
View run_RPI4B_from_SSD.md

Run Raspberry Pi 4 from SSD

Deprecation notice (2021-03-08)

The material in this gist is a bit out-of-date and will soon be withdrawn.