Using Arduino to turn power supply on and off

Hi. In my setup, within the enclosed container, I have sensors which generates heat that accumulates and could cause an internal temperature of 45 degrees Celsius. I have a temperature sensor inside this enclosed container and I am planning to switch off (disconnect it from the power supply) when the temperature exceeds 45 degrees Celsius. I was planning to use a relay switch to disconnect and connect the entire circuit from the power supply.

Thanks

Thanks for letting us know.

Is this the right way of doing it?

it's one way to it :-)

From my point of view it would be better to cool down the box. Either by a better design of the container (metal instead of plastic for example, cooling ripples ...). If this doesn't bring the solution then some kind of active cooling. What's possible and what not depends on the given situation / project.

Thought about using a fan?

More information - for instance is this unattended and is there any danger of fire if the switch fails to turn off correctly? If so you should reconsider your plans.

How much power? Mains power?

Hi. sorry for the very late reply. I am trying to avoid using fans since I am trying to analyze the air inside the chamber using my system. I think using fans can cause some of the air to go outside the container replacing the air originally inside. I have 12 sensors inside the container plus 2 L7805. Each of the sensor draws 150 mA and 5V source, so(150 mA * 5V * 12) + (9-5)(1A)(2) = 9 + 8 = 17Watt of power.

Hi. sorry for the very late reply. I am trying to avoid using fans since I am trying to analyze the air inside the chamber using my system. I think using fans can cause some of the air to go outside the container replacing the air originally inside. I have 12 sensors inside the container plus 2 L7805. Each of the sensor draws 150 mA and 5V source, so(150 mA * 5V * 12) + (9-5)(1A)(2) = 9 + 8 = 17Watt of power.

container plus 2 L7805.

Replacing those with a more efficient switching regulator would go a long way towards reducing the heat generated in the enclosure.

How often do you need to sample your sensor ?
And how much time does it take for a sensor to become available after power up ?
Do your sensors need some minimum temperature in order to function optimal ?

How about switching each sensor on for just one sample, and then off again ?
Relays consume power and will also heat up, is that acceptable ?

I suggest you consider the suggestions in the previous reply by MAS3. If that isn't acceptable, then consider using a P-channel mosfet controlled via an NPN BJT to switch the power to the 7805 regulators off, leaving the Arduino running. If you want, you can have the Arduino switch the power on again when the temperature is low enough.