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
Motor spins at startup and pypilot plugin not working properly
#1
Hello everybody,

my name is Andrea and I write you from Italy. I own a small power boat, 5.5 m 10 cv inboard engine, a "gozzo" in Italian. You see it in my avatar pic.
In these days of coronavirus, I started the project to add a navigation system and an autopilot to the boat, which is obviously overdesigned, but the main aim is to have fun in doing that and at least for this I'm succeeding. I'm a mechanical engineer with very limited knowledge in electronics and programming, so my approach is mainly to look for documentation and tips in forum threads and applying it. 


This what I've done up to now:

I've a Raspberry PI 4 and I've installed on it 2020-03-24-OpenPlotter-v2-Headless-NOOBS.

I have bought:

- USB GPS dongle
- IBT-2 motor controller
- Arduino Nano clone
- 9255 IMU
I've installed the pypilot plugin in opencpn


In raspberry configuration I have activated:
- SHH
- VNC
- I2C
- Serial Port
the rest is disabled

In Serial:
- I activated UART (and reboot)
- I find ttyACM0 which I gave alias ttyOP_gps NMEA 0183 and I assigned it to GPSD
- I find ttyAMA0 which I gave alias ttyOP_serial NMEA 0183 and I assigned it to pypilot
- I find ttyS0 which I've not assigned

In Signal K I've established connections to
- Pypilot NMEA 0183 TCP client - localhost 20220
- Pypilot signal K UDP 20220
- GPSD localhost 2947

In opencpn I've established connections:
- Network TCP input localhost 10110 Priority 2
- Network TCP in/out 10.10.10.01 20220 Priority 1
   
I've connected the IMU 9255 to the PI GPIO pins 1(3.3V) 3 (SDA) 5(SCL) 9(GND)
I've connected the Arduino to the PI GPIO Pins 4 (+5V to +5V) 6 (GND to GND) 8(TDX to RDX) 10(RDX to TDX) (I'm not using optical isolation, i know it's risky, I've ordered a RS 232 logic converter but it is not yet arrived and I've not been able to wait for it....)

At this point, I tried to get into motor.ino to understand how to set it up but I've been struggling, then I found a post from McNuggets https://hackaday.io/project/168592-openc...-waypoints that has modified the motor.ino to work with IBT-2 driver, it also provided a clear schematic, so I decided to have a try with it and I followed his schematic, adding resistors and so on to have voltage, current and temperature sensors.

I've ordered a linear actuator with a potentiometer, but is not yet arrived, so to make trials I've connected a basic potentiometer coming from an Arduino kit as a rudder sensor and a water pump as a motor.

The Arduino and the motor controller are powered by the raspberry pi +5v and GND pins and the motor is powered by a 12v battery.

All I've done up to now has been done on a table in my kitchen, not on the boat.

   

At the moment several things look to work:
- GPS is showed in opencpn ( the boat is in my kitchen)
- Magnetic heading is shown both I pypilot app and opencpn (i can see it both in pypilot scope, pypilot web app, opencpn  and il Signal K)
- I see rudder angle changing if I move the potentiometer, this in pypilot scope and in opencpn dashboard)
- I see accelerometers working in IMU calibration (I've performed calibration on the table by rotating the board 360°)
- If I activate the AP in compass mode and I rotate the IMU the motor start to spin
- If I activate the AP in GPS mode and I activate a route I see the green line pointing to the closest waypoint and the red line alligned with the magnetic heading. If I rotate the imu to have the red line away from the green line the motor start to spin if I align the red and green line the motor stops. 
- I see the temperature of the motor controller in the web app of pypilot.

Now I have two strange behaviors:

- when I turn on the Raspberry Pi, with all the stuff connected, the motor starts to spin. It keeps spinning until I open pypilot app, there I find the AP off, I turn on the AP, then the motor slows down and stops because the target heading is the same as the read heading. Then I turn off the AP. From this moment everything starts to work properly. It looks like the motor controller boots with a wrong logic state and starts to spin the motor until I reset it by turning it on and off.

- In Opencpn pypilot plugin I do not see the gains and most part of the calibration options.
   
Can you help me to understand why I have these 2 issues?
On top of this, I'd apreciate it if you can confirm that my settings are generally correct.

In conclusion, I want to say thanks to Sean and all the other peapole that have developed and is maintaing this sw which is incredibly amazing and well done and, among other things, it allows a small boat owner to implement this equipment at a negligeble expense, which for sure I was not going to do by buying commercial much more expensive stuff.
Reply


Messages In This Thread
Motor spins at startup and pypilot plugin not working properly - by massinia - 2020-04-19, 05:11 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)