Skip to content

Instantly share code, notes, and snippets.

@discreetmayor
discreetmayor / grafana-currentranger.json
Created November 3, 2021 15:30
Grafana Power Analysis Dashboard
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@discreetmayor
discreetmayor / currentranger.py
Last active November 3, 2021 15:27
CurrentRanger output to redis-timeseries
import io
import time
import math
import serial
import threading
from redistimeseries.client import Client as RedisTimeSeries
from time import sleep
from datetime import datetime
#from redis import Redis
@discreetmayor
discreetmayor / gist:2c590b90edc0c79b6649a5301205ff1a
Created November 3, 2021 15:21
CurrentRanger Arduino firmware modified for redis-timeseries logging
// CurrentRanger(TM) stock firmware
// https://lowpowerlab.com/CurrentRanger
// CurrentRanger is a *high-side* precision current meter featuring:
// - fast autoranging
// - uni/bi-directional modes (ie. DC/AC measurements)
// - ultra low burden voltage
// - 1mV per nA/uA/mA measurements with DMM/scope
// - OLED standalone readings
// - serial data logging option via 3.3v/RX/TX header or USB (must use isolation, read guide!)
// - full digital control for power/switching
#include <msp430.h>
/*
* This bit of code is written using CCS6 for the MSP430G2553.
*
* Decodes rotary encoder direction.
*
* While direction is interpreted correctly, only falling edges trigger an interrupt, so only half
* of the available information is used.
* Since the type of encoder used (the cheap Chinese ones found on ebay) have detents