This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pypilot - Motor Driver for Rudder actuator
#1
Hi,


We are using L298N motor driver to drive an actuator using Pypilot.
In Motor.ino file, We set the PWM option pwm_style = 0. When we try connecting Arduino UNO with L298N (IN1-PIN 9, IN2-PIN10), we found the motor NOT running. However, When we given +Vcc to IN1 and GND to IN2 the actuator start extending and for +Vcc to IN2 and GND to IN1 the actuator start retracting.

When we explored the motor.ino further, we found that the motor.ino file is designed such that it needs total 4 pins to connect to H-Bridge controller (2 bottom pins and 2 top pins to connect to H-Bridge motor controller)

#define hbridge_a_bottom_pin 2
#define hbridge_b_bottom_pin 3
#define hbridge_a_top_pin 9
#define hbridge_b_top_pin 10

However, L298N gives only 2 pins apart from ENA pin. (it controls 2 motors and each channel has 2 pins along with a ENA pin).

Hence, this does not match with the motor.ino program. Could you please help me to tweak the motor.ino file.

Also, I believe we should not enable the option pwm_style = 2 for this controller, as that is designed for a different motor controller (VNH2SP30)

Regards
Karthik
Reply
#2
I think the vnh2sp30 is the same as l289N?

In this mode, the bottom pin (2 and 3) are used for direction, and a pin (pin 9) is used for pwm.

So perhaps this ENA pin can be used for PWM and 2 and 3 for direction? Again only for pwm style 2 which requires uncommenting one line of code and compiling.
Reply
#3
(2022-01-05, 05:42 PM)seandepagnier Wrote: I think the vnh2sp30 is the same as l289N?

In this mode, the bottom pin (2 and 3) are used for direction, and a pin (pin 9) is used for pwm.

So perhaps this ENA pin can be used for PWM and 2 and 3 for direction?   Again only for pwm style 2 which requires uncommenting one line of code and compiling.

Hi Sean,

Thanks for your help.

we have issue connecting Arduino with Pi (having Openplotter and pypilot). once the Arduino(with motor.ino sketch) is plugged in USB with pi, the GUI of Pypilot Control showing "arduino" and keep changing to "none" intermittently.

[Image: 2?ui=2&ik=ce6114b668&attid=0.2&permmsgid...U&disp=emb]

Then i followed the Pypilot toubleshooting procedure per the below pypilot link.

https://pypilot.org/wiki/doku.php?id=troubleshooting.


I found the following observation:

1. I followed all the steps per the the Pypilot toubleshooting link.
2. killed all pypilot process and stopped the pypilot service in Openplotter.
3. $ pypilot_boatimu - using this command checked the IMU, it is working well.
4. $ pypilot_servo - this command gives the following error in the snapshot ([Errno 16] Device or resource busy)



[Image: 2?ui=2&ik=ce6114b668&attid=0.1&permmsgid...Q&disp=emb]
[img=0x0]https://mail.google.com/mail/u/2?ui=2&ik=ce6114b668&attid=0.1&permmsgid=msg-f:1721640608308230340&th=17e47f02f91978c4&view=fimg&fur=ip&sz=s0-l75-ft&attbid=ANGjdJ_PQ2rca4LJ13DGYnsQ3v_fQV8y5D8in3rAW2FfYa_rSxSglsDffqLTv1YgT2mIYcXgBT3DNEPHY39c6ANz0nTcakedqg0T7rOmvkhUxWBBg-jTI-HetB5gigQ&disp=emb[/img]

4. After this initiated the pypilot and executed command $ps aux | grep python
5. I found many pypilot process as per below snapshot. is it expected?

[Image: 2?ui=2&ik=ce6114b668&attid=0.3&permmsgid...8&disp=emb]

Please help to solve this issue.
Reply
#4
I am not able to see the images
Reply
#5
seandepagnier I am not able to see the images

Hi Sean, 

I have attached the images as attachements.


Regards
Karthik


Attached Files Image(s)
           
Reply
#6
I think multiple programs are trying to access the serial port at the same time which pypilot needs for the motor controller. This is rare because most pypilot systems use the hardware serial /dev/ttyAMA0 for the motor controller not usb.

Anyway, possible programs that access serial ports:
opencpn
signalk-node-server
avnav
gpsd
pypilot
some openplotter scripts
a multiple instance of one of these
Reply
#7
(2022-01-12, 07:34 PM)Thanks a lot Sean.. seandepagnier Wrote: I think multiple programs are trying to access the serial port at the same time which pypilot needs for the motor controller.   This is rare because most pypilot systems use the hardware serial /dev/ttyAMA0 for the motor controller not usb.

Anyway, possible programs that access serial ports:
opencpn
signalk-node-server
avnav
gpsd
pypilot
some openplotter scripts
a multiple instance of one of these
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)