Kart/DC motor controller

(Difference between revisions)
Jump to: navigation, search
(DC motor)
Line 1: Line 1:
 
{{TOC right}}
 
{{TOC right}}
  
[[File:Kart dc motor board.JPG|center|200px|DC motor board]]
+
[[File:Kart_dc_module.jpg|center|200px|DC motor module]]
  
 
== DC motor ==
 
== DC motor ==
  
The DC motor is a [http://www.conrad.ch/ce/fr/Search.html?search=%22modelcraft%20rb%20350018%202a723r%22 Modelcraft RB350018-2A723R"].
+
The DC motor is a [http://www.conrad.ch/ce/fr/Search.html?search=%22modelcraft%20rb%20350018%202a723r%22 Modelcraft RB350018-2A723R].
  
It is powered with 12 V and draws a maximal current of 0.7 A.
+
It is powered in 12 V and draws a maximal current of 0.7 A.
  
The [[Media:Kart DC Motor board.pdf|control board]] hosts a 4-transistor H-bridge
+
The [[Media:Kart_dc_stepper_schematic.pdf|control board]] hosts a dual full-bridge
 
and a circuitry to create the switching dead-times and the direction of the current.
 
and a circuitry to create the switching dead-times and the direction of the current.
  
 
== FPGA design ==
 
== FPGA design ==
  
The DC motor controller has to generate the a <code>pwm</code> and a <code>forwards</code> signal to control the [[Kart|kart's]] speed.
+
The DC motor controller has to generate a <code>pwm</code> and a <code>forwards</code> signals to control the [[Kart|kart's]] speed.
The kart's <code>speed</code> is set in the [[Kart/serial_link#SmartPhone_to_Kart|DC motor speed register]].
+
The <code>speed</code> is set in the [[Kart/serial_link#SmartPhone_to_Kart|DC motor speed register]], while the frequency is given by the
 +
prescaler in the [[Kart/serial_link#SmartPhone_to_Kart|DC motor prescaler register]] with the formula f = fclk / (PWMsteps * prescaler) = 10M / (16 * prescaler).
  
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>dcMotorController</code> block which contains the provided I2C bus interface
+
which contains the registers and events manager and an empty <code>dcMotorPwm</code> block which is to be completed.
and an empty <code>dcMotorPwm</code> block which is to be designed.
+
  
 
=== Functionality ===
 
=== Functionality ===
  
 
The block receives a <code>speed</code> signed number and has to drive the DC motor with a <code>pwm</code> and a <code>forwards</code> signal.
 
The block receives a <code>speed</code> signed number and has to drive the DC motor with a <code>pwm</code> and a <code>forwards</code> signal.
These signals are sent to the daughterboard in order to drive an [http://en.wikipedia.org/wiki/H_bridge H-bridge].
+
These signals are internally converted to two driving signals to control an [http://en.wikipedia.org/wiki/H_bridge H-bridge]
The daughterboard logic drives the bridge's power transistors from the two signals.
+
(they take into account the dead-times to avoid short-circuiting the motor while switching).
The mean amplitude of the DC motor's voltage is controlled by [http://en.wikipedia.org/wiki/Pulse-width_modulation Pulse Width Modulation] (PWM).
+
 
 +
The mean amplitude of the DC motor's voltage is controlled by a [http://en.wikipedia.org/wiki/Pulse-width_modulation Pulse Width Modulation] (PWM).
  
 
The <code>forwards</code> signal is derived from the sign of the <code>speed</code> control.
 
The <code>forwards</code> signal is derived from the sign of the <code>speed</code> control.
 
The <code>pwm</code> signal is derived from the absolute value of <code>speed</code>.
 
The <code>pwm</code> signal is derived from the absolute value of <code>speed</code>.
  
 +
{{WarningBox|content=
 
The [http://en.wikipedia.org/wiki/Pulse-width_modulation PWM] signal is implemented with the help of a free-running counter and a comparator.
 
The [http://en.wikipedia.org/wiki/Pulse-width_modulation PWM] signal is implemented with the help of a free-running counter and a comparator.
 
However:
 
However:
 
* the power transistors cannot switch at too high frequencies
 
* the power transistors cannot switch at too high frequencies
 
* there is a need for a dead time where all power transistors are open between the PWM transitions
 
* there is a need for a dead time where all power transistors are open between the PWM transitions
Because of this, the PWM period is limited to a minimal value.
+
 
This is achieved with the help of an <code>en</code> signal generated by a counter dividing the clock frequency.
+
Because of this, the PWM period is limited to a certain value.
The counter only increments when this <code>en</code> signal is '1'.
+
This is achieved with the help of an '''en''' signal generated by a counter dividing the clock frequency.
 +
The counter only increments when this signal is '1'.
 +
}}
  
 
{{TaskBox|content=
 
{{TaskBox|content=
Line 44: Line 48:
  
 
The minimal value of the PWM signal is studied in another part of the [[Kart|kart project]].
 
The minimal value of the PWM signal is studied in another part of the [[Kart|kart project]].
The period of the <code>en</code> pulse train is set in the [[Kart/serial_link#SmartPhone_to_Kart|DC motor PWM period register]].
+
The period of the <code>en</code> pulse train is set in the [[Kart/serial_link#SmartPhone_to_Kart|DC motor PWM period register]]
 +
and given by the formula f = fclk / (PWMsteps * prescaler) = 10M / (16 * prescaler).
  
 
=== Hardware orientation ===
 
=== Hardware orientation ===
Line 64: Line 69:
  
 
In order to cope with this, a control signal, <code>btConnected</code>, is provided to the block.
 
In order to cope with this, a control signal, <code>btConnected</code>, is provided to the block.
When <code>btConnecred</code> is '0', the DC motor must stop.
+
When <code>btConnected</code> is '0', the DC motor must stop.
  
 
{{TaskBox|content=
 
{{TaskBox|content=
Line 71: Line 76:
  
 
The BT connection bit is configured in the [[Kart/serial_link#Hardware_control_register|hardware control register]].
 
The BT connection bit is configured in the [[Kart/serial_link#Hardware_control_register|hardware control register]].
 
== Test pins ==
 
 
The DC motor design leaves 18 free pins.
 
Pins 1 to 14 are foreseen for test purposes.
 
  
 
[[Category:Kart]]
 
[[Category:Kart]]

Revision as of 12:02, 27 June 2022

Contents

DC motor module

DC motor

The DC motor is a Modelcraft RB350018-2A723R.

It is powered in 12 V and draws a maximal current of 0.7 A.

The control board hosts a dual full-bridge and a circuitry to create the switching dead-times and the direction of the current.

FPGA design

The DC motor controller has to generate a pwm and a forwards signals to control the kart's speed. The speed is set in the DC motor speed register, while the frequency is given by the prescaler in the DC motor prescaler register with the formula f = fclk / (PWMsteps * prescaler) = 10M / (16 * prescaler).

To begin with, the design environment has to be downloaded, which contains the registers and events manager and an empty dcMotorPwm block which is to be completed.

Functionality

The block receives a speed signed number and has to drive the DC motor with a pwm and a forwards signal. These signals are internally converted to two driving signals to control an H-bridge (they take into account the dead-times to avoid short-circuiting the motor while switching).

The mean amplitude of the DC motor's voltage is controlled by a Pulse Width Modulation (PWM).

The forwards signal is derived from the sign of the speed control. The pwm signal is derived from the absolute value of speed.

Dialog-warning.png

The PWM signal is implemented with the help of a free-running counter and a comparator. However:

  • the power transistors cannot switch at too high frequencies
  • there is a need for a dead time where all power transistors are open between the PWM transitions

Because of this, the PWM period is limited to a certain value. This is achieved with the help of an en signal generated by a counter dividing the clock frequency. The counter only increments when this signal is '1'.


View-pim-tasks.png

Draw the schematics of the dcMotorPwm block.

The minimal value of the PWM signal is studied in another part of the kart project. The period of the en pulse train is set in the DC motor PWM period register and given by the formula f = fclk / (PWMsteps * prescaler) = 10M / (16 * prescaler).

Hardware orientation

The mechanical design can either lead the Kart to drive forwards or backwards when a positive voltage is applied to the DC motor.

In order to cope with this, a setup signal, normalDirection, is provided to the block. normalDirection being '1' means that a positive voltage applied to the DC motor lets the kart drive forwards.


View-pim-tasks.png

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

The setup bit is configured in the hardware control register.

Bluetooth connection

When the Bluetooth connection is lost, the DC motor should not turn.

In order to cope with this, a control signal, btConnected, is provided to the block. When btConnected is '0', the DC motor must stop.


View-pim-tasks.png

Update the schematics of the dcMotorPwm block in order to stop the motor on connection loss.

The BT connection bit is configured in the hardware control register.

Personal tools
Namespaces
Variants
Actions
Navigation
Modules / Projects
Browse
Toolbox