Twizy-Cfg SEVCON configuration shell
This is a minimalistic SEVCON Gen4 configuration shell for Arduino.
It's a port of my SEVCON core functionality from the OVMS project, with a simple command interface on the Arduino serial port.
V1 supported only reading & writing SDO registers and entering/leaving pre-operational mode. This is now supported both by the V1 shortcut commands as well as the original OVMS command syntax.
V2 now also supports the OVMS/Twizy tuning macro commands (i.e.
recup etc.) as well as profile management including saving to / loading from the Arduino EEPROM. Assuming this will be used by hardware hackers, the
brakelight command has been included as well. Still missing from the OVMS command set is the
clear command, this is planned to get included along with log access and output. Also missing are all dynamic adjustment functions, i.e. auto drive/recuperation power level following and kickdown.
V2.1 adds support for low level OBD2 diag requests. Look out for DDT2000 XML files for device IDs, requests and data definitions. There is currently no parsing of the results, output is just the hex encoded data.
Read the OVMS user manual and command overview for details on all commands. You may also like to read the SEVCON Gen4 manual for some basic description of registers. The full register set is documented in the SEVCON master dictionary, which is ©SEVCON. It's contained in the SEVCON DVT package.
Most registers of interest for normal tuning can be found in the Twizy SDO list.
Note: SEVCON write access has been limited by Renault on Twizys (SEVCONs) delivered after June 2016. The write protection applies to all power and driving profile tuning registers, and also to the battery limits. A locked SEVCON will respond to register writes with an error. You can also check the software version (
rs 100a 00): if it's
0712.0003 or higher, the Twizy is locked.
- An Arduino (a Nano will do)
- An MCP 2515 SPI CAN module, i.e. a "CAN-BUS Shield"
- An OBD2 plug/cable for the MCP module
To download, click the DOWNLOADS button in the top right corner, download the ZIP file. Extract the ZIP, open
TwizyCfg/TwizyCfg.ino from Arduino IDE.
You will also need these libraries:
Enter your CAN module configuration in the
Connect to the OBD2 port, switch on the Twizy, start the sketch & open the serial monitor. Set the serial monitor line mode to "new line".
The Arduino will display a help screen, then wait for your commands:
Low level CANopen commands
|Enter pre-op mode||
|Enter op mode||
|Read numerical register||
|Read string register||
- Standard OVMS command syntax (i.e.
readetc.) is also accepted
<sub>define the SDO register to access, need to be given as hexadecimal numbers
<val>is the value to write, needs to be given as an unsigned decimal number (negative = two's complement, see below)
|Set profile from base64||
|Get profile base64||
|Show main profile values||
|Save config to profile||
|Load config from profile||
|Set drive level||
|Set recuperation levels neutral & brake||
|Set ramp levels||
|Set ramp limits||
|Set max & warn speed||
|Set torque, power & current levels||
|Set torque speed maps||
|Set brakelight accel levels||
Low level OBD-2 commands
|Set OBD2 device address||
|Send OBD2 request||
- See OBD-II PIDs
- See Unified Diagnostic Services
- Look out for DDT2000 (©Renault) XML files for Renault specific device IDs, requests and data structures
- Check canbushack.com for digging deeper
- Get firmware version:
rs 100a 00(if it's
0712.0003or higher, the Twizy is locked)
- Set vmax to 100 kph:
- Set torque to 130% and power to 120%:
power 130 120
- Set neutral recuperation to 20% and brake recuperation to 30%:
recup 20 30
- Set and apply a base64 profile:
set 0 3m9wg295ABozAAAAAAAAAAAuOkVbZVNFNRUrRVtlNSMbJGUAAAABAABlZQAAAAAA(Twizy needs to be on, not in
- Save current profile to EEPROM slot 1:
- Reset SEVCON to default configuration:
- Read DTC from instrument cluster:
da 743 763, then
- Read battery health estimation from BMS:
da 79b 7bb, then
The shell automatically logs into the SEVCON with access level 4 (highest user level, 5 is reserved for SEVCON engineering), so all user SDOs can be written to. See SEVCON master dictionary for access levels. Note: all logins are logged in the SEVCON event logs. See SEVCON manual on how to access the logs.
When writing to a register using
w, for convenience the old value will be read and shown. For write-only registers use
wo to skip the read operation.
The shell does not know about the data type of the SDO accessed (that's why you need to use
rs for string SDOs). It handles all numerical registers as being unsigned long. To convert to/from negative values, build the two's complement value by adding the offset:
|Type||Negative offset||-1 = …|
Most signed tuning registers are of type Integer16. See Twizy DCF for register data and access types and default values.
Error messages are mostly self-explanatory, i.e. "SEVCON OFFLINE" means you haven't switched on the Twizy.
Some of the functions contained in the "utils" module have been written by other OVMS contributors.
Donations to support my efforts and further development are very welcome.
Please send donations via Paypal to:
This is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this software; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110- 1301 USA