Inputs and outputs
End of turn switch
The end of turn switch is located in the I/O board's middle row. It is the 4-pin connector closest to the 5-pin connector. The switch cable is to be connected as:
cable pin green 5 V power supply yellow input
The input has a pull-down resistor. Closing the switch brings a logic '1'.
The sensor connectors are located in the I/O board's middle row. The sensor cable is to be connected as:
cable pin red 3.3 V or 5 V power supply brown sensor signal black ground
The sensor connectors are located in the I/O board's middle row. It is the single 5-pin connector. The sensor cable is to be connected as:
cable pin red 5 V power supply yellow measurement start (trig) green echo signal (distance) black ground
The sensor connectors are located in the I/O board's side row.
The sensor cable is to be connected as:
cable pin orange 3.3 V power supply yellow SDA green SCL blue ground
The board has 4 LED outputs which can also be used for other purposes, such as buzzers.
The outputs have a common power supply, 2 resistor mount holes and a 2-pin LED connector located on the I/O board's bottom row.
The power supply is connected directly to the 12 V battery packs. The resistor is connected between the power supply and the LED. The LED is connected between the resistor and the ground.
One or two Hall sensors are used to track the driven distance. An ultrasound ranger can detect if there is an obstacle at the front of the kart.
To begin with, the design environment has to be downloaded.
It comprises the
dcMotorController block which contains the provided I2C bus interface
and an empty
dcMotorPwm block which is to be designed.
The hall sensor.
The block receives a
speed signed number and has to drive the DC motor with a
pwm and a
These signals are sent to the daughterboard in order to drive an H-bridge.
The daughterboard logic drives the bridge's power transistors from the two signals.
The mean amplitude of the DC motor's voltage is controlled by Pulse Width Modulation (PWM).
forwards signal is derived from the sign of the
pwm signal is derived from the absolute value of
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 minimal 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
en signal is '1'.
The ultrasound ranger.
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.
The setup bit is configured in the hardware control register.