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

Contact

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

Lightweight Sliding Door Automator
Intermediate
  • 1,535
  • 7

Work in progress

Automate the opening and closing of a lightweight sliding door (e.g. a screen door), including remote controls on your phone.

Christmas Gift Box
Intermediate
  • 3,633
  • 595

Full instructions

Christmas Gift Box plays music and sends an email when it is opened.

Carbon Fiber Vacuum Chamber
Intermediate
  • 2,905
  • 94

Full instructions

Our project is a carbon fiber vacuum chamber that is monitored by multiple particle photons and various sensors.

ConnectTheDots with Particle Azure IoT Hub Integration
Intermediate
  • 841
  • 8

Protip

This project will allow you to connect your Particle device into an Azure IoT Hub for viewing data in real-time through an ASP.NET web app!

What should I wear outside?
Intermediate
  • 5,044
  • 67

Full instructions

A whimsical weather clock powered by Particle and forecast.io

Garage Door Opener with Blynk
Intermediate
  • 367
  • 2

Open, close and monitor a garage door opener with a smart phone using a Particle Photon and the Blynk application.

Add projectSign up / Login