Go Down

Topic: How to connect Load Cell to Arduino UNO (or MEGA??) (Read 48 times) previous topic - next topic


I'm trying to interface a DL-100 load cell with an arduino UNO. I'm very new to coding and am unfamiliar with Serial and Serial 2 in the example code they provided on the website.
Here is the tutorial and the example code they gave. 
It won't compile and I think it's because I have an UNO and not a MEGA. If anyone can help me and tell me how to get this to work on an UNO that would be much appreciated.
If this is not possible without a MEGA, I have the funds to purchase one so let me know if that's my best option.
Thanks so much!

Code: [Select]

This program continuously reads weights from a Loadstar Sensors'
DI-100 digital load cell interface connected to a load cell.
The DI-100 is powered by the Arduino and the Tx/Rx pins are connected to
TX2 and RX2 of the Arduino Mega 2560 board.


int isPolling=0; //are we continuosly reading weights?
void setup()

// start serial port at 9600 bps for communicating with the Arduino via Serial/USB to PC:
  while (!Serial) {
    ; // wait for serial port to connect.
  Serial.print("Connected to PC\n");

// start serial port 2 at 9600 bps for communicating with iLoad Series Serial Sensor or DI-100 Serial Interface:
  while (!Serial2) {
    ; // wait for serial port to connect.
  Serial.print("Connected to Sensor\n");
  Serial2.write("TARE\r"); //zero the sensor
  delay(5000);//wait for 5 seconds before polling
  isPolling=1; //start polling
  Serial2.write("W\r"); //send one command to read the weight, after the weight is
        //read in the event loop, another command to read the weight is sent

void loop()


void serialEvent2() {
  char c=char(Serial2.read());
  if (isPolling==1 && c=='\n') {
    //we just finished reading a weight
    //read the weight again.


As it's using a baudrate of 9600 baud you may try to use SoftwareSerial for the connection to the load cell. If the load cell isn't overly picky about the timing this should work.


If this is for a commercial project use the Mega or some other device that has a crystal clock driving the UART baud clock. The UNO has that but it is used for the serial monitor and is not available for general use without jumping a lot of hurdles.
This response is to help you get started in solving your problem, not solve it for you.
Good Luck & Have Fun!


There is a fuse bit that can be changed to bring the 16 MHz system clock out on PB0 (check the datasheet, might be a different pin).
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Go Up