Skip to content

Instantly share code, notes, and snippets.

Gerad Munsch unforgiven512

Block or report user

Report or block unforgiven512

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@unforgiven512
unforgiven512 / comed_hourlypricing_data.py
Created Jul 19, 2019
Improved ComEd Hourly Pricing python script
View comed_hourlypricing_data.py
#!/usr/bin/env python2
import argparse
import locale
import logging
import time
import threading
import json
import requests
import datetime
@unforgiven512
unforgiven512 / example.py
Created Jul 18, 2019
INA219 library (example) for MicroPython on ESP8266
View example.py
from machine import Pin, I2C
from ina219 import INA219
from logging import INFO
SHUNT_OHMS = 0.1
i2c = I2C(-1, Pin(5), Pin(4))
ina = INA219(SHUNT_OHMS, i2c, log_level=INFO)
ina.configure()
@unforgiven512
unforgiven512 / README.md
Created Jul 18, 2019
README for INA219 library for MicroPython on ESP8266
View README.md

Using the Library on an ESP8266

On the NodeMCU clone I used to test with I got an out of memory error when trying to import the ina219 module, this is due to there being insufficient RAM to compile this module to byte code. If you encounter this issue then you can use the frozen byte code as explained below.

Usage

This is an example script:

from machine import Pin, I2C
@unforgiven512
unforgiven512 / README.md
Created Jul 18, 2019
README for INA219 library for MicroPython on ESP8266
View README.md

MicroPython Library for Voltage and Current Sensors Using the INA219

This MicroPython library for the INA219 voltage, current and power monitor sensor from Texas Instruments. The intent of the library is to make it easy to use the quite complex functionality of this sensor.

The functionality is currently under development and is based on my INA219 library for the Raspberry Pi.

The library currently only supports continuous reads of voltage and

@unforgiven512
unforgiven512 / example.py
Created Jul 18, 2019
INA219 library (example) for MicroPython on ESP8266
View example.py
"""Example script.
Edit the I2C interface constant to match the one you have
connected the sensor to.
"""
from ina219 import INA219
from machine import I2C
# Edit to match interface the sensor is connect to (1 or 2).
@unforgiven512
unforgiven512 / example.py
Created Jul 18, 2019
INA219 library (example) for MicroPython
View example.py
"""Example script.
Edit the I2C interface constant to match the one you have
connected the sensor to.
"""
from ina219 import INA219
from machine import I2C
# Edit to match interface the sensor is connect to (1 or 2).
@unforgiven512
unforgiven512 / ina219.py
Created Jul 18, 2019
INA219 library for MicroPython
View ina219.py
"""MicroPython library for the INA219 sensor.
This library supports the INA219 sensor from Texas Instruments with
MicroPython using the I2C bus.
"""
import logging
import utime
from math import trunc
from micropython import const
@unforgiven512
unforgiven512 / ssd1306.py
Created Jul 18, 2019
old ssd1306.py library file on MicroPython ESP8266 board #7
View ssd1306.py
"""
This is a MicroPython driver for the SSD1306 OLED display.
The driver implements both the I2C and SPI interfaces, as the SSD1306 is available with either interface.
"""
# MicroPython SSD1306 OLED driver, I2C and SPI interfaces
from micropython import const
import time
@unforgiven512
unforgiven512 / ds1621.py
Created Jul 18, 2019
old ds1621.py library file on MicroPython ESP8266 board #7
View ds1621.py
"""
This is a MicroPython driver for the Dallas (Maxim) DS1621 digital temperature sensor.
The DS1621 is an I2C device, and is able to provide digital temperature data with a resolution of 9 bits, resulting in a
granularity of 0.5 degrees Celsius.
Additionally, the DS1621 is a relatively simple device; as such, the I2C command set is rather simple. The simplicity is
a great factor for utilizing this device (and driver) as a simple example for use of I2C on MicroPython; the basic read,
write, and other functionality are demonstrated. Additionally, some simple data manipulation methods are demonstrated.
"""
@unforgiven512
unforgiven512 / bme280.py
Created Jul 18, 2019
old bme280.py library file on MicroPython ESP8266 board #7
View bme280.py
# Author: Paul Cunnane 2016
#
# This module borrows heavily from the Adafruit BME280 Python library
# and the Adafruit GPIO/I2C library. Original copyright notices are reproduced
# below.
#
# Those libraries were written for the Raspberry Pi. This modification is
# intended for the MicroPython and WiPy boards.
#
#
You can’t perform that action at this time.