A high quality sine wave, synthesised using an Arduino |
The ability to generate a high quality sinusoidal waveform at a specific frequency,and amplitude is at the heart of the Open Inverter project.
Most microcontrollers these days have on-chip timers that can synthesise these waveforms from a look-up table stored in flash memory.
Whilst the early developments of sinusoidal waveform generation were done on Arduino using "Fast PWM" the pwm control registers could only produce a limited number of PWM clock frequencies:
62.5 kHz
31.25 kHz
7812.5 Hz
My BTN8960 ICs really needed something above the audio threshold frequency of 16kHz but below 25kHz. My initial experiments were done at 7800Hz - but this produces a painful howl from the transformer windings, and is really not ideal for transformer efficiency. With the Arduino I had a couple of options left - reduce the crystal frequency to either 4MHz, 8MHz or 12MHz giving me access to 15.625kHz or 23.4375kHz, or write some custom code. These will be tried at some point when I have the right crystals available.
At the latest open inverter workshop, we reconfigured the Arduino clock to 8MHz allowing us a 15.625 kHz pwm clocked sinewave output. This worked well with the BTN8960 driver ICs.
An ARM Solution
In the meantime, I was keen to press on and get some sinusoid generation code at 25kHz running on at least one of my available STM32Fxxx dev-boards.
At the latest open-inverter hack session held in Snowdonia in early November, I managed to get the STM32F103 sine wave generation code running, and successfully drove the inverter using the BTN8960 half H-bridge ICs.
I must point out at this stage that I have been actively designing pcbs for the STM2Fxxx range of ARM microcontrollers for the last 2 years, and I have several designs that I could adapt to the purpose. The cheapest is the $5 Maple Mini clone from Baite Electronics which uses a STM32F103, but I also have boards with STM32F373, STM32F407 and STM32F746 at hand.
Of all of these, the STM32F373 is probably the best suited, as it has 3 ADCs with 16 bit resolution, and a lot of useful analogue peripherals - ideal for monitoring a 3-phase inverter.
However, as there is quite a following behind the cheaper STM32F103 boards - so I think this is where I will start.
It is hoped that there will soon be some modular pcbs available allowing either a dual BTN8960 power board or conventional FET power board to be stacked with AVR and ARM microcontroller boards.
Watch this space.
No comments:
Post a Comment