Patents protect inventions, i.e. technological developments. In order to be patentable, the invention must meet a number of requirements. First and foremost, the invention must be "new", which may be understood as meaning that the invention must be different from what is currently known (referred to as state of the art or prior art in patent jargon). The time at which this is judged is not the date when you made your invention, but when you file a patent application for the invention.
The prior art does not only include technology that has made it into the market place, it also includes anything made public even without ever having been picked-up by the market. What you have made public before you file a patent application for your invention may also form part of the prior art. Therefore, you should file your patent application before you make your invention public, e.g. by corresponding about it without confidentiality in place.
In addition to being different from the prior art, your technological development must also be "inventive" or "not obvious" when compared to the prior art, to be patentable. In other words, the invention must be "different enough" from the prior art to be awarded a patent.
Judging whether your invention is different enough is difficult and forms a major part of the patent application process. Typically, the patent office will identify certain prior art and will require the applicant for the patent explain why the invention is different enough.
Why would people want to use your invention over what is already available? Your answer to this simple question can be a good starting point for a patent attorney to judge whether your invention may be "different enough".
Your patent application must describe your invention in enough detail so that your invention can be implemented by a "skilled person," based on what you have described. Merely speculating that something could be done, or would be nice to do, is generally not sufficient. However, it is not a requirement to have actually built or implemented the invention before you file your patent application. Being able to describe your invention to a patent attorney (sometimes colloquially referred to as patent lawyer or IP lawyer) is a good test for judging whether you have enough information to file your patent application.
If you a) have developed something that is, to your knowledge, different from the prior art, b) can answer why people would want to use your invention over what is already available, and c) have enough information to describe how your invention can be implemented, you should consider starting the process of applying for a patent before disclosing the invention publicly.
NOTE: The information provided above does not constitute legal advise. If you do require legal advise, please contact us to arrange a consultation.