Not sure what you mean by connecting D1 and D2 to ground -- they're not connected to ground. The diodes function as an OR-gate. Without R2, Q2's Gate would always be either 3.3V-VD2 or 5.0V-VD1. In other words, there would be nothing to pull the Gate to ground, so Q2 would never turn off. So, R2 is a Pull Down Resistor.FDV303N
What happens when the battery gets weak andcannot run the motor? Can the door still be opened?Herb
9V batteries, if you mean PP3 size, are a poor choice for any Arduino circuit. I am surprised that it has the strength to move the solenoid! A better choice would be 4xAA NiMh cells. You can connect them to the 5V pin on the Uno, instead of the Vin pin. If you don't have NiMh cells and a charger, please get them, but if you insist in using non-rechargeable AA cells, use 3x not 4x.
I would be using 6xAA batteries to get 9V. For the backup connector outside, I'll use a PP3 though.
Won't 3x be 4.5v, less than the arduino requires?
Indeed, do get a 5V solenoid instead. Makes life a lot easier.
Of course, a 5V one needs more current, but as it's a solenoid I assume it needs a driver anyway. Just one voltage less to deal with, that's always a plus.