Use ADC to detect power

Input 6V, output close to 2.5V is the best
but now, it is 2V
need to recalculate the threshold
6*(10/(22+10)) = 1.875 ---------------- -- 3.3 (0.5681 of 3.3)
4.3*(10/(22+10))=1.34375 ------------------ 3.3 (0.407 of 3.3)

3.3 is 4095 Because the adc of stm32 is a 12-bit twelve-bit full scale is 0xfff---> 4096
0.47 is 1667

{4.3*(10/(22+10))}/3.3*4095

 

The circuit diagram is as follows

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325944841&siteId=291194637