I'm trying to implement a simple current control circuit for an LED from here: https://www.allaboutcircuits.com/technical-articles/the-basics-behind-constant-current-led-drive-circuitry/
The principle of the circuit seems straight forward- the voltage at the inverting input should be controlled by the current passing through the resistor, which in turn is the current passing through the LED minus the input current of the op-amp (1 pA according to the datasheet). For the control voltage on the non-inverting input I am using a DAC output from a microcontroller.
My problem - even when my control voltage is zero my LED lights up. In fact for 0V input I am getting 2.4V across my diode and 0V across the load resistor which corresponds to about 5mA of current through the diode.
With increased control voltage the voltage starts to increase across the resistor but the output soon saturates. and the voltage across the resistor does not match the control voltage. The op amp I am using is a MCP6241 which is a single supply rail-to-rail op amp and I'm running it at VCC = 3.3V. So I am guessing this may be something to do with the single supply?
Is there a solution using this op-amp?