1
\$\begingroup\$

For my hobby project, I'm intending to add a STM32F103C8T6 (and later STM32F407VET6 or ZET6) into an enclosure.

For worst case case, let's take the 407, the datasheet can be found here.

On page 80, there are stated some power dissipations (between 435 and 543 mW). Also some temperatures are shown on the page.

What I want to use in them (maybe spread over two devices, but let's assume I put everything in one STM32):

  • Reset button
  • Maximum 10 small LEDS (3mm, some bicolor). if these will cause too much power/heat I want to use smaller ones or less. Also the LEDs will be very sparsely on probably (at least most of them). They are for notification only. I would assume a total power consumption of 100 mA (assuming some are one more than others, so assuming 20 mA per LED, on average 5 are on).
  • A few dozen ferrite beads
  • 4 or 5 6N137 or similar optocouplers
  • CAN bus driver (MCP2551 breakout board)
  • One or two (2.4 GHz transceivers)

Used peripherals:

  • 6-8 UARTs
  • CAN
  • Some timers
  • One or two SPI ports (for the nRF24L01s)
  • CAN

Environment/Boundaries

  • No low power mode
  • Maximum CPU frequency (168 MHz for STM32F407)
  • Enclosure !

Would I get in trouble putting these STM32 in an enclosure ... I assume I need to add some holes possibly? What other measurements should I take to prevent them frying in their enclosure?

(note: I know I can probably calculate the exact power consumption, but I want to have a general idea about what I can expect, since I never have built a real project, and the only time I put an Arduino in an enclosure it got fried, but it was connected with a 12V adapter).

\$\endgroup\$
  • 1
    \$\begingroup\$ Are you talking about driving the LEDs directly from pins, or with transistors/drivers? The former would be the most likely to cause issues. I've designed many many micros like this, including several F103s into enclosures and never had any sort of issue, not sure they've ever even got that warm. If your Arduino got fried running from 12V I assume that must have been because of a linear voltage reg, which is a completely different matter. \$\endgroup\$ – DiBosco Aug 17 '17 at 10:52
  • 1
    \$\begingroup\$ 15 pins at 20mA is 300mA maximum you're expecting the micro to sink or source. Look at Table 7. Current characteristics. Then have another think about what you're going to do. ;~) In the end you always do have to look at these things. \$\endgroup\$ – DiBosco Aug 17 '17 at 11:01
  • 1
    \$\begingroup\$ Look at Table 7. Tables are boring :D \$\endgroup\$ – P__J__ Aug 17 '17 at 11:05
  • 2
    \$\begingroup\$ @MichelKeijzers What happens if your software crashes with them all on? For the tiny cost of a load of 2N7002s I know what I'd do. \$\endgroup\$ – DiBosco Aug 17 '17 at 11:15
  • 1
    \$\begingroup\$ @MichelKeijzers They're just SOT23 FETs. You could happily use BC847s and resistors or the wonderful ULN28xx drivers. Anything like that. Your round robin method would work too though assuming no crashes! On the subject of LED holes, yes that's what I meant. Finally on the table, max current souced/sunk through Vdd/Vss pins is 150mA. \$\endgroup\$ – DiBosco Aug 17 '17 at 11:24
4
\$\begingroup\$

Well your main goal is to keep the MCU (generally all parts) within its operating region.

For that you have to have to guesstimate the current needed for operation, the thermal resistance (which is hard) and the ambient temperature the device will operate in.

The power dissipation figures you find in the datasheet are numbers which will prevent the junction temperature to go out of spec at the given ambient temperature.


So worst case, everything on, 3.6 V running full speed, they give 109 mA. This is 392 mW.

You are limited to 240 mA max through Vdd or Vss. 109 mA end up in the core, leaves 131 mA for the rest.

With modern LEDs I would not drive them with more than 5 mA as indicators, except they are used outside in sunlight.

Driving 10 LEDs with 5 mA and 0.4 V internal drop (table 49) adds another 20 mW to the internal dissipation.

Not sure about the other I/O ports. But lets assume a 450 mW power dissipation.

Table 98 has the thermal resistance for the packages listed. With the worst one you have 46 K/W.

With 450 mW you get a rise of 20 K of the junction temperature over the ambient (ambient of the MCU not the enclosure). That means you basically can have 85 °C inside your enclosure and the MCU would be fine. (84,3 °C to be precise)


Modeling what temperature will result in your enclosure is much harder. You need to know how the heat will transfer from the air to the enclosure and then from enclosure to ambient again - maybe your enclosure gives a number but most don't.

What I usually do is estimate the total power dissipation (add some extra), place a PCB inside the enclosure and solder a part on it which is able to handle the dissipation.

Then measure the ambient temperature, the temperature of the enclosure and the temperature inside the enclosure while powering the device. After some hours the temperatures will have stabilized and you can see what rise above ambient you get. If it's something like 40 K rise of the inside temperature, you can't use your device in temperatures above 45 °C. Because then, the ambient temperature of the MCU would be above 85 °C.


If you want to have some safeguards, you can use the internal temperature sensor of the MCU to shutdown in case of overtemperature.

There are some ICs around which will do the same and probably more accurate if you don't trust the internal sensor.

\$\endgroup\$
  • \$\begingroup\$ Thank you for this detailed answer ... I think it will be a good exercise for me to see if I also can find those numbers in the spec. Very nice idea to check the IC temperature. Although in a r/l situation I wouldn't like it to power down, I can use it while testing and get an idea if I run into problems. \$\endgroup\$ – Michel Keijzers Aug 17 '17 at 11:55
  • 1
    \$\begingroup\$ If you don't want to power down and temperature is a problem, you have to get better cooling. You don't need holes for that (if holes are a problem), you can use a good thermal conductor and connect the enclosure to heating ICs, so the enclosure becomes a better cooler. \$\endgroup\$ – Arsenal Aug 17 '17 at 11:59
  • \$\begingroup\$ I don't know yet if temperature will be a problem (no experience with temperature regarding microcontrollers, neither with enclosures). I will check how a thermal conductor looks like. I don't think I can connect the heating IC to the enclosure, because it is an STM and the IC is a bit 'inside' if you know what I mean. \$\endgroup\$ – Michel Keijzers Aug 17 '17 at 12:14
  • 1
    \$\begingroup\$ Well you basically just need a strip of aluminium or copper and a thermal glue on both ends and your thermal conductor is done :D \$\endgroup\$ – Arsenal Aug 17 '17 at 12:18
  • \$\begingroup\$ That sounds easier than it sounds :-) ... thanks for the clarification \$\endgroup\$ – Michel Keijzers Aug 17 '17 at 12:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.