Integrating AC-DC Power module into hobbyst PCB - Page 1
Forum section: electronics / general

author: santinilor
author_rank: Newbie
timestamp: April 30, 2025, 11:38:02 am
content: Hi,I will preface by saying that this is my first post inside this forum, hence please forgive me if I make any obvious mistake.Coming to the reason of this post. I am designing a simple terrarium controller that will essentially monitor the temperature and humidity of my terrarium, and turn the heater (ceramic resistive heater) on and off accordingly using a solid-state relay (I was thinking of using a PD controller with PWM if anyone is interested). Now, to control everything, I will be using a raspberry pi pico 2w. Since I already need to bring mains ac to the electronics enclosure (to power the aforementioned heater) I was looking into safe ways to power up my control circuit with mains AC. I am designing a simple PCB to connect everything, and I found out about these power modules which can be mounted on a PCB and encapsulate all the power supply circuitry; here I link one just for referencehttps://www.lcsc.com/datasheet/lcsc_datasheet_2410121947_Recom-Power-RAC03E-05SK-277_C5382940.pdf]https://www.lcsc.com/datasheet/lcsc_datasheet_2410121947_Recom-Power-RAC03E-05SK-277_C5382940.pdf] https://www.lcsc.com/datasheet/lcsc_datasheet_2410121947_Recom-Power-RAC03E-05SK-277_C5382940.pdf.My thought was of having a portion of the PCB reserved just for the AC circuit, and then connect the regulated 5v circuit to the dc side.The AC circuit would just consist of an AC terminal, a fuse on the hot line and then the power module and the relay. I attached a simple schematic to better explain what I mean. I know I need to properly size the traces and space them from the DC ones.Now I've never dealt with Ac directly inside one of my circuits, and I would love to receive feedback on this approach.

author: Psi
author_rank: Super Contributor
timestamp: April 30, 2025, 11:58:06 am
content: The concept all seems fine to me.Your 2W Pi pico will likely need burst currents above 3W so you will need to make sure you have enough capacitance on the output of the 3W converter to keep the pi happy. But that shouldn't be hard.You could maybe consider some mains input filtering, but if it's just a hobby thing it may not be needed.And make sure you use the actual earth pin for connecting to the case or exposed metal parts.One important thing, don't label mains neutral as earth, it's confusing and might lead to actually wiring it up wrong.Consider what will happen if the circuit fails somehow and the heater stays on 24/7. eg Don't design a system that require under 100% PWM to avoid melting and catching on fire. It's a bad idea.If you want something safer, so you don't have to deal with mains at all, you could use an off the shelf IOT wifi style mains relay plug and have the heater connected to a normal mains plug connected to it.Then talk to the wifi relay from the pi for on/off control over wifi. If you want PWM you'd have to find a mains wifi plug that supports that.You'd still need to power your circuit somehow so you'd need a DC in jack and a ACDC wall brick

author: santinilor
author_rank: Newbie
timestamp: April 30, 2025, 12:29:57 pm
content: Thank you, I really appreciate you taking the time to answer my question.My bad on labeling neutral earth, I am still new to the AC side of electronics, as I said, and was using it as an analog of "GND" in DC. I will create global labels both for Live and Neutral in order to prevent any confusion. Regarding the connection of the metal casing to earth, I was planning on 3d printing my case so it will be plastic (probably PETG or PLA).I didn't consider input filtering. In your opinion, can it be beneficial to include it in this kind of circuit?I thought about using an external wifi relay, but given that I am planning on implementing a PWM control, I didn't want to be dependent on wireless communication. I thought about just powering the DC circuit with an external power supply, but since I already need mains, I didn't want to add another cable to run from the socket.Regarding the concern on the circuit failing and the heater remaining on I am thinking of mitigating the issues this way:1) The heater can be powered constantly without risk of melting. The PWM is only needed to reach the desired temperature setpoint.2) I will probably use a normally open relay so that in case of power loss of failure of the control circuit, the heater will be disconnected.3) On the software side I will monitor the temperature and send a notification if it exceeds some threshold4) I will make the raspberry pico ping my server so that I will know if there's a power loss

author: Doctorandus_P
author_rank: Super Contributor
timestamp: April 30, 2025, 08:30:37 pm
content: Your use of the "Earth" symbol is unconventional. There is a difference between "ground" and "Protective Earth" (PE). The normal convention is to use "ground" (GND) symbols for the "reference" / "zero". and use Earth symbols only for PE (connected to pin 3 of J3). But it is just a convention...According to the datasheet, that Recom power module has "significantly wide margin to class B EMC compliance without external components". so apparently it does not need extra filtering, and you just have to make sure of wide enough clearances (both between the AC input wires, and primary and secondary). Also, I think it's (officially) illegal to use a plug with a PE connection, and then not use it in your appliance. Here in the EU, there are basically two options. Use PE as a barrier between mains voltage and anything that can be touched, or do not use PE, but use a double reinforced insulation barrier instead. But it's a long time (30 years or so) since I looked up details. With DIY you can get away with a lot, but having an idea of what the regulations are, (and why they are what they are) is probably a good idea.

author: santinilor
author_rank: Newbie
timestamp: April 30, 2025, 09:05:39 pm
content: Thank you for your help. Yes, the misuse of the Earth symbol was already pointed out to me and was just a stupid error on my part. I have edited the initial post with a corrected schematic. Regarding the regulations concerns, as you say, this being a personal project only, I am not bound as strictly by them, but I am very interested in the reasoning behind them and the general safety guidelines. After all, the main reason I wrote this post is to make sure I am not underestimating the dangers of AC.Since the schematic was just made for illustration purposes, I mistakenly used the socket symbol with PE even if I am not planning on using a plug with a PE connection since my enclosure will be 3d printed and not metal. Is this an ok reasoning, or am I missing something?

author: VEGETA
author_rank: Super Contributor
timestamp: June 02, 2025, 11:07:51 am
content: I have used such modules in a professional selling product:https://thundertronics.net/product/dreamcast-universal-power-supply/first version used Recom and the new one uses Meanwell. I only recommend these 2 as they do not require extra items, all included inside.my advice is to use a powerful module with more power than needed, then derive all your rails from it. its output is not really low noise so you would need to do some filtering like parallel caps or so.

author: santinilor
author_rank: Newbie
timestamp: August 01, 2025, 10:31:15 am
content: Thank you for your help. Sorry if it took a long time for me to answer your comment, but life got in the way, and in the last month, I didn't have much time to dedicate to this project. I looked into the output ripple of these modules (in particular, I chose the IRM-45-5 module) and how to reduce it. The stated output ripple in the datasheet is around 80mV ptp. I tried to design a lowpass filter (a PI filter) to reduce the ripple, focusing on frequencies higher than 65 kHz (the switching frequency stated on the datasheet). I simulated it in LQSpice using both the frequency response plot (Bode plot) and time simulations. However, I was not able to design a passive filter with the required attenuation that performs well with different loads. In particular, I designed the filter considering a maximum load condition; I was able to obtain good performance, but when I tried to decrease the load, I obtained resonance peaks on the Bode plot. I then tried to dampen the circuit by adding resistors in series with the capacitors, but, when simulating a varying load (with a step change in the resistance of the load), I observed significant oscillations on the output voltage.In general, I was not able to find much information on how to design a low-pass filter with a variable load.Now my question is:Is a ptp ripple of 80 mV something to be worried about? Keep in mind that before reaching the more sensitive electronics (esp32, sensors, etc) I have an LDO which drops the voltage from 5V to 3.3V.Is there an easier way to design this lowpass filter with a variable load? As of right now I am thinking of just using the two capacitors (47 uF and 0.1 uF) required by the datasheetOn another note, I read in the datasheet that the typical input current for 230 VAC is 0.9 A. Now this would mean a power consumption of around 200 W when the output is only 45 W, which would translate to a lower efficiency than the one stated in the datasheet. Am I missing something?Thank you in advance to anyone who will help me!

author: VEGETA
author_rank: Super Contributor
timestamp: August 01, 2025, 02:14:27 pm
content: Quote from: santinilor on August 01, 2025, 10:31:15 amas for the ripple, check the test document not the datasheet. it can be less or more in a practical circuit.however, you can add the pi filter and check what happens. maybe even omit the inductor and just use big caps. if you are worried about damping, put a high esr electrolytic capacitor.i advise that you do not use the ac-dc module output by itself directly but rather use a switching regulator after it and before your circuit.you mentioned an LDO before the ESP32, but for those why choosing 45W module? 5W one is enough. if there is an excessive current draw to be expected then do not use ldo but rather a good buck regulator.if using a buck regulator, the final output will be less ripple and noise. i typically use 12v or 15v module with 5v and 3.3v buck regulators.if you achieved 80mv p-p then with lots of input caps on buck regulators or even the ldo, the ripple will be reduced.LDO normally reduce the low frequency ripple but high freq ripple will pretty much pass... you need to have parallel caps after the module as i said before.try for example 3x 220u low esr polymer caps after the module with some 10-22u ceramics in parallel. an additional elec. cap as mentioned above could also help.thanks

author: santinilor
author_rank: Newbie
timestamp: August 01, 2025, 05:10:53 pm
content: Thank you for your answer. I am using a 45 w module because other than the low power 3.3V electronics i have also some higher power components on the 5V line. So your suggestion is to use an higher voltage irm ac-dc module and then use two buck regulators to obtain 5v and 3.3 v? Should i also use an pi filter at the output of the ac-dc converter?

author: VEGETA
author_rank: Super Contributor
timestamp: August 01, 2025, 10:58:45 pm
content: Quote from: santinilor on August 01, 2025, 05:10:53 pmyes use a pi filter after the module output. then use the buck regulator after the pi filter.get high quality capacitors too.

author: santinilor
author_rank: Newbie
timestamp: August 02, 2025, 09:18:45 am
content: Ok, thank you. So you say it is better to use a buck converter instead of an LDO even after the high-frequency ripple is filtered out by the pi filter? Furthermore, do you have any idea why the typical input current for the IRM-45-5 is stated as 0.9 A at 230 VAC, which equates to a power consumption of around 200 W when the module outputs only 45 W?

author: VEGETA
author_rank: Super Contributor
timestamp: August 02, 2025, 10:44:01 am
content: Quote from: santinilor on August 02, 2025, 09:18:45 amyes, using a buck regulator is better overall. You can make it really good and produce little to no ripple. using good capacitors also help.do not worry about input current as it is gonna be smaller than output current due to high input voltage. the efficiency requires input power to be higher than output power which is straightforward...check the test report here:https://www.simpex.ch/wp-content/uploads/2021/07/IRM-45-48-rpt.pdfit says the current is about 0.377A.as i said, do not worry about it and just focus on the output. then you can check the module temperature and see that it is working fine.

author: santinilor
author_rank: Newbie
timestamp: August 02, 2025, 11:13:16 am
content: Ok, thank you very much, I will try everything you just suggested. Regarding the input current, I wanted to fuse the AC line on my PCB as a safeguard against shorts. Should I dimension the fuse using the tested current of 0.37 or the stated 0.9A one? Furthermore, a current of 0.37 A would mean a power consumption of around 85 W, which for a power supply of 45 W equals a significantly lower efficiency than the stated 90%, no?On another note, i still have the issue of resonance with the varying load. The only way I found to remove it is by using very large caps values i found on an online calculator (around 2.2mF). Is this the best option?

author: VEGETA
author_rank: Super Contributor
timestamp: August 02, 2025, 12:49:49 pm
content: Quote from: santinilor on August 02, 2025, 11:13:16 amdo not use any fuse on the input as the power module from meanwell have those and more, it has hiccup mode for short circuit. do not worry about it. if you insist, put something like 1 amp fuse to make sure it only triggers on actual hard short.Input current is AC current not DC, which means there will be some reactive power losses in transformer and so on. while efficiency means DC behavior since you won't pay for reactive power and it won't generate heat. Let's see if more experienced guys have more insight on this.

author: santinilor
author_rank: Newbie
timestamp: August 02, 2025, 01:08:28 pm
content: Ok thank you, you have been very helpful!