Here is a short description what the firmware does:
- wait for zero crossing
- ZC interrupt:
- measure half period of the input AC
- measure TC voltage
- calculate the maximum conduction angle for the configured power limit with the required formula
- calculate the switch off time for the next half cycle
- switch on heater, start a timer with the switch off time
- timer limit reached:
- measure voltage and current going to the iron to get the heater resistance for the power limit calculation
- switch off heater
- wait for the next ZC
If You want 140W max power (for a T245) than You have to switch off at around 55% of the half cycle
edit: If You can wait 2-3 weeks, I will publish my whole design, I am currently cleaning up the project as in its current form it cannot be published...
br,
mike