Managing motors with dual L298N

The default shield only uses the 12V power for the motors. The Arduino gets its 5v power from the USB connection, and the Arduino uses that 5v power for the encoders.

The ‘Test Motors’ function tests one motor at a time, first putting 5v on one of the IN pins of that motor’s L298 and Gnd on the other IN pin for 3? seconds. Then it reverses which pin gets the 5v. That motor should run one way then the other. If not, check that the signals connect to the correct Arduino pins. Check the ENAble pin of the L298 too. When the motor turns, GC checks the encoder signals to see that the motor is turning in the expected direction. If the motor turns but fails both directions, check the encoder connections to make sure the encoder has 5v and Gnd, and maybe try swapping the EncA and EncB.

1 Like

Connection with H bridges works. Tested it when i moved sled to middle of workplace.

Test program

int in5 = 11; // OUTPUT
int in6 = 12; // OUTPUT
int enC = 10; // PWM
int in1 = 4; // OUTPUT
int in2 = 6; // OUTPUT
int enA = 5; // PWM

void setup() {
//R
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(enA, OUTPUT);
//L
pinMode(in5, OUTPUT);
pinMode(in6, OUTPUT);
pinMode(enC, OUTPUT);

}

void loop() {
digitalWrite(in5,HIGH);
digitalWrite(in6,LOW);
digitalWrite(enC,HIGH);

digitalWrite(in1,HIGH);
digitalWrite(in2,LOW);
digitalWrite(enA,HIGH);
}

/\ this program moved sled w/o problem. Tomorrow ill try reconnect everythink and use Ohmmetter to check the connection. How to check encoders? I rotated it with fingers and watched serial monitor. Left encoder send something.
Does GC display directly that encoder fails? My motors work laud when they move… but when tested they didn’t work at all.
I will reset EEPROM, and do calibration w/o motor test.

I will, 1st in arduino program if that wont help ill swap in1 and in2, then I’ll do it phisically :stuck_out_tongue:

w8 till morning

Your test program has pin assignments that match the version 1.2 board layout. When GC starts and connects to the Arduino, it should report ‘PCB v1.2 detected’ to indicate that those pin assignments are being used.


On Windos

Can i force GC to move motors w/o reading encoders? ATM motors wont move at test.

Encoders works. Motors don’t works.
<Idle,MPos:0.00,0.00,0.14,WPos:0.000,0.000,0.000>
[PE:0.56,-0.66,127]
It counts good.

I don’t know why 3 axis works on test program but wont work on maslow firmware.
Connections are good.

Offer a price for original 1.2 shield with shipping to Poland. I’m desperate to run it asap.
Maybe there is somthing special in default version.

Pff. 50$ for pcb with h bridges… no wai
Ill install older firmware

I will Connect Another Arduino as State Detector. If firmware works it should give me clean results that there is any controll signal from mega. Remember that I had an error about Reading from EPROM. When i wipe out EeProm i get connection time out error… can that be the problem?

One thing that I see in this picture is “FAKE_SERVO ON” , something introduced in Firmware v1.28 (not yet released, thanks for helping with the testing :+1:t2::grin:).

That means that the firmware acts as if it has motors attached, but does not actually run the motors. The firmware defaults to “FAKE_SERVO OFF”, and turns it on if the keyboard sends ‘cmd-f’ or ’ curl-f’. Typing a plain ‘f’ on the keyboard will turn it off again and make the motors run as expected.

The corresponding version 1.28 of GroundControl includes a setting in Settings/GroundControl to change the character for controlling “FAKE_SERVO OFF/ON”, whichever lowercase character you choose for “OFF”, and ‘ctrl’ or ‘cmd’ of that character for “ON”. The state is saved in EEPROM to persist over reboots, but wiping the EEPROM sets it “OFF”.

2 Likes

get connection time out error… can that be the problem?

That error in GroundControl usually means either that the Arduino is not on the serial port (check the serial port connection in GC) or that the Arduino doesn’t have the cnc_ctrl_v1.ino firmware programmed in it (maybe still the test program?)

Rly. Bad joke. I hope when ill wake up at the morning everythink will work correctly.
Ill install older version of firmware on another Arduino module.


yeey

Too bad, that after 11th try ive got 1 Direction Fail. Like on this picture.
Left motor moves, in both directions but first test always fails. Encoder problem?
I swapped motor cables with Z axis, and still same problem.

Something like that:

12V 10A Power Supply. Probably i failed to make good PCB.

1 Like

What the motor/encoder test does is it runs a motor forward for a given period of time and counts the number of encoder steps. If the number of steps exceeds some amount, its a pass and if not, its a fail. It then runs the motor backwards for and counts the encoder steps and compares the steps to some amount.

If the motor is running forward slower than it should (for whatever reason) it may not accumulate enough encoder steps to pass. I guess it could be an encoder problem, but someone smarter than me will have to explain why it would work in one direction and not the other…

2 Likes

In your screenshot, you have lots of B99 ON and B99 OFF commands. Was that intentional? I think you have to hit “Ctrl-F”, “Alt-F”, or “Windows-F” to send the B99 ON and “F” to send the B99 OFF.

1 Like

Yes. I was trying to turn off Fake motor mode by clicking random combination.
Ok. Ill try to rotate it with fingers to check that i get same number of ticks :stuck_out_tongue:

Yes. Encoder reading are bad.
Doesn’t matter witch way i turn it counts up.
<Idle,MPos:0.00,0.00,4.03,WPos:0.000,0.000,0.000>
[PE:0.94,-0.59,127]
Bold numbers goes only increase T_T

And if you swap the left and right motor cables, does the ‘fail’ now appear on the right motor?

To be clearer on my question. If you unplug the left motor cable from the left motor and plug it into the right motor, does the issue now appear on the right motor?

Yea. Im testing this on Z axis cuz ive got it in 6x1.5mm shielded cable. Im sure that my Left motor slot on shield is broken. Probbly its shorted somewhere. Ill lost another 3$ and 30 minutes to make another shield T_T

Posting again because nothing changed in blueprint.

Counting up was caused by dust on my 1st board. 2nd board works well. I find that out when i measured resistance between two wires… It was about 170 Ohm and it was clear that something make a bridge. I washed board in alcohol and it clear the short.
My left port works now.

Conclusion! When Your encoder count only up. There is possibility that two encoder channels are shorted together. Measure resistance by unplugging Arduino and any power source on broken port. Plug other motor to the same slot to eliminate the faulty cable or specific encoder.

PS. Now ive got two working maslow 1.2 modules. YEEYYY
Pass2

3 Likes