Kart/sensor board

From FSI
(Difference between revisions)
Jump to: navigation, search
(LED outputs)
(Hall sensors)
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{TOC right}}
 
{{TOC right}}
 +
 +
The sensor board provides different I/Os to the system.
 +
The [[Media:Kart_IO.pdf|schematics]] provides detailed information about it.
  
 
[[File:Kart sensor board.jpg|center|200px|FPGA motherboard]]
 
[[File:Kart sensor board.jpg|center|200px|FPGA motherboard]]
  
== End of turn switch ==
+
== Inputs and outputs ==
 +
 
 +
=== End of turn switch ===
  
 
The end of turn switch is located in the I/O board's middle row.
 
The end of turn switch is located in the I/O board's middle row.
Line 22: Line 27:
 
Closing the switch brings a logic '1'.
 
Closing the switch brings a logic '1'.
  
== Hall sensors ==
+
=== Hall sensors ===
  
The sensor connectors are located in the I/O board's middle row.
+
The [[kart/sensors/SS311PT|Hall sensors]] connectors are located in the I/O board's middle row,
 +
on the side opposite to the 5-pin connector.
 
The sensor cable is to be connected as:
 
The sensor cable is to be connected as:
 
:{| cellpadding="3" cellspacing="0" border="1"
 
:{| cellpadding="3" cellspacing="0" border="1"
Line 31: Line 37:
 
|-
 
|-
 
| red
 
| red
| 3.3 V or 5 V power supply
+
| 3.3 V power supply
 
|-
 
|-
 
| brown
 
| brown
Line 40: Line 46:
 
|}
 
|}
  
== Ultrasound ranger ==
+
=== Ultrasound ranger ===
  
The sensor connectors are located in the I/O board's middle row.
+
The [[Kart/sensors/HCSR04|ultrasound ranger]] connectors are located on the side of the I/O board's middle row.
 
It is the single 5-pin connector.
 
It is the single 5-pin connector.
 
The sensor cable is to be connected as:
 
The sensor cable is to be connected as:
Line 56: Line 62:
 
|-
 
|-
 
| green
 
| green
| echo signal (distance)
+
| distance signal (echo, in)
 
|-
 
|-
 
| black
 
| black
Line 62: Line 68:
 
|}
 
|}
  
== Proximity sensors ==
+
=== Proximity sensors ===
  
The sensor connectors are located in the I/O board's side row.
+
The [[kart/sensors/VCNL4000|proximity sensor]] connectors are located in the I/O board's side row.
  
 
The sensor cable is to be connected as:
 
The sensor cable is to be connected as:
Line 84: Line 90:
 
|}
 
|}
  
== LED outputs ==
+
=== LED outputs ===
  
 
The board has 4 LED outputs which can also be used for other purposes, such as buzzers.
 
The board has 4 LED outputs which can also be used for other purposes, such as buzzers.
Line 92: Line 98:
 
The power supply is connected directly to the 12 V battery packs.
 
The power supply is connected directly to the 12 V battery packs.
 
The resistor is connected between the power supply and the LED.
 
The resistor is connected between the power supply and the LED.
The LED is connected between the resistor and the ground.
+
The LED is connected between the resistor and the [[Media:Kart ULN2003.pdf|switch]] to the ground.
  
 
== FPGA design ==
 
== FPGA design ==
  
One or two Hall sensors are used to track the driven distance.
+
One or two Hall sensors are used to track the distance driven by the kart.
 
An ultrasound ranger can detect if there is an obstacle at the front of the kart.
 
An ultrasound ranger can detect if there is an obstacle at the front of the kart.
  
 
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
+
It comprises the <code>sensorsInterface</code> block which contains the provided I2C bus interface,
and an empty <code>dcMotorPwm</code> block which is to be designed.
+
an empty <code>hallCounters</code> block
 +
and an empty <code>ultrasoundRanger</code> block which are to be designed.
  
 
=== Hall sensor ===
 
=== Hall sensor ===
  
The [[Kart/sensors/SS311PT|hall sensor]].
+
The [[Kart/sensors/SS311PT|hall sensor]] has a [https://en.wikipedia.org/wiki/Schmitt_trigger Schmitt-trigger] output.
 +
This means that it has to "see" a north and then a south magnetic pole in order to switch its output.
  
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>hallPulses</code> signal array, one per hall pulse sensor.
These signals are sent to the daughterboard in order to drive an [http://en.wikipedia.org/wiki/H_bridge H-bridge].
+
For each of these inputs, it requires a counter.
The daughterboard logic drives the bridge's power transistors from the two signals.
+
The counter values are concatenated to build the <code>position</code> output.
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 <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 [http://en.wikipedia.org/wiki/Pulse-width_modulation 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 <code>en</code> signal generated by a counter dividing the clock frequency.
+
The counter only increments when this <code>en</code> signal is '1'.
+
  
 
{{TaskBox|content=
 
{{TaskBox|content=
Draw the schematics of the <code>dcMotorPwm</code> block.
+
Draw the schematics of the <code>hallCounters</code> block.
 
}}
 
}}
 
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]].
 
  
 
=== Ultrasound ranger ===
 
=== Ultrasound ranger ===
  
The [[Kart/sensors/HCSR04 |ultrasound ranger]].
+
The [[Kart/sensors/HCSR04 |ultrasound ranger]] receives a trigger signal, <code>startMeasure</code>, and sends an ultrasound pulse.
 +
Once the pulse is sent, the sensor drives <code>distancePulse</code> to '1' as long as it hasn't received any echo.
  
In order to cope with this, a setup signal, <code>normalDirection</code>, is provided to the block.
+
The circuit has to count the length of the sequence in terms of clock pulses and returns the value on <code>distance</code>.
<code>normalDirection</code> being '1' means that a positive voltage applied to the DC motor lets the kart drive forwards.
+
  
 
{{TaskBox|content=
 
{{TaskBox|content=
Update the schematics of the <code>dcMotorPwm</code> block in order to cope for the different mechanical design possibilities.
+
Draw the schematics of the <code>ultrasoundRanger</code> block.
 
}}
 
}}
 
The setup bit is configured in the [[Kart/serial_link#Hardware_control_register|hardware control register]].
 
  
 
[[Category:Kart]]
 
[[Category:Kart]]

Latest revision as of 16:07, 22 August 2019

Contents

The sensor board provides different I/Os to the system. The schematics provides detailed information about it.

FPGA motherboard

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'.

Hall sensors

The Hall sensors connectors are located in the I/O board's middle row, on the side opposite to the 5-pin connector. The sensor cable is to be connected as:

cable pin
red 3.3 V power supply
brown sensor signal
black ground

Ultrasound ranger

The ultrasound ranger connectors are located on the side of 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 distance signal (echo, in)
black ground

Proximity sensors

The proximity 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

LED outputs

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 switch to the ground.

FPGA design

One or two Hall sensors are used to track the distance driven by the kart. 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 sensorsInterface block which contains the provided I2C bus interface, an empty hallCounters block and an empty ultrasoundRanger block which are to be designed.

Hall sensor

The hall sensor has a Schmitt-trigger output. This means that it has to "see" a north and then a south magnetic pole in order to switch its output.

The block receives a hallPulses signal array, one per hall pulse sensor. For each of these inputs, it requires a counter. The counter values are concatenated to build the position output.


View-pim-tasks.png

Draw the schematics of the hallCounters block.

Ultrasound ranger

The ultrasound ranger receives a trigger signal, startMeasure, and sends an ultrasound pulse. Once the pulse is sent, the sensor drives distancePulse to '1' as long as it hasn't received any echo.

The circuit has to count the length of the sequence in terms of clock pulses and returns the value on distance.


View-pim-tasks.png

Draw the schematics of the ultrasoundRanger block.

Personal tools
Namespaces
Variants
Actions
Navigation
Modules / Projects
Browse
Toolbox