Unpredictable PWM behaviour when powered via 5v pin

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 » Mon Sep 07, 2020 1:36 pm

If you disconnect the power to the controller how are the voltages affected?
IT Professional, Maker
Santiago, Dominican Republic

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 » Mon Sep 07, 2020 1:47 pm

Does your code do this?

pinMode(pwm_1,OUTPUT);
pinMode(dir_1,OUTPUT);
pinMode(pwm_2,OUTPUT);
pinMode(dir_2,OUTPUT);

Setting to output?

Tom
IT Professional, Maker
Santiago, Dominican Republic

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 » Mon Sep 07, 2020 1:52 pm

Does your code do this?

pinMode(pwm_1,OUTPUT);
pinMode(dir_1,OUTPUT);
pinMode(pwm_2,OUTPUT);
pinMode(dir_2,OUTPUT);

Setting to output?

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 » Mon Sep 07, 2020 5:56 pm

Tom, the pwm_1, dir_1,pwm_2,dir_2 pins are all set as outputs. When i disconnect power to the motor driver, there's no change in the voltage at the pwm outputs. in fact what has shocked me today is that when i test the circuit again, the pwm output voltage is now the same(1.92v) whether using powerbank/pc or none. i dont know what has changed overnight. i also confirmed that the expected output pwm voltage is supposed to be around 1.9v and not 2.56v as i earlier stated because im using 8 bit and set the pwm to be at a value 150. the problem however still persists.

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 » Mon Sep 07, 2020 7:13 pm

Nodemcu outputs only 0 - 3 volts the board needs are 0-5. Is that right?

If so you need to change levels 3v to 5v for that controller to work.

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 » Tue Sep 08, 2020 6:54 am

Tom,
The motor driver/controller works with anything between 0 and 5v. As long as the nodemcu is powered using something that has a battery(powerbank/pc), it works well. The problem comes when battery supply to the nodemcu is eliminated. i dont understand this at all. Is there something that a battery does that a capacitor is not able to do??

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

Re: Unpredictable PWM behaviour when powered via 5v pin

Postby Albert » Tue Sep 08, 2020 7:30 am

i meant laptop and not pc. the motor driver works well when it is connected to anything that has got a battery as the power supply

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

Re: Unpredictable PWM behaviour when powered via 5v pin

Postby Albert » Tue Sep 08, 2020 9:16 am

or could it be that the usb chip converter has to be powered in a specific way with the data pins connected in a certain way?

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

Re: Unpredictable PWM behaviour when powered via 5v pin

Postby Albert » Thu Sep 10, 2020 9:31 am

i figured that the pwm will work okay if the chip is powered using a specific usb cable(Anker). i tried many other usb cables but all did not work. They will all supply about 5.01v but when the chip is connected, the voltage output at the 5v regulator reduces to about 4.68v. With the Anker cable, the voltage did not drop.

i also tried a generic 3.3v/5v bredboard power supply chip which i used to power the nodemcu through its 5v pin and everything worked okay (12v 2A DC adapter used to provide power for this unit). this means that the problem has got nothing to do with battery power supply or powering through the microusb port of the nodemcu.

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

Re: Unpredictable PWM behaviour when powered via 5v pin

Postby Albert » Sun Sep 20, 2020 5:44 pm

Hey guys, so i found out that the problem had got to do with the size of wire i was using. i was using a bredboard jumper wire which is AWG 22 or AWG 24. i changed to using another wire that is at least AWG 18 and used it to connect the output of the regulator to the 5v pin of the nodemcu(through the 2200uF cap) and everything now works okay. thank y'all for the help, much appreciated.

Who is online

Users browsing this forum: No registered users and 178 guests