Page 1 of 1

Cross Platform Arduino Motor Shield (L298N) Inquiry

PostPosted: Mon Jun 03, 2013 9:57 pm
by anapple
Hi all, not sure this is a correct place to ask about the cross over platform (FPGA+Arduino Shield) question or not. Basically I am building a miniature mobile robot by using FPGA + Tamiya motors + Arduino Motor Shield (to cut off my time to build the motor driver). The motor driver is as the link below, I purchased it online from cytron :

http://www.dfrobot.com/wiki/index.php?title=Arduino_Motor_Shield_(L298N)_(SKU:DRI0009)

I understand that the shield is an H Bridge motor driver to allow user to control dual channels with direction control over the motor. I manage to generate a PWM from FPGA and able to run the motor. However, I am somewhat confused with the usermanual from dfrobot, screen captured as below:

Motor.png


According to my current configuration, I am running a single channel test only, I connected my PWM signal to Pin 5 (E1) of the shield and Pin 4 (M1) is connected to 5V (High). Such setup give me a motor (Motor 1) turning in CCW direction. According to the control signal truth table as in the dfrobot manual, it is indicating that whenever I am providing PWM signal to E1, M1 should be a dont care signal. Therefore, I am assuming although I provide 0V to M1, the PWM speed control should be still available. Here comes to my questions and problem:

1)When I connect M1 to 0V (tried 3.3v which is supposed to be high signal according to dfrobot manual) the motor no longer run anymore. Any idea about this?

Control signal level:
High:2.3V≤Vin≤5V
Low:-0.3V≤Vin≤1.5V

2)2nd question, as in the III Pin Allocation above, under PWM Mode, Digital Pin 4 is used to control the motor direction, I can see from the shield PCB silkscreen, the Pin 4 is actually the pin M1, here comes to my second doubt, I am assuming the motor direction is controlled by a high (CW) and low (CCW) signal or vice versa, but when I do that, it loop back to my 1st question again. Also can anyone correct me is the Pin Allocation table above is correct or not? As you can see in the table, Digital 4 & 5 is used to control Motor 2 but in my case, I manage to turn a motor but it is Motor 1 instead of Motor 2.

This is my first post :D Dont shoot me ya :P, correct me if my assumptions are wrong. Anyway, I am building this robot for personal hobby and for fun :D Going to put on a camera module (terasic 5MP Camera) one it can navigate :D

Re: Cross Plateform Arduino Motor Shield (L298N) Inquiry

PostPosted: Mon Jun 03, 2013 11:36 pm
by anapple
New findings:

Now I tried to do the following configuration:

Pin 4: High Signal
Pin 5: PWM

The motor M1 is rotating in CCW direction

For 2nd configuration

Pin 7: High Signal
Pin 5: PWM

The motor M1 is rotating in CW direction.

I am very confused with the user manual as Pin 4 is used to control direction of Motor 2 and Pin 7 is used to control the direction for Motor 1. In my case, if I want to control 2 motors to turn at different direction, there is no way for me to do that as the direction of the motor 1 is controlled by Pin 4 and Pin 7 individually. Any advise?

Re: Cross Platform Arduino Motor Shield (L298N) Inquiry

PostPosted: Thu Jun 06, 2013 4:00 pm
by robosang
The page you give got sample code and explanation right? Just try a few configuration and you should be able to understand it.

Try to share the code you are using and the connection of the hardware.

Re: Cross Platform Arduino Motor Shield (L298N) Inquiry

PostPosted: Fri Jun 07, 2013 8:38 pm
by ober
One method is using Signed-Magnitude, another is Locked-antiphase. Try searching these 2 keywords from the Internet and you should get some ideas.