|
|
(34 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
− | {{TOC right}}
| + | #REDIRECT [[Kart]] |
− | | + | |
− | [[File:Kart_sensors_module.jpg|center|200px|DC motor module]]
| + | |
− | | + | |
− | Various sensors can be mounted on the [[Kart/Motherboard|motherboard]] through the exposed [https://digilent.com/reference/pmod/start PMOD] connectors.
| + | |
− | | + | |
− | | + | |
− | == Hall sensors ==
| + | |
− | | + | |
− | One or two Hall sensors are used to track the distance driven by the kart.
| + | |
− | | + | |
− | The [http://sensing.honeywell.com/honeywell-sensing-ss311pt-ss411p-product-sheet-005914-1-en.pdf SS311PT/SS411P]
| + | |
− | digital Hall-effect sensors are operated by a magnetic field and designed to respond to alternating North and South poles with their
| + | |
− | [https://en.wikipedia.org/wiki/Schmitt_trigger Schmitt-trigger] output.
| + | |
− | | + | |
− | They can be powered between 2.7 Vdc to 7 Vdc, with an open collector output (which integrates a 10 kOhm pull-up resistor already).
| + | |
− | | + | |
− | Thus it can be operated through any PMOD by wiring it such as:
| + | |
− | :{| cellpadding="3" cellspacing="0" border="1"
| + | |
− | ! Color
| + | |
− | ! Pin
| + | |
− | |-
| + | |
− | | Red
| + | |
− | | 3.3 V power supply
| + | |
− | |-
| + | |
− | | Brown
| + | |
− | | Hall output
| + | |
− | |-
| + | |
− | | Black
| + | |
− | | GND
| + | |
− | |}
| + | |
− | | + | |
− | {{WarningBox|content=
| + | |
− | No internal pull resistor should be enabled on the FPGA side.
| + | |
− | }}
| + | |
− | | + | |
− | ==== Operating procedure ====
| + | |
− | To enable and root the hall sensors, proceed as follow:
| + | |
− | * Modify the '''Kart/Kart_Student''' package variable '''NUMBER_OF_HALL_SENSORS''' to the number of used hall sensors
| + | |
− | * Modify the .pdc file to root the halls to the desired pins
| + | |
− | ** <code>set_io {halls[1]} -pinname 86 -fixed yes -DIRECTION Input</code>
| + | |
− | ** ''{halls[n]} with n from 1 to NUMBER_OF_HALL_SENSORS''
| + | |
− | | + | |
− | ==== FPGA design ====
| + | |
− | | + | |
− | To begin with, the [[Kart#FPGA_Design|design environment]] has to be downloaded.
| + | |
− | It comprises the <code>sensorsController</code> block which contains the registers and events manager
| + | |
− | and an empty <code>hallCounters</code> block which is to be completed.
| + | |
− | | + | |
− | The <code>hallPulsesFilter</code> block simply debounce the hall pulses.
| + | |
− | | + | |
− | The <code>hallCounters</code> block then receives the <code>hallPulses</code> signal array, one per hall pulse sensor.
| + | |
− | A counter is required for each of these inputs, that shall increment at each Hall signal rising edge or, twice as fast, at each signal edge.
| + | |
− | | + | |
− | {{WarningBox|content=
| + | |
− | Please modify the '''Kart/Kart_Student''' package variable '''HALLSENS_2PULSES_PER_TURN''' to '1' if the signal is counted
| + | |
− | on each edge or '0' if counted only on the rising edge.
| + | |
− | }}
| + | |
− | | + | |
− | The counter values must then be concatenated to build the <code>position</code> output.
| + | |
− | | + | |
− | When the <code>zeroPos</code> signal is at '1' for a specific hall sensor, the counter must be reset immediately.
| + | |
− | | + | |
− | {{TaskBox|content=
| + | |
− | Draw the schematics of the <code>hallCounters</code> block.
| + | |
− | }}
| + | |
− | | + | |
− | == Ultrasound ranger ==
| + | |
− | | + | |
− | An ultrasound ranger can detect if there is an obstacle at the front or back of the kart.
| + | |
− | | + | |
− | It is based on the [https://digilent.com/reference/pmod/pmodmaxsonar/start PMOD-MAXSONAR] board from Digilent,
| + | |
− | and can be plugged into any one-row PMOD connector ('''beware not to wire on the +12V pin !''').
| + | |
− | | + | |
− | The ranger will output a pulse named '''PW''' on the board whose length has to be counted to determine the distance to an object following the rule 147 us / inch.
| + | |
− | Since the start/stop pin is not reachable, the sensor will continuously output pulses between 0.88 and 37.5 ms, each 49 ms.
| + | |
− | | + | |
− | {{WarningBox|content=
| + | |
− | No internal pull resistor should be enabled on the FPGA side.
| + | |
− | }}
| + | |
− | | + | |
− | ==== Operating procedure ====
| + | |
− | To root the ranger, proceed as follow:
| + | |
− | * Modify the .pdc file to root the ranger to the desired pin
| + | |
− | ** <code>set_io distancePulse -pinname 63 -fixed yes -DIRECTION Input</code>
| + | |
− | ** The pin must correspond to the '''PW''' pin on the ranger board
| + | |
− | | + | |
− | ==== FPGA design ====
| + | |
− | | + | |
− | To begin with, the [[Kart#FPGA_Design|design environment]] has to be downloaded.
| + | |
− | It comprises the <code>sensorsController</code> block which contains the registers and events manager
| + | |
− | and an empty <code>ultrasoundRanger</code> block which is to be completed.
| + | |
− | | + | |
− | The <code>rangerSubsignals</code> block is responsible to transmit the pulse internally only 3 times per second and to synchronize the signals to the beginning of the pulse.
| + | |
− | | + | |
− | It creates two signals:
| + | |
− | *<code>countEnable</code>, which stays at '1' the length of the measurement
| + | |
− | *<code>countPulse</code>, which are small pulses that must be counted, dividing the clock by a factor 10 (else the total count may be bigger than its corresponding [[kart/serial link#Registers|register]])
| + | |
− | | + | |
− | The block <code>ultrasoundRanger</code> has the following flow:
| + | |
− | * wait for the signal <code>countEnable</code> to be '1'
| + | |
− | * when so, the pulses <code>countPulse</code> must be counted as long as <code>countEnable</code> is '1'
| + | |
− | * when it goes back to '0', the counter value must be output to the <code>distance</code> signal and the counter reset, waiting for <code>countEnable</code> to go back to '1'
| + | |
− | | + | |
− | {{TaskBox|content=
| + | |
− | Draw the schematics of the <code>ultrasoundRanger</code> block.
| + | |
− | }}
| + | |
− | | + | |
− | == End of turn switch ==
| + | |
− | | + | |
− | The end of turn switch can be plugged into any PMOD connector, respecting the following:
| + | |
− | :{| cellpadding="3" cellspacing="0" border="1"
| + | |
− | ! Color
| + | |
− | ! Pin
| + | |
− | |-
| + | |
− | | Green
| + | |
− | | PMOD I/O
| + | |
− | |-
| + | |
− | | Black
| + | |
− | | GND
| + | |
− | |}
| + | |
− | | + | |
− | {{WarningBox|content=
| + | |
− | An internal pull-up must be enabled on the FPGA side.
| + | |
− | }}
| + | |
− | | + | |
− | ==== Operating procedure ====
| + | |
− | To root the switch, proceed as follow:
| + | |
− | * Modify the .pdc file to root the switch to the desired pin
| + | |
− | ** <code>set_io stepperEnd -pinname 97 -fixed yes -DIRECTION Input -RES_PULL Up</code>
| + | |
− | | + | |
− | == LEDs / Low-consumption outputs ==
| + | |
− | | + | |
− | In addition to the [[Kart/Daughterboard#LEDs|3 indication LEDs present on the daughterboard]], one can use any PMOD to drive [https://digilent.com/shop/pmod-8ld-eight-high-brightness-leds/ LEDs]
| + | |
− | or other outputs requiring either ON, OFF, or 50% duty cycle PWM (from 1 to 16383 ms) output.
| + | |
− | | + | |
− | {{WarningBox|content=
| + | |
− | The consumption per pin cannot be higher than 8 mA.
| + | |
− | | + | |
− | If needed, use a [https://digilent.com/shop/pmod-od1-open-drain-output/ driver extension board] to control voltages other than 3.3V or higher currents (through MOSFETs).
| + | |
− | }}
| + | |
− | | + | |
− | Check with your supervisor before wiring custom systems.
| + | |
− | I/O lines are '''NOT''' protected against over current and voltage backfeed.
| + | |
− | You are held responsible for the cost of repair in the event of destruction of the equipment (up to 50CHF per board).
| + | |
− | | + | |
− | ==== Operating procedure ====
| + | |
− | On the FPGA side, those outputs are called leds[n].
| + | |
− | To root them, proceed as follow:
| + | |
− | * Modify the '''Kart/Kart_Student''' package variable '''NUMBER_OF_LEDS''' to correspond to how many outputs are used
| + | |
− | * Modify the .pdc file to root the leds to the desired pins
| + | |
− | ** <code>set_io {leds[1]} -pinname 78 -fixed yes -DIRECTION Output</code>
| + | |
− | ** ''{leds[n]} with n from 1 to NUMBER_OF_LEDS''
| + | |
− | | + | |
− | == Buttons / Digital inputs ==
| + | |
− | | + | |
− | [https://digilent.com/shop/pmod-btn-4-user-pushbuttons/ Buttons] or other digital inputs can be wired to any PMOD '''as long as their levels are in the range 0-3.3V !'''
| + | |
− | | + | |
− | An event is sent to the smartphone each time the input is rising or falling.
| + | |
− | | + | |
− | {{WarningBox|content=
| + | |
− | Inputs are not suitable for signals faster than 5 Hz.
| + | |
− | | + | |
− | By the design and use of a BLE system, the transmission channel would become congested.
| + | |
− | }}
| + | |
− | | + | |
− | ==== Operating procedure ====
| + | |
− | On the FPGA side, those inputs are called endSwitches[n].
| + | |
− | To root them, proceed as follow:
| + | |
− | * Modify the '''Kart/Kart_Student''' package variable '''NUMBER_OF_EXT_END_SWITCHES''' to correspond to how many inputs are used
| + | |
− | * Modify the .pdc file to root the inputs to the desired pins
| + | |
− | ** <code>set_io {endSwitches[1]} -pinname 64 -fixed yes -DIRECTION Input</code>
| + | |
− | ** ''{endSwitches[n]} with n from 1 to NUMBER_OF_EXT_END_SWITCHES''
| + | |
− | ** If needed, one can add <code>-RES_PULL Up</code> or <code>-RES_PULL Down</code> to use internal pull resistors
| + | |
− | | + | |
− | == Proximity sensors ==
| + | |
− | | + | |
− | The [[kart/sensors/VCNL4000|proximity sensors]] are used to get the ambient light along the ''close'' proximity to an object.
| + | |
− | They can be plugged in any PMOD.
| + | |
− | | + | |
− | '''''They are normally not used anymore and thus not tested in the current Kart project.'''''
| + | |
− | | + | |
− | The sensor cable is to be connected as:
| + | |
− | :{| cellpadding="3" cellspacing="0" border="1"
| + | |
− | ! Color
| + | |
− | ! Pin
| + | |
− | |-
| + | |
− | | Orange
| + | |
− | | 3.3 V power supply
| + | |
− | |-
| + | |
− | | Yellow
| + | |
− | | SDA
| + | |
− | |-
| + | |
− | | Green
| + | |
− | | SCL
| + | |
− | |-
| + | |
− | | Blue
| + | |
− | | ground
| + | |
− | |}
| + | |
− | | + | |
− | {{WarningBox|content=
| + | |
− | External pull-ups should be present on the sensor board I2C lines, else internal ones enabled on the FPGA side.
| + | |
− | }}
| + | |
− | | + | |
− | ==== Operating procedure ====
| + | |
− | To root them, proceed as follow:
| + | |
− | * Modify the '''Kart/Kart_Student''' package variable '''NUMBER_OF_PROXIMITY_SENSORS''' to correspond to how many sensors are used
| + | |
− | * Modify the .pdc file to root the SCL to the desired pin(s)
| + | |
− | ** <code>set_io SCL_proxy -pinname 27 -fixed yes -DIRECTION Input -RES_PULL Up</code>
| + | |
− | ** ''if using multiple sensors and the SCL pins cannot be wired to the same output, root the <code>SCL_proxy</code> to multiple pins''
| + | |
− | * Modify the .pdc file to root the SDAs to the desired pins
| + | |
− | ** <code>set_io {SDA_proxy[1]} -pinname 28 -fixed yes -DIRECTION InOut -RES_PULL Up</code>
| + | |
− | ** ''{SDA_proxy[n]} with n from 1 to NUMBER_OF_PROXIMITY_SENSORS''
| + | |
| | | |
| [[Category:Kart]] | | [[Category:Kart]] |