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

Particle Photon Doorbell
Intermediate
  • 619
  • 9

Full instructions

Get notified when the doorbell is pressed for about 1/6 the price of the RING doorbell!

DIYSprinkler Controller
Intermediate
  • 422
  • 3

Full instructions

Make your own sprinkler controller and I have the software to control it. Must have an existing sprinkler system or you could make your own

DIYSprinkler Controller

Team dougefresh89

Magic Eyeball
Intermediate
  • 781
  • 7

Full instructions

It's like a magic eight ball. But with Alexa, and two eyeballs.

Spoil your Valentine with Particle + Spoil + AWS
Intermediate
  • 478
  • 3

Full instructions

Instead of giving a box of chocolates this Valentines Day, keep the chocolates. Lets give a smart self-gifting box instead!

Pebble + Photon = IoT Watch Switch
Intermediate
  • 50
  • 1

Full instructions

When I arrive in my house I switch on the light with my Pebble Watch! The procedure to make this is very simple.

Automated Cat Feeder with Particle Photon
Intermediate
  • 1,544
  • 19

Work in progress

The goal was to make it possible to feed my cats when I'm not at home.

Add projectSign up / Login
Respect project