Embedded¶
Bolinho uses a microcontroller esp32-s3 for controlling the hardware.
For more info check the Granulado repository.
Serial communication¶
The microcontroller communicates via serial to the host, and is responsible for reading the load cell and controlling the stepper motor.
This communication is done via interrogation, so that the host prompts the peripheral for data and it complies.
Protocol:¶
These are the available commands for the communication between the host and the peripheral.
A instruction is divided in three parts:
command
data
\n
command
is a 1 bytecharacter
.data
is the payload as astring
it can be also empty.\n
is the line terminator to identify the end of an instruction.
Bolinho -> Granulado¶
-
p
-> Ping -
m[str]
-> Moves stepper motor x millimeters.str is an
int
instring
format. -
s
-> Stop -
t
-> Move to top -
g
-> Get motor position millimeters. -
r
-> Get instantaneous reading. -
@
-> Tare load cell -
w
-> Calibrate known weight -
x[str]
-> Set known weightstr is an
int
with the weight ingrams
instring
format. -
y[str]
-> Set z-axis lengthstr is an
int
with the length of the z-axis inmillimeters
instring
format. -
j
-> Get z-axis length -
d
-> Get delta load -
l[str]
-> Set max loadstr is an
int
with the maximum experiment load ingrams
instring
format. -
v[str]
-> Set max travelstr is an
int
with the maximum experiment travel inmm
instring
format. -
a[str]
-> Set max delta loadstr is an
int
with the maximum experiment delta load ingrams / second
instring
format. -
e[str]
-> Set motor speedstr is an
int
with the maximum experiment travel inRPM
instring
format. -
-
-> Nothing
Granulado -> Bolinho¶
-
p
-> Ping Response -
e[str]
-> Erro.str is an
string
with the description of the error. -
r[str]
-> Returns current readingstr is an
int
ingrams
instring
format. -
g[str]
-> Returns current position in millimetersstr is an
int
instring
format. -
j[str]
-> Returns z-axis lengthstr is an
int
instring
format. -
b
-> Bottom interrupt was triggered -
t
-> Top interrupt was triggered -
d[str]
-> Returns delta loadstr is an
int
instring
format. -
s
-> Response to the stop command -
i[str]
-> Debug infostr is any
string
to be shown on the terminal.