Yacht keel winch controller – Part 1


My friend came to me with an interesting problem… he was doing some work on his yacht and wanted to improve the mechanism for raising and lowering the keel. Mechanically the keel is controlled by an electric motor (essentially an old cordless drill) turning a drum that winds a cable attached to the keel. There is a cut-out switch that is activated when the keel is fully raised, but there wasn’t a good way to mechanically detect when the keel was lowered.

So instead of guessing when the keel was lowered completely, we wanted to find a reliable way to switch off the winch motor at the appropriate time.

The first approach considered was around using a timer to switch off the winch motor, however, there are certain situations where this approach fails. If the winch motor speed is not consistent (perhaps due to battery voltage), or if the keel had been partially lowered/raised then a timer approach doesn’t work.


The solution chosen is one where the keel position is more precisely tracked. This is achieved by using magnets attached to the winch drum and a reed switch to count the drum turning. So to summarise the parameters of the design there are 4 inputs;

and 2 outputs;

To implement this my mind turned to using the Arduino, and then I remembered a post on Google+ talking about the ATtiny series. It seemed like a perfect fit seeing the ATtiny supports 6 I/O pins! So I decided to design a solution using the ATtiny85.

The solution has a hardware part, essentially supporting hardware for the ATtiny, and a software part that implements the intelligence around what to do with the inputs, and when to drive the outputs.

One scenario I had in mind was to do with if the keel was partially lowered. If the circuit remains powered then it can know how lowered it is seeing the drum turns are being counted, and thus it can still know how to lower the keel completely. However, if the circuit is powered off (as it can) then it has know way of knowing the keel position any more. In this case, if the “lower keel” switch is on, the circuit will first raise the keel completely, thus getting things into a known state, then from there the keel can be lowered properly.


I started using Eagle to design the circuit and produce the PCB layout, then Mitch from Hackvana (no longer in operation) convinced me to try Kicad, and after a considerable learning curve I became comfortable enough with it to complete the project.


Keel winch controller circuit

The final circuit looks like this:

Power regulator

The power regulator part of the circuit (the top part of the diagram) incorporates various features from automotive circuits, namely reverse voltage protection (D2), voltage spike protection (D4), and load dump protection (D3). These were included because the yacht electrical environment is similar to a car – there is an alternator for charging the battery (as well as solar charging), and an electric motor, the winch motor, that will contribute to noise on the circuit. The motor can draw around 15A in a stall situation, so there is potential for load dumping occurring.

Relay drivers

The bottom right part of the diagram are the two relay drivers. Relays that can handle switching currents of up to 30A were chosen, and such relays are not able to be driven directly by the ATtiny (which has a 40mA max driving current limit). So general purpose NPN transistors are used.


I added an ICSP (In-circuit serial programming) header so I could program the ATtiny in place. This turns out to be less useful than I originally thought… as I need to use six I/O pins on the ATtiny, the device’s fuses need to be reprogrammed to allow the reset pin to be used as an I/O pin, and that then means ICSP programming won’t work. If I need to re-program the device later on I need to use a high voltage (12V) reset circuit first.

In any case, it’s still handy to be able to program the circuit this way, especially for some initial testing. I use an arduino UNO to do this, using a modified six-way ribbon cable as per this web page.


One PCB design aspect I had to learn the slow way was that it’s generally better to manually route the PCB traces. At the end of the number of iterations I went through I think I ended up with a nice enough board layout.

Circuit board layout

I learned that Hackvana were able to produce PCBs for hobbyists, and that they had a good deal on an order of 10 boards of up to 5x5cm. These can be dual layer, have plated through holes and include solder masks on both sides and a front silk screen. One really useful benefit of working with Hackvana was that they run an IRC channel to which your board design can be aired where other people can comment on the design and make suggestions. This was immensely useful and was how the voltage spike etc. parts of the design came about.

The resultant board back from Hackvana is very nice:

Circuit board front
Circuit board rear

And with the components installed…

Populated circuit board
Populated circuit board

To be continued…

Part two will cover the installation, calibration, and testing. I will also post the final code in the next post.

See all posts »