Thanks Marvin for your comments and suggestions. I am still making the code better and better. It takes about 15K from the controller so far with 4K reserved for bootloader so mainly 11K for app. If can be fitted to ATMega 164 if needed but the price even for 1284 is quite the same... I will try to make a bootloader with firmware update capabilities. This way we can ditch the ISP port from the board. Also I might try to add a current detector circuitry, making this way this project able to compete with commercial ones...
Mihai