Car alarms help deter crooks from stealing your car or any valuables you may have inside. It does that by blaring a loud siren or blowing the car horns, and immobilizing the car by shutting off the ignition and the fuel-injection systems.
Most late-model cars will have a factory-installed car alarm and immobilizer system controlled by the key fob. A car immobilizer can be a simple static radio-frequency identification (RFID) code generated by a chip inside the transponder key recognized by the car's engine control unit (ECU) via a low-energy sensor near the ignition key barrel. That is how a transponder key works and how it got its name, a portmanteau of 'transmitter' and 'responder.'
The typical range would be a few centimeters only, so you need to have the key near the sensor for it to respond. Someone with enough technical knowledge can copy this static code without even handling the keys. To prevent this, rolling paired codes between the key and the ECU was developed and implemented. If the randomly generated paired code is not recognized by the system, the ECU will not supply power to the spark plugs and the fuel pump.
Transponder key setups may also have an incorporated radio-frequency remote control to open or lock the car doors with the push of a button, or two. Transponder keys have evolved and now constantly transmit radio signals that allow the key fob and the ECU to passively communicate when in range—proximity range is about a meter or two. Once the key is out of radio range, that is the signal for the car to power down all electrical systems, activate the alarm sensors, or even lock all the doors. Conversely, you could have the key fob inside your bag or pockets and as soon as the signal from the transponder is acquired by the radio receiver of the ECU, you would be able to unlock your doors, turn on the ignition, and start the car without ever holding the keys. Multiple sensors can detect which side of the car the key is located, so it will allow the opening of doors only on that side. Car doors will not even have visible keyholes, only grip sensors as switches on the handles.
After the paired key arms the factory alarm by being out of range, or actively turned on, the alarm can be triggered by one or more sensors. Opening a door without the key in range will set it off. Interior microphones or pressure sensors will detect if a window glass is broken into or if someone enters the car without disarming the system. Tilt sensors will detect if the car is jacked up and an attempt at towing it away is recognized. These sensors' level of responsiveness may or may not be adjustable. Whenever a key could not be detected or can't be code-paired, the procedure is to lock the car down.
Security features like these are usually enough deterrents for the casual burglar. Like any electronic equipment, it can be defeated by a determined thief who can find and exploit weaknesses in the factory design.
If the car remote controller runs out of battery, you may open the doors using the physical key but the alarm may still be active. Deactivating it will require a manufacturer specified procedure like unlocking the passenger door first, or upon entering you have to turn on the ignition within a few seconds to prevent the alarm from blasting or immobilizing the car. On some cars, there won't be a visible keyhole on the car doors but it will have one hidden under the driver-side door handle. Review the manual. Aftermarket alarms may have a deactivation button that should be hidden by the installer, or they can have their own proprietary deactivation procedures meant to increase security.
When you have a weak battery, the alarm system may interpret the low voltage as an attempt to disconnect the battery, with that, it will power down and lock up the car. Manually deactivating it or resetting the alarm may work. To reset it, just disconnect the battery, then after a pre-determined time, reconnect it. Since you already have a weak battery, the problem may reoccur, replace it with a new one to fix that.
If you're unfamiliar with the car's factory alarm system, you don't have the manual to consult, and disconnecting the battery won't reset it, call the dealer for help or instructions. If it’s an aftermarket alarm, consulting the local distributor, or doing an online search may provide the necessary information.
If the system is malfunctioning or randomly roused, you may have faulty sensors. Find out which sensors are busted and replace them or disconnect them from the alarm control unit. When they activate easily, and the sensors have adjustable sensitivity, try lowering the triggering threshold. If the control unit itself is defective, replace it or upgrade to a better setup.