I made a prototype of multisensor circuit with temperature, humidity, PIR, etc using a ESP8266.

My idea is to put each of this module in each house room. To achieve this and I want to put the entire PCB in the back side of the plastic plate used to cover empty switches holes on wall switch plate (the 3 black plastic items in the photo below)

enter image description here enter image description here

Each of switch hole cover is about 20x40mm and the available depth in the back of switch plate is about 40/45mm. To avoid batteries I want to power the circuit using the AC 230V main power.

Can you suggest me the best way to power the circuit with the main requirement to keep PCB as small as possible?

  • using switching PSU?
  • using capacitor impedance?
  • other?
  • \$\begingroup\$ The defacto way to do that is a capacitive dropper, although 300ma might be a bit much to ask from one. \$\endgroup\$ Jun 1 '17 at 15:43
  • 1
    \$\begingroup\$ I'd recommend using a USB charger. They are small, plentiful, cheap and reasonably efficient. Extract the guts from its case for embedding. \$\endgroup\$
    – marcelm
    Jun 1 '17 at 16:07
  • 6
    \$\begingroup\$ There are a number of fully isolated, 3 W modules, providing 3.3 V, 5.0 V, and 12.0 V (HLK-PM03, -PM01, and -PM12.) These are very tiny, sealed units for $3 to $4 each. They accept 100 VAC to 240 VAC as the input, 50-60 Hz. 4 pins, CE rated. \$\endgroup\$
    – jonk
    Jun 1 '17 at 16:29
  • \$\begingroup\$ for cheap and small listen to marcelm, and for solid and small listen to jonk; both are among the best ideas, having tried lots of combos myself. \$\endgroup\$
    – dandavis
    Jun 1 '17 at 21:29
  • \$\begingroup\$ If you don't have a neutral wire in the wall box the design becomes much more difficult. \$\endgroup\$
    – Transistor
    Aug 6 '17 at 18:35

You want a premade offline SMPS module for this

The downside of a capacitive dropper or a buck converter is it isn't isolated from the mains supply, and a wall-wart is an extra box involved, which is also likely undesirable. However, what if you could get the innards of a wall-wart in a form factor you can build into your own box?

Meet the Mean Well IRM-02-5:


This little black brick is a mini wall wart, capable of 400mA at 5V (2W power), with a full set of worldwide safety approvals (cRUus, TUV, CE), extra wide input range, PCB mount pins (there are other modules available with wire leads if that would be preferred), integral overload protection, and full Class II double-insulation so that you can safely do things like probe the low-voltage side of your board with your 'scope (just like a wall wart).


External 5V or whatever voltage power supply to a dc Jack. Most wall warts are fairly compact at this point. Alternatively, a usb charger and usb connector. Eliminate the need to have any power supply inside the very small box, so you don't have to worry about creepage or heat or any power failure. Safer too.


The following answer assumes that the ESP and the sensors are rated at either 3.3V or 5V.

First, a step down to almost 5V is necessary. Now if your sensors are all at 3V3, a buck converter with a good coupling capacitor should be used. The ESP can draw (typical) 215mA when broadcasting, and adding the current requirements for the sensors, the complete module can create short current surges.

For achieving this, the best bet would be to use the keychain-sized phone chargers. The output is a decent 5V at ~1A. These should fit well within 35mm of depth and 20 mm width. You can then use a LDO linear regulator like the LD1117 to get a fairly constant output of 3.3 Volts.

There are cheap breakouts available for the AMS1117 (SMD version) which can greatly reduce the size of the PCB.


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.