I want to use an 555 timer and one magnet switch on my fuse cabinet door connected to one 9V battery.
I want the led to fade on after door is opened and stay on for 20 seconds before the the led fades off and stays off, until the door closes and opens again.
Is that possible with an 555 timer, 9V battery and magnet switch?
Can someone give me an headstart regards to the wiring?
For straight on/off behaviour, a 555, a cap and a few resistors will fit the bill. For fading, on the other hand, you will need the PWM capabilities of a uC. An arduino is overkill for that; an ATTiny85 will do, like it was suggested on post #2.
The biggest problem with this project is the 9V battery, any proposed circuit using a 555 timer is going to flatten the battery in a few hours, or a few days if you are lucky.
You can:
Forget the dimming and just use a switch to turn the light on and off
Design a circuit that goes to sleep and consumes negligible power when it shuts down
Use a mains power supply
You might get away with using a large capacitor to keep the LED on after the switch removes the power. You will get the fade and zero power consumption when off. Only problem being that the switch will have to charge the capacitor when it closes and that might flash the contacts.