Showing results for 
Search instead for 
Did you mean: 

ADC Readings Effected by Capacitors?



I am new to ST boards, so please bear with me!

I am trying to get a vibration reading from a beam using a piezoelectric sensor through an analog pin (ADC reading). I noticed in experiment that the timing of the piezoelectric sensor was not quite right. I thought it was a clock issue so I went through and made sure my timer was fine, and from what I gathered it is working fine.

However, my piezo signal still lags compared to what it is expected to do. I added a DC battery to the loop attached to the analog pin that is being read using ADC to troubleshoot and that's when I noticed an issue. When the program starts running, the pin reading starts at 0 and then slowly goes up until it reaches the battery voltage - plot attached below. I flicked the piezo as well in this plot to make sure it was working, but the main issue is the time it takes to achieve the battery's voltage. I am not an expert in electrical components, but this seems to suggest that there is a capacitor being charged in the loop, and possibly that when the Piezo is hooked up, it's signal is being effected by the capacitor's dynamics as well. Is my analysis accurate?

Is this a settings issue that I can fix in CubeMX or is this a limitation of the hardware? I am running everything through Simulink and using an embedded encoder along with CubeMX. My settings in CubeMX are also attached for reference. I am running everything at 350Hz. My board is the Nucleo-F401RE and I am using Simulink's STM32F4xx Based Boards Library. 

Any advice or help would be appreciated. Thank you in advance! 




Accepted Solutions
Senior III

If my memory is OK, piezo devices do have capacitive properties:

But to be sure I looked it up: 

View solution in original post

Senior III

If my memory is OK, piezo devices do have capacitive properties:

But to be sure I looked it up: 


I removed the piezo from the loop and measured just the battery. You are 100% correct, the capacitive behavior is coming from the piezo itself. Good catch!

I guess I have to find another way to capture the beam behavior. Thank you for your help!




the piezo element is a capacitor (1...10nF typ. ), which generates voltage when bent/deformed/force applied.


you have to give some offset (center) voltage to the adc input - not let it float !

try like this:



If you feel a post has answered your question, please click "Accept as Solution".