Difference between revisions of "Adapter V2 manual"

From Spintend service and support
 
(140 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The V2 adapter is designed to make convenient for users to connect wires of e-bike/e-scooters to the VESC. Combine with Ubox V2, We can easily to build an e-bike/e-scooter.
'''update: 07/30/2022'''


[[File:Adapter V2 PCBA.jpg|300x300px]]
Buy link: https://spintend.com/products/ewheel-adc-adapter-v2-for-diy-ebike-escooter


This manual is based on Ubox V2, for the other VESCs, the conceptions are the same.  
The V2 adapter is designed to make convenient for users to connect wires of e-bike/e-scooters to the VESC. Combine with Ubox V2 or Ubox single, We can easily to build an e-bike/e-scooter.


[[File:Adapter V2 real picture.jpg|300x300px]]
Size: 63 x 53 x 12.5 mm
This manual is based on Ubox V2 dual, for the other VESCs, the conceptions are the same.
==Features==
==Features==
#Horn, head light, turn light, brake & rear light, and reverse light support.
#Horn, head light, turn light, brake & rear light, and reverse light support.
Line 11: Line 16:
#Buzzer to prompt turn, reverse and settings.
#Buzzer to prompt turn, reverse and settings.
#Support both hall brake and mechanical brake input.
#Support both hall brake and mechanical brake input.
#Support centered(bidirectional) throttle.
#Support centered (two way) throttle.
#Two / one wheel drive support.
#Two/one wheel drive support.
#Power limit mode for compliant to the local regulations.
#Power limit mode for compliant to the local regulations.
#Convert 5V throttle and analog brake input signal to 3.3V range, no harm to VESC.


==Wiring==
==Wiring==
[[File:Ewheel ADC adapter V2 with function port.png|alt=Ewheel ADC adapter V2 with function port display|center|frameless|800x800px]]
* Mechanical brake, light, horn, reverse and cruise are actually switches, we don't need to distinguish the two wires of each switch.
* The turn left/right switch and throttle level switch, they usually has three wires,  the '''neutral''' '''wire''' is the one which can be switched on/off to  other wires, so if you are not sure the wire orders, use a multimeter to test them to find the neutral  wire first, then know what the rest two wires are.
* Usually, hand bar throttle or thumb throttle have three wires: '''black, red, green, corresponding to GND, 5V, throttle output'''.
* Users can also use these type of throttles to make ADC(analog) brake, in Adapter V2, the '''ADC brake''' signal is transferred to VESC's ADC2 pin.
* The second VESC ADC PORT is for two wheel drive config, '''if you have one wheel drive only, connect MAIN PORT  to VESC'''.
* Adapter need a 5V and 12V power source, the 5V is get from VESC ADC port, users need to connect a 12V power source to adapter's 12V socket, for Ubox V2 connect to its FAN socket.
* The rear and brake light, usually comes with three wires in common ground connection mode, the two lights share one GND. '''Connect the positive(anode) wire of rear light to 12V, and brake light's to Brake light+, and their negative(cathode) wire to GND.'''
*The other lights and horn are low side switched, so connect the '''positive(anode) wire to the '12V' pin''', and the '''negative(cathode) wire to the pin with a '-' suffix'''.
*For '''Ubox single 75V''', the extra NRF port is not available, or for the other VESCs without NRF port (some vendor referred as second UART), if the cruise and reverse functions are not needed,  the TX and RX pin from the 8 pin port can connect to VESC Bluetooth by pick out the wires from the cable. Or you can refer to this small kit : the single vesc UART port seperator:https://spintend.com/collections/diy-tools-and-accessory/products/single-vesc-uart-port-seperator
== The throttle, brake, their switch and potentiometers ==
Some ebike/escooters have 3 level throttles, VESC does not support 3 level.
Most throttle working on 5V, and output voltage up to 4.2V, VESC can only accept ADC input within 3.3V (3.44V for some hard ware version).
VESC supports analog brake (variable/propotional) input to its ADC2, common ebike/escooter only provide a electronic switch attached to mechanical brake.
The adapter V2 do these translating jobs, makes VESC a full funtional ebike/scooter controller.
The adapter V2 divide the 5V range throttle, remap it to 3 levels, send to VESC ADC1; Simulate an analog brake voltage to the VESC ADC2 when the mechanical brake switch is triggered; Co-work analog brake input with mechanical brake.  This dividing, remapping, and simulating can be adjust to require your demands with these switch and potentiometers:
[[File:Switch and potentiometers of adapter V2.jpg|400x400px]]


== On board switch and potentiometers ==
The potentiometers are '''increase clockwise''' and '''decrease counterclockwise'''.


=== Throttle and brake power supply ===
=== Throttle and brake power supply ===
Line 23: Line 53:


=== Throttle potentiometers ===
=== Throttle potentiometers ===
Adapter V2 supports three level throttles, the High level is equal to the throttle handle in put. The middle and low is scaled from throttle handle in put according to the M and L potentiometer's positions. The scale range is from 0 to 100%.  
Adapter V2 supports three level throttles, the High level is equal to the throttle handle in put. The middle and low level are remaped from throttle handle input according to the 'THR M' and 'THR L' potentiometer's positions. The reamap range is from 0 to 100%.  
 
'''If you are not connect a three level throttle switch to adapter,  in case you don't have it or don't need it, the default throttle level is middle, so adjust the''' '''<nowiki/>'THR M' potentiometer to its maximum postion (clockwise), let the adapter not shrink the''' '''orginal throttle to''' '''the VESC.'''
 
'''Set 'M' and 'L' potentiometers to their maximum postion (clockwise) when do the input setup on the VESC tool to avoid some confusion.'''


=== Brake potentiometer ===
=== Brake potentiometer ===
When trigger the mechanical brake, adapter V2 will assist it with regenerative brake automatically, the regenerative brake strength is according to the 'BRK' potentiometer, from 0 to 100%.  
Mechanical brake have a electronic switch, to tell ESC to stop driving, some ESC can then do regenrative braking. 
 
When trigger the mechanical brake switch, adapter V2 will assist it with regenerative brake automatically, the regenerative brake strength is according to the 'BRK' potentiometer, from 0 to 100%. '''Set it to its maximum postion when do the input setup on the VESC tool.''' 
 
=== Analog/variable brake ===
When no actions happened from mechanical brake(no braking), adapter V2 will conduct the analog voltage from "ABRK"  to the VESC ADC2. There for to support the analog/variable brake.
 
=== What if I don't want a regenrative brake? ===
So the ADC2 input is no needed for VESC, set the APP mode to "Current", set to "Current Reverse Button" mode if you need a reverse function.
 
== The brake, throttle level, and trun left/right switch ==
[[File:The brake, throttle level, and trun leftright switch.jpg|border|frameless|640x640px]]
== The cruise, reverse, and horn inputs ==
[[File:The cruise, reverse, and horn function.jpg|frameless|619x619px]]
 
== The lights and horn output ports ==
[[File:The lights and horn output ports.jpg|frameless|630x630px]]


== Mode configuring ==
== Adapter's own Mode configuration ==
Adapter V2 has 3 mode configurations: '''2/1 wheel drive mode switching,''' '''power limit mode on/off, and unidirectional / bidirectional throttle switching'''.
Adapter V2 has 3 mode configurations: '''two/one wheel drive mode switching,''' '''power limit mode on/off, and one way/ two way throttle switching'''.


===Two/one wheel drive mode switching===
===Two/one wheel drive mode switching===
Hold both the right and left brake handles then power on the system, the adapter will toggle the 2/1 drive mode, after the switching, the buzzer will ring '''once for one wheel mode''', and '''twice for two wheel mode'''. Release both left and right brake.
Hold both the right and left brake handles then power on the system, the adapter will toggle the 2/1 drive mode, after the switching, the buzzer will ring '''once for one wheel mode''', and '''twice for two wheel mode'''. Release both left and right brake.


The principle of 2 wheel drive is to copy the control signal from main ESC to the second ESC. In order to implement this function, the CAN bus connection of two ESCS need to set off, for Ubox, please refer:  [[The power button of Ubox#The click button configuration]].
The principle of 2 wheel drive is to copy the control signal from main ESC to the second ESC. In order to implement this function, the CAN bus connection of two ESCS need to set off, for Ubox dual, it has a internal CAN bus connection, please refer:  [[The power button of Ubox#The click button configuration]].


===Power limit mode===
'''Note: The new version firmware support a button to control the two/one wheel driving mode switching:'''
Hold both the left brake handle and the throttle handle bar, then power on the system, the adapter will toggle the power limited/unlimited mode, after the switching, the buzzer will ring '''three times''' to indicate the mode change, release the throttle and left brake.


The principle of Power limit mode is to scale the throttle handle bar's input to the L level, ignores the H, M, L state. So set the L level to meet your local regulations.
[[File:Ewheel adc adapter v2 switching dual single motor mode(quare).jpg|alt=adc adapter v2 Two/one wheel drive switching port for button collection|frameless|400x400px]]


By connect the TX pin to the GND, the adapter will swtich to two wheel drive mode, will copy the throttle and brake signle from main socket to the secondary socket.
===Power limit mode===
'''When power on, the buzzer will ring to prompt the power limit mode state:'''
'''When power on, the buzzer will ring to prompt the power limit mode state:'''


'''Ring one time ---- Limited mode.'''
'''Ring one time ---- Limited mode.'''


'''Ring three times ---- Unlimited mode.'''  
'''Ring three times ---- Unlimited mode.'''
 
To change mode:
 
'''Hold both the left brake handle and the throttle handle bar, then power on the system,''' the adapter will switch the power limited/unlimited mode, after the switching, the buzzer will ring '''three times''' to indicate the mode change, '''release the throttle and left brake immediately.'''
 
'''If not release them in time''', the adapter will proceed to next setting: Two/one way throttle switching.
 
The principle of Power limit mode is to scale the throttle handle bar's input to the L level, ignores the H, M, L state. So set the L level to meet your local law regulations.
=== Two/one way throttle switching ===
Two way throttle is being referred as 'centered' throttle in VESC tool, it return to its center position when idle.
 
To change mode:


=== Unidirectional / centered(bidirectional) throttle switching ===
Hold both the left brake handle and the throttle handle bar, then power on the system, wait the buzzer ring '''three times, then still hold throttle and left brake 3 more seconds,''' until the buzzer '''again to ring 6 times''', release the throttle and  left brake.
Hold both the left brake handle and the throttle handle bar, then power on the system, wait the buzzer ring '''three times, then still hold throttle and left brake 3 more seconds,''' until the buzzer '''again to ring 6 times''', release the throttle and  left brake.


The difference between unidirectional / centered(bidirectional) mode is, in unidirectional mode, the throttle output to ESC is as same as input throttle, in centered mode, if the brake not triggered, it is acting like unidirectional mode; if the brake handle is triggered, it will replace the throttle output with the brake signal from the brake input.
The setting entry is shared with power limit mode switching, so we need to wait the power limit mode setting being time out.
 
The difference between adapter's two/one way mode is, in one way mode, the throttle output to ESC is as same as throttle input, in two way mode, if the brake not triggered, throttle output to ESC is as same as throttle input; If the brake handle is triggered, it will replace the throttle output with the brake signal from the brake input.


==Setup in VESC tool==
==Setup in VESC tool==
Before setup control logic to the VESC, we need to setup motor's FOC first. The following contents are based on VESC tool PC edition.  
Before setup control logic to the VESC, we need to setup motor's FOC first. The following contents are based on VESC tool 3.01 PC edition.
 
The setup input wizard of VESC tool 3.01 (FW 5.3) is easy to fail:
 
[[File:False firmware issue.jpg|frameless|413x413px]]
 
This is because there is too many data transfered on CAN bus when ESCs are bound to gether by CAN bus, the firmware check command is being blocked. '''Two solve this issue, we can reduce the CAN bus load by disable the secondary ESC's CAN status, then we set the main ESC's input separately first, then set the secdary ESC as salve on CAN bus manually.'''
 
For two wheel drive mode, the principle is set ADC input on main ESC (this guide will assign it to ESCA), then let the control signal relied to ESCB by CAN bus.
 
For two/one wheel drive switchable configuration, the principle is to turn off CAN bus connection, let the adapter to send the control single to the two ESCs separately.
 
For '''two way throttle''',  we need to change the control mode in VESC to 'center' mode, we adopt the ''''Current No Reverse Brake Center'''' mode in this guide. We also can do two/one wheel drive mode for two way throttle.
 
'''For one way throttle with regenerative brake, we adopt the 'Current Reverse ADC2 Brake Button' mode.'''
 
The Ubox dual has a internal 2.4G receiver,  the receiver is no use in this application, we can disable receiver by click the button 9 times after the Ubox powered on and the button LED solid.
 
We will begin from one way throttle with two wheel drive mode. For the two/one drive switch-able mode, just disable the CAN bus connection and set the ADC control mode on the secondary ESC similar to main ESC . For the two way throttle, just set the control mode to 'Current No Reverse Brake Center'.
 
'''During the setup, the motor will spin even to full speed, keep every thing and every one away from the motor to avoid damage or injury.'''
 
=== Prepare ===
Refer the wiring picture to make wirings:
# Set the throttle and power supply switch to the voltage your throttle required on the adapter board.
# Set the brake potentiometer to its maximum positon (increase clockwise) on the adapter board.
# Set the throttle "M" and "L" potentiometers all to their maximum positon (increase clockwise) on the adapter board.
#Connect the throttle to the "GND", "THR“, "5V", respectively. '''Measure the "THR" voltage to the GND with a multimeter if you are not sure the wires are connected correctly or the throttle is defective'''. The voltage should be 0-0.8V when idle, and 3.5-4.2V when triggled.
# Connect the mechanical brake switch to the "L.BRK", "R.BRK" respectively if you have them.
# Connect the analog brake to the "G", "ABRK", "5V" respectively if you have a  analog brake such as hall throttle, a potentiometer etc.
# For the cruise, horn, head light, they are working indepently from the VESC, so we can set them later.
 
----
 
=== Two wheel drive only mode with one way throttle on VESC tool PC edition ===
If you want  2 wheel drive only mode, you can config the two ESC of Ubox into CAN mode, let the control signals relay through the CAN bus.
 
'''If you don't use any machanical, analog brake for regenerative brake, to set the APP mode to "Current" , "Current Reverse center" or "Current Reverse Button" mode instead of "Current reverse ADC2 Brake Button" mode, the "Current Reverse Button" is suggested because it supports reverse fucntion.'''
 
1.After Ubox power on, and button LED solid, click the button 6 times, then wait 1 second, the internal CAN bus connection is on.
 
2. Do the FOC setup for both ESC. 
 
3. Set the adapter V2 to one way throttle mode (default shipping mode), the Two/one wheel drive mode is meaningless in this configuration.
 
4.Plug in the ADC cable only from adapter's main socket to ESCA's socket.
 
5.'''Set you throttle handle bar's H-M-L switch to H position, if you don't have this switch, adjust the 'THR M‘ potentiometer to it max position (increase clockwise).'''
 
6. '''Set the brake potentiometer to max position,''' connect ADC (HALL or analog) brake if you have it.
 
7.Then use a USB cable plug into ESCA, on the VESC tool PC edition: make connection:
 
[[File:Make connection.jpg|frameless|400x400px]]
 
8. Then connect to the secondary ESC on the CAN bus:
 
[[File:Connect to secondary ESC.jpg|frameless|400x400px]]
 
9. Then reset the secondary ESC's APP settings.
 
[[File:Reset app settings.jpg|frameless|400x400px]]


For 2/1 switch-able configuration, the setup is a little more complicated.  
On the right sidebar, click '<nowiki/>'''Read app configuration'''<nowiki/>', ''''Read default app configuration'''<nowiki/>', ''''Write app configuration'''<nowiki/>' to restore default settings.


The Ubox has a internal 2.4G receiver, in this application, we can disable receiver, by click the button 9 times after the Ubox powered on and the button LED solid.
10. Then go back to main ESC, do setup input wizard:
=== Two wheel drive mode only ===
If you want  2 wheel drive mode only, you can config the two ESC of Ubox into CAN mode, let the control signals relay through the CAN bus. We can let the wizard to finish the input setup.


1.After Ubox power on, and button LED solid, click the button 6 times, then wait 1 second, the internal CAN bus connection is on.
[[File:Go back to main esc and do setup input.jpg|frameless|400x400px]]


2.Plug in the ADC cable only from adapter's main socket to ESCA's socket.
[[File:Input setup wizard step 1.jpg|frameless|400x400px]]


3.Set you throttle handle bar's H-M-L switch to H position.
[[File:This vesc.jpg|frameless|400x400px]]


4.Then use a USB cable plug into ESCA, on the VESC tool PC edition:
[[File:Select adc input.jpg|frameless|400x400px]]


[[File:Setup_input.jpg|300x300px]]
11. Do ADC mapping:


[[File:Welcome_to_input_setup_wizard.jpg|300x300px]]
[[File:Set adc mapping.jpg|frameless|400x400px]]


[[File:Multiple_vescs.jpg|300x300px]]
In this step, push/rotate the throttle, triggle the mechanical brake or rotate the analog brake to let the VESC learn the throttle and brake input voltage, '''Apply then next.'''


[[File:Choose_app.jpg|300x300px]]
'''If you don't have a mechanical brake or analog brake, set the mode to "Current Reverse Button" instead of "Current Reverse ADC2 Brake Button".'''


[[File:Adc_mapping.jpg|alt=Adc mapping|300x300px]]
[[File:Conclusion.jpg|frameless|400x400px]]


In this step, pull the throttle and the brake handles, to let the ESC learn the input signal. If you don't have handle for brake, switch the brake mode switch to 'SW' mode, then use a screw to adjust the 'BRK' potentiometer to fulfill the ADC CH2 learning.
11. Then set the secondary ESC as slave to follow main ESC.


[[File:Adc configuration.jpg|300x300px]]
[[File:Set slave ESC.jpg|border|frameless|400x400px]]


[[File:Conclusion.jpg|300x300px]]
Finished, test the throttle and brake to check if two ESCs are running normally.


[[File:Set up adc mode.jpg|300x300px]]
'''If you want reverse and curise function, go to set "APP to Use" to "ADC" only mode:'''


Go to APP Settings->General->APP to Use, set it to '''ADC'''.
[[File:Set app to use adc only.jpg|frameless|400x400px]]
----


[[File:Write app configuration.jpg|300x300px]]
=== Two wheel drive only mode with one way throttle on VESC tool mobile ===
On VESC tool mobile, the principle is same, only the UI apearence is different, and we need a BlueTooth module to make wireless connection with phone. Below screenshots are based on VESC tool moble for ios.


Click Write app configuration, to save configuration to ESC.
Let's do parepares as discribled above, and step 1-6 in the chapter "'''Two wheel drive only mode with one way throttle on VESC tool PC edition'''".


Finished, to check if all the controls are working correctly.
Power on the Ubox V2 plug a BlueTooth module into the NRF socket.


=== Two/one wheel drive switch-able ===
Click the power button of Ubox V2 3 times, wait 1 seconds, Ubox V2 will swtich the NRF connection to ESCA, the bule LED will turn on at ESCA side.
If you want a switch-able system, you  need to separate two ESCS from CAN bus, let them working alone. And set each of them one by one.


#After Ubox power on, and button LED solid, click the button 7 times, then wait 1 second, the internal CAN bus connection is off.
Start the VESC tool mobile APP.
#Plug in an ADC cable from adapter's main socket to ESCA's socket.
#Plug in another ADC cable from adapter's second socket to ESCB's socket.
#Set you throttle handle bar's H-M-L switch to H position.
#Then use a USB cable plug into ESCA, setup ESCA first.
On the VESC tool PC edition:


[[File:Set up adc mode.jpg|300x300px]]
[[File:Make connection on vesc tool mobile.jpg|frameless]]


<br style="clear:both;">1.Click connect.
[[File:Start screen on vesc tool mobile.jpg|frameless|533x533px]]


2.Read out APP configuration.
[[File:Choose vesc over can on vesc tool mobile.jpg|frameless|533x533px]]


3.Goto APP Settings->General->APP to Use, set it to '''ADC'''.


Then
[[File:Select input type on vesc tool mobile.jpg|frameless|533x533px]]


[[File:Setup adc control type.jpg|300x300px]]


<br style="clear:both;">Go to APP Settings->General->ADC->General->Control Type set it to '''Current Reverse ADC2 Brake Button'''.
[[File:Mappin adc input on vesc tool mobile.jpg|frameless|533x533px]]


Then
[[File:Set control mode on vesc tool mobile.jpg|frameless|533x533px]]


[[File:Setup adc mapping.jpg|300x300px]]


<br style="clear:both;">1.Goto APP Settings->General->ADC->Mapping page.


2.Set mode to '''Current Reverse ADC2 Brake Button'''.
[[File:Can device list.jpg|frameless|533x533px]]


3.Click '''Reset min and max'''.


4.Click '''RTAPP''' (real time app data).
[[File:App config no app on vesc tool mobile.jpg|frameless|533x533px]]


5.In this step, pull the throttle and the brake handles, to let the ESC learn the input signal. If you don't have handle for brake, switch the brake mode switch to 'SW' mode, then use a screw to adjust the 'BRK' potentiometer to fulfill the ADC CH2 learning.


6.Click Apply.
[[File:App config can status on vesc tool mobile.jpg|frameless|533x533px]]


7.Click Write app configuration, to save configuration to ESC.
----


[[File:Write app configuration.jpg|300x300px]]
===Two/one wheel drive switch-able===
If you want a switch-able system, you need to separate two ESCS from CAN bus, let them working alone. And set each of the two ESCs one by one.


ESCA is finished, click disconnect, connect the USB cable to ESCB, do the above config for the ESCB.
#Do the prepare steps.
#Set adapter to two/one wheel drive switch-able mode.
#After Ubox power on, and button LED solid, click the button 7 times, then wait 1 second, the internal CAN bus connection is off.
#Plug in an ADC cable from adapter's main socket to ESCA's socket.
#Plug in another ADC cable from adapter's second socket to ESCB's socket.
#Do setup input wizard setps as "'''Two wheel drive only mode with one way throttle'''"  separately for each ESC.


When two ESCs are finished, to check if both ESCA and ESCB are working correctly.
When two ESCs are finished, to check if both ESCA and ESCB are working correctly, and to try to switch the two/one wheel drive mode, to check if the switching is working.
----


=== Centered throttle ===
===Two way (centered) throttle===
Centered throttle setting is similar to above two modes, except we need to choose the '<nowiki/>'''Current No Reverse Center'''<nowiki/>' mode instead of ''''Current Reverse ADC2 Brake Button'''<nowiki/>'.
Two way throttle setting is similar to above two modes, except we need to choose the '<nowiki/>'''Current No Reverse Brake Center'''<nowiki/>' mode in the APP Settings->General->General page, instead of ''''Current Reverse ADC2 Brake Button'''<nowiki/>'.


Before configure on VESC tool, set adapter to two way (centered) throttle mode first.
==Concludes and explains==
==Concludes and explains==


# The reverse function is remapped on to the RX pin of VESC's ADC & UART socket. And the cruise function onto the TX pin. So  we suggested to '''use ADC only mode instead of ADC and UART mode'''. This is a link to illustrate the mapping of TX RX pins: https://vesc-project.com/node/600  
#The reverse function is mapped on to the RX pin of VESC's ADC & UART socket. And the cruise function onto the TX pin. So  we suggested to '''use ADC only mode instead of ADC and UART mode'''. This is a link to illustrate the mapping of TX RX pins: https://vesc-project.com/node/600
# There are many ADC control mode in the VESC, the most flexible mode is '''Current Reverse ADC2 Brake Button,''' it supports cruise, reverse, and ADC brake, if you want a button brake, you can let the brake input connect to a button with the other pin of the button  connected to  VDD (3.3V).
#If you don't need the reverse and cruise function, you can set the 'APP to use' to 'ADC and UART'.
# If you have a bidirectional throttle, please set adapter to bidirectional mode. Although the ADC2 is connected to VESC in centered throttle mode, but the ADC2 is no use for VESC to do brake, VESC brake is triggered by the throttle's lower half travel. When mechanical brake is triggered, adapter will replace the throttle output to VESC with a value according to brake potentiometer's.
#There are many ADC control mode in the VESC, the most flexible mode is '''Current Reverse ADC2 Brake Button,''' it supports cruise, reverse, and ADC brake, if you want a button brake, you can let the brake input connect to a button with the other pin of the button  connected to  VDD (3.3V).
#For UBox's power button click function, please refer: [[The power button of Ubox|The power button of Ubox.]]  
#For UBox's power button click function, please refer: [[The power button of Ubox|The power button of Ubox.]]
#On Ubox, the two/one wheel drive switching can also be achieved by Ubox's power button to turn on/off its internal CAN bus connection.
#On Ubox dual, the two/one wheel drive switching can also be achieved by Ubox's power button to turn on/off its internal CAN bus connection.
#For the ignite key and voltage meter of Ubox V2, please refer: [[The CAN-IN and IGNITE socket of Ubox V2|The CAN-IN and IGNITE socket of Ubox V2.]]
#For the ignite key and voltage meter of Ubox V2, please refer: [[The CAN-IN and IGNITE socket of Ubox V2|The CAN-IN and IGNITE socket of Ubox V2.]]
#
#
Line 158: Line 281:
==Caution and limits==
==Caution and limits==


# Since our solution is based on open source VESC, users should fully understand the risks of open source projects. This article only describes the possibility of this build method, and is not responsible for the damage and accidents caused by user themselves.
#'''Use a battery to power the system instead of a AC adapter power source, because AC adapter can't handle the brake current, will damage the ESC or power source. And recommend to add a fuse in to the power line to deal with accidents.'''
# This product is for DIY purpose, so we only offer a very limited warranty.
#'''For two/one wheel drive switchable mode, when switch to one wheel mode, the ADC1 and ADC2 pins of secondary ESC are floating! This is the default circuit design of most VESC hardwares,''' '''a floating ADC input is easy to be interfered, cause the ESC out of control! Make pull down resistors on ADC pins to the GND, 20K - 30K is usually appropriate.''' Ubox V2 and Ubox single 100V have built in pulldown resistors, no need extra pulldown resistors.
#Since our solution is based on open source VESC, users should fully understand the risks of open source projects. This article only describes the possibility of this build method, and is not responsible for the damage and accidents caused by user themselves.
#This product is for DIY purpose, so we only offer a very limited warranty.
==FAQ==
 
===Q: What is the requirement of the lights and horn?===
A: The adapter is designed for 12V power source, so they need to be 12V spec. And the total current is limited within 3A, if you are using Ubox as 12V power source.
 
===Q: Can my Bluetooth or DAVEGA share the 8 pin UART-ADC port with adapter V2?===
A: The Bluetooth and DAVEGA are using the UART port, so you can pick out the TX&RX of the UART wires from the 8pin cable to connect them, '''and set the ‘APP to Use’ to 'ADC and UART'.'''
 
[[File:Separate the TX RX from 8 pin port.jpg|frameless]]


===Q: My VESC only have a 5V power source, can I use this adapter?===
A: The 12V for adapter is for power the lights, and horn, the logic circuit is using the 5V, if your lights and horn can work with 5V, you can connect your 5V source into the adapter's 12V socket, they will working.


==Firmware and PC loader app==
https://github.com/JohnSpintend/Adapter-V2-FW


==See also==
==See also==
[[Main Page]]
[[Main Page]]
==FAQ==

Latest revision as of 21:24, 1 August 2022

update: 07/30/2022

Buy link: https://spintend.com/products/ewheel-adc-adapter-v2-for-diy-ebike-escooter

The V2 adapter is designed to make convenient for users to connect wires of e-bike/e-scooters to the VESC. Combine with Ubox V2 or Ubox single, We can easily to build an e-bike/e-scooter.

Adapter V2 real picture.jpg

Size: 63 x 53 x 12.5 mm

This manual is based on Ubox V2 dual, for the other VESCs, the conceptions are the same.

Features

  1. Horn, head light, turn light, brake & rear light, and reverse light support.
  2. High, middle, low, 3 level throttle support.
  3. Motor reverse and cruise support.
  4. Buzzer to prompt turn, reverse and settings.
  5. Support both hall brake and mechanical brake input.
  6. Support centered (two way) throttle.
  7. Two/one wheel drive support.
  8. Power limit mode for compliant to the local regulations.
  9. Convert 5V throttle and analog brake input signal to 3.3V range, no harm to VESC.

Wiring

Ewheel ADC adapter V2 with function port display
  • Mechanical brake, light, horn, reverse and cruise are actually switches, we don't need to distinguish the two wires of each switch.
  • The turn left/right switch and throttle level switch, they usually has three wires, the neutral wire is the one which can be switched on/off to other wires, so if you are not sure the wire orders, use a multimeter to test them to find the neutral wire first, then know what the rest two wires are.
  • Usually, hand bar throttle or thumb throttle have three wires: black, red, green, corresponding to GND, 5V, throttle output.
  • Users can also use these type of throttles to make ADC(analog) brake, in Adapter V2, the ADC brake signal is transferred to VESC's ADC2 pin.
  • The second VESC ADC PORT is for two wheel drive config, if you have one wheel drive only, connect MAIN PORT to VESC.
  • Adapter need a 5V and 12V power source, the 5V is get from VESC ADC port, users need to connect a 12V power source to adapter's 12V socket, for Ubox V2 connect to its FAN socket.
  • The rear and brake light, usually comes with three wires in common ground connection mode, the two lights share one GND. Connect the positive(anode) wire of rear light to 12V, and brake light's to Brake light+, and their negative(cathode) wire to GND.
  • The other lights and horn are low side switched, so connect the positive(anode) wire to the '12V' pin, and the negative(cathode) wire to the pin with a '-' suffix.
  • For Ubox single 75V, the extra NRF port is not available, or for the other VESCs without NRF port (some vendor referred as second UART), if the cruise and reverse functions are not needed, the TX and RX pin from the 8 pin port can connect to VESC Bluetooth by pick out the wires from the cable. Or you can refer to this small kit : the single vesc UART port seperator:https://spintend.com/collections/diy-tools-and-accessory/products/single-vesc-uart-port-seperator

The throttle, brake, their switch and potentiometers

Some ebike/escooters have 3 level throttles, VESC does not support 3 level.

Most throttle working on 5V, and output voltage up to 4.2V, VESC can only accept ADC input within 3.3V (3.44V for some hard ware version).

VESC supports analog brake (variable/propotional) input to its ADC2, common ebike/escooter only provide a electronic switch attached to mechanical brake.

The adapter V2 do these translating jobs, makes VESC a full funtional ebike/scooter controller.

The adapter V2 divide the 5V range throttle, remap it to 3 levels, send to VESC ADC1; Simulate an analog brake voltage to the VESC ADC2 when the mechanical brake switch is triggered; Co-work analog brake input with mechanical brake. This dividing, remapping, and simulating can be adjust to require your demands with these switch and potentiometers:

Switch and potentiometers of adapter V2.jpg

The potentiometers are increase clockwise and decrease counterclockwise.

Throttle and brake power supply

If your throttle can only accept 3.3V supply, set the ‘HALL VDD’ switch to '3.3V' side. Otherwise set it to '5V'. The ADC brake port shares this supply too.

Throttle potentiometers

Adapter V2 supports three level throttles, the High level is equal to the throttle handle in put. The middle and low level are remaped from throttle handle input according to the 'THR M' and 'THR L' potentiometer's positions. The reamap range is from 0 to 100%.

If you are not connect a three level throttle switch to adapter, in case you don't have it or don't need it, the default throttle level is middle, so adjust the 'THR M' potentiometer to its maximum postion (clockwise), let the adapter not shrink the orginal throttle to the VESC.

Set 'M' and 'L' potentiometers to their maximum postion (clockwise) when do the input setup on the VESC tool to avoid some confusion.

Brake potentiometer

Mechanical brake have a electronic switch, to tell ESC to stop driving, some ESC can then do regenrative braking.

When trigger the mechanical brake switch, adapter V2 will assist it with regenerative brake automatically, the regenerative brake strength is according to the 'BRK' potentiometer, from 0 to 100%. Set it to its maximum postion when do the input setup on the VESC tool.

Analog/variable brake

When no actions happened from mechanical brake(no braking), adapter V2 will conduct the analog voltage from "ABRK" to the VESC ADC2. There for to support the analog/variable brake.

What if I don't want a regenrative brake?

So the ADC2 input is no needed for VESC, set the APP mode to "Current", set to "Current Reverse Button" mode if you need a reverse function.

The brake, throttle level, and trun left/right switch

The brake, throttle level, and trun leftright switch.jpg

The cruise, reverse, and horn inputs

The cruise, reverse, and horn function.jpg

The lights and horn output ports

The lights and horn output ports.jpg

Adapter's own Mode configuration

Adapter V2 has 3 mode configurations: two/one wheel drive mode switching, power limit mode on/off, and one way/ two way throttle switching.

Two/one wheel drive mode switching

Hold both the right and left brake handles then power on the system, the adapter will toggle the 2/1 drive mode, after the switching, the buzzer will ring once for one wheel mode, and twice for two wheel mode. Release both left and right brake.

The principle of 2 wheel drive is to copy the control signal from main ESC to the second ESC. In order to implement this function, the CAN bus connection of two ESCS need to set off, for Ubox dual, it has a internal CAN bus connection, please refer: The power button of Ubox#The click button configuration.

Note: The new version firmware support a button to control the two/one wheel driving mode switching:

adc adapter v2 Two/one wheel drive switching port for button collection

By connect the TX pin to the GND, the adapter will swtich to two wheel drive mode, will copy the throttle and brake signle from main socket to the secondary socket.

Power limit mode

When power on, the buzzer will ring to prompt the power limit mode state:

Ring one time ---- Limited mode.

Ring three times ---- Unlimited mode.

To change mode:

Hold both the left brake handle and the throttle handle bar, then power on the system, the adapter will switch the power limited/unlimited mode, after the switching, the buzzer will ring three times to indicate the mode change, release the throttle and left brake immediately.

If not release them in time, the adapter will proceed to next setting: Two/one way throttle switching.

The principle of Power limit mode is to scale the throttle handle bar's input to the L level, ignores the H, M, L state. So set the L level to meet your local law regulations.

Two/one way throttle switching

Two way throttle is being referred as 'centered' throttle in VESC tool, it return to its center position when idle.

To change mode:

Hold both the left brake handle and the throttle handle bar, then power on the system, wait the buzzer ring three times, then still hold throttle and left brake 3 more seconds, until the buzzer again to ring 6 times, release the throttle and left brake.

The setting entry is shared with power limit mode switching, so we need to wait the power limit mode setting being time out.

The difference between adapter's two/one way mode is, in one way mode, the throttle output to ESC is as same as throttle input, in two way mode, if the brake not triggered, throttle output to ESC is as same as throttle input; If the brake handle is triggered, it will replace the throttle output with the brake signal from the brake input.

Setup in VESC tool

Before setup control logic to the VESC, we need to setup motor's FOC first. The following contents are based on VESC tool 3.01 PC edition.

The setup input wizard of VESC tool 3.01 (FW 5.3) is easy to fail:

False firmware issue.jpg

This is because there is too many data transfered on CAN bus when ESCs are bound to gether by CAN bus, the firmware check command is being blocked. Two solve this issue, we can reduce the CAN bus load by disable the secondary ESC's CAN status, then we set the main ESC's input separately first, then set the secdary ESC as salve on CAN bus manually.

For two wheel drive mode, the principle is set ADC input on main ESC (this guide will assign it to ESCA), then let the control signal relied to ESCB by CAN bus.

For two/one wheel drive switchable configuration, the principle is to turn off CAN bus connection, let the adapter to send the control single to the two ESCs separately.

For two way throttle, we need to change the control mode in VESC to 'center' mode, we adopt the 'Current No Reverse Brake Center' mode in this guide. We also can do two/one wheel drive mode for two way throttle.

For one way throttle with regenerative brake, we adopt the 'Current Reverse ADC2 Brake Button' mode.

The Ubox dual has a internal 2.4G receiver, the receiver is no use in this application, we can disable receiver by click the button 9 times after the Ubox powered on and the button LED solid.

We will begin from one way throttle with two wheel drive mode. For the two/one drive switch-able mode, just disable the CAN bus connection and set the ADC control mode on the secondary ESC similar to main ESC . For the two way throttle, just set the control mode to 'Current No Reverse Brake Center'.

During the setup, the motor will spin even to full speed, keep every thing and every one away from the motor to avoid damage or injury.

Prepare

Refer the wiring picture to make wirings:

  1. Set the throttle and power supply switch to the voltage your throttle required on the adapter board.
  2. Set the brake potentiometer to its maximum positon (increase clockwise) on the adapter board.
  3. Set the throttle "M" and "L" potentiometers all to their maximum positon (increase clockwise) on the adapter board.
  4. Connect the throttle to the "GND", "THR“, "5V", respectively. Measure the "THR" voltage to the GND with a multimeter if you are not sure the wires are connected correctly or the throttle is defective. The voltage should be 0-0.8V when idle, and 3.5-4.2V when triggled.
  5. Connect the mechanical brake switch to the "L.BRK", "R.BRK" respectively if you have them.
  6. Connect the analog brake to the "G", "ABRK", "5V" respectively if you have a analog brake such as hall throttle, a potentiometer etc.
  7. For the cruise, horn, head light, they are working indepently from the VESC, so we can set them later.

Two wheel drive only mode with one way throttle on VESC tool PC edition

If you want 2 wheel drive only mode, you can config the two ESC of Ubox into CAN mode, let the control signals relay through the CAN bus.

If you don't use any machanical, analog brake for regenerative brake, to set the APP mode to "Current" , "Current Reverse center" or "Current Reverse Button" mode instead of "Current reverse ADC2 Brake Button" mode, the "Current Reverse Button" is suggested because it supports reverse fucntion.

1.After Ubox power on, and button LED solid, click the button 6 times, then wait 1 second, the internal CAN bus connection is on.

2. Do the FOC setup for both ESC.

3. Set the adapter V2 to one way throttle mode (default shipping mode), the Two/one wheel drive mode is meaningless in this configuration.

4.Plug in the ADC cable only from adapter's main socket to ESCA's socket.

5.Set you throttle handle bar's H-M-L switch to H position, if you don't have this switch, adjust the 'THR M‘ potentiometer to it max position (increase clockwise).

6. Set the brake potentiometer to max position, connect ADC (HALL or analog) brake if you have it.

7.Then use a USB cable plug into ESCA, on the VESC tool PC edition: make connection:

Make connection.jpg

8. Then connect to the secondary ESC on the CAN bus:

Connect to secondary ESC.jpg

9. Then reset the secondary ESC's APP settings.

Reset app settings.jpg

On the right sidebar, click 'Read app configuration', 'Read default app configuration', 'Write app configuration' to restore default settings.

10. Then go back to main ESC, do setup input wizard:

Go back to main esc and do setup input.jpg

Input setup wizard step 1.jpg

This vesc.jpg

Select adc input.jpg

11. Do ADC mapping:

Set adc mapping.jpg

In this step, push/rotate the throttle, triggle the mechanical brake or rotate the analog brake to let the VESC learn the throttle and brake input voltage, Apply then next.

If you don't have a mechanical brake or analog brake, set the mode to "Current Reverse Button" instead of "Current Reverse ADC2 Brake Button".

Conclusion.jpg

11. Then set the secondary ESC as slave to follow main ESC.

Set slave ESC.jpg

Finished, test the throttle and brake to check if two ESCs are running normally.

If you want reverse and curise function, go to set "APP to Use" to "ADC" only mode:

Set app to use adc only.jpg


Two wheel drive only mode with one way throttle on VESC tool mobile

On VESC tool mobile, the principle is same, only the UI apearence is different, and we need a BlueTooth module to make wireless connection with phone. Below screenshots are based on VESC tool moble for ios.

Let's do parepares as discribled above, and step 1-6 in the chapter "Two wheel drive only mode with one way throttle on VESC tool PC edition".

Power on the Ubox V2 plug a BlueTooth module into the NRF socket.

Click the power button of Ubox V2 3 times, wait 1 seconds, Ubox V2 will swtich the NRF connection to ESCA, the bule LED will turn on at ESCA side.

Start the VESC tool mobile APP.

Make connection on vesc tool mobile.jpg

Start screen on vesc tool mobile.jpg

Choose vesc over can on vesc tool mobile.jpg


Select input type on vesc tool mobile.jpg


Mappin adc input on vesc tool mobile.jpg

Set control mode on vesc tool mobile.jpg


Can device list.jpg


App config no app on vesc tool mobile.jpg


App config can status on vesc tool mobile.jpg


Two/one wheel drive switch-able

If you want a switch-able system, you need to separate two ESCS from CAN bus, let them working alone. And set each of the two ESCs one by one.

  1. Do the prepare steps.
  2. Set adapter to two/one wheel drive switch-able mode.
  3. After Ubox power on, and button LED solid, click the button 7 times, then wait 1 second, the internal CAN bus connection is off.
  4. Plug in an ADC cable from adapter's main socket to ESCA's socket.
  5. Plug in another ADC cable from adapter's second socket to ESCB's socket.
  6. Do setup input wizard setps as "Two wheel drive only mode with one way throttle" separately for each ESC.

When two ESCs are finished, to check if both ESCA and ESCB are working correctly, and to try to switch the two/one wheel drive mode, to check if the switching is working.


Two way (centered) throttle

Two way throttle setting is similar to above two modes, except we need to choose the 'Current No Reverse Brake Center' mode in the APP Settings->General->General page, instead of 'Current Reverse ADC2 Brake Button'.

Before configure on VESC tool, set adapter to two way (centered) throttle mode first.

Concludes and explains

  1. The reverse function is mapped on to the RX pin of VESC's ADC & UART socket. And the cruise function onto the TX pin. So we suggested to use ADC only mode instead of ADC and UART mode. This is a link to illustrate the mapping of TX RX pins: https://vesc-project.com/node/600
  2. If you don't need the reverse and cruise function, you can set the 'APP to use' to 'ADC and UART'.
  3. There are many ADC control mode in the VESC, the most flexible mode is Current Reverse ADC2 Brake Button, it supports cruise, reverse, and ADC brake, if you want a button brake, you can let the brake input connect to a button with the other pin of the button connected to VDD (3.3V).
  4. For UBox's power button click function, please refer: The power button of Ubox.
  5. On Ubox dual, the two/one wheel drive switching can also be achieved by Ubox's power button to turn on/off its internal CAN bus connection.
  6. For the ignite key and voltage meter of Ubox V2, please refer: The CAN-IN and IGNITE socket of Ubox V2.

Caution and limits

  1. Use a battery to power the system instead of a AC adapter power source, because AC adapter can't handle the brake current, will damage the ESC or power source. And recommend to add a fuse in to the power line to deal with accidents.
  2. For two/one wheel drive switchable mode, when switch to one wheel mode, the ADC1 and ADC2 pins of secondary ESC are floating! This is the default circuit design of most VESC hardwares, a floating ADC input is easy to be interfered, cause the ESC out of control! Make pull down resistors on ADC pins to the GND, 20K - 30K is usually appropriate. Ubox V2 and Ubox single 100V have built in pulldown resistors, no need extra pulldown resistors.
  3. Since our solution is based on open source VESC, users should fully understand the risks of open source projects. This article only describes the possibility of this build method, and is not responsible for the damage and accidents caused by user themselves.
  4. This product is for DIY purpose, so we only offer a very limited warranty.

FAQ

Q: What is the requirement of the lights and horn?

A: The adapter is designed for 12V power source, so they need to be 12V spec. And the total current is limited within 3A, if you are using Ubox as 12V power source.

Q: Can my Bluetooth or DAVEGA share the 8 pin UART-ADC port with adapter V2?

A: The Bluetooth and DAVEGA are using the UART port, so you can pick out the TX&RX of the UART wires from the 8pin cable to connect them, and set the ‘APP to Use’ to 'ADC and UART'.

Separate the TX RX from 8 pin port.jpg

Q: My VESC only have a 5V power source, can I use this adapter?

A: The 12V for adapter is for power the lights, and horn, the logic circuit is using the 5V, if your lights and horn can work with 5V, you can connect your 5V source into the adapter's 12V socket, they will working.

Firmware and PC loader app

https://github.com/JohnSpintend/Adapter-V2-FW

See also

Main Page