For a long time now courts have realized that a confession is certainly not voluntary simply because it is true. There are a long line of Supreme Court cases which have shown that the voluntariness of a confession is based on the "totality of the circumstances" surrounding the giving of the confession. If under the totality of the circumstances test the confession is held to be involuntary, it is held to be admissible as a violation of the due process of law guaranteed by the Fifth and Fourteenth Amendments of the Constitution.
Many cases have been overturned because of involuntary confessions. Similarly, many cases have been overturned and other cases thrown out of court because of a Miranda Warning violation.
The Miranda Warnings come from an early 1970s case entitled Arizona v. Miranda. The Miranda Warning stemmed from a case focused on custodial interrogations. When there is a police encounter, the idea behind Miranda is once the defendant has been placed into custody, he shall not be interrogated by any police or state agent until he has first waived his right to remain silent and his right to have an attorney present during questioning.
These constitutional protections have evolved over time as have many individual rights.