Makes And Models > Zero Motorcycles Forum | 2013+

Diginow Supercharger Source Code is now Available

(1/2) > >>

GoneToPlaid:
Brandon Nozaki Miller has posted the Diginow Supercharger source code on GitHub. Thanks, Brandon!

https://github.com/RIAEvangelist/SCv2-sketches

Electric Cowboy:
You're welcome. There are some treats in there as well, like the code to show the battery voltage on the dash when the throttle is rolled off.

Also, there is another repo which is the MIT licensed library for connecting to the Zero CAN bus. If any companies want to use it I am open to commercial licenses as well. Just be careful what you do with it. The warnings are real. I have welded contractors and had runaway bikes while performing discovery on the messages. I had to disassemble a power tank battery once to replace a contactor I borked when I was spamming the bus to see what happened on different commands. It caused the contactor to go nuts.

https://github.com/RIAEvangelist/zero-motorcycle-canbus

Kill3rT0fu:
I have a diginow pack I need to install. But I appreciate this kind of support in the community. It's part of why I went with this bike.

Unfortunately, after seeing NewZeroland's battle with the motor and encoder chip, I'm seeing how difficult it is for people to fix and repair on their own (that's a thread on its own). But I appreciate the effort when 3rd party builders open up and support a product or service

GoneToPlaid:
Here's something to get you started with a charger controller:

BOM

Arduino MKR WiFi 1010  SKU: 7630049200258
https://store-usa.arduino.cc/products/arduino-mkr-wifi-1010

Arduino MKR Can Shield  SKU: 7630049200302
https://store-usa.arduino.cc/products/arduino-mkr-can-shield?selectedStore=us

Connectors
https://www.amazon.com/MCIGICM-Waterproof-Electrical-Automotive-Connectors/dp/B0829Y7TGS

Arduino IDE
https://www.arduino.cc/en/software

CANbus library
https://github.com/coryjfowler/MCP_CAN_lib

One or more chargers. I've never bought these as I bought a used Diginow kit. Can anyone add to this thread how to option out one of these?
Elcon TC HK-J 3300W Charger
https://www.evcomponents.com/elcon-tc-hk-j-3300w-charger.html


The connector wires connect to the CANbus shield as follows:

----------------
| CAN Shield |
|                  |
|                  |
|                  |
|                  |
|                  |
|                  |
|                  |
|                  |
|  1  2  3  4   |
----------------

1 Red
2 Blue
3 Brown
4 Black



The Arduino code:

// This does the bare minimum to turn on Diginow chargers. Voltage and current are set in the program below.
// Requires the mcp_can library, from here: https://github.com/coryjfowler/MCP_CAN_lib

#include <mcp_can.h>
#include <SPI.h>

// User adjustments here
word outputvoltage = 1126; //Set starting output voltage *10.  For example, 1120 = 112.0v.  112.6 = 90% charge.   **Do not set more than 1164!!**
word outputcurrent = 60;   //Set starting output amps *10. 320 = 32A. Here, 60 means 6 amps DC output.
unsigned long int sendId = 0x1806E5F4; //CAN Id of Charge controllers - Works on Diginow chargers.

// Nothing to adjust below here
unsigned char voltamp[8] = {highByte(outputvoltage), lowByte(outputvoltage), highByte(outputcurrent), lowByte(outputcurrent),0x00,0x00,0x00,0x00}; //5th byte is charge enable. 0x01 puts it in standby.
MCP_CAN CAN(3); //CS pin for CAN Controller.

void setup() {
  Serial.begin(9600);
  while(CAN_OK != CAN.begin(MCP_ANY, CAN_250KBPS, MCP_16MHZ)){ //initialize canbus.
    delay(200);}
  CAN.setMode(MCP_NORMAL); //Change to normal mode to allow messages to be transmitted.
}

void loop() {
  CAN.sendMsgBuf(sendId, 1, 8, voltamp); //Turn on the chargers and set volts and amps, once per second.
  delay(1000);
}


Use at your own risk, of course. Hope this helps.

DerKrawallkeks:
Hey, thanks for that info.

I ordered the Elcons with the following configuration:

Battery type: Lithium-ion
Cells in series: 28
Nominal voltage: 3,7V

The rest irrelevant. I recommend adding a note "For Zero motorcycle" cause the guy at evcomponents knows the Zeros. Also you have to decide if you want the charger to be preprogrammed (then the config can't be changed), or if you want it changable via CAN. I had to wait forever to get my chargers from evcomponents though..

I have code for a controller using an ESP32 instead of an Arduino. With my code, you can change the charging current and voltage, if anyone wants that

Navigation

[0] Message Index

[#] Next page

Go to full version