River Boat Drive by Wire Controller

Hello Community,

I would like to use an Uno, hooked up to an old, modified Gameport PC Steering Wheel with self made Thrust-Lever (Just a bunch of potentiometers and 4 buttons), to control two DC Motors with potentiometer angle detection (Steering and Throttle), and three relais ( 2 for Bow Thrusters, 1 for Engine Kill) to steer my old and slow little River Boat from other places than the rudder house. Most of the setup and programming I figured out already even though I am an absolute beginner, but some questions are troubling me. I try to get my head around a proper calibration method to adjust center and extreme positions from both the input device and the outputs. I was thinking about end and center sensors mounted to the rudder and throttle lever of the boat, and initialize an reference run at start up, while using one of the buttons at the PC Steering Wheel to switch the Uno to "calibration mode" in which it would detect and memorize the extreme values of the analog inputs till the button is pushed again to safe the centered positions. Is there a function to detect and memorize lowest and/or highest values of analog ports? Does someone have a better idea how to match and calibrate inputs and outputs?

Greetings Marco

Inputs are fairly simple because you can test them at your desk - hook up the gaming wheel & throttle as they'll be on the boat, read the inputs and display the values on your PC in the serial monitor. Move the controls through their limits, oberve what you get & use them in your final sketch as constants.

Calibrating the outputs is really going to depend on what mechanism you build to control the rudder and motors. If you can take a laptop to the boat though, you can write a little sketch that reads single charater serial instructions from the serial monitor and changes the values on the output accordingly as you type them in, reporting it back in the monitor. Then you can play around moving the rudder/throttle in small increments until you reach your mechanical limits, note the values as above & put them into your riverboat driving sketch.

@wildbill This was my first thought too, but this way you can not compensate for temperature drift or wear tolerances. I need to ensure that the middle position of my remote throttle lever will always result in an exact neutral positioning of the boats throttle, and that the boat will go straight after the spring mechanism pulls the remote wheel back to its center.


Shaft Angle encoders sounds like a good idea, but if I understand this right, this will give out an 4bit information. Doesn't this mean I would have to use 4 Arduino Pins for each encoder? That would be too much for an Uno. To save pin usage, I even thought of an parallel array of end and center switches, all connected to one pin, with the software "guessing" by comparing the approximate values of the pots, which switch might be giving the impuls. Center calibration on startup would be ok for the wheel, because of the spring loaded mechanism, but I can not be sure in which position the throttle lever will be on startup. This device should be fool proof and at best should be able to self calibrate at any circumstances. It might be OK to have an simple calibration routine, the user can initiate by pressing a button and then follow a few simple steps, like turning all inputs to their extremes and then center them, not unlike an old windows joystick calibration routine. It would be nice though to then safe the gathered values and keep them even after reboot. Is this possible?

Another solution might be to add some trim tabs on your wheel & throttle to give fine adjustment.

As to storing the calibration results, you can store them in eeprom: http://www.arduino.cc/en/Tutorial/EEPROMWrite

Yes, trim tabs came to my mind too, i would like to explore some more sophisticated methods first though. But as a fall back solution its surely valid. Thanks for the eeprom hint, it will come in handy.

Quote It would be nice though to then safe the gathered values and keep them even after reboot. Is this possible? Yes, there are ways of saving values in non-voltatile memory. But I don't see the point, since the controls can move during power down.

I do not want to save the latest input values but the extreme values of each pot as well as the central position value of each pot, after the calibration routine. I would like to know why you think a calibration routine, like windows did it before self calibrating hardware was available, is a bad idea?

Please don't get me wrong! I am very concerned about the safety of this project. In fact i am thinking about multiple independend fail safe mechanisms to fall in place and even conduct an FMEA (Failure Mode and Effects Analysis) to cover up as much as possible. But I did evaluate the risk of a malfunction caused by severly wrong adjusted controls and do think that this will not cause a dangerous failure. For information. This Boat is not able, even with the engine cranked up to full power, to reach more than 10Km/h. There is always the possibility to switch back to manual, even with total power loss, and the arduino will have to send a "dead man" signal to an redundant system to prove its still in control, otherwise the power to the engine gets cut off, which will bring the boat to a total stop in about 15 seconds. The risk for humans will not really be higher than it is now, since the throttle and steering controls now are connected with bowden cables, who tend to fail as well.