Build Log: Waterproof longboard 10s LiFe with Vesc

Board looks really clean man, love it!

1 Like

Wow this board is beautiful! Im happy you liked the design of my switch and I hope it fits your needs!

1 Like

Nice :slight_smile: We have 12mm Kegels now btw. They are a much nicer/durable fit than the previous versions.

1 Like

Iā€™ve had a few people ask me how I did the Arduino battery meter so hereā€™s how I did it: :grinning: Iā€™m writing this assuming basic arduino programming knowledge and goodish math knowledge.

This is how the Arduino reads the battery voltage:

The Arduino analog pins can read anything from 0 to 5 volts so I just used resistors to drop the main voltage down before connecting to an analog pin. The voltage will still be proportional to the main voltage.

So now that the arduino can read the battery voltage it just needs to know what voltage correlates to what capacity. Since my LiFe batteries donā€™t discharge linearly I had to find an equation for the discharge curve. To do this I charged my battery fully then rode my board until it died, checking the battery voltage with a multimeter every mile and writing it down (I used the app Strava to know how many miles I had gone).

Once I had a table of data (distance traveled and voltage) I put the data in my calculator and used the calculators built in quartic regression to find an equation for the curve:

I put 5 LEDs on my board so I decided my battery meter would have 6 states: (1 means LED on and 0 means LED off)

Then I just had to use the equation to find out what the battery voltage would be at every increment.

The arduino analogRead() function doesnā€™t directly read the voltage. It only reads a fraction of the voltage determined by the resistors used in the first picture. It also doesnā€™t return the value of the voltage, it returns a number 0 through 1023 (0 being 0 volts and 1023 being the reference voltage(the reference voltage is really close to 5 volts)).

So now I had to find an equation that relates the battery voltage to the number the arduino analogRead() function returns. This is way easier than the last equation because it will be a linear one. I just needed two data points:

first data point: battery voltage: 0 analogRead(): 0

second data point: battery voltage: 33.6 analogRead(): 748

To find the second data point I just measured the battery with a multimeter and used the arduino serial monitor to display the results of analogRead().

Then I plugged these into my calculator and used linear regression to find an equation. I used that equation to translate all the battery voltage increments into what analogRead will say at those voltages:

So now I know what increments to change the LEDs at, time to program the ardiuno! The ardiuno code is really simple, here it is:

//longboard battery meter code //Nick Wallick 10/20/16

int delayTime = 100; int battery; int flashingTimer = 0;

void setup() { // put your setup code here, to run once: pinMode(A7, INPUT); pinMode(8, OUTPUT); pinMode(9, OUTPUT); pinMode(10, OUTPUT); pinMode(11, OUTPUT); pinMode(12, OUTPUT);

startupAnimation(); startupAnimation(); }

void loop() { //reads pin attached to resistors and battery battery = analogRead(A7);

//BATTERY AT 5 BARS/////////////////////////////// if (battery >= 750){ digitalWrite(8, HIGH); digitalWrite(9, HIGH); digitalWrite(10, HIGH); digitalWrite(11, HIGH); digitalWrite(12, HIGH); } //BATTERY AT 4 BARS/////////////////////////////// if (battery < 750){ if (battery >= 741){ digitalWrite(8, LOW); digitalWrite(9, HIGH); digitalWrite(10, HIGH); digitalWrite(11, HIGH); digitalWrite(12, HIGH); } } //BATTERY AT 3 BARS///////////////////////////////// if (battery < 741){ if (battery >= 737){ digitalWrite(8, LOW); digitalWrite(9, LOW); digitalWrite(10, HIGH); digitalWrite(11, HIGH); digitalWrite(12, HIGH); } } //BATTERY AT 2 BARS/////////////////////////////// if (battery < 737){ if (battery >= 734){ digitalWrite(8, LOW); digitalWrite(9, LOW); digitalWrite(10, LOW); digitalWrite(11, HIGH); digitalWrite(12, HIGH); } } //BATTERY AT 1 BAR/////////////////////////////// if (battery < 734){ if (battery >= 724){ digitalWrite(8, LOW); digitalWrite(9, LOW); digitalWrite(10, LOW); digitalWrite(11, LOW); digitalWrite(12, HIGH); } } //BATTERY AT FLASHING/////////////////////////////// if (battery < 724){ if (battery >= 683){ if (flashingTimer > 2000){ digitalWrite(8, LOW); digitalWrite(9, LOW); digitalWrite(10, LOW); digitalWrite(11, LOW); digitalWrite(12, LOW); }else{ digitalWrite(8, HIGH); digitalWrite(9, HIGH); digitalWrite(10, HIGH); digitalWrite(11, HIGH); digitalWrite(12, HIGH); } flashingTimer = flashingTimer + 1; if (flashingTimer > 8000){ flashingTimer = 0; } } } //BATTERY AT FAST FLASHING/////////////////////////////// if (battery < 683){ if (flashingTimer > 500){ digitalWrite(8, LOW); digitalWrite(9, LOW); digitalWrite(10, LOW); digitalWrite(11, LOW); digitalWrite(12, LOW); }else{ digitalWrite(8, HIGH); digitalWrite(9, HIGH); digitalWrite(10, HIGH); digitalWrite(11, HIGH); digitalWrite(12, HIGH); } flashingTimer = flashingTimer + 1; if (flashingTimer > 1000){ flashingTimer = 0; } } }

void startupAnimation() { digitalWrite(8, HIGH); delay(delayTime); digitalWrite(8, LOW); digitalWrite(9, HIGH); delay(delayTime); digitalWrite(9, LOW); digitalWrite(10, HIGH); delay(delayTime); digitalWrite(10, LOW); digitalWrite(11, HIGH); delay(delayTime); digitalWrite(11, LOW); digitalWrite(12, HIGH); delay(delayTime); digitalWrite(12, LOW); digitalWrite(11, HIGH); delay(delayTime); digitalWrite(11, LOW); digitalWrite(10, HIGH); delay(delayTime); digitalWrite(10, LOW); digitalWrite(9, HIGH); delay(delayTime); digitalWrite(9, LOW);
}

The code just reads the A7 pin and turns the right number of LEDs on depending on what A7 returns.

When writing the code I decided to add fast flashing, in addition to normal flashing, if the battery gets way too low so I know to turn it off. I also added a startup animation just cause it looks cool :slight_smile: .

Hopefully this helps some people figure out how to make a battery meter!

Also hereā€™s my full electrical drawing of the circuitboard I soldered the arduino to. The wires going up on the right go to the LEDs. This circuit board also has this mosfet switch.

10 Likes

This is one of the most beautiful builds Iā€™ve seen with external enclosures.Your enclosures along with buttons and leds just look professional. The builds I love the most are the stealth builds with a hollow wooden deck, but you have the added advantage of leaving some flex in the board for comfort!

The only thing I think you should do make it actually waterproof is getting rid of the connector between the enclosure, and making an enclosure/spray-shield for your motor so water doesnā€™t spray in to it. Iā€™m also going to do a waterproof build so yours will definitely serve as inspiration!

1 Like

Thanks so much! It would look better without the connector between the enclosures but I kinda need it for ease of maintanence. It should be fine getting wet though.

A splash guard for the motor would be good to protect the motor bearings from water. Or I can change the motor bearings with ceramic ones.

Do you have a complete list of all the parts you used?

Hey @ndwallick I love the schematic for the board and how you implemented everything, only thing I would suggest is using a small buck converter instead of the Linear one because they are 100x more efficient. Also I purchased these for headlights and they seem pretty bright, though I havenā€™t tested them on my board in real conditions yet. And for the GPS thing, Iā€™ve had an idea in dev for a little while now which would have a GPS module as well as UART communication with the VESC and connect via BT to your phone to get accurate info on your VESC as well as GPS based info, but donā€™t expect anything any time soon lol.

EDIT: you may also want to slightly bump your positive side MOSFET gate driver voltage divider resistor a little, like 12K ohms because ATM gate is being given 17V which is a little closer to the max of 20V for the 3034. You should be fine at 17V but if you wanna make sure Iā€™d go with 12K resistor. And if you really want to perfect it you could use a 12V Zener instead to give it a constant 12V.

Here you go @LivingLongboard I meant to post this earlier. All the parts I bought and their prices: https ://docs.google.com/spreadsheets/d/1z52R29VjZmLlpdBmYNeP7w5TYLwirt2lKW2v7VQmexs/edit?usp=sharing

Edit: just remove the space after https. The link was causing problems

@JdogAwesome I do plan on switching to a buck converter. At first I thought a linear voltage regulator would be fine cause it is only powering an arduino but it does get pretty warm. Il also switch to the newer higher voltage mosfets that you suggested in your post and Iā€™ll change out the resistors according to whatever those mosfets need.

Iā€™ll probably just make a whole new circuitboard with all the changes and add whatever circuitry for headlights I may need. Il definitely check out those headlights theyā€™re super cheap.

Also looking forward to your GPS module!

Fantastic build, @ndwallick!

Iā€™m looking at getting the same deck and 5065-200kv motor. Have you found the flex of the deck to be a problem? Also, how hot does the motor get during a riding session?

In hindsight is there anything you wouldā€™ve done differently with this build?

Thanks

Thanks! The deck has a medium flexiness to it. When I attached the kydex it definitely got stiffer but the flex didnā€™t cause any problems.

The motor gets pretty warm but never too hot to touch.

The main thing I changed since I finished the board is upgrading to this 12mm pulley kit because I already had a 9mm belt break.

Good luck with your build

Great, thanks for the info. What range are you getting with your 10S2P LiFe pack?

Right when I finished the build I did a range test and got 11 miles, but I was likely not pushing it very hard since I was still getting used to it. I also live in an area with no hills. So Iā€™d guess a little less than that. The board only weighs 15 pounds so thereā€™s definitely room for more battery.

1 Like

Hi! what type of mounting hardware you are using? Can you share the site, where you bought it?

general waterproofing question iā€™ve always wondered, are outrunner motors inherently waterproof? do you just need to watertight and insulate the connections coming off of them?

That is correct.

@laikiux I designed the motor mount myself and got a friend with a machine shop to machine it for me. Hereā€™s the design and hereā€™s the final product. It turned out pretty good, I just had to cut off a corner with a saw after to get more ground clearance.

@osbor Outrunners are inherently waterproof. I believe even if the connections coming off of them get wet it will be fine. Regular water isnā€™t conductive enough to screw them up electricaly. The motor bearings could rust though if they arenā€™t ceramic. Water mostly causes problems with sensitive smaller electronics like circuitboards and possibly sensors on an outrunner (havenā€™t tried those wet yet). Salt water however is more conductive and could cause problems. Hereā€™s a good video on the topic.

Sorry, but I asked for enclosure mounting hardware :smiley:

Ohhhh I used M5 bolts that are 25mm long (threads + head) with a flat head for countersinking. Then I used M5 washers and M5 nylon lock nuts on the other side. I got everything at ace hardware. Hope that helps!

2 Likes

Hello ā€œfirst time trying to build electric longboardā€ Im wondering about something, those measurements of yours, are those in mm? or? I have a friend that have acces to cnc machine, but he could not quite understands the measurements of yours, like whats R.5250 ? appreciate if you have time to answer :smiley: