-1

I'm studying H-Bridge for DC motors. I have a 9V battery, DC motor (9v), Arduino Nano and L293D. I'm following Jeremy Bloom's book about Arduino. Well, the system works perfectly with a PC connected. When I turn off the PC and connect the battery only, it doesn't work at all. The system should work only with a 9V battery.

const uint8_t MC1 = 8; const uint8_t MC2 = 7; const uint8_t POT = 0; uint16_t velocity = 0; uint16_t PWM = 0; void forward(uint16_t); void reverse(uint16_t); void brake(); void setup(){ Serial.begin(9600); pinMode(EN, OUTPUT); pinMode(MC1, OUTPUT); pinMode(MC2, OUTPUT); brake(); } void loop(){ Serial.println(PWM); PWM = analogRead(POT); if (PWM > 562){ velocity = map(PWM, 563, 1023, 0, 255); forward(velocity); } if (PWM < 462){ velocity = map(PWM, 461, 0, 0, 255); reverse(velocity); } } void forward(uint16_t speedValue){ digitalWrite(EN, LOW); digitalWrite(MC1, HIGH); digitalWrite(MC2, LOW); analogWrite(EN, speedValue); } void reverse(uint16_t speedValue){ digitalWrite(EN, LOW); digitalWrite(MC1, LOW); digitalWrite(MC2, HIGH); analogWrite(EN, speedValue); } void brake(){ digitalWrite(EN, LOW); digitalWrite(MC1, LOW); digitalWrite(MC2, LOW); digitalWrite(EN, HIGH); }``` The A0 pin is used to rotate the sensor (PWM). [![The circuit][1]][1] [1]: https://i.sstatic.net/GliSw.png 
3
  • 1
    Did you use this type of 9 Volt battery? These types of battery do not have enough current capacity to run most type of motors. Consider using batteries with more current capacity. Likely the type used in older flashlights would work better. Commented Feb 8, 2024 at 13:25
  • Yes, i did. Which one should I use? Commented Feb 8, 2024 at 13:28
  • Well, I connected 7.4V 1500mAh Li-ion battery and... it's working. Could you explain why?? Commented Feb 8, 2024 at 13:47

1 Answer 1

0

Well, I connected 7.4V 1500mAh Li-ion battery and... it's working. Could you explain why??

The PP3 batteries (rectangular 9v battery with snap-on terminals) can supply only a very limited amount of current; barely enough to run an Arduino at all, and none left over to run a motor or other higher current devices.
The best application for PP3s is in low-current, standby devices like smoke detectors, which need very little current under normal circumstances (no smoke) but can draw enough current to make a lot of noise for long enough to wake you up and alert you to the danger, when they detect smoke.

For your application you need a larger capacity battery that can supply more current. Carbon, Alkaline, and nickel chemistries could all work, provided the battery is large enough to supply the current you need; the PP3's form factor is its limitation. Li-ion's big advantage over the other chemistries is, of course, it's rechargeability, and with less degradation than Nickel-based rechargeables.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.