Kart/stepper motor controller

(Difference between revisions)
Jump to: navigation, search
(Initial position)
Line 39: Line 39:
  
 
The stepper motor controller has to generate the 4 phases to turn the [[Kart|kart's]] steering wheels to the desired angle.
 
The stepper motor controller has to generate the 4 phases to turn the [[Kart|kart's]] steering wheels to the desired angle.
 +
The kart's <code>target</code> angle is set in the [[Kart/serial_link#SmartPhone_to_Kart|desired steering angle register]].
  
 
To begin with, the [[Kart#FPGA_Design|design environment]] has to be downloaded.
 
To begin with, the [[Kart#FPGA_Design|design environment]] has to be downloaded.
It comprises the <code>stepperMotorController</code> block contains the provided I2C bus interface
+
It comprises the <code>stepperMotorController</code> block which contains the provided I2C bus interface
 
and an empty <code>angleControl</code> block which is to be designed.
 
and an empty <code>angleControl</code> block which is to be designed.
  
Line 51: Line 52:
  
 
The block provides the estimated angle, <code>actual</code>, together with a logic signal, <code>reached</code>, telling if the desired angle has been reached.
 
The block provides the estimated angle, <code>actual</code>, together with a logic signal, <code>reached</code>, telling if the desired angle has been reached.
 +
This information is sent back to the [[Kart#Android_App|controlling smartphone]].
  
 
=== Zero position ===
 
=== Zero position ===
Line 57: Line 59:
 
As soon as <code>stepperEnd</code> is activated, the stepper motor is stopped and the <code>actual</code> angle is reset.
 
As soon as <code>stepperEnd</code> is activated, the stepper motor is stopped and the <code>actual</code> angle is reset.
  
With this, the steering motor will not try to turn further than what the kart's mechanical structure allows it to in one of the directions.
+
With this, the steering motor will not try to turn further than what the kart's mechanical structure allows it to do in one of the directions.
 
In the other direction, it is the programmer's task not to request a too large <code>target</code> angle.
 
In the other direction, it is the programmer's task not to request a too large <code>target</code> angle.
 
This also means that the angles are always considered as positive numbers, the zero position being given by the <code>stepperEnd</code> switch.
 
This also means that the angles are always considered as positive numbers, the zero position being given by the <code>stepperEnd</code> switch.
Line 77: Line 79:
 
In order to cope with all possibilities, 2&nbsp;setup signals are provided to the block:  
 
In order to cope with all possibilities, 2&nbsp;setup signals are provided to the block:  
 
* <code>sensorLeft</code> being '1' means that the <code>stepperEnd</code> switch has been placed such as to react when the wheels are oriented to the maximal steering angle on the left side
 
* <code>sensorLeft</code> being '1' means that the <code>stepperEnd</code> switch has been placed such as to react when the wheels are oriented to the maximal steering angle on the left side
* <code>clockWise</code> being '1' means that the sequence <code>1 - 2 - 3 - 4 - 1 - 2 - …</code> lets the wheels turn to the right
+
* <code>clockWise</code> being '1' means that the sequence <code>1 - 2 - 3 - 4 - 1 - 2 - …</code> lets the steering turn to the right
The corresponding setup bits are configured in the [[Kart/serial_link#Hardware_control_register|hardware control register]].
+
  
 
{{TaskBox|content=
 
{{TaskBox|content=
 
Update the schematics of the <code>angleControl</code> block in order to cope for the different mechanical design possibilities.
 
Update the schematics of the <code>angleControl</code> block in order to cope for the different mechanical design possibilities.
 
}}
 
}}
 +
 +
The corresponding setup bits are configured in the [[Kart/serial_link#Hardware_control_register|hardware control register]].
  
 
=== Initial position ===
 
=== Initial position ===
Line 88: Line 91:
 
The [[Kart/serial_link#Hardware_control_register|hardware control register]] also contains the bit <code>restart</code> allowing to let the stepper motor turn all the way to the angle where the <code>stepperEnd</code> switch is pressed.
 
The [[Kart/serial_link#Hardware_control_register|hardware control register]] also contains the bit <code>restart</code> allowing to let the stepper motor turn all the way to the angle where the <code>stepperEnd</code> switch is pressed.
  
This has to be sent by the [[Kart#Android_App|remote control smartphone]] after a successful Bluetooth pairing, together with the appropriate <code>sensorLeft</code> and <code>clockWise</code> setup bits, in order to discover the zero angle position.
+
This has to be sent by the [[Kart#Android_App|remote control smartphone]] after a successful Bluetooth pairing, together with the appropriate <code>sensorLeft</code> and <code>clockWise</code> setup bits, in order for the FPGA hardware to discover the zero angle position.
 
Obviously, this should only be done after the [[Kart/serial_link#SmartPhone_to_Kart|Stepper motor period register]] has been set to a proper value.
 
Obviously, this should only be done after the [[Kart/serial_link#SmartPhone_to_Kart|Stepper motor period register]] has been set to a proper value.
  

Revision as of 10:08, 10 June 2015

Contents

The kart's stepper motor controller FPGA generates 4 coil driving signals and receives a stepper end input.

stepper motor board

Stepper motor

Hardware

The stepper motor is a Nanotec SP3575M0906-A.

It has a step angle of 7.5°, and as such 48 steps per turn.

Connector

The cables are connected as follows:

Signal Color
phase 1 white
phase 2 blue
phase 3 red
phase 4 yellow
power brown, black

FPGA design

The stepper motor controller has to generate the 4 phases to turn the kart's steering wheels to the desired angle. The kart's target angle is set in the desired steering angle register.

To begin with, the design environment has to be downloaded. It comprises the stepperMotorController block which contains the provided I2C bus interface and an empty angleControl block which is to be designed.

Functionality

The block receives a target unsigned number and has to step the coils at each occurrence of the enStep signal until the desired angle is reached. The current in the coils is given by the 4 outputs coil1 to coil4. The steering angle, actual, is estimated with the help of a counter which increments or decrements each time when when the coil control signals change.

The block provides the estimated angle, actual, together with a logic signal, reached, telling if the desired angle has been reached. This information is sent back to the controlling smartphone.

Zero position

A switch contact, providing the signal stepperEnd, has to be mechanically fitted on the kart in order set one end of the wheels' direction movement. As soon as stepperEnd is activated, the stepper motor is stopped and the actual angle is reset.

With this, the steering motor will not try to turn further than what the kart's mechanical structure allows it to do in one of the directions. In the other direction, it is the programmer's task not to request a too large target angle. This also means that the angles are always considered as positive numbers, the zero position being given by the stepperEnd switch.


View-pim-tasks.png

Draw the schematics of the angleControl block.

Dialog-warning.png

  • In order to limit the current consumption, turn off the current in all the coils when the stepper motor is not turning any more.
  • Make sure that both the first and the last pulse of the coil control signals have the same duration as all the others.

Hardware orientation

The mechanical design allows the following variations:

  • the stepperEnd switch can be placed such as to detect the maximal steering angle either on the left or on the right side
  • switching the coil controls in the sequence 1 - 2 - 3 - 4 - 1 - 2 - … can result in the kart to turn either to the left or to the right

In order to cope with all possibilities, 2 setup signals are provided to the block:

  • sensorLeft being '1' means that the stepperEnd switch has been placed such as to react when the wheels are oriented to the maximal steering angle on the left side
  • clockWise being '1' means that the sequence 1 - 2 - 3 - 4 - 1 - 2 - … lets the steering turn to the right


View-pim-tasks.png

Update the schematics of the angleControl block in order to cope for the different mechanical design possibilities.

The corresponding setup bits are configured in the hardware control register.

Initial position

The hardware control register also contains the bit restart allowing to let the stepper motor turn all the way to the angle where the stepperEnd switch is pressed.

This has to be sent by the remote control smartphone after a successful Bluetooth pairing, together with the appropriate sensorLeft and clockWise setup bits, in order for the FPGA hardware to discover the zero angle position. Obviously, this should only be done after the Stepper motor period register has been set to a proper value.

Restarting to the zero position can also be a help if too much current has been drawn from the batteries and the FPGAs' power has sunk in a way that they have performed a reset.


View-pim-tasks.png

Update the schematics of the angleControl block in order to turn all the way to the stepperEnd position once the input restart has been set.

Personal tools
Namespaces
Variants
Actions
Navigation
Modules / Projects
Browse
Toolbox