cancel
Showing results for 
Search instead for 
Did you mean: 

capacitor does nut fully charge

Ala
Senior

hi

I have a 1000uF capacitor and a blue pill STM32F103c8t6. I connected the positive end of cap to PB9 and the negative end to GND.

then I had the code below inside while(1) loop

///////////////////////////CHARGE//////////////////////////////////
HAL_GPIO_WritePin(GPIOB,GPIO_PIN_9,GPIO_PIN_SET);
HAL_Delay(10000);//wait to fully charged

but when I measure voltage using a multimeter, I see 0.5v instead of 3.3v. why?

Edit. when I use 1uF cap or less, I see 3.3v... can someone explain that?

7 REPLIES 7

You'd need more code than that to enable the pin

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
MasterT
Lead

There is a risk of damaging uCPU. Look into datasheet, max. GPIO current limits section. Usually it's just 3 mA. Than put appropriate resistor in series to limit current.

Piranha
Chief II

Until the capacitor charges, it is basically a short circuit... You have to limit the current with a 180 ohm or higher resistor or by some other means. And learn the basics of electronics.

For STM32 the absolute maximum is typically +/-25 mA.

yes, it is actually 25mA. I forgot to say that I've used a 1Mohm resistor in parallel with the cap

you're right. I forgot to say that I've used a 1Mohm resistor in parallel with the cap

To limit a current you have to put a resistor in series. That is the absolute basics of the electronics. While you do not understand such a things, you should not connect anything to any microcontroller or any integrated circuit at all - you will just damage it. Take a battery, LED, resistor, switch/button and learn the absolute basics. When you can calculate the correct resistor value, then you have understood the absolute minimum to go further.