If the alarm is chirping, replace the battery. The chirping is the result of a weak battery. In fact, you should be changing the battery once a year.
Clean in and around the alarm with a vacuum hose and brush attachment. Sometimes, dust and insects can clog the alarm's sensor causing that chirping noise. Clogging can also prevent the alarm from sounding when being tested. Other times, a dirty alarm sensor can trigger the alarm when it shouldn't be going off.
Make sure the alarm is located in the proper position and hooked up correctly. If the alarm is mounted in the wrong position, it can trigger the sensors when there is no sign of smoke. Smoke alarms should be at least 20 feet from ovens and furnaces, and at least 10 feet from high-humidity areas like bathroom.
Check the connections underneath the alarm's casing. Loose connections can cause sporadic functionality. If the wires appear damaged or are dead, you'll need to have the entire alarm replaced.