A surgical device, comprising a device housing defining a connecting portion configured to selectively connect with an adapter assembly, a drive motor supported in the device housing and configured to rotate a drive shaft, a battery disposed in electrical communication with the drive motor, a controller disposed within the device housing and configured to control power delivered from the battery to the drive motor, a loading unit configured to perform at least one function, an adapter assembly configured to selectively interconnect the loading unit and the device housing, the adapter assembly including a drive tube configured to translate along a longitudinal axis of the adapter assembly in response to rotation of the drive shaft and a loading unit detection assembly disposed in mechanical cooperation with the adapter assembly, the loading unit detection assembly including a detection link configured to be engaged by the loading unit and including a detection link ring having an opening, the drive tube passing through the opening of the detection link ring, a switch pin disposed in mechanical cooperation with the detection link and a switch button disposed in mechanical cooperation with the adapter assembly, wherein a predetermined amount of mechanical engagement between the loading unit and the loading unit detection assembly causes proximal translation of the detection link and causes the switch pin to move proximally into contact with the switch button.