Project 001 – Creating a simple solution
Low-frequency three-phase sinewave generator
Three-phase sine waves are widely used in mains powered heavy electrical equipment. For these applications it is easy to obtain the appropriate electronics such as frequency converters.
This client needed to create a rotating magnetic field from a low-cost, small size battery powered device. Quite the opposite from heavy electrical equipment.
He needed a stable, low-frequency, three-phase sine wave generator to create three varying magnetic fields. He had trouble finding suitable electronics for this application and he could not find a waveform generator IC that would do this for him. The rotation frequency needed to be stable and the waveform needed to have the right shape. An analog three output oscillator would not have been accurate enough.
So he was looking to create three pwm signals from a microcontroller. Unfortunately, nearly all low-cost microcontrollers have at most two pwm outputs. So he was advised to use two microcontrollers in parallel with one creating two pwm outputs and the other for the third pwm output. But having two microcontrollers would have raised the costs and complicated the design because synchronization between the two microcontrollers would have been needed. This was beyond the capabilities of the client and he asked for help.
My solution was to use just one microcontroller with special firmware.
Because the requested frequency was so low, it was possible to create the three pwm signals by simply bit-banging the outputs. A basic RC-filter then converts the pwm signals to proper sine waves.
The firmware was written in assembly language for optimal performance. An optional battery low indicator LED could be connected to the input pin of the device and was activated by using the internal pull-up resistor on this input pin.
The cost of the chosen microcontroller (the tiny Microchip PIC10F222, which has no pwm peripheral) was also much lower than that of a microcontroller with two pwm outputs.
The client was very happy with this solution.
Download source code (.txt)