Project Overview and Table of Contents
The photo above shows the console used to propel a 10 foot kayak electrically. The console contains an Arduino Uno computer capable of generating Pulse Width Modulation (PMW) signals. The Cytron driver, a 2 by 3 inch circuit board located next to the Uno, interprets the PWM signals and powers the trolling motor as it would a robot motor.
On the side of the console, a stock 4 Ampere Hour (AH) or 6 AH Ryobi Lithium battery pack (used to power cordless tools) provides the operating power for the trolling motor. The console also provides a voltmeter and an ammeter to monitor the battery charge and the power flowing to the motor. The speed of the motor is controlled by a rotary switch with 6 forward and 3 reverse speeds.
The Arduino Uno's PWM control of the trolling motor is used in two ways, first it adjusts the 18 volt power of the Lithium-Ion battery pack to the 12 volt rating of the motor, second it controls the speed of the motor. This is where it excels: small trolling motors operate at less than full speed by inserting resistors in the battery circuit. These resistors transform the excess battery power into heat which is dissipated in the water and wasted. At low speed a typical trolling motor's efficiency is about 25%. The PWM technique for controlling speed is 98% efficient at all speeds.
The convenience of using a battery pack to power the motor is most notable for its light weight: a 4 AH pack weighs 2 lbs. It is easy to plug into the console or into the charger which fully charges the battery in about 2 hours. Spare battery packs are easy to carry to extend the range of the cruise. The Lithium battery is also excellent at holding its charge over long periods of time and delivering its full rated power at any speed.
The components used in this project have exceptionally good value. A 10 foot kayak costs about $200, the trolling motor about $100, two 4 AH Lithium battery packs $100 and less than $100 for the miscellaneous electronics and parts needed for a handy do-it-yourselfer to put it all together.
The combination of an Arduino Uno and PWM with its simple programming has many applications. Although my interests lie mostly in boating, this type of motor control can be also be used effectively for powering go-carts or electric scooters. These are all fun projects and they provide great learning experiences.
Table of Contents
The following is an annotated list of the contents of this article.
1. Background and Introduction - How the project came about
2. Overview of the Project - Modifications and additions to the kayaks
3. Pulse Width Modulation - What it is and why we need it
4. The Control Box - An Arduino Uno coupled to a Cytron driver controls the motor
5. Wiring of the Control Box
6. Software - The Arduino “Electric Kayak” sketch that is used in the Uno
7. Mounting the Components - The control box, the steering device, and the transom.
8. Testing - Operation of the kayak in the water and summary of the results
9. Transporting and Launching the Kayak
An Electric Kayak1. Background and IntroductionTo make life a little easier for myself, I invested $200 for a “sit upon” 10-foot kayak to replace my “sit in” 10-foot kayak. At my very senior age, getting in and out of a “sit in” kayak is quite a chore! As shown in the picture below, I added a pair of sturdy handles and a home-made wood mast and boom. Since the boat is basically built like a board, I thought that I could install a small sail and control the direction of the boat with the paddle. That did not work. I then added a weighted centerboard, but it still did not sail satisfactorily. I decided that building a sizable rudder would have to be the next step.
While I was weighing the pros and cons of various sailing rigs, I spent a day at my favorite beach in Hingham, a town on Boston Harbor dating back to 1636. The beach is muddy at low tide and consequently, it is not a busy place. The town runs a sailing school nearby where they start the kids on Optimists (Opti) 8-foot skiffs. Its 35 square foot sail and 7.5-foot mast seemed about right for my new kayak.
The Opti was designed by an American, Clark Mills, in 1947. He built the largest pram that he could get out of two sheets of plywood. It went on to become one of the most popular sailing dinghies in the world. He donated the plans to the Optimist Club.
Getting back to my day at the beach, as I was walking to the sailing school to find out how the kids rigged their Opti, I noticed that there was not a bit of wind. I fully expected to find a group of kids with very long faces. On the contrary, they could not have been happier. Some of the kids were laying on the bottom of their boats, paddling with their hands, others were using the boat's scupper for water fights and some were just happy to jump in the water from the dock with their clothes and sneakers on. I could not help wondering why grown-ups could not enjoy a day on the water as much as the kids do. I think that the grown-ups could if the boats were more reasonably priced (a new Sunfish costs $5000 today) and the boats were easy to transport and readily set up and launched.
During the water tests of the Opti sailing rig, I had a gusty day and capsized the kayak twice. Fortunately, I was not far from shore and the boat righted itself without taking on water, but the incident reminded me that kayaking is a dangerous sport. Before venturing out too far, it is wise to learn to right the boat and practice getting back on board, taking a lesson at a sailing school if necessary. At that point it was late in the season, so I put the sailing idea on hold and started my new winter project “An Electric Kayak.”
Like 10-foot kayaks for $200, the two small Minn-Kota and Newport Vessels, 12-volt, trolling motors costing around $100 each are hard to beat when it comes to value. They weigh less than 20 pounds and put out enough power to duplicate the speed of a paddler. They are not efficient. The dynamometer tests that I performed on these motors show that they are about 65 % efficient at full power and as we will see, far less efficient at lower speeds. With a battery as large as a car battery, the low efficiency is not a serious problem, but for a kayak a smaller battery and better efficiency are very desirable features. Fortunately, the miracle of Pulse Width Modulation (PWM) using a small Arduino Uno microprocessor (to be described later) provides very efficient propulsion.
Twenty years ago, I did a lot of work on electric boats resulting in a couple of books. My most successful boat was “Sunny II, ” a converted 19-foot sailboat (O'Day Rhodes 19 hull with an efficient British Etek motor as described in my book “My Electric Boats”). The boat was on a trailer so the batteries could be charged before putting the boat in the water. Although it required much less work than removing the batteries to charge them, and was more reliable than using solar cells on the roof of the boat to charge them, it was still the most unfulfilling part of my electric boating experience.
Much has been done over the years to improve the capacity and reduce the weight of batteries by using Lithium-Ion rather than lead. These improvements will continue because there is a growing market for electric cars and for cordless tools (Ryobi now has more than 150 different cordless tools). Ryobi 18-volt, 4 Ampere Hour (AH) and 6 AH battery packs are readily available. Using PWM to generate the lowest speed when the motor consumes only 35 watts, the continuous running time was measured at 2 hours from one 4 AH battery pack. Of course, as the speed is increased, the running time decreases. Considering the 2-hour charge time and the ease of plugging in a freshly charged battery pack in the control box, this is an excellent solution for the battery problem.
The Proposed ProjectMy plan for the “Electric Kayak” project is to modify two 10-foot kayaks so that in addition to paddling them, it would be possible to propel them electrically using slightly modified Minn-Kota or Newport Vessels trolling motors. PWM techniques inherent in the Arduino Uno microprocessors are used to reduce the 18 volts of the battery packs to 12 volts and to control the speed of the motors for maximum efficiency. Ryobi 4 AH battery packs such as those used in cordless tools were used for the battery power.
2. Overview of the ProjectTo describe the project, I will use photos of the red kayak (the “sit-in” kayak) since I showed the coral colored, “sit upon” kayak as a sailing kayak. I made the same electrical modifications to both kayaks. The reason for doing this is that I wanted to find out if the hull shape affected the speed of the boats. Both boats can also operate with either of the two motors. With water test results from all four possible configurations, we should be able to understand the advantages and disadvantages of each hull shape and of each motor.
Mounting the MotorStarting from the back of the kayak, we see that the location of the mini transom from which we will hang the motor is 2 inches from the end of the boat. In the past, I have built a bracket for a small motor to be used on a canoe. The bracket was located near the seat so that there was no need to relocate the controls nor to add a steering device. It worked but the handling (especially the turns) felt awkward, and I did not want to repeat those disappointing results.
In my distant past, I had also seen large dories used by lobster fishermen fitted with a box inside the boat on which an outboard motor was mounted. The motor controls were used, and the steering was done with the outboard. All very convenient and easy to implement. Since I had already cut a hole for the centerboard in the coral kayak, I reasoned that by enlarging it, I could mount the trolling motor there within easy reach of the paddler running the kayak. This idea did not work either, mainly because the motor was mounted too close to the middle of the boat for effective steering. But my in-water tests did reveal the following good news, although there are no easy shortcuts, when the motor is mounted on the transom, both the controls and the steering work perfectly.
The SteeringThe steering is done with a lever on a pivot (look for a photo in section 7 where the components are shown) within easy reach of the paddler. It actuates a steering bar added to the motor as shown above. A ¼ inch line is attached to the end of the steering lever and runs out of sight on each side of the boat and emerges a couple of feet forward of the motor to connect to the steering bar. The line needs to be a good quality, smooth and non-stretching. In front of the boat, it goes around a small pulley, the rest of the way it is guided through 6 eye bolts.
The Control BoxMuch more will be said about the control box. In general, it must be located within reach for the operator. As a first line of defense for keeping it dry, it is mounted on a 3-inch-high pod. It houses the Uno microprocessor and the Cytron driver. Two power wires (at least #14 gauge) go to the motor from the control box to the transom.
The additions and modifications described above do not hamper the operation of the kayak with paddles. Of course, the control box should be kept as dry as possible. An easy solution is to cover it with a plastic bag approximately 1 1/2 gallons in size, with drawstrings at the bottom to secure it. A photo of the control box and the steering handle are shown and described in section 7
3. Pulse Width ModulationTo take advantage of the great value inherent in the Minn-Kota and Newport Vessel trolling motors, a 12-volt source of power must be provided. But our Lithium-Ion battery packs which have so many advantages themselves over the lead acid batteries, generate 18 volts. Using Pulse Width Modulation (PWM), the 18-volt power can easily and efficiently be reduced to 12 volts.
Another equally important job for the PWM is to provide the 6 forward speeds and the 3 reverse speeds. In this case, the PWM technique will make a dramatic improvement in the efficiency of these motors at low speeds.
Let us explore how the speed control of these motors normally works. Two resistors are connected to a complicated (and not very reliable) switch to provide the 5 forward and 3 reverse speeds. These resistors are located in the front of the motor, in the water, to dissipate the heat that they generate. For the slowest speed, the two resistors are connected in series and dissipate the most heat to provide the lowest battery voltage to the motor. Assuming that 4 volts go to the motor and 8 volts are wasted in heat (33% efficiency), the full speed 65% efficiency of the motor will now be further reduced to less than 25%. On the other hand, the PWM operates at 98% efficiency. We can have confidence in this efficiency figure because the Cytrons' ventilated Mosfets drivers which generate the PWM output power do not become excessively hot. They provide the best possible overall efficiency at all speeds.
The Arduino Uno and the Cytron DriverThe Cytron driver ($20) rated at 20 amps at 30 volts is designed to run robot motors at various speeds in the forward and reverse direction. It is specifically designed to interpret PWM signals (0 to +5 volts) from devices such as the Arduino Uno ($10) to drive permanent magnet motors such as the trolling motors. In our project, using the Cytron and Uno, we can reduce the battery voltage and provide 9 motor speeds in the forward and reverse directions very efficiently. This is a match made in heaven!
Pulse Width Modulation
Let's explore how the PWM technique works. The diagram above shows the switched method of controlling the motor on the top line (100% duty cycle) and the PWM method on the bottom line (50% duty cycle). The top line simply shows that a switch turns the motor power on and off. For example, if a 12 volt battery were connected in series with a switch, and 15 amps of current flowed when the switch is turned on, then the motor would consume 180 watts of power 100% of the time.
On the bottom line, under PWM control set at, say, 50% duty cycle, the motor receives 15 amps for one half the time because the pulse width is set at 50%. It would consume 90 watts and generate one half the power. Using an Arduino Uno, the duty cycle is determined by a number from 0 to 255 provided by the software. The number for 50% duty cycle being 127 (50% of 255).
If this motor were a trolling motor, it would push the boat at a reduced speed. This reduced speed would be equivalent to the speed obtained when a stock motor's speed control handle is set to the middle of the five forward speeds. At that setting, the series resistance inserted in the circuit would cause the motor to receive 6 volts instead of 12 volts.
As we discussed before, there is a big difference in efficiency between the two techniques: with the PWM, the drain from the battery is 90 watts whereas with the resistor method, the drain from the battery is approximately 150 watts. 60 watts are converted to heat by the resistors and wasted.
An oscilloscope was connected to the output of the Cytron driver which was connected to one of the trolling motors. The images of the wave-shapes produced by the driver under PWM control are shown above. The first image shows the output at approximately 50% duty cycle, PWM = 120. It correlates well with the diagram above. The second image shows the output at the slowest speed (PWM = 60). It corresponds to the slowest setting on the motor handle. At this slow speed setting, the motor consumed about 45 watts in the barrel water tests.
Driving a Motor under PWM Control
Wiring a motor with the Cytron driver and an Arduino Uno computer is a simple job. It only takes 3 control wires between the Uno and the Cytron, one of these being the PWM signal.
Programming the Uno for this task is equally easy. We will go into the details of writing the sketch later but at this point, let's consider the task of generating an appropriate signal for the PWM terminal of the Cytron driver.
We calculate the duty cycle of the Electric Kayak as follows. First, calculate the full speed duty cycle number. Since our power pack voltage produces somewhat more than 18 volts, it should be about 2/3 of 255 to run the motor at the equivalent of 12 volts. For now, we will use the number 160. To obtain a range from full speed to minimum speed, we will decrease this number in 20 point steps from 160 to 60 (values of 160, 140, 120, 100, 80 and 60) in order to provide 6 forward speeds. This is a good starting point to select the value of the PWM number. Depending on the type of kayak, the water test results and the desired performance, the top speed and the intermediate speeds are completely adjustable by using PWM values between 0 to 255.
That's all there is to generating a PWM signal. The oscilloscope images shown above produced the expected results. The PWM number used for the top photo was 120 and the number used for the bottom photo was 60. Until we tackle the software this concludes our PWM discussion.
4. The Control BoxThe control box houses the Arduino Uno and the Cytron driver unit. Each one is a small electronic board approximately 2 x 3 inches and about 1 inch thick. The block diagram above shows the electronic connections to the speed control switch (10 wire cable) and the 3 wires between the two boards (PWM, Direction and Ground). The heavy lines from the Cytron driver show the two connections to the battery (be sure to observe the correct polarity!) and the two connections to the motor (the direction of rotation is determined by the polarity of the connections).
The power connections are all made with #14 braided wire. The connectors are crimped blue spade lugs. To connect the meters, use #22 braided wire. Where it is advantageous (from the battery output and from the shunt), these smaller wires can be crimped along with the #14 wire in the blue connectors. At the other end of the #22 wires, use small red connectors.
Construction of the Control BoxThe custom-made control box is made (mostly) of ¼ inch plywood glued together. The back and the bottom panels are screwed on for access to the electronics and to the mounting screws. The diagrams below show the dimensions of the panels.
The basic design criterion is to make the box as narrow as possible to allow as much room as possible for the legs of the paddler. I have built four of these boxes and I can safely say that they can't be made much narrower than 5.5 inches without doing something about the meters. For example, we could forego the use of the voltmeter by using the 4 indicator lights that are integral to each battery pack (by plugging the pack upside down) or we could use smaller meters. The control box would then be about one inch narrower.
The Two Side PanelsBuilding the wooden box is straightforward except for the right side where the battery pack plugs into the box. To provide a solid backing for the battery pack, I used a 6 x 6 piece of 1-inch oak (¾ inch thick) for the right side of the box. The sketch below shows the overall dimensions of the right-side panel and the detailed dimensions to mount the battery pack. The left side panel made of ¼ inch plywood has the same overall dimensions. This panel only needs a 1-inch hole drilled approximately 1 ½ inch from the front edge and 1 inch from the bottom to access the USB connector of the Uno.
The 2 3/8 section of the panel is recessed ¼ inch to accommodate the protruding flat portion of the battery pack. The cut-out 1¾ inch away from the right edge accommodates the protrusion of the battery pack contacts. A spring conductor (about 3/16 inch wide) is mounted on each side of the cut-out to carry the current from the battery to the Cytron driver. The battery is locked in place with ¼ inch and 1 1/16 inch Plexiglas plates that are carefully mounted 2 ½ inches apart.
Numerous slots must line up with the protrusions of the battery pack. Use one of the Ryobi portable tools as a guide. The pictures of the control box may also help resolve the mystery of the locking mechanism. This and the installation of the contacts are the only difficult parts of the control box construction.
One more detail. The left side panel have wooden ½ x ½ reinforcement wooden pieces glued to the back and bottom edges of the panel. This is where the back and the bottom panels are attached with ¾ inch #6 screws.
The Other 5 PanelsThe other 5 panels overlap the side panels in all cases. Consequently, they are ¼ to ½ inch longer or wider than the measurements of the side panels to which they attach. The dimension of the panels will be provided but since they are simply rectangular pieces of ¼ plywood, a drawing is only provided for the front panel.
Top Panel: 2 ¾ inch x 5 ½ inch wide
Front Panel: 6-inch (trim as needed for good fit) x 5 ½ inch wide
Bottom front panel: 1 ¾ x 5 ½ inch wide
Back Panel: 6 ¼ inch x 5 ½ inch wide
Bottom panel: 5 ½ x 5 ½ inch wide
The angle at which the front panel is mounted means that the 90-degree right angle between front and top must be divided 4 ways. The approximate angles are as follows: the angle between the top panel and the front panel is approximately 55 degrees (28 degrees for the edge of each panel). The angle between the bottom panel and the front panel is about 35 degrees (17 degrees for the edge of each of these panels)
A sketch of the front panel is shown above. It shows the suggested location of the components and the controls. An edge view of the 3 front panels also shows the angles discussed above. The control box components include the following: a 20-amp ammeter, with a shunt mounted below the top panel and a 30-volt voltmeter. The speed control switch which provides 6 forward speeds and 3 reverse speeds and the on/off switch with the indicator light are also mounted on this panel. (The meters are available at Amazon for a total of about $20).
The two circuit boards (Cytron and Uno) are mounted on the bottom panel under the meters as far forward as possible. The Uno being closest to the left side where the 1 inch access hole for the USB cable is located
5. Control Box WiringThe wiring of the control box is shown in two diagrams. The first diagram shows the power wiring diagram, namely the wiring from the battery pack to the Cytron driver board and to the motor. The second diagram (wiring of the electronics) shows how the controls are connected to the Arduino Uno microprocessor and to the Cytron driver. As wiring diagrams go, these two are very basic and easy to implement.
The Power DiagramStarting at the + terminal of the battery pack, the wiring diagram shows the 3 connections to this terminal: a) a 400 ohm, ½ watt resistor, b) the ammeter shunt and c) the + terminal of the voltmeter. The a) resistor connection is made on the shield board that is plugged into the Arduino Uno. Its purpose is to provide power to Uno. This simulates the use of a 9-volt battery. The resistor is used to reduce the 18-volt battery voltage to less than 12 volts to conform to the Uno specifications. It is soldered to the + of the 9 volt battery connector.
The b) connection is made to one side of the shunt device which is supplied with the ammeter. The shunt is simply a calibrated resistor which matches the mechanism of the ammeter (which is really a 75-millivolt voltmeter). The other shunt connection goes to the + of the Cytron driver. The Cytron driver is not protected against improper polarity connections, it is therefore important to observe the polarity of the source. Note that there are no polarity marks for the motor. The reason is that the motor simply runs in the opposite direction when the wires are reversed. Two wires (22 gauge) go from the shunt to the ammeter.
The c) connection goes from the battery + to the + of the voltmeter. Another 22-gauge wire goes from the negative of the battery to the negative of the voltmeter. We mentioned before that the 22 gauge wires can be crimped along with the 14-gauge wire in the blue terminals. Of the last three connections, one goes from the battery – to the Cytron – and the last two go from the Cytron board to the trolling motor.
These instructions apply to both trolling motors:
Remove the 6 screws that hold the cover on. Notice that 4 wires go down the shaft to the motor: 2 large wires, red (+) and black (they go to the motor terminals) and 2 smaller wires, white and yellow (they go to the resistors). The black speed control switch and the resistors are not needed when using the PWM control and will be by-passed as follows - Cut the the red and black wires about 2 inches from the control switch. Using butt connectors add about 18 inches of wire (the battery wire can be used for this purpose) to the red and black wires from the motor. You need enough wire to reach the terminals on the mini-transom. The white and yellow wires can be left connected as they are. With 4 butt connectors, 2 for the motor wires and 2 for the battery wires, the wiring can be restored to its original configuration.
The Electronics Diagram
We mention the word “shield” in the diagrams above. Many of the Arduino computers such as the Uno can accommodate a shield which plugs into the processor board with a pre-built circuit for special purposes such as connecting to the Internet. A prototype shield can also be purchased ($3) to implement custom circuits. It looks like a bare breadboard with a few connectors and usually a reset switch. We use one of these prototype shields to conveniently mount the resistors that we need.
The electronic connections in the control box show the interconnections between the speed controller, the 5 volt on/off switch, the Uno shield and the Cytron driver.
The speed controller is a 12-position rotary switch. The center position is “Off”. Turning the dial clockwise, selects speeds F1 to F6 one at a time. F1 is the slowest forward speed and F6 is full speed forward. When a speed is selected the 5 volts from the center position is connected to the selected pin. When the dial is rotated counterclockwise, reverse speeds R1 to R3 are selected one at a time. If the rotary switch has a stop, chose the “Off” position carefully to make sure that the stop does not interfere with the sequence of 6 forward or 3 reverse speeds.
If you can find a short piece of color-coded, 9 conductor, #26 (or close to that size) stranded wire, great. If not, make three, 3-wire cables, identifying each end As shown on the diagram, pins F1, F2 and F3 go to ports 4*, 5* and 6*. Pins F4, F5, and F6 go to ports 7*, 8*and 9*. Reverse pins R1, R2 and R3 go to ports 10*, 11* and 12*.
The asterisks indicate that a 10, 000 ohm, ¼ watt resistor is connected to the each of the 11 ports. This connection to ground is necessary so that the Uno port will not “float”, an unstable condition which is neither a 1 nor a 0. All shields are not the same but the one that I happened to buy has a ground strip (and a +5 strip) to which one end of the 11 resistors can be soldered. I carefully slid the plastic housing from the shield connectors to expose the interior pin, then carefully soldered one end of the resistor to it. Then I also soldered the wire from the speed controller to the resistor.
Another 3-wire cable is needed for the connections between the Cytron driver and ports 3*, 13* and Gnd. Any stranded wire between #23 and #26 will work. For the connection at the Cytron board which uses a screw connector, tin the wire so that it does not unravel when the screw is tightened.
The last bit of electronic wiring is the 5-volt connection to the on/off switch and the LED indicator. The same stranded wire used above is fine for these connections. The +5v goes from the Uno shield to one side of the switch, the other side of the switch goes to the common of the speed controller and to a 500-ohm LED current limiting resistor. The other side of the resistor goes to the + side of the LED (the polarity of the LED must be observed). The other leg of the LED is wired to Gnd.
This concludes the power wiring and the electronic wiring of the control box
6. Software - The Arduino SketchThe Arduino Uno was selected to control the Cytron driver because it is small yet powerful enough to perform the required tasks. The main requirements are to provide enough ports or channels for the 6 forward and 3 reverse speeds. It must also be able to generate a PWM signal to reduce the 18 volt battery pack voltage to 12 volts.
The program capable of doing this job (called a “sketch” in Arduino talk) is written on a PC and uploaded to the Uno board via a PC's USB connector. Before uploading the sketch, it is verified and compiled by the built-in compiler. The “Electric Kayak” sketch has been written for you so that it is merely a matter of typing a couple pages of code on your PC.
To write and upload an Arduino sketch from your PC to the Uno, you must first load the Arduino IDE (Integrated Development Environment) comprehensive software program into your PC. Among its many features, a library of sketches, an editor (similar to Open Office's editor) to type in a new sketch, a compiler which also verifies the sketch and the software needed to upload the sketch to a computer board such as the UNO. To download the latest version of the IDE, go to the Arduino.com site. The IDE is an “open source” program which is completely free.
You need to follow the installation instructions and select the USB drivers. You must also provide the name of your board (Uno) and the COM number of the port (usually 3). When you get to this point select a sketch such as “Blink” from the Arduino library (File/Examples/Basics/Blink) and make sure that you can upload it and run it.
You are now ready to copy the sketch “Electric Kayak” and upload it to the Uno which will operate the trolling motor using the Cytron driver. Once the sketch is loaded into the Uno, it can be used over and over. Disconnecting the power to the Uno board does not affect the stored program.
The Sketch “Electric Kayak”If this is the first time that you have powered up your Uno board with an USB cable, you will immediately see a blinking LED on the board. This tells you that the board was shipped with a sketch already loaded in it. The blinking LED is the traditional “Hello World” symbol used to introduce a new program.
Test the installation described above by uploading the sketch “Blink” to the board. A good short exercise at this point is to modify the delays (in “Blink”) from 1000 (1 second) to 200 (1/5 of a second). After uploading the modified “Blink”, you will see a very fast blinking LED. This exercise shows how easy it is to change the parameters in a sketch.
The next job is to copy the sketch shown below into the program listings of the Arduino IDE. The procedure is as follows.
Open the IDE
Under “New”, you will find the following bare bones sketch which shows the two essential parts of a sketch: the “setup” (which only runs once) and the “loop” which runs over and over. When there are numbers (integers) in the sketch, they will need to be defined before the setup section.
In the sketch “Electric Kayak”, we will have numbers (integers) corresponding to the ports. They are defined as shown in the following example: “int KAYAK_PWM= 3;”. It means that port 3 will generate the PWM outputs.
In the setup section, we will also show whether the port is used as an input or an output port. For example: “pinMode(3, OUTPUT);”
In the loop section, the example shows that we will drive the motor according to the selected speed and direction of rotation: “analogWrite(KAYAK_PMW, 100*val);”
A basic, bare bones sketch, is shown below:
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
Please note that the punctuation, the capital letters, the spaces, the underlining and the parentheses must all conform to the C++ rules. Any error will be picked up by the compiler and progress will stop until the error is corrected. It is very easy to make a punctuation error or omit a punctuation. Type the sketch with care! Use the editing functions “copy” and “paste” as much as possible to duplicate code that has passed the compiling test.
The Electric Kayak sketch follows. A double slash (//) tells the compiler to ignore the rest of the explanatory information on that line. (It also comes in handy if you need to troubleshoot an error uncovered by the compiler).
// put your setup code here, to run once:
int KAYAK_PWM = 3;
int KAYAK_F1 = 4;
int KAYAK_F2 = 5;
int KAYAK_F3 = 6;
int KAYAK_F4 = 7;
int KAYAK_F5 = 8;
int KAYAK_F6 = 9;
int KAYAK_R1 = 10;
int KAYAK_R2 = 11;
int KAYAK_R3 = 12;
int KAYAK_DIR = 13;
int val = 0;
void setup ()
{
pinMode(3, OUTPUT);
pinMode(4, INPUT);
pinMode(5, INPUT);
pinMode(6, INPUT);
pinMode(7, INPUT);
pinMode(8, INPUT);
pinMode(9, INPUT);
pinMode(10, INPUT);
pinMode(11, INPUT);
pinMode(12, INPUT);
pinMode(13, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
val=digitalRead(KAYAK_F1);
if (val == 1) {
digitalWrite(KAYAK_DIR, val);
analogWrite(KAYAK_PWM, 60*val);
delay (1000);
digitalWrite(KAYAK_DIR, LOW);
digitalWrite(KAYAK_PWM, LOW);}
val=digitalRead(KAYAK_F2);
if (val == 1) {
digitalWrite(KAYAK_DIR, val);
analogWrite(KAYAK_PWM, 80*val);
delay (1000);
digitalWrite(KAYAK_DIR, LOW);
digitalWrite(KAYAK_PWM, LOW);}
val=digitalRead(KAYAK_F3);
if (val == 1) {
digitalWrite(KAYAK_DIR, val);
analogWrite(KAYAK_PWM, 100*val);
delay (1000);
digitalWrite(KAYAK_DIR, LOW);
digitalWrite(KAYAK_PWM, LOW);}
val=digitalRead(KAYAK_F4);
if (val == 1) {
digitalWrite(KAYAK_DIR, val);
analogWrite(KAYAK_PWM, 120*val);
delay (1000);
digitalWrite(KAYAK_DIR, LOW);
digitalWrite(KAYAK_PWM, LOW);}
val=digitalRead(KAYAK_F5);
if (val == 1) {
digitalWrite(KAYAK_DIR, val);
analogWrite(KAYAK_PWM, 140*val);
delay (1000);
digitalWrite(KAYAK_DIR, LOW);
digitalWrite(KAYAK_PWM, LOW);}
val=digitalRead(KAYAK_F6);
if (val == 1) {
digitalWrite(KAYAK_DIR, val);
analogWrite(KAYAK_PWM, 160*val);
delay (1000);
digitalWrite(KAYAK_DIR, LOW);
digitalWrite(KAYAK_PWM, LOW);}
val=digitalRead(KAYAK_R1);
if (val == 1) {
digitalWrite(KAYAK_DIR, LOW);
analogWrite(KAYAK_PWM, 60*val);
delay (1000);
digitalWrite(KAYAK_DIR, LOW);
digitalWrite(KAYAK_PWM, LOW);}
val=digitalRead(KAYAK_R2);
if (val == 1) {
digitalWrite(KAYAK_DIR, LOW);
analogWrite(KAYAK_PWM, 80*val);
delay (1000);
digitalWrite(KAYAK_DIR, LOW);
digitalWrite(KAYAK_PWM, LOW);}
val=digitalRead(KAYAK_R3);
if (val == 1) {
digitalWrite(KAYAK_DIR, LOW);
analogWrite(KAYAK_PWM, 120*val);
delay (1000);
digitalWrite(KAYAK_DIR, LOW);
digitalWrite(KAYAK_PWM, LOW);}
//delay (2000);
}
After typing in the sketch and checking that it compiles, save it with “save as” (under “File”) with a file name of your choosing. To retrieve the sketch, the easiest way is by using the up arrow located at the top of all sketches.
Operation of the “Electric Kayak” Code.The setup code shows that we have 2 output ports (ports 3 and 13). Port 3 is a PWM port, it is used to output the PWM signal to the Cytron driver. Port 13 is used to output the motor direction signal to the Cytron driver. Six speeds operate forward while 3 speeds run the motor in reverse. Ports 4 through 9 are the forward speeds while ports 10, 11 and 12 are the reverse speeds. “val” has a binary value of either one or zero. It becomes a 1 when that particular speed routine is selected by the rotary speed control switch.
The loop section is composed of 9 similar speed routines for the 6 forward and 3 reverse speeds. Each speed has its own PWM number and direction of rotation according to the setting of the speed control switch. For example, when the switch is turned one position clockwise (from the center/off position) the motor will operate at its slowest speed (PWM number 60) in the forward direction (F1). The next clockwise position will cause the second routine to become active. It will increase the speed to PWM 80 in the forward direction. The next 4 positions will have the same effect in the forward direction. The last switch position runs the motor at its maximum speed with a PWM of 160. To activate the 3 reverse routines, the switch is returned to center/off and turned counterclockwise. Each step will increase the speed in reverse in the same manner as the speed was increased in the forward direction. The reverse routines are routines 7, 8 and 9.
Looking at the 7 lines of code in each routine, we first determine which routine is active (if any). The first speed routine is speed F1 (Forward 1). The first line of code determines the value of “val”. It can be a 1 or a 0 and it will only be a 1 if its switch position is selected. Center/off will return a 0 and so will any of the other speeds since only one speed can be selected at any one time.
If val is a 0, we will go on to the next speed routine. But if it is a one, meaning that the speed switch has a +5 volt on this contact, we will activate the next 5 lines of code following the open curly brace (“{“) until we reach a closed curly brace (“}”).
The first of these lines of code is “digitalWrite(KAYAK_DIR, val). That means that we will activate port 13 with +5 volt to make the motor turn in the forward direction.
The second line of code is “analogWrite(KAYAK_PWM, 60* val). That means that we will activate port 3 (a PWM port) with a signal which causes a pulse, 60/255 in duration, to be generated by the Cytron driver.
The third line simply means that we pause for 1 second under these operating conditions.
The fourth line of code, “digitalWrite(KAYAK_DIR, LOW)” turns off port 13 and the fifth line of code, “digitalWrite(KAYAK_PWM, LOW)” turns off port 3.
We now move to the next speed routine in the loop. The most likely situation is that the speed switch was not moved, so that, after having checked the other 8 possible speeds, we find val = 1 again in the first speed routine. That situation will again cause the motor to run for one second before checking to see if the switch position has changed. This could go on for hours. There is no noticeable power loss in the motor because the Uno is so fast that going around the loop once (to check the other 8 speed routines) takes less than 50 microseconds, a time lapse too short for the motor to notice.
Eventually, the speed will be changed or the speed switch will be returned to the center/off position. In that case, val will not be “1” in any of the speed routines and the motor will shut down. At this point, the power to the electronics can be turned off and the battery pack can be removed from the control box.
Summary of the Software SectionIn this very interesting section we saw how the brains (the Uno computer) controls the battery pack muscles using the Cytron driver to run the trolling motor at various speeds in the forward and reverse directions. The Electric Kayak sketch is the program that controls the operation of the brains. We first setup the required 11 input and output ports. Then, using 9 similar “speed routines” we energized the trolling motor at the speed selected by the speed control switch. Simultaneously, the battery pack voltage, is reduced from 18 volts to 12 volts to match the operating voltage of the trolling motor.
7. Mounting the ComponentsWe have seen that the Electric Kayak is a stock 10 foot kayak with 3 major additions: a mini-transom on which to mount an electric trolling motor, a steering mechanism and a control box which operates the motor at various speeds in two directions and houses the battery pack. In this section, we will describe these additions with photos and show how they are mounted in the kayak.
The Control BoxThe image below shows a control box with an ammeter, a voltmeter and a speed controller. On the right side, a Ryobi 4 or 6 Ampere Hour battery pack can be plugged in. On the left side a 1 inch hole is provided so that a USB cable can be connected to the control box from a PC. In the back cover of the box there are 2 terminals for the two conductors to the motor.
The control box is mounted on a 3 inch tall pod to avoid it getting wet from the water that we usually find in the bottom of a kayak. The bottom of the pod is contoured like the bottom of the kayak. It is screwed to the bottom about 12 inches forward of the front of the seat with two ¼ inch flat head, stainless steel screws, 1¼ inches long. The control box is attached to the pod with 3/16 inch brass (or stainless steel) screws 1½ long with a 32 thread.
I made the pod out of 2 pieces of 2 x 4 glued together. It measures approximately 3 by 3 inches. The 3/16 inch screws go through the top 1 ½ inch half of the pod. They are recessed ¾ of an inch so that they protrude ¾ of an inch. They match the holes in the control box which are located near the Cytron board, not too far forward, so that lock nuts can be tighten with a box wrench when the back cover is removed.
The Steering MechanismThe steering mechanism is simply an arm on a pivot near the middle of the kayak. Attached to the bottom of the arm is a rope that goes around the two sides of the boat and emerges about 2 feet from the electric motor's control arm. Pulling on the control arm with the steering handle, in turn pulls on the right side of the motor's control arm. It causes the boat to turn in the starboard (right) direction. Below is a picture of the steering mechanism. The steering control arm is shown in the picture of the motor in section 2.
The construction of the steering mechanism is straightforward. The arm, ¼ inch thick is made with two 1/8 thick aluminum bars approximately 1¼ inches wide (the same width as the diameter of the handle). The two 1/8 inch sections are 9 and 10 inches long. They are bolted together with 4 flat-head, stainless steel, #8, ½ inch long screws with lock-nuts so that the tops of the bars are even with each other.
The pivot hole is a 3/8 inch hole drilled 5 ½ inches from the bottom of the longest bar. It accommodates a 3/8 inch bolt that has no threads for a distance of ½ inch (in order to provide a smooth rotating surface). The threaded part of the bolt will then be cut flush with the end of the lock-nut.
The other half of the pivot will anchor the mechanism to the side of the boat. It consists of an aluminum bar 1 ½ inch wide, ¼ inch thick (or two 1/8 inch thick bars). It is attached (with 2 appropriate screws) to a wood spacer block also 5 inches long and approximately 3 inches wide and 2 inches thick. The back of the block will have to be shaped to the contour of the side of the boat and to a thickness that allows the pivot arm to pass through a slot in the top side of the kayak as shown in the photo of the control box and handle (above). A belt sander works very well to do this contouring work.
The steering mechanism and the contoured spacer are then attached to the boat with two, 3 inch long ¼ inch stainless steel screws and lock-nuts. These bolts go through the spacer and the ¼ inch pivot bar as seen in the pivot arm picture above.
The only remaining part of the steering to be built is the handle which will be attached to the steering arm. Like the spacer, it is made out of a clear section of pressure treated 2 x 4. The cross-section is octagonal about 1 1/4 inch in diameter. First cut a 7 inch long piece of 2 x 4, then make it 1¼ inches square. Then, by adjusting the fence and the angle of the blade on the bench saw, a professional looking octagon is readily made. A ¼ inch slot is cut on one end of the handle into which the steering arm fits. The arm is locked in place with two 1 1/2 inch # 6 screws with lock-nuts.
The Mini-TransomThe equivalent of a transom is needed to mount the electric motor on the kayak. There is just enough room for a custom built mini-transom 7 to 10 inches wide (depending on the width of the kayak ) to accommodate the motor clamps which require a minimum of 6 inches in width. A good height for the transom is 3 ½ to 4 inches and a good thickness is 2 1/2 inches. A block of wood of that size can be assembled from our pressure treated 2 x 4 in the following manner. 2 layers of 2 x 4 and one layer of 1 x 4 which are glued together to obtain the necessary height. The ends of the block are then trimmed to match the lines of the side of the kayak. The thickness of 2 ½ inches is cut on the bench saw. Then, the bottom of the block is contoured to match the top of the kayak as we see in the photo below.
To attach the transom to the boat, I used ¼ inch stainless steel threaded rod which does double duty by bringing the motor power from the inside the boat to the surface of the transom. On the port side we have two threaded rods whereas on the starboard side we only have one. Be careful to keep the rods with the power separated from each other and away from the mounting bracket of the motor as much as possible so that they don't cause a short circuit when the battery cable connections to the motor are tightened.
8. The Water Test ResultsThe In-the-Water TestsWith two kayaks and two motors, we have four configurations to compare four different sets of performance results. The most important information to be gathered is the efficiency of each configuration. It will be determined by the amount of running time that is produced by a given amount of power in watts. Equally important is the maximum speed that is achieved at each speed setting.
The four charts below show this information. For each of the six forward speed setting for each configuration, the following data is measured: the battery voltage and current (which determines the power in watts when multiplied together) and the speed. From separate tests, (the barrel water tests) the running time is determined for each speed setting. The four configurations are as follows:
A. The sit-in (red) kayak with the Minn-Kota (M-K) trolling motor
B. The sit-in kayak with the Newport Vessels (N-V) trolling motor
C. The sit upon (coral) kayak with the Minn-Kota motor
D. The sit upon kayak with the Newport Vessels motor
The voltage and current readings were taken from the meters on the console. The power in watts was calculated. The speed was obtained using the satellite app ”MPH” on my iphone. It works very well when it rests in the boat. I used the cup holder which works much better than trying to hold the phone.
Test results for Configuration A (Red kayak with M-KThe running time is determined by using the barrel water test results described below.
Barrel Water TestsTo determine the running time, namely, the amount of time that the motor can run continuously with one fully charged 4AH or 6AH battery, is a time consuming task. Each motor must be run at 6 different speed settings for a total of nearly 7 hours during which weather conditions are likely to change on the water. More accurate results can be obtained by running the motors under more controlled conditions in a barrel full of water. There is more turbulence in the barrel but as long as the drain from the battery is approximately the same as when the motor powers a boat, the results are valid. The running time numbers were obtained from the barrel tests. The curves and the two charts below show the running times for each motor.
Note that position 1a was added to the 6 forward positions for the barrel tests. It was added to produce a lower speed with less battery drain which is more compatible with position 1 when the motors are used to propel the boat in the open water. The tests showed that in the open water the battery drain is considerably less than in the turbulent waters of the barrel for the same speed position. To run the barrel tests for position 1a, we simply reduced the PWM number of position 1 from 60 to 55.
Barrel Tests ResultsThe two charts below show the running time of each motor for the 7 forward positions (including position 1a). This data, plotted on the curves shown below, is used to determine the running time of each position in the water test results. Batteries rated at 4 A-H were used for these tests. If 6 A-H batteries had been used the results would have been 50 % greater namely 3 hours of running time for positions 1a. Note that the batteries have identical characteristics using either motor.
Now that we have associated running times with boat speed (which determines the range) we can average the values for the four configurations and present the following chart of the results. For each of the speed settings, we have the average boat speed and the average run time generated by a fully charged 4 AH battery.
Powering a 10 foot boat at a trolling speed of 1.7 MPH for two hours or at hull speed of 3.5 MPH for nearly one half hour with one small lithium-ion 4 AH battery pack is a remarkable feat. I was the boat operator and I weigh 185 pounds so, with a lighter operator the results would have been better still. An average kayak paddler's speed is 2.8 MPH.
The main reason excellent low speed results were obtained is our use of the Pulse Width Modulation technique. It reduces the speed efficiently compared to the resistors which waste energy by converting the excess power into heat. A bonus from the PWM technique is that the software simultaneously converts the 18 volt battery pack voltage to the 12 volts required by the trolling motors.
To implement the PWM motor drive, we built two consoles into which to plug the battery packs. The other two electronic components in the console are the Arduino Uno which produces the PWM signal under the control of a very simple software sketch and a 20 amp Cytron driver designed to run robot motors. The Cytron requires just 3 signal wires from the Arduino Uno. Due to their simplicity, both consoles operated flawlessly during the design, construction and the testing of the project.
The Ryobi battery packs worked flawlessly as well. I bought two 4 AH units on sale for $100. 6 AH units are also readily available but they cost over $100 each. Be sure to buy the genuine Ryobi product. Numerous “knock-offs” are on the market that do not meet the AH specifications claimed. One product reviewer pointed out that these knock-offs weigh far less than the genuine product.
Unlike the lead acid batteries, the lithium ion batteries are much smaller and lighter and meet the 4 A-H rating at all discharge rates from 2 amps to 12 amps. The built-in indicator lights are useful to monitor the charge level of the batteries. The chargers work equally well. You can expect a full charge in about two hours.
This design emphasizes the quick setup of the electric propulsion. Only two wires have to be attached to the motor. The motor attaches to the mini-transom with two large wing nuts. The steering cables snap onto the steering bar easily by tilting the motor forward without further need for adjustments.
The barrel water tests provided a repeatable method for building the curves needed to determine the running time of the six speed settings. The continuous operation of an entire battery charge bodes well for the reliability of the electronics and especially of the Cytron motor drive module which was never more than warm when checked.
The water tests show that the speed for the 6 positions respond correctly to the PWM number selected for each position. Position number 3 produces an average speed of 2.6 MPH which is close to the average paddler's speed of 2.8 MPH. At this speed, producing about 1/8 of a horsepower, a 4 AH battery pack will drive the 10 foot kayak for 57 minutes for a distance of about 2.5 miles.
The water tests also show that the conventional displacement hull of the sit-in kayak is a little faster than the flatter hull of the sit-upon kayak. The red (sit-in) kayak has a water line length of 9 feet which produces a hull speed of 3 x 1.34 equal to 4 Knots or 4.6 MPH. We are close to reaching this speed with either motor using about 200 watts of power (about ¼ of a horsepower)
What can be improved? If I were to do it again, I would give more thought to making the console waterproof. I had no water problem during the water tests, but I can see that it could be a problem long term. Another area where the design could be improved is in the steering. It should be modified in order to be able to make sharper turns. Possibly crisscrossing the cables would help.
9. Transporting and Launching the KayakTransporting the KayakPart of the enjoyment of spending a day on the water is being able to deal with the chore of getting the boat ready for the water. Few people have a dock in their back yard that allows them to jump in the boat anytime they feel like it. By the way, even those boats get minimal usage. The next best thing is to have a boat on a dock or on a mooring somewhere on the water within a short drive from home. For most of us, the reality of the expenses involved force us to trailer or carry the boat to a beach or launching area in a car or truck.
What does not work for me is to trailer a sailboat to a launching site and spend a long time getting the boat ready for launching. I have seen people arrive at the launch area and, even with two people doing the work, spend an hour stepping the mast, adjusting the stays, unfurling and attaching the sails, installing the outboard and launching the boat. Then, they still have to find a docking area and a place to park the car and trailer.
I have also tried the inflatable route. Even with the best pumps, hand or electric, it takes a lot of effort to get the boat ready and when you are done, you may end up with a craft that's not all that seaworthy or enjoyable.
So, after trying numerous boating options, I am happy to settle for a kayak that I can handle myself and get ready for the water in a few minutes. The 10 foot kayaks discussed above weigh only 40 pounds, they are easy to load in car or truck or carried on top of the roof. I have carried canoes and aluminum boats that way but I have never been comfortable driving at highway speed with something large on my roof. The alternative is to carry the boat in the back of an SUV (which is only 30 inches off the ground) and leave the rear hatch partially open. But this causes two problems: the interior gets dirty and the open hatch creates a lot of wind and noise at highway speed. The dirt problem can only be alleviated by letting the kayak dry out for a half hour and do a good job brushing or wiping the sand off with a towel.
But the noise can be greatly reduced with a baffle. The noise level is then reduced to being more like having a back window open rather than an open hatch. The picture below shows the baffle that I built for noise and wind reduction and also to keep the kayak in place. The baffle is made from a 2 x 4 foot piece of 3/8 plywood. To improve the seal between the car and the baffle, the top eight inch section is made of 2 inch thick foam which adapts to the contours of the back window. Home Depot sells 22 X 22 inch squares of 2 inch foam for about $5. In my car, the baffle can be attached with two small barrel bolt latches ($4) that slide into existing holes normally used for the shelf.
The two pieces of foam approximately 8 by 21 inches each, are attached to the panel in the following manner. A slot 1 ½ deep is cut with an electric knife or an electric jig saw in the middle of the foam so that the foam can slide over the top part of the plywood. Four 3/16 holes are drilled in each piece of foam through the ¾ inch wood strips front and back and through the top of the plywood panel. Holes through the foam have to be punched out. I used #8 screws with lock-nuts 2 inches long but 2 ½ long screws would make the assembly much easier.
The bottom of the panel is held in place with two 1/8 inch aluminum plates measuring 1 ½ x 2 ½ inches. They fit between the carpet and the trim of the car as seen in the photo below.
The kayak sticks out about 18 inches beyond the hatch, which comes down to rest on the boat. A cushion between the hatch and the boat avoids scratches and rattles. Two strong shock chords are needed to keep the hatch down. In my car an alarm sounds when driving with the hatch open. That problem is easily remedied. The alarm can be tricked into thinking that the hatch is locked down by tripping the lock mechanism into the closed position with a flat blade screwdriver. Be sure to unlatch it (using the clicker) before closing the hatch.
Launching the Kayak
Launching the kayak is easy. Drag it to the water and secure the trolling motor to the transom with the large knobs. The power to the motor is provided from the 2 terminals that protrude from the transom (Red is +, it goes to the front bolt). The motor is then tipped forward and the end of the two steering lines are snapped on the steering bar. Return the motor to the locked down position to tension the lines. A battery pack is then snapped in place in the control box and you are very quickly on your way for an enjoyable day on the water.
Comments