You can do it yourself, but I don’t recommend it. Use a patent attorney. Patents must be filed within one year of using the invention, not including testing/development period.
First meet with the attorney, tell them about your invention, and have them do a search to see if it’s patentable.
Patents are all about the “claims.” What are you claiming is novel?
The attorney writes up the application with professionally prepared drawings the way the patent office likes it all. Read it over carefully – particularly the claims.
You can claim variations of your invention to prevent someone copying you in a bit different way, but the broader you make the claims, the less chance of getting your patent approved as written.
Expect to wait a year or more to hear back from the Patent Office. It’s a government operation – what do you expect? In all fairness to them, the number of applications they get annually has gone up dramatically over the years.
Expect that they will reject your application. It’s normal. Your patent attorney will rewrite the claims and maybe throw some out to submit it again to try to get it approved. This process may go on two or three times over many months.
Hopefully, two to four years and $8,000 – $15,000 later, you’ll have your patent!