Skip to content

Protocol Rpi Arduino

Gaétan Collaud edited this page Sep 16, 2018 · 11 revisions

This page will describe the messages sent and received by the arduino module.

All message ends with a \n (new line).

Each command must be acknowledged by sending the same command back on the serial line.

Command home

This indicate the arduino that it has to do the homing procedure. After that the position of the carier should be 0mm.

h

Command tare

This command is used by the backend to tare the scale. After a tare, the weight status should be 0 grame.

t

Command fill

This command set the position of the carier relative to the home position, the servo to use and the quantity of the liquid in grams

f:{distanceInMm}:{servoId}:{gr}

Examples

f:0:0:0 carrier goes back home. Servo is ignored

f:100:2:50 carrier goes to 100mm from home and fill 50gr of the liquid using the servo 2

Move

Move the carrier to the given position

m:{distanceInMm}

Servo

Set the servo aperture in percent. 0% means closed, 100% means full open.

a:{servoId}:{percentage}

Queue

Queue a liquid to fill (do this only when everything is ready). The queue size is limited. If you queue too much element they will be ignored.

q:{servoId}:{gramme}

Clear

Clear the queue c

Emergency

Stop everything and close the servo

e

Release

Release the stepper motor.

r

Status

Each 50ms (configurable) a status message is sent to the serial line. The message should contain the distance of the carrier relative to the home position, the current weight of the load on the carrier and the pression inside the chamber in milli bar.

a:{distanceInMm}:{weightInGr}:{pressionMilliBar}:{queuesize}:{fps}

Examples

s:0:0 home position, no load (maybe we just tare the scale)

s:150:200 carier at position 15cm and 200gr on scale

Clone this wiki locally