Hi,
It has happened in the past that I have committed to help on some specific issues offline of the forum but could not actually keep up to my commitments. So rather than showing you specific pointers it would be better if you cross each hurdle - one at a time. This would ensure that other forum members take interest try to solve your problems. Cause being a one man army I hardly get time to log onto the forum [I visit mostly when I am in trouble - I know sounds selfish]
For your project :
While in mains -->
Monitor Zero Cross for abnormal timings
Monitor Mains Voltage (through Sense Transformer)
To achieve fastest transfer start sampling the mains voltage from the zero cross and validate against a lookup table to be within range every 0.5ms. Your ADC pin should see the mains voltage as a 100Hz fully rectified DC waveform. In a blind sampling can detect zero-crosses within 0.5mS accuracy. With a clock of 20MHz shouldn't be much trouble. Even works at 4MHz Internal Osc. I have done a square wave UPS with a 16F676 internal Osc (In full assembly However)
While in inverter mode --->
A periodic sampling (every 1 sec) of the input AC voltage may be enough alone. However if you require valid Frequency range then Zero-Cross might be needed. When found normal you can activate the restore to mains routine. Here you need to take care of output voltage regulation through PWM (software if square wave) and also protect MOSFETs from over-current, besides doing housekeeping such as battery-low, no-load shutdown, PC connectivity (16F73 recommended or any other with Hardware USART)
Breakup your job in discrete sections. Then assemble the whole when each one is ready.
Good Luck
P.S. - It is not that I do not want to share my code. But sometimes legally tied.
Bookmarks