I am a student in high school and have been working with buck boost converters. I currently have a buck boost converter that steps up 5V to about 58V. I created 3 voltage dividers that should step the output voltage from the buck boost converter to 30V, 35V, and 40V. I then wired the voltage dividers to a 3 way DIP switch. This should allow you to choose which voltage to use (30V, 35V, or 40V via the switch.) However, the voltages I am getting as an output are nowhere near the predicted voltage (given \$V_{out}=V_{in}(R_2/R_1+R_2)\$.)
For example, I am getting an output of 12V with two 1k resistors. I then tried using a voltage dropping resistor to get the 3 voltages. This worked initially, with 10k ohms getting 30V, 15k ohms getting 35V and 23k ohms getting 40V. However, when I turned the converter off and back on, all of these voltages were different (i.e the 10k resistor was giving a \$V_{out}\$ of 40V instead of 30V.) Also, the converter does not give the same \$V_{out}\$ each time it is turned on. The output usually ranges from 52V to 62V but is mostly a steady .939A. The power supply is a 5v usb plugged into an iPhone charger port.
Here is the schematic to the buck boost converter.
Here is the link to the datasheet for the LM2588.
If anyone can offer an explanation to why \$V_{out}\$ is so inconsistent, or offer an alternative method for creating 30V, 35V, and 40V that would be fantastic. I am happy to provide any other information if necessary.