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
A little help please!!
#1
Hello,

I try without success to connect an arduino running 'motor.ino' on my raspberry pi4 in UART (after having disabled the bluetooth) to make a test of pypilot.
I have grounded pins A0, A1, A2, A3 and A4, as I have not connected any sensor!
At first, I connected an RC servo to pin 9 after putting pin 6 to earth (pwm_style = 0); and I observe encouraging reactions from my servo which compensates for the deviation from the chosen route in the right direction, but which does so in the form of brief deviations from the servo !!
Secondly, I plug the pin 6 on vcc (pwm_style = 1) to switch to H-bridge mode and I plug in a L298N module with 'enable' on pin 9, 'In1' on pin 2 and 'In2' on Pin3, but I don't see any reaction from the engine.
In motor.ino, it is indicated that the H-bridge plugs in low on pins 2 and 3 and in high on pins 9 and 10: but where plugs the 'enable', given that pin 9 of pwm is busy!
I pers my Latin !!!
I must surely make a mistake, thank you for putting me on the right way!

Cordialy
Reply
#2
Neither pwm modes will work with l298n. You might try pwm style = 2

Sean
Reply
#3
thank you Sean for your quick response,
So I leave pin 6 open and your program (motor.ino) starts in pwm_style = 2 (by default)
Remains the 'enable' of the l298n, should it be connected to pin 9 or elsewhere?
I tested this H-bridge on a simplistic program and it seems to work well. No doubt therefore a bad connection or a modification in 'motor.ino' which would have escaped me !?
Bravo again for this superb program and thank you for your help
Kinefou
Reply
#4
I believe you need to ensure that pwm mode is 2 by slight code change.

YOu should use pin 2 and 3 for ina and inb, pin 9 for pwm and pin 10 for enable
Reply
#5
Dear Sean,

Despite your good advice, my engine is still stopped.
In your last message, you advise me to use pin2 for ina, pin3 for inb, pin9 for PWM and pin 10 for 'enable', but it turns out that my l298N module only has 3 inputs: In1 , In2 and 'enable'; it is by this pin 'enable that the pwm must be sent. So I tried to connect it to the pin9, then to the pin10, but without success.
I added a line at the start of the setup () of 'motor.ino' to be sure of the pwm_style:
pwm_style = 2;
But still nothing and the engine does not react
An idea?
Thanks again for your help
cordially
Kinefou
Reply
#6
Good evening Sean,

A little progress in my assembly: I redone everything and finally get a reaction from my engine when I turn the boat to port. But as soon as the engine starts, I get the message: 'sync engaged port_fault' and then nothing more until I do a 'sudo service pypilot restart'. (I don't know what this message means) . No engine response when turning to starboard.
Do you have a track to guide me, because I feel that victory is not far !!
cordially
kinefou
PS: sorry for the change in character size of the previous message beyond my control!
Reply
#7
the port fault means overcurrent was detected and any further commands in that direction are prevented until the motor moves the other direction.
Reply
#8
Hello Sean,

Thank you very much for your explanation on the 'port_fault' which allowed me to eliminate this error.
I still have the fact that the engine does not start until the heading of the boat is less than the compass heading; nothing if the boat has a course higher than the compass !!
I'm still looking for the cause.
Knowing your passion for Opencpn, maybe you are aware of the bug on raspbian buster which means that nothing is displayed in the 'route' window. As a result, pypilot does not work in GPS mode, while everything is fine with raspbian Stretch in which the AP button turns yellow when it follows the gps and green for the compass! can be a specific problem to 'Buster'?
Thank you for your return if you have an idea
cordially

Thierry
Reply
#9
Are you still getting port fault flags?

Can you post a schematic of your controller?
Reply
#10
Hello Sean,

Thank you very much for taking an interest in my problem, when I know how busy you are with your superb contributions !!!
I no longer have a problem with 'Port_Fault' and I think I had a mass problem on the resistor bridge (100 and 200 ohms) which I added to protect the raspberry in the absence of optical isolation.
I connected the pwm (pin9) to the 'enable' of the H-Bridge and I observe proportional and brief reactions when the boat has a heading lower than the desired heading. Nothing however in the other direction!
I am enclosing a small diagram of my connections.
About Opencpn, forget what I asked you in my previous message because the default settings printed the figures in black on black (invisible therefore!), Which I corrected in the settings of Opencpn.
Thanks again for your help

Thierry

   
I retry to post my attachement
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)