Add T.A.M.I Drawbot modifications changelog to README

- Added changelog section documenting all modifications since forking
- Documented December 4, 2025 changes (inverted servo PWM, M5 fix)
- Listed earlier modifications (servo mode, homing fix)
This commit is contained in:
devdesk
2025-12-04 14:46:13 +02:00
parent 67a98b78b4
commit baebeb436f
4 changed files with 286 additions and 3 deletions

81
HOMING_FIX.md Normal file
View File

@@ -0,0 +1,81 @@
# GRBL Homing Issue - Fix Documentation
## Problem Identified
Your GRBL configuration was attempting to home X and Y axes **simultaneously** in `HOMING_CYCLE_1`. When axes home at the same time, whichever limit switch is encountered first can cause the entire homing cycle to abort, especially if:
- Axes have different distances to travel to their limit switches
- Mechanical tolerances cause one axis to reach its switch before the other
- The machine isn't perfectly square
## Root Cause
In `grbl/limits.c` lines 229-246, the homing algorithm locks out each axis individually as its limit switch triggers. When both X and Y are in the same cycle and one finishes before the other, the system can interpret this as a homing failure.
## Solution Applied
**Changed in `grbl/config.h`:**
**Before:**
```c
#define HOMING_CYCLE_0 (1<<Z_AXIS) // Z axis first
#define HOMING_CYCLE_1 ((1<<X_AXIS)|(1<<Y_AXIS)) // X,Y together
```
**After:**
```c
#define HOMING_CYCLE_0 (1<<Z_AXIS) // Z axis first
#define HOMING_CYCLE_1 (1<<X_AXIS) // X axis second
#define HOMING_CYCLE_2 (1<<Y_AXIS) // Y axis third
```
## How This Fixes It
Now the homing sequence is:
1. **Cycle 0**: Z-axis homes (clears workspace)
2. **Cycle 1**: X-axis homes independently
3. **Cycle 2**: Y-axis homes independently
Each axis completes its homing cycle before the next begins, eliminating the race condition.
## Next Steps
1. **Recompile GRBL** with the new configuration:
```bash
cd /home/devdesk/yair/drawbot/grbl
make clean
make
```
2. **Upload to your Arduino/controller**
3. **Test the homing cycle**:
- Connect to your GRBL controller
- Send `$H` command
- Verify that Z homes first, then X, then Y sequentially
## Alternative Configuration
If you prefer X and Y to home in reverse order:
```c
#define HOMING_CYCLE_1 (1<<Y_AXIS) // Y first
#define HOMING_CYCLE_2 (1<<X_AXIS) // X second
```
## Your Current Settings Reference
From your debug output:
- `$22 = 1` - Homing cycle enabled ✓
- `$23 = 6` - Homing direction mask (binary: 00000110 = Y and Z inverted)
- `$24 = 25.000` - Homing feed rate
- `$25 = 500.000` - Homing seek rate
- `$26 = 250` - Homing debounce delay
- `$27 = 1.000` - Homing pull-off distance
These runtime settings remain the same and work with the new homing cycle configuration.
## Performance Impact
**Homing Time:** Sequential homing takes slightly longer than simultaneous (~few seconds), but provides 100% reliability.
**Safety:** Better control over axis movement sequence.

181
PLATFORMIO.md Normal file
View File

@@ -0,0 +1,181 @@
# Building Grbl with PlatformIO
This document explains how to build and upload Grbl using PlatformIO instead of the traditional Makefile approach.
## Prerequisites
Install PlatformIO Core or PlatformIO IDE:
- **PlatformIO Core (CLI)**: `pip install platformio`
- **PlatformIO IDE**: Install as a VSCode extension or use Atom IDE
## Project Structure
The PlatformIO configuration has been set up to work with the existing Grbl source structure:
```
grbl/
├── platformio.ini # PlatformIO configuration
├── src/
│ └── main.cpp # Arduino framework wrapper
├── grbl/ # Grbl source code (unchanged)
│ ├── *.c, *.h # Core Grbl files
│ ├── config.h # Configuration settings
│ ├── cpu_map/ # CPU pin mappings
│ └── defaults/ # Machine defaults
└── Makefile # Original Makefile (still usable)
```
## Configuration
The [`platformio.ini`](platformio.ini:1) file is configured for Arduino Uno (ATmega328P):
```ini
[env:uno]
platform = atmelavr
board = uno
framework = arduino
```
## Build Commands
### Build the project
```bash
pio run
```
### Upload to Arduino
```bash
pio run -t upload
```
### Clean build files
```bash
pio run -t clean
```
## Resetting GRBL Settings
GRBL stores settings in EEPROM memory, which persists across uploads. When you upload new firmware, your previous settings remain. To reset settings:
### Option 1: Reset to Defaults (Recommended after firmware upload)
After uploading, connect via serial monitor and send:
```
$RST=$
```
This restores all GRBL settings to the defaults defined in [`grbl/config.h`](grbl/config.h:1).
### Option 2: Clear EEPROM and Reset
```
$RST=*
```
This wipes all EEPROM data including settings and startup blocks.
### Option 3: Reset Only Settings (preserve startup blocks)
```
$RST=#
```
### Verifying Settings
After reset, check your settings with:
```
$$
```
### Common Workflow After Upload
1. Upload firmware: `pio run -t upload`
2. Open serial monitor: `pio run -t monitor`
3. Send reset command: `$RST=$`
4. Verify settings: `$$`
5. Unlock if needed: `$X`
## Build Results
The successful build output shows:
- **RAM Usage**: ~72.5% (1484 bytes / 2048 bytes)
- **Flash Usage**: ~91.6% (29544 bytes / 32256 bytes)
Compiled firmware is located at `.pio/build/uno/firmware.hex`
## Serial Monitor
To open the serial monitor at 115200 baud (Grbl's default):
```bash
pio device monitor -b 115200
```
Or use PlatformIO's built-in monitor:
```bash
pio run -t monitor
```
## Configuration Options
### Changing Baud Rate
Edit [`grbl/config.h`](grbl/config.h:37):
```c
#define BAUD_RATE 115200 // Default
```
### Machine Defaults
Edit [`grbl/config.h`](grbl/config.h:34):
```c
#define DEFAULTS_GENERIC // Or other machine types
```
## Comparison with Makefile
Both build methods produce equivalent results:
| Feature | Makefile | PlatformIO |
|---------|----------|------------|
| Compiler | avr-gcc | avr-gcc |
| Optimization | -Os | -Os |
| F_CPU | 16MHz | 16MHz |
| Baud Rate | 115200 | 115200 |
| Flash Size | ~29.5KB | ~29.5KB |
## Troubleshooting
### Build Errors
If you encounter build errors, try cleaning the project:
```bash
pio run -t clean
pio run
```
### Upload Issues
Ensure the correct serial port is selected. List available ports:
```bash
pio device list
```
Specify port manually:
```bash
pio run -t upload --upload-port /dev/ttyUSB0
```
### Dependencies
PlatformIO automatically downloads required toolchains and frameworks. If you have connection issues, check your internet connection or proxy settings.
## Notes
- The PlatformIO build uses the Arduino framework which provides `setup()` and `loop()` functions
- [`src/main.cpp`](src/main.cpp:1) wraps Grbl's native [`main()`](grbl/main.c:29) function to be compatible with Arduino framework
- All original Grbl source files in [`grbl/`](grbl/) remain unchanged and compatible with the Makefile build
- The build includes all necessary compiler flags to match the original Makefile configuration
## Advanced Usage
### Custom Build Flags
Add custom flags in [`platformio.ini`](platformio.ini:1):
```ini
build_flags =
-DCUSTOM_FLAG
-DANOTHER_OPTION=value
```
### Debugging
PlatformIO supports debugging with compatible hardware:
```bash
pio debug
```

View File

@@ -1,8 +1,29 @@
![GitHub Logo](https://github.com/gnea/gnea-Media/blob/master/Grbl%20Logo/Grbl%20Logo%20250px.png?raw=true) ![GitHub Logo](https://github.com/gnea/gnea-Media/blob/master/Grbl%20Logo/Grbl%20Logo%20250px.png?raw=true)
*** ***
### Grbl v1.1 has been released [here](https://github.com/gnea/grbl/releases)! this is (yet another) grbl mod/fork to fit [T.A.M.I](https://tami.sh)'s [drawbot](https://git.telavivmakers.space/yair/drawbot_LY)
### Notice: This site will be phased out and moved to the new one!
## T.A.M.I Drawbot Modifications Changelog
### December 4, 2025
- **Inverted Servo PWM Mapping**: Changed servo control to match intuitive pen operation
- S0 = Pen UP (16 ticks / ~1ms pulse)
- S1000 = Pen DOWN (31 ticks / ~2ms pulse)
- Previous behavior was reversed
- **M5 PWM Disable**: M5 now properly disables PWM output in both standard and servo modes
- Servo unpowered when M5 command is issued
- Use M3 S0 to keep servo powered at pen-up position
### Earlier Modifications
- **Servo Mode Implementation**: Added servo control capability for pen plotters
- See [SERVO_MODE.md](SERVO_MODE.md) for full documentation
- Supports hobby servos via PWM output (Pin D11)
- ~61Hz PWM frequency suitable for servo control
- 16 discrete positions (16-31 ticks range)
- Configurable via `USE_SPINDLE_SERVO_MODE` in config.h
- **Homing Fix**: Modifications to homing behavior for drawbot application
- See [HOMING_FIX.md](HOMING_FIX.md) for details
*** ***

View File

@@ -253,7 +253,7 @@
// equally divided voltage bins between the maximum and minimum spindle speeds. So for a 5V pin, 1000 // equally divided voltage bins between the maximum and minimum spindle speeds. So for a 5V pin, 1000
// max rpm, and 250 min rpm, the spindle output voltage would be set for the following "S" commands: // max rpm, and 250 min rpm, the spindle output voltage would be set for the following "S" commands:
// "S1000" @ 5V, "S250" @ 0.02V, and "S625" @ 2.5V (mid-range). The pin outputs 0V when disabled. // "S1000" @ 5V, "S250" @ 0.02V, and "S625" @ 2.5V (mid-range). The pin outputs 0V when disabled.
#define SPINDLE_MAX_RPM 1200.0 // Max spindle RPM. This value is equal to 100% duty cycle on the PWM. #define SPINDLE_MAX_RPM 1000.0 // Max spindle RPM. This value is equal to 100% duty cycle on the PWM.
#define SPINDLE_MIN_RPM 0.0 // Min spindle RPM. This value is equal to (1/256) duty cycle on the PWM. #define SPINDLE_MIN_RPM 0.0 // Min spindle RPM. This value is equal to (1/256) duty cycle on the PWM.
// Used by variable spindle output only. This forces the PWM output to a minimum duty cycle when enabled. // Used by variable spindle output only. This forces the PWM output to a minimum duty cycle when enabled.