Hardware GPIO Map - jaas666/my-flo GitHub Wiki
Hardware / GPIO Map
Pin assignments for PCB rev 6.3 / factory firmware 2.9.2 (see Device Overview). A different PCB revision could wire things differently. Items marked unconfirmed have not been measured on a unit.
Outputs
| GPIO | Role |
|---|---|
| GPIO9 | valve driver input A |
| GPIO10 | valve driver input B |
| GPIO40, 39, 41, 42 | the four LEDs (which is which is unconfirmed) |
| GPIO15, GPIO2 | unidentified outputs, probably the second driver IC's inputs (unconfirmed) |
Inputs
| GPIO | Pull | Active level | Role |
|---|---|---|---|
| GPIO6 | pull-up | low | front button: wakes the unit and keeps it awake (also a wake pin) |
| GPIO17 | pull-up | low | unidentified; a press appears to restart the unit (long press does something else), probably an external key pad (unconfirmed) |
| GPIO13 | pull-up | low | bottle eject switch (also a wake pin) |
| GPIO7 | pull-up | low | float switch (also a wake pin) |
| GPIO16 | pull-down | high | external power sense (also a wake pin) |
| GPIO18, GPIO19, GPIO20 | pull-up | n/a | hardware-variant straps (below) |
Pulls are what the board design expects; the active level follows from the pull (the idle level is the pulled level) and is unconfirmed on a unit. Wake behavior is on Power and Sleep.
Hardware variant straps (GPIO18 / GPIO19 / GPIO20)
Three pins select the valve variant: id = g18 + 2*g19 + 4*g20.
0(all low): simple valve, no feedback.7(all high): latching valve with position feedback.
Other values leave the valve drivers unused. The straps look like external resistors on the PCB, so a unit's variant can be read off the board or by reading the three pins. GPIO19/20 are also the S2's native-USB pins.
Valve driver
- Simple valve: open = GPIO9 low + GPIO10 high; closed = both low.
- Latching valve: the same pins are driven with short reverse pulses, with a feedback line polled for about 700 ms after each move and one retry if it is slow. This points to a motorized valve with position or stall feedback. The ESPHome config does not implement it.
A dispense runs: battery check, count the start, valve open, hold for the dose time, valve closed, count the finish.
Battery
The battery is sensed on ADC1 channel 7 = GPIO8 at 11 dB attenuation. A good reading is the average of 16 samples converted to millivolts with the ESP-IDF calibration, then multiplied by about 3.02 (the divider ratio; unconfirmed, measure the battery and the BAT_ADC pad). The battery range is 2200 to 3000 mV; the unit treats 20% as low and 10% as critical, and blocks dispensing below 20%.
Dose time
The dose time is probably counted in tenths of a second (unconfirmed).