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
commandis a 1 bytecharacter.datais the payload as astringit can be also empty.\nis the line terminator to identify the end of an instruction.
Bolinho -> Granulado¶
-
p-> Ping -
m[str]-> Moves stepper motor x millimeters.str is an
intinstringformat. -
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
intwith the weight ingramsinstringformat. -
y[str]-> Set z-axis lengthstr is an
intwith the length of the z-axis inmillimetersinstringformat. -
j-> Get z-axis length -
d-> Get delta load -
l[str]-> Set max loadstr is an
intwith the maximum experiment load ingramsinstringformat. -
v[str]-> Set max travelstr is an
intwith the maximum experiment travel inmminstringformat. -
a[str]-> Set max delta loadstr is an
intwith the maximum experiment delta load ingrams / secondinstringformat. -
e[str]-> Set motor speedstr is an
intwith the maximum experiment travel inRPMinstringformat. -
--> Nothing
Granulado -> Bolinho¶
-
p-> Ping Response -
e[str]-> Erro.str is an
stringwith the description of the error. -
r[str]-> Returns current readingstr is an
intingramsinstringformat. -
g[str]-> Returns current position in millimetersstr is an
intinstringformat. -
j[str]-> Returns z-axis lengthstr is an
intinstringformat. -
b-> Bottom interrupt was triggered -
t-> Top interrupt was triggered -
d[str]-> Returns delta loadstr is an
intinstringformat. -
s-> Response to the stop command -
i[str]-> Debug infostr is any
stringto be shown on the terminal.