Use a calibrated adjustable voltage source. Set it to 3.1V and the pin will receive 3.1V, set it to 4.5V and the pin will receive 4.5V.
But seriously, you will have to give some more detail about what you're trying to achieve or which problem you're trying to solve before somebody can give a sensible answer.
Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advice on) your project
See About the Installation & Troubleshooting category.