Can Core/Photon operate a PWM H Bridge?

Hi, I’d like to drive a thermoelectric cooler (peltier) efficiently for both heating and cooling at about 24 volts 15amps maximum.

The drive circuit for this task involves a H bridge and some inductors and capacitors. An example power stage is detailed here (ignore the controller IC):

I would like to know if the Core/Photon is capable of safely managing the various PWM gate drive waveforms as well as dead time that is required.

I would like to build a circuit with mosfet drivers that are controlled form the spark, but I am weary that any non-realtime behaviour (missed or delayed interrupts etc.) could cause big problems like shoot through, or simply losing output regulation.

Is the spark core capable of this kind of task?

For the record, I’m avoiding motor driver ICs because all of the ones I’ve found are limited to 20 or 25 KHz and at 15 amps the required magnetics are VERY expensive for such a low frequency.

Advice and suggestions welcome!

Hmm… It might be good to use an external driver or MCU as the Spark core is single threaded and any issues with it ending up with a weird state might cause issues for your application. :smiley:

I can check out the frequency that the SPI bus can work on and get back to you :wink:

Thanks kenneth. I was afraid that might be the case and I appreciate your confirmation.

I have found some driver ICs with simple PWM inputs that use external FETs and these allow operation at an arbitrary frequency (well above 20KHz) so I think I’ll give these a go.

Example: A3941 Full Bridge Driver IC

1 Like

Hi @megabyte

I think the answer depends entirely on what else you want the Core/Photon to do. Both Core and Photon are very capable and high-speed ARM processors, but driving high-speed PWM and connecting to the Internet is likely to be hard. There is a certain economic efficiency to be gained from dedicated processing power in that your system has more margin, is more debuggable and testable, and can be brought to market quicker but perhaps at higher cost.

I would prototype it (without the high current switching) and see. If it doesn’t work you can always add the second processor.

1 Like

Thanks @bko, I expect that the core will be capable of outputting a reliable PWM stream to feed the A3941 chip since PWM is usually managed with a hardware register rather than software interrupts. I’ll have to confirm this with the core’s documentation.

I completely agree about the economics but I still think I would die a little inside adding an external MCU to the spark core. Stupid I know.

Hi @megabyte

There are no wrong answers here just different requirements! Only you know your application and constraints, so trust your instincts.

The timers on the STM32 chips used on the core/photon have all sorts of modes with dead time generation etc.

The simplistic PWM code that exists in the wiring emulation library probably is not up to the task, but you might be able to drive the peripheral yourself.

First you’d need to check the manual for the timers that have the capability you need, then check how/if those timers are used by the stock firmware, then check the pins are brought out to the board edge. Once you get past that book-keeping, you should be able to use them as you require.

The STM32F205 manual (used in the Photon) is here, check out sections 13 thru 16 for the timers, personally I think they are top notch, when compared with PIC/AVR/MSP430 timers.