Managing motors with dual L298N

Ive got problem with calibration process. I’ve got 12760 ticks per revolution.
Distances between chain links are 10mm.
9 teeth gear.
Both chain are 5m longs.
Distance between 2 motor axis are 2954mm
Distance from centre of mill to first chain link is 180mm

I don’t know why GC lie that there is 4618mm between motors.

This time I’ve got 4570 mm.

Pffff. It dont extand both chains equally. Left extand for 192cm, right to 135cm.

Rly. Calibration takes 40 minutes T_T whats wrong.
OMG Chinease encodersss

Conclusion.
If your motors don’t sound equally when rotating. There is possibility that encoder loses ticks. Move the magnet of the encoder to the right height on the motor shaft.

OMG. Another 40 minutes for calibration.
Yet. Ive got almost 19500 ticks per revolution :expressionless:

Success

Now chains extend equally, but my middle position is a bit too high on board.
Is there any method to get encoder resolution?

The chains are extended a set amount as defines under settings. That amount is not typically the amount of chain needed to center. After you calibrated, you should be able to goto actions->return to center and the sled will move to 0,0

but be sure to mark the links that are at the 12 o;clock position before you
move to center (hen you need to reset your chains because something went wrong,
you will want to get it back to this point)

David Lang

My home position is 10 cm higher than middle of plate.
I’ve got motors different resolution. I will try to build Photointerrupter on axis to measure how much pulses for fifty rotations. Then div it by 50 to get almost perfect measure of encoder resolution.

https://easyeda.com/polaski/enkoder-trigger

You are using the motors you linked to earlier in the thread?

Because they were easy to get :stuck_out_tongue: with free shipping

Can you contact them and find out the encoder’s pulse per revolution? (I didn’t see it in the specs). They publish the gear ratio so your encoder steps should be:

gearRatio x PPR x 4

I believe that’s correct…

1 Like

I was using instructions from datasheet. Dmm is 36 so i should get 290x16x4= 18560 and thats probbly correct :slight_smile:


But im still working on photointerrupter.

1 Like

it is, but remember that on the stock motors we found that thr published gear
ratio was not accurate, we had to open the gearbox and count teeth to get it
right

David Lng

1 Like

Ok. I’ve got photo interrupter working. I will mount it on axis :stuck_out_tongue:
Lets test it

Test

void setup() {
pinMode(A0,INPUT);
Serial.begin(9600);
}

void loop() {
if(digitalRead(A0)!= HIGH){
Serial.println(“HI”);
}else{Serial.println(“LO”);}
}

It’ working. Soooo. I will need extract code to examine A encoder channel.

https://create.arduino.cc/editor/polaski/23d033c9-7e97-4a3a-94eb-b5e4296a7d30/preview

Test code

// EnableInterrupt - Version: Latest
#include <EnableInterrupt.h>

int in5 = 11; // OUTPUT
int in6 = 12; // OUTPUT
int enC = 10; // PWm
int encoder3A = 2; // INPUT w/ interrupts
int encoder3B = 3; // INPUT w/ interrupts

int rotation_counter = 0;
int encoder_counter = 0;

void setup() {
pinMode(A0,INPUT);
pinMode(encoder3A,INPUT);
pinMode(encoder3B,INPUT);
pinMode(in5,OUTPUT);
pinMode(enC,OUTPUT);
digitalWrite(in5,HIGH);
digitalWrite(enC,HIGH);
Serial.begin(9600);
delay(100);
while(digitalRead(A0)==LOW){}
while(digitalRead(A0)==HIGH){}
enableInterrupt(encoder3A,encoder_counter++, RISING);
enableInterrupt(A0,rotation_counter++,RISING);
}

void loop() {
if(rotation_counter == 50){
disableInterrupt(encoder3A);
disableInterrupt(A0);
Serial.println("Encoder tisck after 50 rotations: ");
Serial.println(encoder_counter);
}
}

You could write a test program to count the number of pulses from one encoder while you slowly turn the motor shaft one revolution by hand.

Its hard to eyeball that’s the full rotation. Fingering encoders is bad for my mental health xD
At the morning I will drill M8 nut and attach it to the end of shaft by screw-tapping M4 in it, long enough to activate sensor. There is much space to attach this sensor to wood.
Google Photos
Google Photos
I will do this test maybe 9 times… only to get effective PPR of every motor. I’ve got 3x same motors but this are chinese products soooo. I will take two motors with PPR approximately equal and make them work on chain.
That way the worst motor will go to less accurate work as Z axis :stuck_out_tongue:
Opening of gearbox gives nothing but headache.
At most lazy way I could just leave the mesurement at this point, because I had already calibrated it accurate enough, that I could treat the calibration dimension as a reference to using a simple ratio for drawings.
But NO. I will do as much I can to make it calibrate better.

BTW. I find photointerrupter in trash can… so it was free. I’m unemployed

Results /\

Summary

// EnableInterrupt - Version: Latest
#include <EnableInterrupt.h>

int in5 = 11; // OUTPUT
int in6 = 12; // OUTPUT
int enC = 10; // PWm
int encoder3A = 2; // INPUT w/ interrupts
int encoder3B = 3; // INPUT w/ interrupts
int noR = 50;
int photointerruptor = 15;
int VCC = A7;
//int aux5 = A7;
//int aux6 = A6;

int rotation_counter = 0;
unsigned long encoder_counter = 0;
//24571
//24561
//24643
//24552
//24565

void setup() {
pinMode(photointerruptor, INPUT);
pinMode(encoder3A, INPUT);
pinMode(encoder3B, INPUT);
pinMode(in5, OUTPUT);
pinMode(enC, OUTPUT);
pinMode(VCC, OUTPUT);
digitalWrite(in5, HIGH);
digitalWrite(VCC, HIGH);
analogWrite(enC, 100);
Serial.begin(115200);
Serial.println(“HI”);
delay(1000);
while (digitalRead(photointerruptor) == HIGH) {}
while (digitalRead(photointerruptor) == LOW) {}
enableInterrupt(encoder3A, inc_encoder_counter, FALLING);
enableInterrupt(photointerruptor, add_rotation, FALLING);
Serial.println(“start”);

}

void loop() {
if (rotation_counter > noR - 1) {
disableInterrupt(encoder3A);
disableInterrupt(photointerruptor);
Serial.print("Encoder ticks after “);
Serial.print(rotation_counter);
Serial.println(” rotations ");

Serial.println(encoder_counter);
digitalWrite(in5, LOW);
digitalWrite(enC, LOW);
while (1) {}

}
}

void add_rotation() {
disableInterrupt(photointerruptor);
Serial.println(rotation_counter);

rotation_counter++;
enableInterrupt(photointerruptor, add_rotation, FALLING);
}
void inc_encoder_counter() {
disableInterrupt(encoder3A);

encoder_counter++;
//Serial.println(encoder_counter);
enableInterrupt(encoder3A, inc_encoder_counter, FALLING);
}

Test is half way done. I will need help with interpretation of results :stuck_out_tongue:

Hmmmm, I Eyeball it last time prtty good. I will set my PPR as 19050

Ok. After 40 cuts it come to my mind I’ve got connection problem :stuck_out_tongue:
It turns out that usb port in my comuputer is loose. In that case i want something that shutdown my Makita and dust collector.
Is there any solution with a macro like that?
“Ouuu. I’ve lost connection to my PC T_T, lets shutdown”
“Wee. I’m connected, w8 for macro button from GC to run things again”

I’ve got solid SSR setup available so there I only need macro.

I’ve got alternative for peoples that are tired of losing connection between maslow shield and cable. Sometime it can be caused by vibrations, or cable twists. More often occurs on the movable Z axis.
I have made another version close to 1.2 shield. The older versions will still works fine.

Old version
https://easyeda.com/polaski/maslow-diy-1-2-shield-for-external-h-drivers

Version for reliable screw/soldered connections
https://easyeda.com/polaski/maslow-1-2-big

Whats better:

  1. Now You can solder cables securely to Maslow shield. You can still install screw terminals.
  2. I removed connectors for motor power, because shield is prepared for external H bridges, that already got motor power connectors.
  3. I flipped 3 connectors that are responsible for communication that every Enable in a row pin faces down now.

The main idea on this is to remove as much connectors as possible. In my case they were the biggest problem. At this moment

1 Like

According to this thread. Today i will add firestarter to my maslow.
I made it from chinesium SSR, aluminum scooter board and three plugs. It will carry 800W Makita and 1800W dust collector.
2600W/230V=11.5 A.
I hope it wont blow up in 2-3h cuts. SSR is rated for 230V 50 A, but don’t trust this numbers unless You make your own SSR out of optotriac ,triac and beefy heatsink.
Yes. Heat sink is made of scooter board :stuck_out_tongue:

spindle Automation

Don’t touch heatsink because some Triac got GATE on metal plate that is connected to POWER!

1 Like

Uploading: 20191028_113312.jpg…

And it works :stuck_out_tongue:
How to do?

  1. Find in advanced settings “Spindle Automation” → Relay_HIGH
  2. Use macros on M3 to start. M4 to stop Spindle.

Connect + of relay to aux1 and - to gnd

1 Like

Its time for WEB controll :slight_smile:

I will try to use Raspberry Pi in my system. At the moment is getting colder in my garrage. Thanks to my dust collector system I’m leaving my maslow alone w/o worries that its getting cough in fire. I will build small network between my Maslow CNC, garrage and house. I’ve got experience with RPI 3 (I’ve fry the HDMI connection in it :P). The most of day I spend in my garrage that is 30 m from my CNC rig and its pain in the ass when I leave it just after fixing “keeping up error” and I must go back again and again, and again.

It’s time for UPGRADE!
How problem looks? My maslow is not keeping up I’ve set up default settings. Position error on 2, feed rate 800, 0.7mm per pass. After every stop im cleaning work peace witch sand paper to remove splinters and burrs. I’m cutting in part under middle of CNC workspace and it helps a lot. But still, maslow don’t have time to execute 1 order and goes 2 further. It’s always occur on long straight lines.
At that moment i have to go back, remember last order>stop>Run macro to start spindel>go to last order -1 and start again. Rly, i could write an script to make that happen, but there is probably place for GC upgrade. Am I missing something? Variable execution speed?

Plate is light, I didn’t add any weight to it. Maybe removing will help. Blade don’t grind dust thanks to dust collector. Position error must be set on 2.
Motors and encoders works perfectly. I’m cutting in soft wood.

Can Web controll work on PI Zero?