While those modules are dirt cheap, USB "Phone Chargers" are not so much dearer and save you the trouble of mounting in a box and finding a power lead. I really don't think there is any value in assembling it yourself given that if they are sold retail, there is at least some implicit degree of certification that they are fit for purpose (and contain a fuse).
I think they are about $7 at Aldi. Mind you, I tend to buy them second hand for $1 each at garage sales. :roll_eyes:
Yes a good idea, how do you connect the mains though?
For example, the arduino is controlling a light. So the feed to the arduino would be best to come from the same lighting circuit.
So, either fit a socket to the lighting circuit specifically for the arduino "phone usb charger", or connect mains directly to the mains pins of the phone charger pins (solder and heatshrink possibly?).
Would be interested to see how you do it.