Unpredictable PWM behaviour when powered via 5v pin

Albert
Posts: 25
Joined: Wed Oct 11, 2017 3:06 pm

Unpredictable PWM behaviour when powered via 5v pin

Postby Albert » Wed Aug 26, 2020 1:31 pm

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.

ESP_Sprite
Posts: 9759
Joined: Thu Nov 26, 2015 4:08 am

Re: Unpredictable PWM behaviour when powered via 5v pin

Postby ESP_Sprite » Thu Aug 27, 2020 7:49 am

- Are your grounds all connected together?
- What's the current capacity of your 5V power supply?

Albert
Posts: 25
Joined: Wed Oct 11, 2017 3:06 pm

Re: Unpredictable PWM behaviour when powered via 5v pin

Postby Albert » Sat Sep 05, 2020 7:13 pm

Yes all my grounds are connected together. Im using LM7805 regulator for my 5v supply with a current capacity of 1.5A.

username
Posts: 536
Joined: Thu May 03, 2018 1:18 pm

Re: Unpredictable PWM behaviour when powered via 5v pin

Postby username » Sat Sep 05, 2020 10:59 pm

Does your LM7805 regulator have 0.1uf bypass caps on both the input and output ?

Albert
Posts: 25
Joined: Wed Oct 11, 2017 3:06 pm

Re: Unpredictable PWM behaviour when powered via 5v pin

Postby Albert » Sun Sep 06, 2020 6:57 am

No i don't have the bypass caps. could this be the cause?

username
Posts: 536
Joined: Thu May 03, 2018 1:18 pm

Re: Unpredictable PWM behaviour when powered via 5v pin

Postby username » Sun Sep 06, 2020 1:11 pm

I cannot say if that is the problem. I can say you should never use a regulator without a bypass cap on it.

tommeyers
Posts: 184
Joined: Tue Apr 17, 2018 1:51 pm
Location: Santiago, Dominican Republic

Re: Unpredictable PWM behaviour when powered via 5v pin

Postby tommeyers » Sun Sep 06, 2020 3:14 pm

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
IT Professional, Maker
Santiago, Dominican Republic

Albert
Posts: 25
Joined: Wed Oct 11, 2017 3:06 pm

Re: Unpredictable PWM behaviour when powered via 5v pin

Postby Albert » Sun Sep 06, 2020 7:24 pm

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.

tommeyers
Posts: 184
Joined: Tue Apr 17, 2018 1:51 pm
Location: Santiago, Dominican Republic

Re: Unpredictable PWM behaviour when powered via 5v pin

Postby tommeyers » Sun Sep 06, 2020 10:54 pm

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?
IT Professional, Maker
Santiago, Dominican Republic

Albert
Posts: 25
Joined: Wed Oct 11, 2017 3:06 pm

Re: Unpredictable PWM behaviour when powered via 5v pin

Postby Albert » Mon Sep 07, 2020 7:07 am

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.
Attachments
Capture.PNG
Capture.PNG (17.27 KiB) Viewed 8171 times

Who is online

Users browsing this forum: kaxx1975 and 104 guests