The first and foremost thing you have to do before anything else is make sure your idea is new! I can’t stress this enough. There have been sooo many cases where people would even go as far as trying to patent their idea only to find out it’s already on the market and they wasted so much money for nothing.
And even if it’s not on the market (or you can’t find it on the market), it doesn’t mean it hasn’t been invented. You have to do patent research, and there are plenty of websites to help you do it for free.