Schematics and Instructions
The kit is split into seven individual PCBs: the main board hosting the STM32, 2 current sensor boards, a voltage sense board and 3 gate driver boards.
If you have a kit with the large sensor board, look here for instructions.
- 1 General instructions
- 2 Schematics
- 3 Errata
- 4 Using the web interface
- 5 Firmware Upgrade
- 6 Connecting the sensor boards
- 7 Connecting the gate drivers
- 8 Connecting the IGBTs
- 9 Connecting the motor
- 10 Connecting the speed sensor
- 11 Connecting the throttle pot
- 12 Running slip control
- 13 Connecting precharge and main contactor
- 14 Connecting motor temperature sensor, emergency stop and motor protection switch
- 15 Forward and reverse
- 16 See Also
Check out the assembly video.
The names of the individual parts are printed on the PCBs. The kits info sheet contains the BOM for all boards. (Look here for older BOMs) Assemble the PCBs accordingly. Whenever applying power, make sure to set a sane current limit as to not feed too much energy into a possible fault. Especially before inserting the STM32-H103 module make sure that the power supply is at the correct level (5V) and being fed to the correct pins. Test each PCB individually before connecting it to the system.
When populating the PCBs be advised that parts are VERY hard to remove in one piece unless you have a hot air gun. So make sure you insert them correctly especially parts that have a Pin 1 marking (all integrated circuits and resistor network RN1 on the main board).
There are some glitches which can be easily fixed.
1. The socket for the external signals (JP5) has the pins mirrored. This causes the pins to show up on unexpected ribbon cables. Here is the map when looking from the top:
1 3 5 7 9 11 13 15 17 19 21 23 25 2 4 6 8 10 12 14 16 18 20 22 24 26
This results in the ribbon cable map:
2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25
2. There is a glitch on the new Voltagse Sense Board. The temp sensor polarity is sort of swapped. So connect resistor R9 to the closest GND source (instead of VCC). Connect Pin 2 of JP1 to the closest VCC source. See pictures on the right for details.
3. On Windows you might need an older version of the serial port driver, if you're having issues.
Using the web interface
The included Olimex MOD-WIFI-ESP8266 is preloaded with an easy to use Web Interface. Connect to mainboard JP6 like so
- Pin 1 of Wifi to Pin 2 on mainboard (3.3V) (note Pin 1 is now 5V!, schematic not yet updated)
- Pin 2 of Wifi to Pin 5 on mainboard (GND, next to inductor)
- Pin 3 of Wifi to Pin 3 on main board
- Pin 4 of Wifi to Pin 4 on main board
The ESP8266 acts as a wifi access point. SSID and password are printed on the instructions sheet included with you kit. Connect to the access point, then open your browser and type 192.168.4.1 to open the web interface.
The STM32-H103 comes with a bootloader and a current software version. Both configuration and software updates are done via the Wifi interface. To update the inverter firmware extract the stm32_sine.bin and upload it via the "Update" form of the web interface. The update takes about 2s and when it is finished the green LED should flash.
Make sure you're not running a plot or gauges during firmware upgrade!
You can also customize the web interface itself by replacing the respective files like index.html, index.js etc. Upload them with the same form as the firmware.
Connecting the sensor boards
The sensor boards are connected to JP4. The provided 10-pole ribbon cable must be inserted into the socket as shown. 3 slots must be blank on either side of the 16-pole socket. Connect the boards like so:
- Current sensor module 1: JP4 Pin 6 to J1 Pin 1, JP4 Pin 7 to J1 Pin 2 and JP4 Pin 8 to J1 Pin 3
- Current sensor module 1: JP4 Pin 9 to J1 Pin 1, JP4 Pin 10 to J1 Pin 2 and JP4 Pin 11 to J1 Pin 3
- Voltage sense module: JP4 Pin 13 to JP2 Pin 1, JP4 Pin Pin 4 to JP2 Pin 2, JP4 Pin 5 to JP2 Pin 3, JP4 Pin 12 to JP2 Pin 4
- Temperature sensor: Connect to voltage sense board JP1
Current values are only measured in Run mode, so tie Pin 11 and 17 to 12V and type
Now verify the values by typing
This command will display all 4 values. To repeat the command, simply type "!".
The current sensor gain depends on it's distance to the conductor (including the isolation). Your AC cable must run on the underside of the PCB between the pins of the sensor IC. Use a cable tie for mounting. The PCB should be placed far away from other high currents to prevent cross-talk. To increase your current range simple put a spacer between cable and PCB.
To calibrate the current, set il1gain and il2gain to 1. Then put a known current through the sensors by winding for example a 1.5mm² cable 10 times through both sensors. Then, using you lab power supply run 5A through your wound cable.
The new Melexis sensors cannot have cable wound through them. So you need to attach them in their final positions and then pass current through the phase wire.
set ocurlim 1000
You will get something like
The gain factor is calculated by g=Ireading/(Iref*N) (Ireading: reply from get, Iref: reference current, e.g. 5A, N: number of turns through sensor, e.g. 10). So for our example il1gain=95.32/(5*10)=1.9064 and il2gain=98.12/(5*10)=1.9624. So type
set il1gain 1.91
set il2gain 1.96
Calibration is crucial to ensure correct operation of the over current limit!
If your current sensor gains are negative then your 'ocurlim' also needs to be negative!
Likewise you need to calibrate the voltage sensor board. Type (or set on web interface)
set udcgain 1 set udcofs 0
Now make sure the input to the sensor board is disconnected. Get the value of udc and write it to udcofs:
get udc 500.00 set udcofs 500
Now connect a known voltage to the input, the higher, the more accurate the calibration is. If your test voltage is 100V and udc reads 450V then you need to set udcgain=450/100=4.5
set udcgain 4.5 save
Connecting the gate drivers
The steps from here on will only work with the "sine" software, not the FOC software. So temporarily flash that, you can revert later on.
Connect the gate drivers with a ribbon cable like shown in the picture. Power up the inverter, which will now pull around 300mA @ 12V. If its less, one or more gate drivers are unpowered, if its more, there is an error on the drivers or the connection. Remove power quickly in that case. The inrush current is higher of course, so set the current limit of your power supply to about 1A.
When all is fine, connect pin 11, 13 and 17 to 12V as well to overcome the hardware PWM inhibit logic. Now type
This will start sine wave generation. Type
set fslipspnt 1
set ampnom 1
This outputs a clean 50/50 duty cycle on all 6 PWM outputs. Verify this with a scope on the main board, the gate driver inputs and the gate driver outputs. Also verify that there is about 1.5µs dead time between GTOP and GBOT.
Note that the sensor board has to stay connected at all times, otherwise the over current protection will kick in due to an implausible signal.
Connecting the IGBTs
Now you are ready for some more power. Connect the gate drivers to the IGBTs and repeat the steps above. The slope of the PWM will be less steep as to show that the gate driver is really working against the gates capacity. Connect a small voltage (like 30V) to the DC bus and verify that the PWM shows on the IGBT modules outputs and looks the same on all outputs. This circuit is completely symmetrical so the output should be symmectrical as well. If its not, there might be something wrong. There must be absolutely 0 current flow on the DC bus, otherwise you are experiencing shoot-through, i.e. the top and bottom IGBT of one leg are on at the same time. Correct this before continuing!
Connecting the motor
Now comes the big one. Connect a motor to the three output phases. Leave the DC voltage at a small value but make sure it can supply enough current (more than 10A). But also make sure to limit the possible current e.g. with a fuse. Now type
set fweak 10
set fslipspnt 10
set ampnom 100
This will start the inverter at 10Hz and the motor should spin at the corresponding speed.
to stop the inverter. Connect the voltage that you actually want to run at to the DC input. Before turning on, you must configure the frequency/voltage curve. Therefor you have to do some math with your motors nameplate values. You need to calculate the frequency at which the motor can be driven with the maximum output voltage. Beyond that point, the motor operates in the field weakening region, therefor the parameter is called fweak. This calculates as follows:
So for a DC bus voltage of 350V, a nameplate frequency of 60Hz and a nameplace voltage of 200V you get fweak=60Hz x (350V/1.41)/200V = 74.5Hz. Now type
set fweak 74.5
set fslipspnt 10
set ampnom 100
The motor should spin as it did before but at its nomimal nameplate torque. You can try different frequencies. Should the motor only spin very shortly and stop, you might be hitting the current limit. It can be modified e.g. to 200A with
set ocurlim -200
If all is working save the current parameter set by typing
Alternatively you can use the python-script tuning.py to try and determine the parameters automatically. Start it in a linux console by typing
python tuning.py -d /dev/ttyUSB0
Connecting the speed sensor
This board has been designed with optical encoders in mind. So it supplies 30mA on pin 2 for an IR diode. Pin 3 expects an open collector pulse signal. The picture shows a very exposed version of such a sensor which explains the principle very well though. The controller needs to know how many pulses it gets per turn of the shaft. It also needs to know the number of pole pairs of your motor. You can deduce that from the nameplate or data sheet. Type
set numimp 64
set polepairs 2
The motor should now spin up smoothly.
Note that this controller only supports up to about 10000 pulses per second. So for example if you plan to spin your motor up to 10000 rpm which is 166.7 1/s the encoder mustn't generate more than 60 pulses per turn. The limit is imposed by the low pass filter and can be changed by populating a different resistor R3.
Some encoders require more than the provided 30mA. In that case replace R2 by a bridge.
Connecting the throttle pot
The throttle needs a 5V source. It depends on your encoder type. If you have a simple 1-channel encoder you can populate R1 with a wire and use Pin 1 as 5V. If you use an advanced quadrature encoder, replace R7 with a wire and use Pin 2 as 5V for both throttle and encoder. Connect pot GND to Pin 23 (or some other GND source) and the slider to pin 6. Type
When the pot is at "full throttle" the value must be higher than if it is completely released. Write down the maximum and minimum value, add/subtract a bit of slack (like 10-20 digits) and tell the controller by typing
set potmin 2000
set potmax 3000
Now the pots position can be correctly translated to %. When completely released, you get -30% for regen (can be adjusted with parameter brkmax), at full throttle you get close to 100% for acceleration. Verify by typing
If the pot value leaves the window defined by potmin and potmax the throttle command is set to 0 and the error light is triggered.
Running slip control
Now start the controller in slip control mode by typing
As you reach 30% of throttle travel the motor should start spinning. The harder you press the more it will accelerate until it reaches its maximum speed (parameter fmax, preconfigured to 200Hz). When you let go the throttle the motor will brake to a standstill.
Once the whole setup is inside your car you can play with various parameters for fine tuning.
Connecting precharge and main contactor
Connect the precharge relay and the main contactor as depicted in the diagram. It is recommended to disconnect both battery poles. The inverter controls the two contactors by means of the DC bus voltage. When udc < udcsw then the precharge relay is closed, the main contactor is inhibited. When udc > udcsw the main contactor is closed as soon has the start signal (pin 7) goes high. The precharge relay is opened at the same time. udcsw should be set to about 80% of your nominal pack voltage. So if the latter is 360V set udcsw to 300V by typing
set udcsw 300
Connecting motor temperature sensor, emergency stop and motor protection switch
The software supports the KTY83 and KTY84 temperature sensor. Other types might be supported in upcoming releases. Note that the sensor has a polarity. When connected the wrong way it will saturate at 120°C. So even if the temperature rises above 120°C it will be displayed as 120°C. Connect it to pin 21 (negative) and pin 22 (positive).
Some motors have a protection switch that opens at some threshold temperature. You can connect it to 12V and pin 11. It will stop the inverter immediatly if tripped. If your motor does not have this feature, connect pin 11 to 12V.
The emergency stop serves a similar function. It can be installed in the drivers reach and will stop the inverter immediatly when 12V are interrupted (failsafe). Connect it to 12V and pin 17.
Forward and reverse
You can connect a 3-position switch for selecting the drive mode. Forward (pin 13) turns the motor in one direction, reverse (pin 15) in the other. If they are both low, no current is fed to the motor making this essentially the neutral position.
Information about the softwares Parameters.