Disclose the control method that a kind of digital cap is used for drug container, mobile device, etc.. Digital cap, one embodiment according to the invention, comprising: fastening module can come from mobile device for receiving, at least if the type of medication time and drug, in drug container with medicine bottle, communication module Whether the scanning of detection module connection is with being opened or closed Medicine container output module exports an alarm, detection when limiting drug opening and closing, if current time is not in the received medication time of institute Controller passes through for sending about opening and closing to mobile device and controls communication module Battery supplies electricity at least one of the element.