Code Monkey home page Code Monkey logo

vescninebotdash's Introduction

Vesc to Ninebot Dashboard interface

Lisp code to use a Ninebot dashboard (either G30 or ES2/ES4 based) on a VESC(tm) based controller. (requires VESC Firmware 6 or above)

Wiring

Ninebot dashboards use a half-duplex serial link. To connect the dashboard to your VESC you should wire the YELLOW wire from the dashboard to the TX pin of the VESC uart connector.

Currently the button is not supported but for future reference the button uses the GREEN wire from the dashboard, it should be connected to an input on the VESC with a pullup resistor in place, when the button is pressed it grounds the line.

A note on wiring

When I was first wiring up the dashboard I didn't want to cut the wire from the dashboard. I bought a wire from Amazon that had a Julet (or Higo) connector on one side and 4 loose wires on the other. While wiring it up I discovered the pin/colors were not wired to the same pins at the Julet connector. i.e. the ground wire correctly passed through to the ground wire on the dashboard, but the other three wires were swapped in the connector. After a little investigation it seems this is a common problem as there is no specification for pin to wire color only connector size and pin spacing.

I strongly recommend you test continuity all the way from the soldered connector on the dashboard through to the end of the wire you intend to interface to the VESC. You might find that the +5v is the green wire, or alternatively you may receive a connector wire that has red/black/blue/white wires instead.

The only way to properly deal with this is to talk about colors from the dashboard side of things. On an ES2/ES4 dashboard looking at it from the circuit board side the colors and pins should be

[red]  [green]  [yellow]  [black]

5v     button   uart      ground

Software

The script currently listens for commands 0x64 and 0x65 that come from the dashboard, the dashboard sends these packets with a data blob that includes the levels of the hall sensors for both throttle and brake, these packets are decoded.

(Update:). Thew script now processes this data and convert them to (set-current-rel) and (set-brake-rel) commands. Theres a slight amount of deadspace added to the bottom end of the range (so your scooter doesn't suddenly decide to go on a short trip around your livingroom thanks to electrical interference). The whole range mapping thing probably needs a little more work and testing with other throttles and brakes to ensure a consistent range is being received from the dashboard.

When a 0x64 packet is received the dashboard expects a reply, the packet contains data that sets the info the dashboard should display, including a bit-field that sets particular properties to display.

on an ES2/ES4 dashboard

Right now, the bitfield is configured to hide the (S) (the (S) is used to show either Sport mode (in red) or Eco mode (in blue)) and switch the speed display to mph

on a G30 Max dashboard

The Bitfield is configured to show the (D) option for 'drive' mode and switch the speed display to mph

general display

There is a variable at the top of the code called bShowMPH setting this to 1 will show the speed in miles per hour (what a surprise...), setting it to 0 will show the speed in kilometers per hour and will switch the dashboard so that the km/h lights up.

Battery level is read from the vesc and displayed on the dashboard. The Ninebot dashboard battery display has 5 segments, a solid segment represents 11-20% of charge and a flashing segment represents 0-10% of charge, adding up the segments gives an estimation of charge state

e.g. 3 solid segments, a flashing segment, and an empty segment would be (20+20+20)+(10)+(0) = 60-70% charge

vescninebotdash's People

Contributors

tonymillion avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.