Module: weigh

This driver implements the protocol to retreive samples from the ADC in the weigh scales. The weight is periodically sampled and an event fired to all listeners when the weight changes.
Author:
  • Dave Leitch

Requires

  • module:json-fs-store
  • module:events
  • module:brewdefs.js
  • module:brewlog.js
  • module:onoff.js

Methods


<static> calibrate(refKg, Callback)

For a specific weight, take a measurement and adjust the calibration data (slope).
Parameters:
Name Type Description
refKg number Reference weight
Callback function

<static> tare(function)

Assume that the weight is zero. Take a measurement and adjust the calibration data (offset).
Parameters:
Name Type Description
function Callback

<inner> sample()

Take a sample by driving the GPIO pins connected to the ADC. The protocol is: 0 - Drive CLK low to leave low power mode. 1 - Wait until the ADO pin goes low. 2 - Drive CLK high. 3 - Drive CLK low. 4 - Read ADO 5 - Repeat 2,3,4 for each of the 24 bits. 7 - Drive CLK high 8 - Drive CLK low 9 - Drive CLK high to enter low power mode.