Things used in this project

Hardware components:
Photon new
Particle Photon
×1
ControlEverything.com I2C Shield
×1
ControlEverything.com ADS1115 I2C 16-Bit Analog-Digital Converter
×1
Digital Glass Bathroom Scale
×1
Software apps and online services:
Particle Build
Mobicle
Atomiot
Hand tools and fabrication machines:
Wire stripper
heat shrink connectors

Schematics

Full Bridge
This is a single full bridge that represents one side of the scale. The differential reading is taken at the signal points (red wires).
Wheatstone

Code

keg-beers.inoArduino
You will need to include the ADAFRUIT_ADS1X15 library.
// This #include statement was automatically added by the Particle IDE.
#include "Adafruit_ADS1X15/Adafruit_ADS1X15.h"
Adafruit_ADS1115 ads;  /* Use this for the 16-bit version */
//Adafruit_ADS1015 ads;     /* Use thi for the 12-bit version */


// CONNECT PHOTON TO ADS1115 BOARD AS FOLLOWS:
//
//  PHOTON PIN  ->  ADS11x5 PIN
//  ----------      -----------
//  3.3V        ->  VDD
//  GND         ->  GND
//  D0          ->  SDA (I2C DATA)
//  D1          ->  SCL (I2C CLOCK)
//  D2          ->  ALERT
double beers_left = 0;
double beers_leftnew = 0;
int voltage = 0;
char publishString[40];

void setup(void) 
{
  Serial.begin(9600);
  Serial.println("Setup..");
  Particle.variable("Beers_left", &beers_left, DOUBLE);
 
  // The ADC input range (or gain) can be changed via the following
  // functions, but be careful NEVER TO EXCEED +0.3V OVER VDD ON GAINED INPUTS,
  // or exceed the upper and lower limits if you adjust the input range!
  // Setting these values incorrectly may DESTROY your ADC!
  //
  //  *** TAKE CARE WHEN SETTING GAIN TO NOT EXCEED ABOVE LIMITS ON INPUT!!
  //                                                                    ADS1015   ADS1115
  //                                                                    -------   -------
  // ads.setGain(GAIN_TWOTHIRDS);  // 2/3x gain +/- 6.144V  1 bit =       3mV       0.1875mV (DEFAULT)
  // ads.setGain(GAIN_ONE);        // 1x gain   +/- 4.096V  1 bit =     2mV       0.125mV
  // ads.setGain(GAIN_TWO);        // 2x gain   +/- 2.048V  1 bit =     1mV       0.0625mV
  // ads.setGain(GAIN_FOUR);       // 4x gain   +/- 1.024V  1 bit =     0.5mV     0.03125mV
  // ads.setGain(GAIN_EIGHT);      // 8x gain   +/- 0.512V  1 bit =     0.25mV    0.015625mV
  ads.setGain(GAIN_SIXTEEN);    // 16x gain  +/- 0.256V  1 bit =     0.125mV   0.0078125mV  
  ads.begin();

  Serial.println("Getting differential reading from AIN0 (Positive) and AIN1 (Negative)");
  Serial.println("ADC Range: +/- 6.144V (1 bit = 0.1875mV for ADS1115)");

}

void loop(void)
{
  double multiplier = 0.0078125F; //milli Volts per bit for ADS1115
  //double multiplier = 3.0F; //milli Volts per bit for ADS1105

  short adc0_1 = ads.readADC_Differential_0_1();  
  double av0_1 = (adc0_1 * multiplier);
  
  short adc2_3 = ads.readADC_Differential_2_3();
  double av2_3 = (adc2_3 * multiplier);

  float voltage = (av0_1 + av2_3); 
  
  beers_leftnew = ((voltage - .25) / 0.02109376); // The subtracted number zeros out the reading based on empty keg count. The divided number is equal to the full keg count divided by 53.3 (beers). "calibrated single beer count"

  beers_left = ((beers_left * 63) + beers_leftnew) / 64;
  
  sprintf(publishString, "%3.1f",beers_left);
  Particle.publish("Beers_left",publishString);
    
  Serial.print("AIN0_1: "); Serial.print(adc0_1); Serial.print(", AV0_1: "); Serial.print(av0_1,7); Serial.println("mV");
  
  
  delay(500);

}

Credits

A59debacaf7fc125dc34c7663fb1f916
Eric Joyce

Mechanical Engineering major at UNC Charlotte, Energy concentration

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Blynk GPS Tracker
Intermediate
  • 41
  • 2

Full instructions

Simple GPS tracker using a Particle Photon (or Electron) and an EM406 GPS module with location visible on Blynk app map.

Pool Buddy
Intermediate
  • 1,619
  • 11

Work in progress

Monitor and log water quality (pH & ORP) and temperature from everywhere.

IoT Thermometer Using Python
Intermediate
  • 986
  • 8

Full instructions

How to develop a simple but powerful IoT thermometer using a Zerynth-powered single-board MCU and the Zerynth App.

Particle Photon Flip Dot Clock
Intermediate
  • 2,162
  • 31

Full instructions

The flip dot display uses an electromechanical dot matrix that spin from black to yellow to display text, numbers and more!

Patriot iOS App
Intermediate
  • 547
  • 9

Use an old iPhone device to control and display the status of your Patriot IoT devices.

Patriot iOS App

Team Patriot

What To Wear LCD
Intermediate
  • 48
  • 1

Ever wondered what to wear due to unpredictable weather??? Wonder no longer!

Add projectSign up / Login