The voltage regulator circuit is based on the LM317, mainly because this is what I currently had handy, that would give me a comfortable margin of error. There can be up to a 40V difference between input and output voltage, which means this circuit should be able to handle a input voltage of up to 43V between GND and VBAT
The values of R1 and R2 where chosen from resistors I had available, using this LM317 Voltage Calculator. I was aiming for something around 3.3V.
R1=470Ω R2=680Ω, which gives a output voltage of about 3.06V, which is acceptable for all of the components.