Most large research universities have offices of technology and licensing and and intellectual rights policies. You likely are on the hook if in any way it was developed in their labs or used their resources to produce your invention. Then you are likely required by these policies to disclose your invention to the university and they have a duty to either waive their interest, exert their interest or classify the invention as premature. You really need to consult with your universities patent office for the policy.
Many universities have very liberal policies with a lot of benefits from royalties to spin-off company formation for the inventors. On the plus side they take on the risks and costs of prosecuting a defensible patent. You then may be entitled to royalties from licensing deals that they enter into on behalf of you, your professor and the university for your invention. Other universities are more strict holding back all proceeds giving you only your name on the patent and holding back all royalties and equity in spun-off entities. The % royalties available are entirely up to the institution but if you developed the invention in their labs they have certain definite rights to the invention unless you entered into a previous agreement where they waived interest.
If you are a graduate student you likely signed and agreed to the IP policy ... so look it up.