Page 1 of 3

Unpredictable PWM behaviour when powered via 5v pin

Posted: Wed Aug 26, 2020 1:31 pm
by Albert
I have a NodeMCU breakout board which im using as a wifi access point to control dc motors, through a motor driver, using the pwm pins 32 and 33 at a pwm frequency of 1800Hz on pwm channels 4 and 5 respectively. im using a pwm resolution of 8 bits to write a pwm value of 150 on each of the pins at different periods of time (NOT simultaneously). I control the motors using an android phone over wifi. I have also used pins 18,19 as digital inputs, pins 5,21,25,26 as digital outputs, and pins 34 and 36 as analog inputs. The output pins of 5v current sensors are connected to the analog input pins 34 and 36 through a voltage divider of 2.2k and 3.3k resistors to scale down the 5v voltage output from the output pin of the sensor. The pins 18 and 19 are set as input pins(with internal pulldown) for detecting push button presses.

When the breakout board is powered via the microUSB port through a computer or a power bank, everything works okay and the dc motors will spin according to the pwm value that is written to the pins. However, if i supply power to the breakout board using the 5v pin (from a 5v voltage regulator with 2200uF caps at the input and output), the wifi access point will be successfully created and the android phone will access and communicate with the server successfully BUT the dc motors controlled via the pwm pin will just hum for a few seconds, stop and then hum again repeatedly. Note that the voltage regulator is dedicated for the breakout board only and nothing else draws power from it. I've tried powering the breakout board using microUSB and then disconnecting the USB cable while the 5v pin is still connnected, but the dc motors are still humming intermittently but not rotating.

What could be the cause of the problem? i do not want to power my board using the microUSB port because my setup will be very bulky and i want to save on space.

Re: Unpredictable PWM behaviour when powered via 5v pin

Posted: Thu Aug 27, 2020 7:49 am
by ESP_Sprite
- Are your grounds all connected together?
- What's the current capacity of your 5V power supply?

Re: Unpredictable PWM behaviour when powered via 5v pin

Posted: Sat Sep 05, 2020 7:13 pm
by Albert
Yes all my grounds are connected together. Im using LM7805 regulator for my 5v supply with a current capacity of 1.5A.

Re: Unpredictable PWM behaviour when powered via 5v pin

Posted: Sat Sep 05, 2020 10:59 pm
by username
Does your LM7805 regulator have 0.1uf bypass caps on both the input and output ?

Re: Unpredictable PWM behaviour when powered via 5v pin

Posted: Sun Sep 06, 2020 6:57 am
by Albert
No i don't have the bypass caps. could this be the cause?

Re: Unpredictable PWM behaviour when powered via 5v pin

Posted: Sun Sep 06, 2020 1:11 pm
by username
I cannot say if that is the problem. I can say you should never use a regulator without a bypass cap on it.

Re: Unpredictable PWM behaviour when powered via 5v pin

Posted: Sun Sep 06, 2020 3:14 pm
by tommeyers
I would measure the voltages being supplied to assure they are not lower when the problem occurs.

If you have a scope look at the pwm pins too.

Tom

Re: Unpredictable PWM behaviour when powered via 5v pin

Posted: Sun Sep 06, 2020 7:24 pm
by Albert
I added 0.1uf bypass caps on both the input and output but there's no change. The voltage measured on the 5v pin remains constant(4.56v) even when the problem occurs. ive found out that the pwm output when powered using pc or powerbank is 2.56v but when powered from the lm7805 regulator, the pwm output is 1.92v. I even tried to channel the regulator output through the micro usb port but still the pwm output is 1.92v instead of the expected 2.56v.

Re: Unpredictable PWM behaviour when powered via 5v pin

Posted: Sun Sep 06, 2020 10:54 pm
by tommeyers
I think 1.5 to 3.5 is lala land for ttl 5v. As you disconnect components where does it rise? Like the pwm motor controller what are its specs?

Re: Unpredictable PWM behaviour when powered via 5v pin

Posted: Mon Sep 07, 2020 7:07 am
by Albert
sorry i dont have a scope to see where it rises when disconnecting. im using the mdd10a motor driver and not able to attach datasheet here.