Reading rudder sense - Printable Version +- OpenMarine (https://forum.openmarine.net) +-- Forum: Pypilot (https://forum.openmarine.net/forumdisplay.php?fid=17) +--- Forum: General discussion (https://forum.openmarine.net/forumdisplay.php?fid=18) +--- Thread: Reading rudder sense (/showthread.php?tid=1414) |
Reading rudder sense - jodi001 - 2018-08-17 Hi, I have successfully in installed opencpn with NOOBS and got my IMU sensor to deliver data to pypilot. My arduino acts like a controller (connected to USB port) and so far a small RC servo reacts when I move IMU and set AP course, great! In my boat I have a hydrualic pump with reversing motor that I would like to control via H bridge. Before I install it and try I need to be sure that I do not stall this pump and create damage, therefore I need to able read rudder angle and current but I cannot figure out how to get the reading i opencpn. I have attached a potentiometer to my arduino at adc5 and give it 5 V and ground. Thanks for a great work! Regards, Joakim RE: Reading rudder sense - seandepagnier - 2018-08-17 The pump can be prevented from stalling by using current measurement. It will only stall for 1/10th of a second, and doesn't usually cause harm, but it's a good idea to use rudder angle as well. I recommend measuring motor current like this as backup, and to prevent damage if there are other problems. I use a 500uOhm resistor with 50x amplifier. You can also use end of travel switches to prevent the pump from stalling. This would be a magnetic reed switch at either end, and a magnet to trigger it in most cases, but you could possibly use a switch with a spring as well. The rudder angle feedback was recently improved, and this change is not in openplotter yet. I recommend you upgrade pypilot from github, as well as the pypilot plugin in opencpn if you are using that. Once you do, the pypilot_calibration script has buttons for calibrating the rudder. You need to center, and then set the range by moving hard over to starboard, and setting the angle. Once done, the rudder will stay within this range, as well as accurately report rudder angle over nmea0183 port 20220 in a connection to opencpn. The rudder angle is normally read from adc4. Check the source code to motor.ino you have uploaded. The rudder angle is normally in the range of 0 - 1.1 volts. You can modify the source code to read from 0 to 5 but this will change all the other adc measurements like voltage and current feedback. Changing the voltage reference for different readings causes other problems. https://youtu.be/IMqUmcTbQOE RE: Reading rudder sense - jodi001 - 2018-08-21 Thanks for reply! Since I'm new to this I need some hints on where to find motor.ino when running opencpn? I cannot find it in the file system. /Joakim RE: Reading rudder sense - jim321 - 2018-08-21 https://github.com/pypilot/pypilot/blob/master/arduino/motor/motor.ino in openplotter it needs to be installed on an arduino then connected to the rpi board ..i use usb. then it will show up in the serial tab, set it up there, and then pypilot tab will show it too.. RE: Reading rudder sense - jodi001 - 2018-08-22 (2018-08-21, 05:25 PM)jim321 Wrote: https://github.com/pypilot/pypilot/blob/master/arduino/motor/motor.ino Thanks for reply. I hav e downloaded motor.ino and modified it and then upload it to Arduino. I can see that my changes takes effect. But I cannot get the H-bridge relays to work. I have changed row with code: uint8_t rc_pwm = 1; to uint8_t rc_pwm = 0; but my relays does not operate when seting AP course and wiggle the IMU. Is there any other code that needs to be changed in order to get H-bridge to work? I have no sensors for servo travel, temp et. connected. All my adc pins are grounded RE: Reading rudder sense - seandepagnier - 2018-08-22 (2018-08-22, 02:23 PM)jodi001 Wrote:(2018-08-21, 05:25 PM)jim321 Wrote: https://github.com/pypilot/pypilot/blob/master/arduino/motor/motor.ino There is a digital io pin to detect rc output which sets the rc_pwm variable. So the modification you made probably does nothing. The code is not designed for actual relays the mechanical kind make a clicking noise. If you cannot detect the end of travel, you will stall the motor, and this is a waste of power, and also hard on the mechanical system, it can eventually burn out the motor, but just to get started you could try it... Grounding the ADC pins is not correct. This will cause over temperature fault. Maximum temperature is 0 volts. Either connect these pins to 3v3 or 5v, or modify the code to not read temperature or fault from it. I encourage building your own controllers, unlike all other autopilots available. I even provide source code and support for this, but I am concerned because, so far from feedback I have seen, everyone wants to cut corners. This includes:
So.. feel free, do what you want, but you may encounter problems. Yesterday I sailed 20 miles up the winding nanticoke river in maryland completely on autopilot route following adjusting only sails. I am sailing everywhere on autopilot, even tacking under autopilot against 25 knot winds. RE: Reading rudder sense - jodi001 - 2018-10-02 Hi again! After many hours trying to figure out how to build my own motor controller I finally surrendered and bought one labelled VNH3SP30. This controller should drive a brushed motor with PWM signal. But, when trying to get the controller to work with motor.ino I get stuck and I don´t know how to connect it. The controller has the following schematic VNH3SP30 Controller schematic. To test the motor I wrote a simple python script I then needed to connect 5 wires from my Arduino (INA, INB, ENA/DIAGA, INB/DIAGB and PWM). I cannot figure out how to connect it when using motor.ino and if I need to re-program in any way? I tried and have been partly successful in building a very simple course holding script using a H-bridge with "clicking" relays. This holds the course somewhat steady Thanks for your support! RE: Reading rudder sense - seandepagnier - 2018-10-02 This board "VNH3SP30" does not use RC style signal pwm, so you would need to modify motor.ino to make it work. It uses completely different type of pwm. |