npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

brewpi

v0.1.1-alpha

Published

Node.js implementation of BrewPi temperature control

Downloads

8

Readme

Build Status

BrewPi for Node.JS

This is a Node.JS implementation of BrewPi, the Raspberry Pi and Arduino temperature controller for brewing. This implementation is extremely alpha and incomplete. Please check out the official BrewPi repository for the tried and true approach.

Why?

  • Speed - Node is fast. And it's easy on the resources. Both of which are important to consider when running an application on a Raspberry Pi.

  • Event-driven, non-blocking IO - With BrewPi, the Raspberry Pi and Arduino are continuously communicating with each other. Rather than writing complex, blocking loops in order to manage serial port communication. We can instead listen for data and act on it.

  • Simplicity - Having a Node option for BrewPi mean that everything from serial port communication to a web front-end can all be written in the same language. Don't feel like spinning up a LAMP stack on your Brew Pi? No problem.

How to use

Install Node.js on your Raspberry PI! This might take a while as there is currently not a straightforward way to do this.

When inside a project where you want to include the BrewPi package:

$ npm install brewpi

Import BrewPi package into your project and create a local instance:

var BrewPi = require('brewpi');

var myBrewPi = new BrewPi({
  serialPort: '/dev/ttyACM0'
});

Build something!

API

BrewPi

Constructor exposed by require('brewpi').

BrewPi()

Creates a new BrewPi. Works with and without new:

var BrewPi = require('brewpi');

var myBrewPi = new BrewPi({
  serialPort: '/dev/ttyACM0'
});

BrewPi(opts:Object)

Creates a BrewPi with an optional options object. Current supported option is:

  • serialPort - This is the path to the serial port that your Arduino is connected to. Defaults to '/dev/ttyACM0'.

Methods

These methods can be called on a BrewPi instance.

BrewPi.start()

Calling .start() on your BrewPi instance will make the serial port connection. It will then start polling the Arduino for its control constants and control settings.

BrewPi.stop()

Stops the polling of data from the Arduino.

BrewPi.getMode()

Gets the BrewPi's current mode.

BrewPi.getFridgeTemperatureSetting()

Gets the BrewPi's current fridge temperature from stored settings.

BrewPi.getBeerTemperatureSetting()

Gets the BrewPi's current beer temperature setting from stored settings.

BrewPi.getControlSettings()

Gets the BrewPi's current control settings from stored settings.

BrewPi.getControlConstants()

Gets the BrewPi's current control constants from stored settings.

BrewPi.getControlVariables()

Gets the BrewPi's current control variables from stored settings.

BrewPi.refreshControlSettings()

Update stored control settings with data from Arduino.

BrewPi.refreshControlConstants()

Update stored control constants with data from Arduino.

BrewPi.refreshControlVariables()

Update stored control variables with data from Arduino.

BrewPi.loadDefaultControlSettings()

Tells Arduino to load default control settings programmed on the Arduino.

BrewPi.loadDefaultControlConstants()

Tells Arduino to load default control constants programmed on the Arduino.

BrewPi.sendSettings(settingsAsJSON)

Takes a settings object and sends it to the Arduino.

Events

These events are emitted from a BrewPi instance. You can use these events to attach your own behaviors.

myBrewPi.on('brewPiStart', function() {
	doSomethingWhenBrewPiStarts();
});

or with data

myBrewPi.on('newLCDData', function(data) {
	doSomethingWhenLCDDataIsReceived(data);
});

brewPiStart

Emitted when BrewPi instance is started.

brewPiStop

Emitted when BrewPi instance is stopped.

newTemperatureData

Emitted when BrewPi receives new temperature data.

controlConstantsUpdated

Emitted when control constants are updated.

controlSettingsUpdated

Emitted when control settings are updated.

controlVariablesUpdated

Emitted when control variables are updated.

Todo

This is a work in progress. Currently this package can control your BrewPi, but the ability for more advanced (and practical) temperature control is still being developer. The following list is a roadmap of intended functionality.

  • Support for beer profiles
  • Data logging (either to static files or a database)
  • Ability to program an Arduino with a binary file
  • Much more...

Special Thanks

Thanks to Elco for creating the fantastic BrewPi project. He's put a lot of time and money into his BrewPi project, support it if you can.

Also, thanks to node-serialport library for making Node.js serial port development remarkably easy and awesome.