How to control 8V over I2C from a microcontroller
To get 0-8V from 0-5V you must amplify the DAC output voltage by a factor of 8/5 = 1.6. However the LM317 regulates its output voltage to 1.25V above the ADJ pin, so you will also have to bias it with -1.25V. The circuit below should do the job:-







simulate this circuit &ndash; Schematic created using CircuitLab

R3 and R4 set the non-inverting voltage gain of OA1 to (R4+R3)/R3 = 1.6. R1 and R2 provide a bias voltage of 2.083V to the inverting input. The formula for Inverting gain is -(R4/R3), so the bias voltage output is 2.083*-(60k/100k) = -1.25V. V3 provides the negative supply voltage that the op amp needs to pull its output below ground.

The LM324 has 4 op amps in it so you only need one IC to do 4 channels. The negative supply voltage is not critical (just has to be at least -2.2V) and only a few milliamps is required, so you could generate it from the +5V supply using eg. an ICL7660 or LM555.