Go Down

Topic: Digital kitchen weighing scale interface (Read 3 times) previous topic - next topic

avandalen

For a DC motor test bench, I needed a weighing scale which can be read out by a computer. I developed an interface program for the Arduino to read out the scale. There is no additional electronics needed, just two wires between the internal scale electronics and the Arduino.
See here for the site and libraries:
http://www.avdweb.nl/arduino/hardware-interfacing/scale-interface.html




Main program:
Code: [Select]
/* Scale interface
* Version 20-12-2011
* Copyright (C) 2011  Albert van Dalen http://www.avdweb.nl
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses
*/

#include <Streaming.h>
#include "Scale.h"

const byte scalePin = 3;
const byte scaleInterrupt = 1; // = pin 3

Scale scale = Scale();

void setup()
{ Serial.begin(9600);
  attachInterrupt(scaleInterrupt, scaleISR, CHANGE);
  scale.tare();
}

void loop()
{ if(scale.ready()) Serial << endl << _FLOAT(scale.gram, 0);
}

void scaleISR()
{ scale.getWeight(1);
}

MarkT

Nice hack - alas I could not manage to take the back off my scale without risking breaking something so I can't investigate it...
[ I won't respond to messages, use the forum please ]

Go Up