Hi it seems that L298N is supported in simhub, but I have this one now L298P and it doesn't seem to work. I'm using this UNO clone:
Elegoo UNO R3: amazon(dot)com/gp/product/B01EWOE0UU
https://www.amazon.com/gp/product/B01EWOE0UU
new motor shield:
L298P Shield R3 DC Motor Driver: amazon(dot)com/gp/product/B00WN4UB8W
https://www.amazon.com/gp/product/B00WN4UB8W
I'm using these fans:
fans: amazon(dot)com/gp/product/B079NXYC7H
https://www.amazon.com/gp/product/B079NXYC7H
Previously I was using this motor shield, and it is compatible with "DK" shield in simhub and it worked fine, but the fans blew too slowly as the DK shield didn't have enough output to drive them fully. They seemed completely compatible, speed was fine at low and high, just not enough RPM:
old motor shield: amazon(dot)com/gp/product/B00TMA4YSS
Motor Drive Shield L293D (DK compatible)
https://www.amazon.com/gp/product/B00TMA4YSS
On this new shield, I tried the PWM suggestion using pins 3 and 11, and the lights on the board light up, but the fans don't spin.
If I set the new shield to be DK compatible and I test channel 2 the fan spins really fast but won't shut off until I turn off simhub, it seems to blow 100% but won't shut down :/ So it seems that since the fans worked on the old shield, and semi work on the new shield, I should be able to get them to run. I've tried uploading the sketch to my Arduino UNO with just about every shield listed on the UI but none of them work. The board I have shows the pins as:
PWMA: 3
BRAKEB: 8
BRAKEA: 9
PWMB: 11
DIRA: 12
DIRB: 13
I thought L298P and L298N are only different between 2 and 4 motors - is there any chance to get this to work?
Thanks!!
Took me 3 hours of messing about to get it to work on Motor Drive Shield L293D! Try these settings. i made a profile just to reply to you since you were the only one with the same issue as all the youtubers use the adafruit motor shield V2.
I have the same problem but when i apply your recommended settins it just makes the sounder go on constantly and no fans at all?
any chance anyone can help please.
I got the L298p to work with my VERY limited knowledge COMBINED WITH AN Arduino uno R3 but is did take about 20hrs of trial and error with an adafruit board that would not work at all before I went back to the L298P that i bought by mistake and got it to work just fine all i did was make 4 changes to the SHAKIT L298N in Simhub and bingo .I found the correct terminals on a test sketch for for testing the DC MOTORS AND IT WORKED!!
P.S IM AN ABSOLUTE BEGINNER AT THIS
- @chrisgrant72 Hi, many thanks for posting your settings, had the same issue, however only the ‘B’ channel works on my L298p, I have enabled channel 1&2 in SimHub but only ‘B’ lights up & powers a fan. Any ideas?
@chrisgrant72 Following another question from John Biggs just a little while ago I find my self with exactly the same issue.
I was about to write and commend you for saving my sanity, then realised that I too am only getting output to channel 2 fan and not channel 1.
Did you try a test sketch for DC motors before to see if your L298P is working with both fans ( I picked one up off a company that was selling it online)if it doesn’t then your Aurdrino or L298P has a problem . If it’s all good then it’s settings within Simhub you need to change, like I did with the picture I put up and follow boosted medias version of setting up a Windsim.
Did you try a test sketch for DC motors before to see if your L298P is working with both fans ( I picked one up off a company that was selling it online)if it doesn’t then your Aurdrino or L298P has a problem . If it’s all good then it’s settings within Simhub you need to change, like I did with the picture I put up and follow boosted medias version of setting up a Windsim.
I am a novice at this. I spent many hours researching and trying other combinations of pinouts for Motor A to no avail. Replacing pin 10 on your image with pin 3 was the only one which would give me current at the output for Motor A, but the motor wouldn't spin.
I have 2 x L298P shields (a Diymore and a genuine Arduino). However I gave up and went with an Adafruit V2.3 - Which also showed my lack of experience with soldering, having to solder 32 header pins with bad eyesight!!
Everything works fine with the Adafruit, but I'm not letting it go. Now that I understand better how the motor shield works, I am borrowing a couple of dc motors from a friend, which I can use on my desk with a breadboard, and I will get to the bottom of whether the Diymore is faulty or not, and report back. I suspect not, given that John Biggs' problem is identical.
@davido996 you sound like me I couldn’t let it go it drove me mad and I’m a complete beginner aswell plus bad eye sight which is age related 😂
Good luck with it.
I’ll try and find the test sketch I used and paste it in for you
paste paste the below into your Audrino library ( that was a learning curve aswell trying to set thst up and making a program run it’s a bit clunky ) it’s not the one I used but hopefully it should work for you paste code in after code begin line and make sure no other codes are already on the board so clear it first other wise it won’t work
3. Example
“UR4” Pull up resistor
“5V_EN”
This module can drive 2 channel DC motor or 2 phase stepper motor.
For 2 channel DC motor, connection and code as below:
Connection: IN1==========13;
IN2==========12; IN3==========11; IN4==========10;
*****Code begin*****
int in1=13; int in2=12; int in3=11; int in4=10;
int speedPinA=6; int speedPinB=5;
void setup() {
pinMode(in1,OUTPUT); pinMode(in2,OUTPUT); pinMode(in3,OUTPUT); pinMode(in4,OUTPUT);
digitalWrite(in1,HIGH); digitalWrite(in2,HIGH); digitalWrite(in3,HIGH); digitalWrite(in4,HIGH);
}
void loop() {
_mRight(in1,in2); _mRight(in3,in4);
int n=analogRead(A0)/4; _mSetSpeed(speedPinA,n); _mSetSpeed(speedPinB,n);
}
void _mRight(int pin1,int pin2) {
digitalWrite(pin1,HIGH);
digitalWrite(pin2,LOW); }
void _mLeft(int pin1,int pin2) {
digitalWrite(pin1,LOW);
digitalWrite(pin2,HIGH); }
void _mStop(int pin1,int pin2) {
digitalWrite(pin1,HIGH);
digitalWrite(pin2,HIGH); }
void _mSetSpeed(int pinPWM,int SpeedValue {
analogWrite(pinPWM,SpeedValue);
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);} }
both test codes are to work with dc motors ( Fans)
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
I know it might sound silly but is the other motors polarity correctly terminated . Guess you have already checked that .