i am new in this topic and I would need help.
I created a sketch to controll my DC motor with a joystick. Everything works fine with the on board 5.5 voltage. But if I'm using an other energy source, the motor is really slow but the extern enery is about 9 Voltage... also with a battery about 16.1 voltage it does not even move. Can anybody explain that? I am using a L298N Dual H-bridge.
Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Can you post a picture of your project so we can see your component layout?
Are you using an "ebay-L298-board" ? Can you post a picture of the L298 circuit? I had one counterfeit L298N that gave me a lot of headache until I replaced it with a proper one.
Full details of all the hardware please - what batteries exactly? 16.1V is not something I've heard of before,
and most 9V batteries are not suitable for powering motors, which need substantion amouts of power.
Here is what i made.
I wanted to control the DC motor via joystick. So the amout of the POWER of the ENA has to be around 0 >= 255. Then the other thing is. You can use an extern power, but u have to remove the little jumper on H bridge. The led on the bridge is on, but nothing happens.
int INA =2;
int INB =3;
int ENA =4;
const int SW_pin = 5; // digital pin connected to switch output
const int X_pin = 0; // analog pin connected to X output
void setup() {
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(SW_pin, INPUT);
digitalWrite(SW_pin, HIGH);
Serial.begin(115200);
}
void loop() {
if( analogRead(X_pin) > 510)
{
Serial.println(((0.5039526691699605)*(analogRead(X_pin)-520)));
digitalWrite(2,LOW);
digitalWrite(3,HIGH);
analogWrite(ENA,((0.5039526691699605)*(analogRead(X_pin)-520)));
}
else if( analogRead(X_pin) < 500)
{
Serial.println(((0.5039526691699605)*(analogRead(X_pin)-506)/(-1)));
digitalWrite(2,HIGH);
digitalWrite(3,LOW);
analogWrite(ENA,((0.5039526691699605)*(analogRead(X_pin)-506)/(-1)));
}
else
{
digitalWrite(2,LOW);
digitalWrite(3,LOW);
analogWrite(ENA,0);
}
delay(95);
}
wopps. that should be the GND :'D Sorry my mistake.
TomGeorge:
Hi,
Have you got the motor connected to the correct motor terminals?
What are you using as your motor power supply?
Do you have a DMM?
Thanks. Tom..
Ya I suppose so. Its working with the power supply by the arduino. Or what do u mean with terminal? :o
I am using the 9V battery(u know that 9v block?). I also tried with an older battery pack with abou 16.8 Voltage. If I just connect the wires with the battery and the DC motor its working fine.
Ya, I bought one few moths ago.
MarkT:
Don't use low current signal wires for the motor supply into the H-bridge - use wire designed to carry high current.
Oh well... I didn't know.Does it make a difference ? Shall I use higher quality wires?