- Thu Jul 28, 2011 12:59 am
#130862
I'm going to be using my STM32F103ZG to drive an electric bike motor controller, i.e. I need to be able to put out a voltage between 0V and 3.3V -- with a current of maximum 1.5mA being drawn. I am slightly puzzled by the hardware aspects of how to do this though (Yes I'm rather new to microcontrollers and electronics).
The STM32 I have does have a built in DAC: this DAC has an output buffer as well, however I am not sure how much current I can draw from it (Datasheet can be found here -- right hand side of page -- look at pages 107-108) -- extensive googling has delivered no results. The MCU is operating at 3.3V, i.e. the DAC should in theory be able to supply 0-3.3V.
The datasheet says I can draw up to 25ma on the General Purpose IO pins, however there is no maximum current specified for the DAC (with the buffer switched on). What is specified that might be of relevance is Rload (Resistive load vs. VSSA [Ground] with buffer ON) with minimum 5kOhm. I'm not really sure how to interpret this -- does this mean any load I put between the DAC ouput and Ground must be at least 5kOhm? (In this case I wouldn't be able to connect directly to the bike since it looks like ~2.5kOhm.) Or does this specify what the buffer looks like to the DAC -- meaning I can in fact draw the 25ma of current that are specified for the GPIO pins?
The other issue I have seen is that the buffer seems to take away 0.2V from the top an bottom voltages, i.e. I can only get 0.2 to 3.13V? In this case I would need to use an output buffer: how do I go about adding this, i.e. what sort of chip would be suitable (I have power supplies of ~24V unregulated, 5V regulated and 3.33V regulated already available -- i.e. would I have to use some sort of rail-to-rail single supply opamp)? It doesn't particularly matter if the range of voltages I get is slightly larger than 3.3V, i.e. 5V output is perfectly safe.
The STM32 I have does have a built in DAC: this DAC has an output buffer as well, however I am not sure how much current I can draw from it (Datasheet can be found here -- right hand side of page -- look at pages 107-108) -- extensive googling has delivered no results. The MCU is operating at 3.3V, i.e. the DAC should in theory be able to supply 0-3.3V.
The datasheet says I can draw up to 25ma on the General Purpose IO pins, however there is no maximum current specified for the DAC (with the buffer switched on). What is specified that might be of relevance is Rload (Resistive load vs. VSSA [Ground] with buffer ON) with minimum 5kOhm. I'm not really sure how to interpret this -- does this mean any load I put between the DAC ouput and Ground must be at least 5kOhm? (In this case I wouldn't be able to connect directly to the bike since it looks like ~2.5kOhm.) Or does this specify what the buffer looks like to the DAC -- meaning I can in fact draw the 25ma of current that are specified for the GPIO pins?
The other issue I have seen is that the buffer seems to take away 0.2V from the top an bottom voltages, i.e. I can only get 0.2 to 3.13V? In this case I would need to use an output buffer: how do I go about adding this, i.e. what sort of chip would be suitable (I have power supplies of ~24V unregulated, 5V regulated and 3.33V regulated already available -- i.e. would I have to use some sort of rail-to-rail single supply opamp)? It doesn't particularly matter if the range of voltages I get is slightly larger than 3.3V, i.e. 5V output is perfectly safe.