# Managing motors with dual L298N

**URL:** https://forums.maslowcnc.com/t/managing-motors-with-dual-l298n/9896
**Category:** Electronics
**Created:** [May 17, 2019, 6:40pm UTC](https://forums.maslowcnc.com/t/managing-motors-with-dual-l298n/9896 "2019-05-17T18:40:45Z")
**Posts on this page:** 18
**Page:** 6

<div class="post-metadata">

### Author: ![MarcinanBarbarzynca](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/marcinanbarbarzynca/32/22125_2.png) [@MarcinanBarbarzynca](https://forums.maslowcnc.com/u/MarcinanBarbarzynca)
#### Post date: [April 9, 2020, 9:38am UTC](https://forums.maslowcnc.com/t/managing-motors-with-dual-l298n/9896/101 "2020-04-09T09:38:28Z")

</div>

At least You can swap Z axis encoder if your works bad.  
I’ve posted video about how i did it 😛

[![](https://img.youtube.com/vi/rHz5z7vhg5w/maxresdefault.jpg "New encoders to my Maslow CNC part 6/6") ](https://www.youtube.com/watch?v=rHz5z7vhg5w)

Making of that video give me a lot of laugh 😛

I hope You will enjoy. Leave comment to boost my channel 😛  
Still haven’t get any money from YT 😛 but still, lets share some fun.  
I had to stop working on my maslow becouse i had to sell my laptop… lack of money. Coronavirus killed my business.

---

<div class="post-metadata">

### Author: ![bluestang](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/bluestang/32/16251_2.png) [@bluestang](https://forums.maslowcnc.com/u/bluestang)
#### Post date: [April 9, 2020, 11:53am UTC](https://forums.maslowcnc.com/t/managing-motors-with-dual-l298n/9896/102 "2020-04-09T11:53:15Z")

</div>

Sorry to hear that, I think allot of small hobby and medium businesses will really get hurt by this pandemic. Here we are all watching movies about zombies, aliens, dirty politicians and nuclear wars… and what stops the world; a bug so small we can’t even see it, from a country that really supplies the world with industry.

---

<div class="post-metadata">

### Author: ![bluestang](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/bluestang/32/16251_2.png) [@bluestang](https://forums.maslowcnc.com/u/bluestang)
#### Post date: [April 9, 2020, 9:41pm UTC](https://forums.maslowcnc.com/t/managing-motors-with-dual-l298n/9896/103 "2020-04-09T21:41:31Z")

</div>

So i am still reading a lot of these (not enough time in a day), but has anyone else had any luck with using different motors on the originally designed Maslow Kit? From the looks of it you seem to be the only one?

---

<div class="post-metadata">

### Author: ![MarcinanBarbarzynca](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/marcinanbarbarzynca/32/22125_2.png) [@MarcinanBarbarzynca](https://forums.maslowcnc.com/u/MarcinanBarbarzynca)
#### Post date: [April 9, 2020, 9:53pm UTC](https://forums.maslowcnc.com/t/managing-motors-with-dual-l298n/9896/104 "2020-04-09T21:53:51Z")

</div>

Ok. Another idea. I will connect Optical encoders direcly to that 3mm motor shaft 😛  
It will give me 300\*2400 PPR xD = 720000 🔥  
If that will be too much i will try to lower PPR by using external arduino Nano for both top motors.

I will use small rubber tube as joint. I need to get new laptop for maslow 😛

---

<div class="post-metadata">

### Author: ![MarcinanBarbarzynca](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/marcinanbarbarzynca/32/22125_2.png) [@MarcinanBarbarzynca](https://forums.maslowcnc.com/u/MarcinanBarbarzynca)
#### Post date: [July 12, 2020, 8:40pm UTC](https://forums.maslowcnc.com/t/managing-motors-with-dual-l298n/9896/105 "2020-07-12T20:40:46Z")

</div>

It’s the END.  
Opitcal encoder for Z axis with 2400 PPR works good.  
Both top encoders mounted in two diffrent configurations doesn’t work.  
One time the resolution is too low, other the wobble from motor rpms are too big and it dismount itself xD  
I’m already build new cnc in 80% (Frame, x,y,z axis). I’ve recycled parts from maslow into this new project. It will still work on GRBL servo programs with arduino (maybe mega/Due) I think maslow shield can run it too xD.  
Yup and I started my own company to get money. Yea, i quit low paid job to kickstart on my hobby.  
I’ve got some news from people that managed to run maslow with my DIY boards. HEH 🙂  
You will still get my support 😃 On THE TOP of thread are links for my EASYEDA profile where You can find prbbly 3 working versions of maslow 1.2 shields.

@HipNerd 🙂  
There are scripts for drawing that can process images. Some tweaks can be made to product Gcode

> **[Drawing script](https://www.autoitscript.com/forum/topic/72522-drawing-script/)**
>
> Hi Ive been working on this script in the last few days, and although its not so small, I believe it can serve a few coding examples and provide some fun. Its idea is simple: It reads an image, makes it b/w, and using the mouse it draws this image. I...

My Maslow adventure ended ✌ No problem, everyday we roll dice and sometime we get 6sis and sometime don’t

---

<div class="post-metadata">

### Author: ![esspe2](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/esspe2/32/12893_2.png) [@esspe2](https://forums.maslowcnc.com/u/esspe2)
#### Post date: [August 22, 2020, 5:12pm UTC](https://forums.maslowcnc.com/t/managing-motors-with-dual-l298n/9896/106 "2020-08-22T17:12:24Z")

</div>

Hi Marcinan,

sorry to hear about that;  
I was loosely following your work, and I was amazed by what you have done/found yourself: the PCB, the ring, the steel bar, the L and R motor reinforcements, and, and …  
I could pinpoint several others.

I myself was stuck at the prototype stage, when using for the Z axis, a motor coming from a photocopier: 24V, no gearbox and 100PPR, far from the standard Maslow motors encoders.

That motor was oscillating and I have found it had to do with PID, but never found which parameter had to be tuned.

My project is put at sleep but I still hope to wake it one day.  
I could understand your point.

If someone is interested, here are two great (huge) resources about PID control:  
Controlguru – an online resource for practitioners of process control. :  
[https://controlguru.com/](https://controlguru.com/)  
Teaching Old Motors New Tricks, especially Part 1: Introduction to Motor Control, PI Controllers, PID Controllers and Intro to Field Oriented Control :  
[https://training.ti.com/teaching-old-motors-new-tricks-c2000](https://training.ti.com/teaching-old-motors-new-tricks-c2000)

---

<div class="post-metadata">

### Author: ![MarcinanBarbarzynca](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/marcinanbarbarzynca/32/22125_2.png) [@MarcinanBarbarzynca](https://forums.maslowcnc.com/u/MarcinanBarbarzynca)
#### Post date: [August 27, 2020, 9:50pm UTC](https://forums.maslowcnc.com/t/managing-motors-with-dual-l298n/9896/107 "2020-08-27T21:50:48Z")

</div>

Yes. But experimental pid setting wont allow to get precision. I saw maslow 1 rig made on heavy windshield motors(made by some Polish). They got 1:55 gearbox and if You have tools to make motor shaft longer you can get about 22000PPR from 300-400 optical encoder.

I’m building diffrent CNC on maslow motors. Now flat with DCServo and I’m working on scenario about tuning this sh…  
Make screenshot. Lower 2nd ‘i’ and 3rd ‘d’ parameters to 0. Then slowly get P-roportional lower till it stop oscilating. 0.1 point every step.  
If the oscilation is low enough start tuning 3rd parameter. Than 2nd parameter to make oscillation slow down even faster.

To make it faster put Z axis motor on table. Mount optoencoder to the shaft via hotglue and start tuning.  
To get test done You can run DCServo code

> **[GitHub - misan/dcservo: Position control of DC motors](https://github.com/misan/dcservo)**
>
> Position control of DC motors. Contribute to misan/dcservo development by creating an account on GitHub.

Edit H-bridge and encoder pins in Arduino IDE (You can leave DIR and STEP pins becouse they wont be used) to match maslow shield output.

HEH. Peoples who got some skill in making visualisation on Arduino IDE Graphs can show somth like this

[![](https://img.youtube.com/vi/uXnDwojRb1g/maxresdefault.jpg "Empirical PID gain tuning (Kevin Lynch)") ](https://www.youtube.com/watch?v=uXnDwojRb1g)

---

<div class="post-metadata">

### Author: ![Gero](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/gero/32/17487_2.png) [@Gero](https://forums.maslowcnc.com/u/Gero)
#### Post date: [August 27, 2020, 10:01pm UTC](https://forums.maslowcnc.com/t/managing-motors-with-dual-l298n/9896/108 "2020-08-27T22:01:43Z")

</div>

> [@MarcinanBarbarzynca](#):
>
> I’m working on scenario about tuning this sh…

I was almost to give a warning, but looking at it again i am amazed about the work on this that you are doing. Would love to see more on alternatives! Thanks for the effort you are putting into this.

Kind regards, Gero

---

<div class="post-metadata">

### Author: ![ame](https://avatars.discourse-cdn.com/v4/letter/a/3be4f8/32.png) [@ame](https://forums.maslowcnc.com/u/ame)
#### Post date: [August 27, 2020, 10:07pm UTC](https://forums.maslowcnc.com/t/managing-motors-with-dual-l298n/9896/109 "2020-08-27T22:07:51Z")

</div>

Spooky! I just built a CNC machine based on this design by homofaciens (Norbert Heinz):  
[https://www.homofaciens.de/technics-machines-cnc-v0-6\_en.htm](https://www.homofaciens.de/technics-machines-cnc-v0-6_en.htm)

However, instead of using his code for the Arduino controlling it I used grbl. Then I added two Arduino Pro Minis with misan’s dcservo for the X and Y axes. It’s a small world after all.

---

<div class="post-metadata">

### Author: ![MarcinanBarbarzynca](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/marcinanbarbarzynca/32/22125_2.png) [@MarcinanBarbarzynca](https://forums.maslowcnc.com/u/MarcinanBarbarzynca)
#### Post date: [August 27, 2020, 10:13pm UTC](https://forums.maslowcnc.com/t/managing-motors-with-dual-l298n/9896/110 "2020-08-27T22:13:42Z")

</div>

![IMG_0325](https://canada1.discourse-cdn.com/flex031/uploads/maslowcnc/original/3X/b/8/b8b13e60ad18fbaa11f029b6c5f5c7937cefe4b3.jpeg) ![IMG_0326](https://canada1.discourse-cdn.com/flex031/uploads/maslowcnc/original/3X/f/d/fd589f7b78cbcf02c44d5d73886d1f99efed0dd8.jpeg) ![IMG_0327](https://canada1.discourse-cdn.com/flex031/uploads/maslowcnc/original/3X/0/6/06c6b304b116e724947a8e271d4005981da9fbbf.jpeg)

Im doing this on arduino nano becouse I’ve got shield ready for this. I will need to repeat tuning process after assembly becouse friction will change response. But atm im close enough to get max speed from this setup

---

<div class="post-metadata">

### Author: ![ame](https://avatars.discourse-cdn.com/v4/letter/a/3be4f8/32.png) [@ame](https://forums.maslowcnc.com/u/ame)
#### Post date: [August 27, 2020, 11:48pm UTC](https://forums.maslowcnc.com/t/managing-motors-with-dual-l298n/9896/111 "2020-08-27T23:48:35Z")

</div>

One thing to add. The L298 modules are not that good. They drop a lot of voltage, and they get hot. On my CNC I had to add a small fan to cool the module.

However, they are cheap and easily available…

---

<div class="post-metadata">

### Author: ![MarcinanBarbarzynca](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/marcinanbarbarzynca/32/22125_2.png) [@MarcinanBarbarzynca](https://forums.maslowcnc.com/u/MarcinanBarbarzynca)
#### Post date: [September 24, 2020, 12:33am UTC](https://forums.maslowcnc.com/t/managing-motors-with-dual-l298n/9896/112 "2020-09-24T00:33:41Z")

</div>

I’m preparing ESP32 shield 😛

 ![Schematic_ESP32 CNC DIY Shield copy_2020-09-24_02-30-27](https://canada1.discourse-cdn.com/flex031/uploads/maslowcnc/original/3X/1/7/179cfa862548bcd007e7a77299dda70457538ff2.png)

It may work by connecting encoders into limit switch pins and external H-bridges to DIR and STEP pins

If You got any suggestions please let me know 😛

---

<div class="post-metadata">

### Author: ![bar](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/bar/32/10_2.png) [@bar](https://forums.maslowcnc.com/u/bar)
#### Post date: [September 24, 2020, 3:55pm UTC](https://forums.maslowcnc.com/t/managing-motors-with-dual-l298n/9896/113 "2020-09-24T15:55:00Z")

</div>

> [@MarcinanBarbarzynca](#):
>
> external H-bridges to DIR and STEP pins

Does this work to drive a DC motor? I guess it kind of does 😀

---

<div class="post-metadata">

### Author: ![MarcinanBarbarzynca](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/marcinanbarbarzynca/32/22125_2.png) [@MarcinanBarbarzynca](https://forums.maslowcnc.com/u/MarcinanBarbarzynca)
#### Post date: [September 25, 2020, 9:58pm UTC](https://forums.maslowcnc.com/t/managing-motors-with-dual-l298n/9896/114 "2020-09-25T21:58:45Z")

</div>

yup. its possible to run 7axis and 6 encoders 😛  
but there is no software yet

Ok. I’ve ordered prototypes from china. I will build grbl esp32 software adaptation, then sell them on tindie

---

<div class="post-metadata">

### Author: ![MarcinanBarbarzynca](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/marcinanbarbarzynca/32/22125_2.png) [@MarcinanBarbarzynca](https://forums.maslowcnc.com/u/MarcinanBarbarzynca)
#### Post date: [October 28, 2020, 1:25pm UTC](https://forums.maslowcnc.com/t/managing-motors-with-dual-l298n/9896/115 "2020-10-28T13:25:51Z")

</div>

![IMG_0378](https://canada1.discourse-cdn.com/flex031/uploads/maslowcnc/original/3X/5/f/5f93ef07a27d7a8788d546ddd868ceb1d1644da1.jpeg) ![IMG_0377](https://canada1.discourse-cdn.com/flex031/uploads/maslowcnc/original/3X/b/6/b62c8aef613fd0c8b650d6c24bb4a3824119e4a8.jpeg)  
2 Pics but with wrong ESP32. This is 30 pin, and board is made for 38 pin.  
Now my way thru porting hell begins. I will try… try maybe fail to port GRBL ESP32 library to that board.

---

<div class="post-metadata">

### Author: ![bar](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/bar/32/10_2.png) [@bar](https://forums.maslowcnc.com/u/bar)
#### Post date: [October 28, 2020, 4:10pm UTC](https://forums.maslowcnc.com/t/managing-motors-with-dual-l298n/9896/116 "2020-10-28T16:10:25Z")

</div>

Very exciting!

---

<div class="post-metadata">

### Author: ![MarcinanBarbarzynca](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/marcinanbarbarzynca/32/22125_2.png) [@MarcinanBarbarzynca](https://forums.maslowcnc.com/u/MarcinanBarbarzynca)
#### Post date: [October 29, 2020, 1:14pm UTC](https://forums.maslowcnc.com/t/managing-motors-with-dual-l298n/9896/117 "2020-10-29T13:14:37Z")

</div>

> **Pinout**
>
> #define MACHINE\_NAME “numernabis\_4axis\_xyyz” //now based on “ESPDUINO\_32”
> 
> #define X\_STEP\_PIN GPIO\_NUM\_18  
> #define X\_DIRECTION\_PIN GPIO\_NUM\_5
> 
> #define Y\_STEP\_PIN GPIO\_NUM\_17  
> #define Y\_DIRECTION\_PIN GPIO\_NUM\_16
> 
> #define Z\_STEP\_PIN GPIO\_NUM\_4  
> #define Z\_DIRECTION\_PIN GPIO\_NUM\_0
> 
> #define A\_STEP\_PIN GPIO\_NUM\_2  
> #define A\_DIRECTION\_PIN GPIO\_NUM\_15
> 
> #define SPINDLE\_TYPE SPINDLE\_TYPE\_RELAY //SPINDLE\_TYPE\_PWM  
> #define SPINDLE\_OUTPUT\_PIN GPIO\_NUM\_26 //DAC //PWM //ON\_OFF
> 
> #define X\_LIMIT\_PIN GPIO\_NUM\_36 //A //I will just connect both limit switches to one input 😕  
> #define Y\_LIMIT\_PIN GPIO\_NUM\_39 //B //As PinMode(Y\_LIMIT\_PIN,IMPUT);  
> #define Z\_LIMIT\_PIN GPIO\_NUM\_34 //C //As PinMode(Z\_LIMIT\_PIN,IMPUT);
> 
> //BONUS LIMIT SWITCHES  
> //#define D\_LIMIT\_PIN GPIO\_NUM\_35 //D //As PinMode(D\_LIMIT\_PIN,IMPUT);  
> //#define E\_LIMIT\_PIN GPIO\_NUM\_32 //E //As PinMode(E\_LIMIT\_PIN,IMPUT);  
> //#define F\_LIMIT\_PIN GPIO\_NUM\_33 //F //As PinMode(F\_LIMIT\_PIN,IMPUT);  
> //#define G\_LIMIT\_PIN GPIO\_NUM\_25 //G //As PinMode(G\_LIMIT\_PIN,IMPUT);  
> //#define H\_LIMIT\_PIN GPIO\_NUM\_27 //H //As PinMode(H\_LIMIT\_PIN,IMPUT);
> 
> //BONUS ALARM SWITCHES  
> //#define X\_ALARM\_PIN GPIO\_NUM\_23 //As PinMode(X\_ALARM\_PIN,IMPUT\_PULLUP);  
> //#define Y\_ALARM\_PIN GPIO\_NUM\_22 //As PinMode(Y\_ALARM\_PIN,IMPUT\_PULLUP);  
> //#define Z\_ALARM\_PIN GPIO\_NUM\_21 //As PinMode(Z\_ALARM\_PIN,IMPUT\_PULLUP);  
> //#define R\_ALARM\_PIN GPIO\_NUM\_19 //As PinMode(R\_ALARM\_PIN,IMPUT\_PULLUP);
> 
> /\*//ENABLE EXTERNALS  
> #define COOLANT\_MIST\_PIN GPIO\_NUM\_8 // labeled Mist  
> #define COOLANT\_FLOOD\_PIN GPIO\_NUM\_7 // labeled Flood  
> #define PROBE\_PIN GPIO\_NUM\_13 // labeled Probe
> 
> #define CONTROL\_RESET\_PIN GPIO\_NUM\_35 //PinMode(CONTROL\_RESET\_PIN,IMPUT);  
> #define CONTROL\_FEED\_HOLD\_PIN GPIO\_NUM\_32 //PinMode(CONTROL\_FEED\_HOLD\_PIN,IMPUT);  
> #define CONTROL\_CYCLE\_START\_PIN GPIO\_NUM\_33 //PinMode(CONTROL\_CYCLE\_START\_PIN,IMPUT);  
> \*/

---

<div class="post-metadata">

### Author: ![cncking](https://avatars.discourse-cdn.com/v4/letter/c/e99b99/32.png) [@cncking](https://forums.maslowcnc.com/u/cncking)
#### Post date: [October 29, 2024, 8:42am UTC](https://forums.maslowcnc.com/t/managing-motors-with-dual-l298n/9896/118 "2024-10-29T08:42:43Z")

</div>

“What is the working principle of this dust removal system?”

[Previous page](https://forums.maslowcnc.com/t/managing-motors-with-dual-l298n/9896.md?page=5)
