fixed 24V

This commit is contained in:
cpu
2026-06-04 14:23:36 +02:00
parent 9488edcddc
commit 1ec56ce169
3 changed files with 17999 additions and 18473 deletions

View File

@@ -23,12 +23,12 @@ A fail-safe water flow monitoring module designed to protect CNC spindles and la
* **Adjustable Threshold:** 2-button interface (Up/Down) using an analog resistor ladder (ADC) to save MCU pins.
* **Fail-Safe Output:** N-channel MOSFET (2N7002) acting as an open-drain output. It actively pulls the CNC input to GND during normal operation. If power fails, wires break, or water stops, the connection opens and triggers the CNC alarm.
* **EMI Protection:** Hardware RC debouncing and noise filtering on the sensor input.
* **Direct 5V Operation:** Powered directly from the CNC controller's 5V rail.
* **Direct 24V Operation:** Powered directly from the CNC controller's 24V rail.
## Hardware Design (KiCad)
* **Power:** 5V DC Input (via CNC connector J4).
* **Power:** 24V DC Input (via CNC connector J3).
* **Sensor Compatibility:** ZJ-S401 Water flow sensor (plastic valve body, a water rotor and a hall-effect sensor). See [the working principle of the hall water flow sensor](https://www.seeedstudio.com/blog/2020/05/11/how-to-use-water-flow-sensor-with-arduino/).
* **Output:** 3-pin CNC interface (+5V, GND, ALARM_CNC). Connects directly to standard CNC active-low sinking inputs.
* **Output:** 3-pin CNC interface (+24V, GND, ALARM_CNC). Connects directly to standard CNC active-low sinking inputs.
## Panel Design and GCode
The [scripts](scripts) folder contains a guide to panelize the board (`Flow_Controller_Panel.kicad_pcb`) and howto generate gcode.
@@ -39,7 +39,7 @@ The [scripts](scripts) folder contains a guide to panelize the board (`Flow_Cont
| 1 | `FLOW_PULSE_MCU` | Input: Pulse counter from Flow Sensor | PD6 |
| 2 | `GND` | System Ground (VSS) | VSS |
| 3 | `ALARM_TRIGGER` | Output: Drives the Gate of the 2N7002 | PA2 |
| 4 | `+5V` | System Power (VDD) | VDD |
| 4 | `+24V` | System Power (VDD) | VDD |
| 5 | `I2C_SDA` | I2C Data (OLED Display) | PC1 |
| 6 | `I2C_SCL` | I2C Clock (OLED Display) | PC2 |
| 7 | `BUTTON_ADC` | ADC Input: 2-Button Resistor Ladder | PC4 |
@@ -56,6 +56,6 @@ The firmware is written in C using the lightweight `ch32fun` framework. All sour
**Step-by-step Setup:**
1. Follow the setup guide in [`firmware`](firmware) to install the RISC-V GCC toolchain and `minichlink`.
2. Connect your **WCH-LinkE** programmer to the 3-pin SWIO header `J1` (+5V, SWIO, GND).
2. Connect your **WCH-LinkE** programmer to the 3-pin SWIO header `J1` (+3.3V, SWIO, GND).
3. Run `make` to compile the firmware.
4. Run `make flash` to upload the code to the CH32V003 microcontroller.