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

Drop of Life
Intermediate
  • 658
  • 17

Full instructions

A display to remind me when I can donate blood and save lives, powered by the Red Cross API and Particle.

IoT Drone - Part 2 - Sensors
Intermediate
  • 399
  • 4

Work in progress

Part 2 incorperates a GPS receiver, 10 DOF IMU, and Ultrasonic distance sensor to be used for flight controls.

How to run Particle on Raspberry Pi (Headless on Pi Zero W)
Intermediate
  • 1,666
  • 19

Protip

Use the most popular single-board computer with the most popular IoT tools.

Your Wife is Hot!
Intermediate
  • 605
  • 6

Full instructions

Not hot like she looked at your browser history, hot as in temperature hot! This can be avoided with an A/C Condensate Monitoring System.

Your Wife is Hot!

Team Is it Summer Yet?

Wireless Tank and Pump Monitoring System with Mobile App
Intermediate
  • 504
  • 3

Particle and Blynk to wirelessly monitor a 4,000 gallon water distribution system.

IoT Controlled Planter Lights
Intermediate
  • 556
  • 6

This is a shelf for starting plant seeds, controlled over the internet with automatic lights.

Add projectSign up / Login
Respect project