I have two hobbies that I am passionate about - Fishing and Engineering. Recently on a fishing trip with a buddy his Minn Kota PowerDrive trolling motor stopped working intermittently. What makes this even worse is that we were catching some decent fish. After several cursing fits we decided to head back to the boat ramp so that I could open up the electronics to diagnose the problem. Turns out the PCB in the foot pedal controller had water in it and the contact connections had become corroded. It was the worse case of poor product engineering I had ever seen.
There is a thin plastic sheet that covers the board and holds the push contacts in place. You can see the square contacts that are corroded in the picture. I don't understand why this plastic layer was not sealed up to prevent water from entering the underside. We could actually squeeze the water out! Obviously the lead engineer was not a fisherman or Minn Kota was cutting corners. The PowerDrive is a $500 trolling motor! Pretty expensive in my opinion and deserves a quality engineered product that can withstand getting wet. If fishing is the market for the products you sell, why in the hell would you sell something that cannot get wet...its fishing Minn Kota!
Any way I am always looking for new projects and I really love projects that combine both fishing and engineering. So I have decide to embark on another Maker project. My buddy has replaced the bad PCB in the foot pedal leaving me with a good PowerDrive cable with leads for control. So it occurred to me that it might be possible to add wifi and develop a web app to control the PowerDrive with a smartphone. But wait!!! the PowerDrive runs off 12VDC and most electronics is 5/3.3VDC. That would require more components to reduce the voltage....so we hooked up the bad board and I checked the voltage on the board. BAM!!!!! 5VDC and 1AMP of current for all connections! Wahoo! Lets get started!!!
Here is the plan for this project:
- Prototype the hardware circuits for each of the controls per lead
- Constant On(blue)
- Left Turn(yellow)
- Right Turn(green)
Confirm the use of the ESP8266 as Wifi and MCU
Develop a prototype web app to confirm functionality and usefulness.
Engineer a rugged wifi device to provide wifi connection and develop an elegant web app for control.
- Hardware interface should be simple
- UI should be elegant and simple
- No internet connection dependencies
- Super fast response for control
- Integrate smartphone GPS for auto-positioning
The first step in a project like this is to confirm my understanding and develop architectures that will scale and be resilient. To do this I will prototype and test the connections between the wifi device and a simple web app. I will need to setup the PowerDrive cable so that I can easily plug/unplug for troubleshooting and testing. Below is a picture showing the test cables soldered to the leads on the PowerDrive cable. This allows me to use a breadboard for hardware and software development.
The black board in the picture is a ESP8266 development board that will allow me to engineer the wifi connection and build the compute environment that will support a wireless access point, web server, websocket server (for control), and storage for the web browser files. This is called a System on Chip or SoC.
To do some of my preliminary testing I will need to create a prototype web app to get me started. This web app is just a starting point mainly for testing the final circuit board that I will get from OSH. I created the files I needed to get me going and they are located in my GitHub repo for this project:
Here is what the web app looks like at the moment. It enough to get me started on design the circuits and creating the code for control. SPEED CONTROL will be the most difficult for me since it requires analog.
I will be using Arduino code to pull this off but I have a unique install to support the SoC files for the web server and websocket server. I will provide links that I used to create my Arduino install.
C = Constant On
I = On/Off
M = Momentary
L = Left Turn
R = Right Turn
T = TestComms
The Arduino code shows the logic I am using to turn on/off the control circuits. The digitalWrite function does this with the HIGH and LOW parameters for the assign GPIO. Which I have defined as LED1 and LED2 that I will use just for this of building the prototype. Basically pressing the button on the phone turns the circuit on and releasing the button turns the circuit off. In order to test this without having to be connected to the trolling motor I will be sending text strings to a log console and I will be using the LEDs on the board to turn on and off.....not sure what to do about analog yet.
Below is the Chrome development console where logs will show on the right and the left is a simulation of a smartphone. I will eventually move to the real hardware.
Test and development is going well so far here is a quick video showing that the comms protocol is working to control the circuits for the LEDs. Next I will begin working on the analog control for speed. I'll try to use an LED and increase from dim to bright
Well I finally figured out how to get the slider working to control speed using an analog signal. I spent a lot time looking at different code on the internet and really struggled with getting something to work. Understanding the difference between unsigned integers and integers and how to convert them was key. Also I thought the function to send the value to adjust the analog (PWM signal) would be difficult as well but it was simple. Here it is:
input type="range" name="speed_name" id="speed_id" value="0" min="0" max="1023" onchange="connection.send(this.value)"
This is HTML5 input type of "range". Basically what this line does is send a value between 0 and 1023 to the websocket connection when the value is changed! The value is determine by the position of the slider...so halfway would be 1023/2 = ~511. When this value is applied to the SPEED GPIO the Arduino code will set the voltage to 3.3/2 = ~1.65v !
Here is a video showing the change in voltage with changing the HTML 5 slider. As I move the slider you can see the voltage change on the meter!
Below is a sample of the code that is running to provide the change on voltage:
HTML 5 Code:
USE_SERIAL.printf("[%u] get binary lenght: %u\n", num, lenght);
Serial.printf("[%u] Analog GPIO Control Msg: %s\n", num, payload);
int temp = atoi((char *)payload);;//Convert the unit8 to char then to an integer
Serial.printf("Intger %u\n", temp);
Now that I have the software and hardware prototypes completed I can start testing with the trolling motor itself. But before I do it was important to make sure the GPIOs on the board were working correctly. Here is a video of the completed work so far and how I confirm the hardware and software was fully functional for further testing and development.
Here is a video of the prototype app on a smartphone....sorry about the quality:
As it turns out the ESP8266 MCU has the ability to provide voltage supply reading using the ADC circuit. As long as I am not using the ADC pin I can query the voltage and display it on the webpage. Since the regulator on the development board is stepping the voltage down from 5.0V to 3.3V, I will need to scale it back up programmatically using some math in the code. I will take the percentage of vcc reading to 3.0 and use that to convert the voltage back into a 12v scale reading. As of this version I will use 11.8 since thats the reading I get from my battery. Probably need to change this to the reading of battery in use and allow for user input when operation on a 24V system. Here is the Arduino code for this. For now I will send the reading every time ON/OFF is pressed:
if (payload == 'I')
if (payload == 'D')
percentage = (value/1000)/3.0;
actual_voltage = 11.8*percentage; //Using 11.8 to conservative
voltage = String(actual_voltage);
Here is the final prototype app. I think this is good enough to allow me to start working on the hardware and the circuits so that I can get a board made.
So testing with the development board did not go well at all. For some reason the leads coming from the trolling motor would not power the development board. I thought all power coming from batteries was DC so I did not worry too much about power hookup. The meter indicated 5.09v from the leads but when connected the dev board would not power up. Leads would power an LED but not the board! Weird! I suspect I am gonna learn something here! To get passed this issue I am going to power the dev board with USB battery and use relays on the control circuits. Relays may be in the final solution but I am not sure. I think the best approach would be to use a transistor but I need to learn more about them. I need to get something working so mechanical relays are the best bet at this point.
UPDATE: So it turns out the leads coming from the trolling motor do not have enough AMPS to boot the dev board...but just barely!!!! The meter show .19 AMPS and the dev board needs .20 AMPS....just my luck! So if I want to complete this project I need to get power from the battery that is powering the trolling motor. When powering devices that are integrated and require control interaction, its best to use the same power source. There are probably ways around this but I am not experienced enough to really know how to pull it off. The issue I have now is reducing the voltage from the battery (12v) down to the required voltage for the dev board. The ESP chip can only handle 3.3v but the dev board its self has a voltage regulatory that reduces the voltage from 5v to 3.3v. So I needed to engineer a way to reduce 12v to 5v to power the ESP. Rather than buy components and design PCB I decided to buy a USB power adapter that plugs into a cigarette lighter. It was simply a matter of using my soldering skills to remove the tension clip and probe that hold the adaptor in a cigarette lighter and attached lead with battery clips. Upon testing with meter to make the soldering was good and also testing on a battery the solution worked perfectly!!!
I am at a point that I can get started on designing the PCB. To do this I will be using Fritzing. A free app that allows you to graphically "draw" the circuit using the connections on development board and the breadboard. Simply draw out your design and the app will create a PCB schematic automatically......at least thats what I understand.
I downloaded the app from Fritzing.org and installed on my laptop.
In the picture below you can kind see how the app works I have inserted the ESP8266 board on the breadboard and will start hooking up components.
Well I finally got the turning, speed and on/off control figured out. It was a struggle getting through the lack of AMPS and I did not fully understand how the no/off circuit worked in conjunction with the speed circuit. When I tested the On/Off nothing happened because I did not have the analog speed signal turned up high enough for anything to happen. Also the dev board GPIO circuits are running at 3.3 volts and the signaling for controlling motor speed is designed for 5.0 volts. So the slider needed to be maxed out so that enough signal was coming through. For turning I had to change the GPIO pin that I was using. For some reason the multiple use pins for I/O, RX/TX, and MOSI will not turn on when the pin goes HIGH. I will need to research this issue later on for now I have enough GPIO pins to support the turning and On/off function.
Below are videos demonstrating the control with the web app for turning, speed and on/off
Now that I have a good idea about the control circuits from the Minn Kota and my prototype is working relatively well I feel comfortable doing the circuit design the printed circuit board. This will be a challenge since I have never done one but I think I can figure things out with some help from Google and few engineering friends. I have decide to use the Eagle PCB software since its includes Sparkfun parts and there seems to be more content on the internet. The Fritz design app was harder to understand how to use and I could not find many part libraries.
One of the challenges is going to be reducing the voltage from 12v to 3.3v. but I think its technically possible. Also I am going to solder the MCU or microcomputer process unit straight to the PCB. This will allow for a small footprint and give me some freedom in the design.
Below is the current design so far....I have the 12 to 3.3 designed and the ESP8266 MCU powered and integration with a 4MB Flash Disk. The antenna is design too.