Giter Club home page Giter Club logo

metosi's Introduction

About

Many Mettler Toledo scales provide RS232 interfaces for control and measure purposes.

Metosi is single header C library covering basic features of Mettler Toledos SICS protocol.

See included hello_scale.ino example code on how to run metosi with ESP32-Arduino.

Metosi is a private project and not affiliated with Mettler Toledo. Metosi is provided as is.

I do not take responsibility for any damage that might happen as a result of using this code.

Setup

Attention: You might need to use a logic-level shifter to connect scale and µC. A minimal setup consists of a voltage divider between scales Tx and µC Rx.

  1. #include "metosi.h"

  2. Implement the following helper method needed by metosi to communicate, char per char, with the scale:

  • void metosi_send_char(const char* msg)
  1. provide the following callbacks to run when metosi receives a response including meaurement, tare, zero, serialnumber or busy information:
  • void metosi_measurement_cb(uint8_t rv, float weight, char* unit)
  • void metosi_tare_cb(int rv)
  • void metosi_zero_cb)(int rv)
  • void metosi_serialnumber_cb (uint32_t SN)
  • void metosi_scale_busy_cb(void)

Usage

call metosi_read(char c) with every single char you received from your scale.

Send commands to scale with scale_cmd(char* cmd).

Implemented commands are:

SCALE_TARE_CMD
SCALE_MEASURE_CMD
SCALE_DISPLAY_CMD
SCALE_DISPLAY_WEIGHT_CMD
SCALE_ZERO_CMD
SCALE_RESET_CMD
SCALE_POWER_OFF_CMD
SCALE_POWER_ON_CMD

example of how to request a single measurement:

  • call scale_cmd(SCALE_MEASURE_CMD);
  • wait for scale to reply with measurement and metosi to execute metosi_measurement_cb(uint8_t rv, float weight, char* unit)

The scale might not be able to handle multiple querys one after the other. Always wait for a certain amount of milliseconds or (better) await response before sending next command.

Special commands

scale_display(const char* text) print text to the scales screen.



To switch back to standard weight display call scale_cmd(SCALE_DISPLAY_WEIGHT_CMD);

metosi's People

Contributors

andrejanowicz avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

ivsto szf2020

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.