Thanks for reply Grumpy_Mike.
I didn't connect grounds because I don't know which ground to connect to arduino.
Should I connect both regulated voltage ground and battery ground to GND to arduino or only battery ground to arduino GND? Will both give me the same result?
I didn't connect grounds because I don't know which ground to connect to arduino.Should I connect both regulated voltage ground and battery ground to GND to arduino or only battery ground to arduino GND? Will both give me the same result?
FYI, if you want build electronic circuits, generally you need to know SOMETHING about electronics.
You have many components but you only have ONE circuit.
Your circuit does not have any isolation so ALL the components need to have a common ground. If , for example, your sensors used opto isolators to interface with the Host uP then you could/would have more than one ground.
components
L293
ARDUINO GND ====================> COMMON GND
REGULATOR => NEG (-) TERM ==========> COMMON GND
SENSOR GND ============> COMMON GND
BATTERY NEG (-) TERM ============> COMMON GND
Should I connect both regulated voltage ground and battery ground to GND to arduino or only battery ground to arduino GND?
To a first approximation it does not matter. There must be a route to the Arduino ground from any ground of any component.
A better method is for there to be a common point and all the grounds meet at this point. This is known as a star ground but is only important when there is a lot of current somewhere in the circuit.
I prefer not to use the car chassis as ground for sensitive circuits, or you should account for the possibility of noise induced in the ground by some of the other rather large currents that may be present there. Depending on where the switch is located.
to switch on a light and to check if the door is open or closed with Arduino.
The switch is using the ground of the chassis for switching (and mounting).
And if they are connected by using the chassis of the car, that should be ok?
Yes. But as pointed out there could be a lot of noise. One way round this would be to use an external pull up resistor, say 1K. This is much "harder" than the internal pull up resistors which are about 35K.