Support for L298P m...
 
Notifications
Clear all

Support for L298P motor shield?

28 Posts
9 Users
0 Reactions
6,761 Views
(@chrisgrant72)
Active Member
Joined: 3 years ago
Posts: 13
 

How mine is wired with Transformer connected to L298p


   
ReplyQuote
(@davido996)
Active Member
Joined: 3 years ago
Posts: 10
 
Posted by: @chrisgrant72

I know it might sound silly but is the other motors polarity correctly terminated . Guess you have already checked that .

Nothing's ever silly, until it is. But yes I had doubled checked. Anyway, couldn't sleep so I'm back at it.


   
ReplyQuote
(@chrisgrant72)
Active Member
Joined: 3 years ago
Posts: 13
 

I’m in Australia so middle of the day here guess your in England where I’m from


   
ReplyQuote
(@davido996)
Active Member
Joined: 3 years ago
Posts: 10
 
Posted by: @davido996
Posted by: @chrisgrant72

Found it this is the test I used to confirm the board is working

int E1 = 10; int M1 = 12; int E2 =11; int M2 = 13;
void setup() {
pinMode(M1, OUTPUT);
pinMode(M2, OUTPUT); }
void loop() {
{ int value;
for(value = 0 ; value <= 255; value+=5) {
digitalWrite(M1,HIGH); digitalWrite(M2, HIGH); analogWrite(E1, value); analogWrite(E2, value); delay(30);
} delay(1000);}
{ int value;
for(value = 0 ; value <= 255; value+=5) {
digitalWrite(M1,LOW); digitalWrite(M2, LOW); analogWrite(E1, value); analogWrite(E2, value); delay(30);
} delay(1000);} }

Well that's interesting. I find it too much of a coincidence that John Bigg's issue is exactly the same as mine to believe that it is a shield fault. But running your code, which is straight forward enough, to 2 dc motors (which I have tested) produces exactly the same result. i.e. Motor 2 runs but Motor 1 does not 🤔 It is late now this evening, so I will look again tomorrow

 

Eureka! Well I'm pleased to say that didn't take too long. I am assuming that while we both appear to be using L298P, we are perhaps using shields with different architecture. Any way I am also pleased top advise @john-biggs that his shield is almost certainly not broken either. I have run some different code including the brake pinouts to reach my conclusion. but your code does work for both motors correctly by changing the direction pinout E1 = 10 to E1=3 

Now I did previously try that on Simhub when trying the "emulation" of L298N. The output LED for channel 1 illuminated but the motor wouldn't spin. There is obviously something else in the Simhub code interfering with the control pattern set by the shield. But I'm covered anyway because I went Adafruit.

So final question is what differences are there in the L298P shields we are using. The one I have been trying to use (and have just been testing) is a Diymore L298P Shield Expansion Board DC Motor Driver Module 2A H-Bridge 2 way For UNO R3 - badged as Deek-Robot. I now have a genuine Arduino R3 motor shield, based on L298P, and I will check tomorrow whether that will also correctly work with the changed pinout.

In the meantime, for my curiosity, perhaps you and @John-biggs could reveal exactly which L298P shield you have?


   
ReplyQuote
(@davido996)
Active Member
Joined: 3 years ago
Posts: 10
 
Posted by: @chrisgrant72

How mine is wired with Transformer connected to L298p

 


   
ReplyQuote
(@john-biggs)
New Member
Joined: 3 years ago
Posts: 2
 

@davido996 Ah, this is beginning to make sense now, my L298p is the same model as yours David, the ‘deek robot’ with identical architecture it appears that @chrisgrant72 L298p is a different brand & different architecture which is probably causing our unresponsive channel ‘A’ issue using the same sketch, in the end I now run two fans direct from the ‘B’ channel & it still outputs 3A to my 4000rpm fans, which is plenty when racing. My next project is to get it running for open cockpit planes in flight simulators. I may need to use the arduino IDE & upload code direct to the board to interpret telemetry from flight sims for this as simhub doesn’t currently support flight sims. 


   
ReplyQuote
(@davido996)
Active Member
Joined: 3 years ago
Posts: 10
 

@john-biggs and @chrisgrant72

For what it's worth, I confirm that the genuine Arduino R3 shield (which is almost identical to the Deek-Robot) also performs correctly using the test sketch as above with E1 revised to =3.

It's a shame that Simhub does not appear to support the Arduino R3 shield, and I have no way of understanding what the glitch might be, without being able to see the sketch which simhub installs on the Uno.

"So near, yet so far" springs to mind.


   
ReplyQuote
(@chrisgrant72)
Active Member
Joined: 3 years ago
Posts: 13
 
  1. When I first set it up with sim hub after proving the l298p was working with DC motors SimHub’s sketch made the sounder go off constantly with and one fan that’s when I started playing around with the terminals. So yes your PCB is probably different and it shouldn’t be to hard to work out which the other channel is good luck.

   
ReplyQuote
(@davido996)
Active Member
Joined: 3 years ago
Posts: 10
 
Posted by: @chrisgrant72
  1. When I first set it up with sim hub after proving the l298p was working with DC motors SimHub’s sketch made the sounder go off constantly with and one fan that’s when I started playing around with the terminals. So yes your PCB is probably different and it shouldn’t be to hard to work out which the other channel is good luck.

It shouldn't be that hard but it is. I think there is something else in the Simhub sketch which is compromising it's ability to run as a clone for the L298N. And as I have it running on an Adafruit V2, I am going to call it a day.

On the 298N pinout selector. we know to set speed and direction of Motor B at 13 and 11. And we now know that in the test code the pinouts for  Motor A should be 12 and 3.

I don't exactly know what IN3 and IN4 represent in the simhub 298N selector unless they are the pins for brake on each motor. Either way, I believe I tried every combination of unused pins for IN3 and IN4. Any change to one (I forget which) had the retrograde effect of preventing Motor 2 from running. So it was possible to focus entirely on the other and cycle through all the unused pinouts to get the Motor 1 to function. But no joy. 😢 


   
ReplyQuote
(@rutty70)
New Member
Joined: 3 years ago
Posts: 1
 

Hey all

I recently visited this stream as I wanted help with my Arduino and L298P set up as I was also struggling in SimHub with settings. But after several hours (Fri Night and Sat morning) I have got both fans working if anyone is interested... I am using them with Speed Curves and it all works fine.

 

I googled some docs and from what I can ascertain ENA PWM Pin is Motor A's PWM and yes this should be 3. ENB PWN Pin is Motor 2's PWM and yes this should be 11. However, I think we only need power as PWN will control the speed and from what I can tell IN1 and IN3 are for Brake - so I ignored them - (both set to zero) and I think IN2 is power to Motor A and IN4 is power to Motor B. I found out through trial and error that IN2 should be 12 (I think that was shown in previous post) but also IN4 should be 13. When I do this I get power to each independently along with signal sending for Channel 1 and 2 just as it should work with Adafruit.

 

These are my settings:

ENA PWM pin: 3

IN1 digital pin: 0

IN2 digital pin: 12

ENB PWN pin: 11

IN3 digital pin: 0

IN4 digital pin: 13

 

This works perfectly for me - two independent fans that now speed up and slow down and use curves perfectly - I have tested in Dirt Rally 2.0 and AC so far. Hopefully it will work for others struggling to get their L298P working (mine is the Deek Robot one). I realise that SimHub lists this as L298N and not 'P' but mine is the L298P and it works with above settings.

 

Hope this helps anyone else struggling like I was 😉

 

Rutty70


   
ReplyQuote
(@raphabaz)
New Member
Joined: 2 years ago
Posts: 1
 

Hi,

Just wanted to mention that I had big trouble with running the 'old adafruit motorshield V1.2' with 2 motors.

 

At least I changed one of the two L293D H-Bridge-ICs and... everything worded fine! Also the Capacitors next to the two L293-ICs tend to die if you are not careful enough with max-current-flow.

 

The 298xx-shields are laying around and wait for getting wired..

 

Greez, Sacha

 


   
ReplyQuote
(@lolivera)
New Member
Joined: 2 years ago
Posts: 1
 

sorry for bringing back  a dead horse but did you guys had to cut with a blade the vin connect to get it to work?

 


   
ReplyQuote
(@belh4wk)
New Member
Joined: 3 months ago
Posts: 1
 

@rutty70 just wanted to let you know that your config worked out of the box for my Deek Robot motorshield; good stuff!


   
ReplyQuote
Page 2 / 2
Share: