WARNING ! I developed this projects before following the C++ projects at 42. The standard and the style may shock :)
Hi there ! This is a preview of my coffee grinder project.
The aim is to drive my manual coffee grinder in order to get a precise amount of ground coffee.
Specifications :
- error ~= 0.01 g ! ( ~=0.5g for average barista grade coffee grinders)
- intuitive UI
This project covers following fields :
- Electronics
- Programming in C++
- Mechanical design
Final solution :
Raspberry pi pico (this is a controller : no operating system)
- cheap
- amazing and very fast programmable I/O
- support C++
- high torque, low RPM (no need of gearbox)
- runs at precise
- long lifetime
- simpler mechanics
- sounds like futuristic CNC machine, not like a cheap blender
- challenging to drive (but very fun) => requires us to program our own driver !
- expensive
- minimum torque (measured with a human scale) : 3 N.m
- rotation speed : 150 RPM
Nema 34 12N.m 6.0A DM860S (Cloudray)
Our library :
- Runs stepper pulse generator in background using PI/O (so we can do some stuff while the motor is running)
- Guarantees continuous motor speed to avoid damages (constant acceleration)
- Allows setting max acceleration and max speed
- very accurate
- very cheap
- challenging to drive (but very fun) => requires us to program our own driver !
We use Pico's IO to read data output (and send gain choice) from HX711 according to supplier specifications : doc/hx711_english.pdf
This was never done in C++, so we need to program our own library
- elastic coupling between motor and grinder
- 80V to 5V power supply
graph TD;
A([PI Pico])
B([Stepper motor])
C([Stepper driver])
D([80V Power supply])
E([5V Power supply])
F([220V House power])
G([Coffee grinder])
H([Amplifier])
I([Aluminium scale])
J([Screen])
K([Push buttons])
I-- "H bridge Analog signal (4 wires)" -->H
H-- "Digital signal (2 wires)" -->A
A-- "PI/O Pulse signal (2 wires)" -->C
C-- "Pulses power (4 wires)" -->B
B-- "Mechanical power" -->G
A-- "Digital signal" -->J
K-- "Digital signal" -->A
F-- "220V" -->D
D-- "80V" -->C
D-- "80V" -->E
E-- "5V" -->A
- sensor sensitivity calibration UI
- ask for mass target
mt
- precise measurement of mass
m0
- stripping (high acceleration short rotations)
- brew 50% at high speed
w0
using live measurement (very inaccurate) - precise measurement of mass
m1
- measurement of time
t1
- brew 20% at low speed
w1
and high acceleration using live measurement (very inaccurate) - measurement of time
t2
- precise measurement of mass
m2
- guess mass flow rate
fr = (m2 - m1) / (t2 - t1)
- remaining mass
mr1 = mt - m2
- measurement of time
t1
- brew 1/5th of remaining mass during
t3 = 1/5 * mr1 / fr
- measurement of time
t2
- guess mass flow rate
fr = (m2 - m1) / (t2 - t1)
- repeat 5 previous steps 4 times