Hi,
I have built my first robot (ultrasonic sensor, 2 wheels, 2 dc motors) using he following motor shield(bought from ebay)
New V3 Arduino Driver Motor Controller Shield L298N 2A 2 Motors Module
Unfortunately my robot always bumps into walls. It turned out that I am not able to apply BRAKE.
As soonas I detect that wall is within 10cm I stop powering the motors but robot keeps moving (inertia)
I looked at the famous Adafruit motor shield but it turned out it also does not support brake(this is the comment from the official arduino website):
// The AdaFruit library didn't implement a brake.
// The L293D motor driver ic doesn't have a good
// brake anyway.
// It uses transistors inside, and not mosfets.
Can anyone suggest any not official motor shield? I know that full Arduino motor shield (cost $40 in Australia) will support brake but I am looking more into Chinese generics...
Thanks for your advice guys.
Is it the official Arduino Motor Shield V3 that you are using?
Is it the official Arduino Motor Shield V3 that you are using?
This is the one I'm using, and it definitely has brake function,
The shield's pins, divided by channel are shown in the table below:
Function |
pins per Ch. A |
pins per Ch. B |
Direction |
D12 |
D13 |
PWM |
D3 |
D11 |
Brake |
D9 |
D8 |
Current Sensing |
A0 |
A1 |
If you don't need the Brake and the Current Sensing and you also need more pins for your application you can disable this features by cutting the respective jumpers on the back side of the shield.
But as per Oddbot's suggestion, you typically would not need brakes unless you were travelling faster than your ranging sensor can resolve.
Hi everyone, thanks for
Hi everyone, thanks for quick response.
1) I am not using official Arduino Motor shield - I use some from ebay.
2) the way it controls the motor - for each motor is has 2 pins and analog speed setting.
to go forward - pin1 is set to HIGH, pin2 is set to LOW. to go backward - opposite.
3) setting speed to zero does not stop the motor - the wheels keep rotating for some amount of time. This happes even without load i.e. if I hold robot in the air. The motors are 1:46 ratios. Probably I need to change them to 1:100? So it is not about heaviness of the robot for sure.
4) The surface is normal laminate in the kitchen - and wheels are standart 66mm wheel with rubber tyres
5) I tried to do reversing for 200 ms- so my stop function was
void StopMe()
{
SetSpeed(0)
Move(backward)
delay(100)
SetSpeed(0);
}
It didn't help much - I will try to make it longer and also will increase distance to 20 cm.
I found a wiki for this board you have from Ebay…with code…
I found a wiki for this board you have from Ebay… And it has sample code for using it.
Arduino L298N motor drive expansion board V03
http://arduino-info.wikispaces.com/ArduinoShieldL298N
but nothing to help your braking… Seems silly but… drive slower?
That’s exactly what I am
That’s exactly what I am using - and this is the code I based my logic on.
I have actually managed to
I have actually managed to make it work.
What was the problem - in order to apply brakes - you have to do send HIGH to both pins:
digitalWrite (dir1PinA , HIGH);
digitalWrite (dir2PinA, HIGH);
Thanks everyone for support - this is the working version:
http://youtu.be/OE4R5Z7f_Zg