It cannot draw enough current I suppose. When wheels are free-spinning, the load on motor is very small. When you put it on ground, the load increases, and it is slow because there is not enough current to drive the load
The Servo library uses Timer 1 to create the servo control signal. That means it can run the servo on any pin or combination of pins, and at the 50Hz speed that a servo likes best.
However, pins 9 and 10 also use Timer 1 to create the PWM signal.
It can't do both.
As soon as you start using the Servo library you lose PWM on pins 9 and 10.
So what can you ...
To analyze your problem:
Switch two wires between two motors (and repeat this to get all combinations), to find out if the code/wiring until the motors is wrong, or there is a problem with the motors.
Print out the values of pins 9, 10, 11 and 12 and the value of t/input to see if the pins are controlled as you expect.
Remove all but one motors, for all ...
You need more power!
The formula for power is Volts * Amps. A PP3 has about 500mAh, which means its can (in theory) output 9V at 500mA for an hour, which means you have about 4.5 watts.
So what power do your motors need? I'll assume they are about 1.5W motors, which means you need 6W to drive all the motors.
Your PP3 can output 6W, but it won't last long ...
According to the Servo reference page it's not possible to use Servo library and PWM outputs on the pins 9 and 10.
On boards other than the Mega, use of the library disables analogWrite() (PWM) functionality on pins 9 and 10, whether or not there is a Servo on those pins.
The problem you have is you are treating minutes and hours separately. That won't work - they need to be combined. As it stands your "on" time is:
Minutes greater than W, and
Hours greater than X, and
Minutes less than Y, and
Hours less than Z.
Or, to rearrange that:
Hours between X and Z, and
Minutes between W and Y.
You can see that won't work. You ...
You need two supply voltages for this board to work: motor supply, which goes directly to your motor (up to 35V for this L298N board, depends on what your motor needs), and logic supply of 5V, which powers the board's logic chips. If the motor supply voltage is between 7V and 12V, you can derive 5V logic supply from motor supply by enabling this board's ...
Try to use this code, without the library, and be shure to connect every pin to the correct arduino output! If everything is ok it should work! Check a tutorial here
int IN3 = 5;
int IN4 = 4;
int ENB = 3;
pinMode (ENB, OUTPUT);
pinMode (IN3, OUTPUT);
pinMode (IN4, OUTPUT);
digitalWrite (IN3, HIGH);
The Uno is a very limited platform, perhaps surprisingly, given its wide range of abilities and built-in hardware features. The two most glaring limitations for you application are its 16MHz clock speed (relative to modern desktop processors) and thus its bandwidth, and it's non-expandable 2KBytes of RAM.
Image processing would be right out the window, and ...
analogWrite() Notes and Warnings
The PWM outputs generated on pins 5 and 6 will have
higher-than-expected duty cycles. This is because of interactions with
the millis() and delay() functions, which share the same internal
timer used to generate those PWM outputs. This will be noticed mostly
on low duty-cycle settings (e.g. 0 - 10) and may result ...
The comment you have found which is also on the Servo library page https://www.arduino.cc/en/Reference/servo and is the core of your problem.
On an Uno, you will have to change the PWM pins to 3,5,6 or 11 as the timer which provides the PWM for pins 9 and 10 is now being used for the Servo library.
This is probably the easiest option, especially if you are ...
I'd use PWM on EN input. Motor will be driven in HIGH and left floating in LOW. The other method means it'll be shorted (= full on brake).
L298N is based on bipolar transistors. That means relatively big voltage drop between drivers Emitter and Collector (about 2V on each transistor), so there are big power losses (= heat).
Maybe something like LMD18200 ...
PWM is used to control the duty cycle and not the voltage directly so your PWM will work directly on the input pins of motor driver and you will be able to control the speed.
just use analogWrite on the input pin which was held HIGH and HOLD the other pin to LOW. If you desire to change the direction while simultaneously controlling the speed. just ...
That's a very poor datasheet. I think it's using equals signs where it means less-or-equal, so:
High level: 2.3V = Vin = Vss
Intends to say that Vin between 2.3 and Vss will be considered high, and
Low:-0.3V = Vin = 1.5V
Intends to say that Vin between -0.3 and 1.5V will be considered low.
"Vss" in the high level definition is confusing, because ...
The stepper motor does not directly control or limit its own current. When using the L298n for stepper control, the motor current control is performed by a PWM signal to the L298n ENABLE pin. If you have ENABLE high (100% duty), current will be a factor of only the DC resistance of the stepper winding and the power supply voltage. Here you are trying to ...
The L298N is a quad half-bridge (or a dual full-bridge) driver. By tying OUT1 and OUT4 together and tying OUT2 and OUT3 (and, of course, the corresponding inputs), you get a higher current output, full-bridge (or H-bridge).
Take a look through the datasheet for the L298N. It has the exact application description you are asking about on page 7.
My first one or couple of HC-06es brought its LED signal out to a pin on the base board, labeled "STATE" on mine. I tested the LED state on every loop and if it was changing regularly, took that to indicate whether it was waiting for a connection.
Later modules no longer bring out the LED signal but it is available on module's edge-pin 24, according to a (...
Using that pin configuration you'll have several problems despite you'll use enable pin.
I would use a I2C module for 16x2 lcd like this https://www.amazon.com/SainSmart-Serial-Module-Display-Arduino/dp/B00813HBEQ
Control 16x2 lcd with I2C.
You're driving the stepper too fast, unintentionally though.
The while loop you use to delay is likely optimized out by the compiler:
Easiest way to fix would be to declare tmp2 as a volatile variable when you declare it up in the top of your program. Thusly:
volatile unsigned int tmp2;
This will inform the compiler that tmp2 ...
What are the "m1" and "m2" pins you mention?
On the diagram I see on that link, the pins "1-M1 motor -" and "6-M1 motor +" should be connected to the motor driver. The other four pins should go to the Arduino only.
You can probably test the motor by disconnecting it and connecting pins 1 and 6 to a 9-12V battery or similar, to see if it turns.
By the way ...
If your second schematic correctly represents your actual wiring, the problem is that you are connecting the arduino 5V pin (instead of the GND pin) to the L298 GND.
I assume you have also connected the control pins of the motor controllers to Arduino pins?