https://wiki.hevs.ch/fsi/api.php5?action=feedcontributions&user=Christop.metraill&feedformat=atomFSI - User contributions [en]2024-03-28T15:36:46ZUser contributionsMediaWiki 1.18.1https://wiki.hevs.ch/fsi/index.php5/KartKart2022-08-29T21:04:52Z<p>Christop.metraill: New link to slides</p>
<hr />
<div>{{TOC right}}<br />
<br />
The Kart module (214_Pr1) is a Summer School module for students<br />
between the 2nd and the 3rd semester.<br />
It is a [[kart/gallery|home-made model car]] remotely controlled by a smartphone.<br />
<br />
[[File:Kart I2C.jpg|150px|center|Demo Kart]]<br />
<br />
The work of the students can be summarized in four main tasks:<br />
* design and assembly of the chassis and the body<br />
* analysis of the DC motor<br />
* [[Kart#FPGA_Design|configuration of the controlling FPGA]]<br />
* [[Kart#Android_App|completion and extension of the control GUI on the smartphone]]<br />
<br />
Take a look at the [[kart/gallery|karts gallery]]!<br />
<br />
== System Architecture ==<br />
[[File:Kart_batmobile.gif|right|Batmobile 2018]]<br />
The kart is controlled by a smartphone via Bluetooth.<br />
<br />
=== Hardware ===<br />
The electronics is composed of a general purpose [[Kart/Daughterboard|FPGA daughterboard]]<br />
mounted on a dedicated [[Kart/Motherboard|motherboard]]<br />
with 8&nbsp;[https://wiki.hevs.ch/fsi/index.php5/Kart/Motherboard#PMOD PMOD connectors].<br />
<br />
An Honor10 Lite smartphone running Android acts as the interface for the user.<br />
<br />
=== Distributed controls ===<br />
<br />
A [[Kart/Bluetooth|Bluetooth - USB dongle]] on the kart communicates via an [[kart/serial link|UART serial link]] with the FPGA.<br />
The control values are stored in a set of [[kart/serial link#Registers|registers]] accessed through a simple [[kart/serial link#Serial link protocol|protocol]].<br />
<br />
The design is separated into four different modules:<br />
* A [[Kart/DC motor controller|DC motor controller]] is controlling the propulsion motor.<br />
* A [[Kart/stepper motor controller|stepper motor controller]] is responsible for the Kart to turn.<br />
* A [[Kart/Sensors|sensor controller]] controls various I/Os (LEDs, buttons, range finder, hall sensors ...).<br />
* A [[Kart/serial_link#Control_Registers|control registers manager]] retrieve and control various status information (Bluetooth connection, hardware directions ...).<br />
<br />
== Tasks ==<br />
<br />
The [[Media:Programming_Introduction.pdf|programming introduction]] gives an overview of the structure of the software/hardware and the students' tasks.<br />
They comprise:<br />
* [http://en.wikipedia.org/wiki/Field-programmable_gate_array FPGA] design for driving the hardware and reading the sensors<br />
* [https://www.android.com Android] application development for the remote control<br />
<br />
The students receive the FPGA board preprogrammed with a functional solution and Android phones with a demo application.<br />
This allows starting the development either with the FPGA design or the Android application.<br />
<br />
=== FPGA Design ===<br />
<br />
==== Design environment ====<br />
<br />
A [https://classroom.github.com/a/YV2oi5ct FPGA design environment] is available, based on:<br />
* [http://www.mentor.com/products/fpga/hdl_design/hdl_designer_series/ HDL designer] for graphical design entry<br />
* [http://www.mentor.com/products/fv/modelsim/ ModelSim] for simulation<br />
* [http://www.microsemi.com/products/fpga-soc/design-resources/design-software/libero-ide Libero IDE] for synthesis and programming<br />
<br />
{{TaskBox|content=<br />
For the smoothest experience, you can use Git directly by cloning the repository.<br />
<br />
Otherwise, it is possible to download directly the corresponding <code>zip</code> and store it in you personal drive (<code>U:\</code>).<br />
While working on the project, it may be preferable to copy it locally for a quicker experience.<br />
<br />
Do not forget to either commit and push your modifications to your Git repository or save the modified files on your drive!<br />
}}<br />
{{WarningBox|content=<br />
Make sure that there is no space character in the full path to the project files.<br />
<br />
HDL may hang while booting or files not loading/saving correctly.<br />
}}<br />
<br />
The design is made using [https://www.mentor.com/products/fpga/hdl_design/hdl_designer_series/ HDL Designer]<br />
as it was the case during the [[Main_Page#Semester_1|previous semester's]] labs and project.<br />
The FPGAs are [[Libero IDE presentation|configured]] using the [https://www.microsemi.com/product-directory/design-resources/1751-libero-ide Libero IDE].<br />
<br />
==== Modules designs ====<br />
<br />
Three of the different modules must be completed:<br />
* The [[Kart/DC motor controller|DC motor controller]] receives a '''prescaler''' and a '''speed''' value to build the corresponding '''PWM''' and '''direction''' signals.<br />
* The [[Kart/stepper motor controller|stepper motor controller]] receives a '''prescaler''' and the '''desired angle''' and builds the coil controls signals.<br />
* The [[Kart/Sensors|sensor controller]] manages I/O comprising '''hall sensors''' (to retrieve the driving speed) and a '''range finder''' (to get the distance from an obstacle).<br />
<br />
==== Testing ====<br />
<br />
In addition to the tests explained in the different modules, an [[Kart/Daughterboard#Testing|overall tester]] is available to test the whole board.<br />
<br />
=== Android App ===<br />
One goal is to implement an Android application that controls and monitors the kart.<br />
<br />
==== Starting point ====<br />
<br />
* You can download the Kart template project with the minimal interface here: [[http://kart-javadoc.hevs.ch/Kart.zip Kart.zip]]<br />
* You can find the instructions on how to open the project in Android Studio in the [[Media:Programming_Introduction.pdf|programming introduction]] presentation.<br />
* The online documentation of all Java classes that are at your disposition is [[http://kart-javadoc.hevs.ch here]]<br />
* The installable package of the (or rather a) solution can be found here: [[http://kart-javadoc.hevs.ch/KartSolution.apk KartSolution.apk]]<br />
* If you need timers, please do not use Java standard Timer and TimerTask, we provide a dedicated Timer class in the package <b>ch.hevs.utils.Timer</b>.<br />
* To be informed when a sensor has a new value or a register is modified by the kart (i.e. the hall sensor counter value has changed), your application has to implement the KartListener interface. Don't forget to register your listener to the Kart (kart.addKartListener(...)).<br />
<br />
==== Common Problems ====<br />
* Don't block the main thread with an infinite loop<br />
* Don't change the orientation of the display during the execution, it can crash the BT communication. Do it in the Manifest.<br />
<br />
== Components ==<br />
<br />
=== Power supply ===<br />
<br />
The main power is drawn from two 6 V / 2400 mAh battery packs in series<br />
The [[Kart/Motherboard|motherboard]] provides two connectors for the batteries, along with an extra one to wire an NiMh charger.<br />
<br />
{{WarningBox|content=<br />
Make sure to shut the circuit off while charging to avoid higher voltage on the 12V rail.<br />
<br />
The charge rate should be around 0.05C => 120mA here.<br />
}}<br />
<br />
The 12V is reduced to a 5V rail through a buck converter.<br />
<br />
The [[Kart/Daughterboard|daughterboard]] is then fed with the 5V to provide an extra 3.3V rail.<br />
<br />
Finally, an ADC converter provides the [[kart/Motherboard#Power state|battery level]] as both the battery voltage and consumed current can be read from it.<br />
<br />
=== FPGA board ===<br />
<br />
The [[Kart/Daughterboard|daughterboard]] is equipped with an [https://www.mouser.ch/datasheet/2/268/Microsemi_DS0110_IGLOO_nano_Low_Power_Flash_FPGAs_-1592764.pdf Igloo AGLN250] FPGA in a VQ100 package.<br />
The clock is rooted to the FPGA from a 10 MHz quartz.<br />
<br />
It is designed as an SODIMM-200 RAM stick to be easily interchangeable and plugged into various motherboards.<br />
<br />
=== Sensors ===<br />
<br />
The sensors connected to the I/Os of the motherboard are:<br />
* 1 to 2 [[kart/Sensors#Hall_sensors|hall sensor(s)]]<br />
* 1 [[Kart/Sensors#Ultrasound_ranger|ultrasound ranger]]<br />
* 1 [[Kart/Sensors#End_of_turn_switch|end of turn]] contact switch<br />
* up to 4 [[Kart/Sensors#LEDs_.2F_Low-consumption_outputs|LEDs or digital outputs]]<br />
* up to 16 [[Kart/Sensors#Buttons_.2F_Digital_inputs|buttons or digital inputs]]<br />
<!--<br />
* 0 to 4 [[kart/Sensors#Proximity_sensors|VCNL4000 I2C Distance/Ambience Light Sensor]]<br />
--><br />
<br />
== Additional Information ==<br />
<br />
* Additional informations [[kart/professor|for collaborators]]<br />
* [[kart/toDo|To do list]]<br />
* When preparing the labs, follow the [[kart/setup|setup guide]]<br />
<br />
<br />
[[Category:Bachelor]] [[Category:SummerSchool]] [[Category:Pr1]] [[Category:Kart]]</div>Christop.metraillhttps://wiki.hevs.ch/fsi/index.php5/File:Programming_Introduction.pdfFile:Programming Introduction.pdf2022-08-29T20:59:34Z<p>Christop.metraill: uploaded a new version of &quot;File:Programming Introduction.pdf&quot;</p>
<hr />
<div>Presentation to introduce you to your tasks for the programming part of the Summer School's Kart project</div>Christop.metraillhttps://wiki.hevs.ch/fsi/index.php5/KartKart2022-08-29T20:56:16Z<p>Christop.metraill: Fix typos</p>
<hr />
<div>{{TOC right}}<br />
<br />
The Kart module (214_Pr1) is a Summer School module for students<br />
between the 2nd and the 3rd semester.<br />
It is a [[kart/gallery|home-made model car]] remotely controlled by a smartphone.<br />
<br />
[[File:Kart I2C.jpg|150px|center|Demo Kart]]<br />
<br />
The work of the students can be summarized in four main tasks:<br />
* design and assembly of the chassis and the body<br />
* analysis of the DC motor<br />
* [[Kart#FPGA_Design|configuration of the controlling FPGA]]<br />
* [[Kart#Android_App|completion and extension of the control GUI on the smartphone]]<br />
<br />
Take a look at the [[kart/gallery|karts gallery]]!<br />
<br />
== System Architecture ==<br />
[[File:Kart_batmobile.gif|right|Batmobile 2018]]<br />
The kart is controlled by a smartphone via Bluetooth.<br />
<br />
=== Hardware ===<br />
The electronics is composed of a general purpose [[Kart/Daughterboard|FPGA daughterboard]]<br />
mounted on a dedicated [[Kart/Motherboard|motherboard]]<br />
with 8&nbsp;[https://wiki.hevs.ch/fsi/index.php5/Kart/Motherboard#PMOD PMOD connectors].<br />
<br />
An Honor10 Lite smartphone running Android acts as the interface for the user.<br />
<br />
=== Distributed controls ===<br />
<br />
A [[Kart/Bluetooth|Bluetooth - USB dongle]] on the kart communicates via an [[kart/serial link|UART serial link]] with the FPGA.<br />
The control values are stored in a set of [[kart/serial link#Registers|registers]] accessed through a simple [[kart/serial link#Serial link protocol|protocol]].<br />
<br />
The design is separated into four different modules:<br />
* A [[Kart/DC motor controller|DC motor controller]] is controlling the propulsion motor.<br />
* A [[Kart/stepper motor controller|stepper motor controller]] is responsible for the Kart to turn.<br />
* A [[Kart/Sensors|sensor controller]] controls various I/Os (LEDs, buttons, range finder, hall sensors ...).<br />
* A [[Kart/serial_link#Control_Registers|control registers manager]] retrieve and control various status information (Bluetooth connection, hardware directions ...).<br />
<br />
== Tasks ==<br />
<br />
The [[Media:Programming_Introduction.pdf|programming introduction]] gives an overview of the structure of the software/hardware and the students' tasks.<br />
They comprise:<br />
* [http://en.wikipedia.org/wiki/Field-programmable_gate_array FPGA] design for driving the hardware and reading the sensors<br />
* [https://www.android.com Android] application development for the remote control<br />
<br />
The students receive the FPGA board preprogrammed with a functional solution and Android phones with a demo application.<br />
This allows starting the development either with the FPGA design or the Android application.<br />
<br />
=== FPGA Design ===<br />
<br />
==== Design environment ====<br />
<br />
A [https://classroom.github.com/a/YV2oi5ct FPGA design environment] is available, based on:<br />
* [http://www.mentor.com/products/fpga/hdl_design/hdl_designer_series/ HDL designer] for graphical design entry<br />
* [http://www.mentor.com/products/fv/modelsim/ ModelSim] for simulation<br />
* [http://www.microsemi.com/products/fpga-soc/design-resources/design-software/libero-ide Libero IDE] for synthesis and programming<br />
<br />
{{TaskBox|content=<br />
For the smoothest experience, you can use Git directly by cloning the repository.<br />
<br />
Otherwise, it is possible to download directly the corresponding <code>zip</code> and store it in you personal drive (<code>U:\</code>).<br />
While working on the project, it may be preferable to copy it locally for a quicker experience.<br />
<br />
Do not forget to either commit and push your modifications to your Git repository or save the modified files on your drive!<br />
}}<br />
{{WarningBox|content=<br />
Make sure that there is no space character in the full path to the project files.<br />
<br />
HDL may hang while booting or files not loading/saving correctly.<br />
}}<br />
<br />
The design is made using [https://www.mentor.com/products/fpga/hdl_design/hdl_designer_series/ HDL Designer]<br />
as it was the case during the [[Main_Page#Semester_1|previous semester's]] labs and project.<br />
The FPGAs are [[Libero IDE presentation|configured]] using the [https://www.microsemi.com/product-directory/design-resources/1751-libero-ide Libero IDE].<br />
<br />
==== Modules designs ====<br />
<br />
Three of the different modules must be completed:<br />
* The [[Kart/DC motor controller|DC motor controller]] receives a '''prescaler''' and a '''speed''' value to build the corresponding '''PWM''' and '''direction''' signals.<br />
* The [[Kart/stepper motor controller|stepper motor controller]] receives a '''prescaler''' and the '''desired angle''' and builds the coil controls signals.<br />
* The [[Kart/Sensors|sensor controller]] manages I/O comprising '''hall sensors''' (to retrieve the driving speed) and a '''range finder''' (to get the distance from an obstacle).<br />
<br />
==== Testing ====<br />
<br />
In addition to the tests explained in the different modules, an [[Kart/Daughterboard#Testing|overall tester]] is available to test the whole board.<br />
<br />
=== Android App ===<br />
One goal is to implement an Android application that controls and monitors the kart.<br />
<br />
==== Starting point ====<br />
<br />
* You can download the Kart template project with the minimal interface here: [[http://kart-javadoc.hevs.ch/Kart.zip Kart.zip]]<br />
* You can find the instructions on how to open the project in Android Studio in the [[http://kart-javadoc.hevs.ch/Programming%20Introduction.pdf programming introduction]] presentation...<br />
* The online documentation of all Java classes that are at your disposition is [[http://kart-javadoc.hevs.ch here]]<br />
* The installable package of the (or rather a) solution can be found here: [[http://kart-javadoc.hevs.ch/KartSolution.apk KartSolution.apk]]<br />
* If you need timers, please do not use Java standard Timer and TimerTask, we provide a dedicated Timer class in the package <b>ch.hevs.utils.Timer</b>.<br />
* To be informed when a sensor has a new value or a register is modified by the kart (i.e. the hall sensor counter value has changed), your application has to implement the KartListener interface. Don't forget to register your listener to the Kart (kart.addKartListener(...)).<br />
<br />
==== Common Problems ====<br />
* Don't block the main thread with an infinite loop<br />
* Don't change the orientation of the display during the execution, it can crash the BT communication. Do it in the Manifest.<br />
<br />
== Components ==<br />
<br />
=== Power supply ===<br />
<br />
The main power is drawn from two 6 V / 2400 mAh battery packs in series<br />
The [[Kart/Motherboard|motherboard]] provides two connectors for the batteries, along with an extra one to wire an NiMh charger.<br />
<br />
{{WarningBox|content=<br />
Make sure to shut the circuit off while charging to avoid higher voltage on the 12V rail.<br />
<br />
The charge rate should be around 0.05C => 120mA here.<br />
}}<br />
<br />
The 12V is reduced to a 5V rail through a buck converter.<br />
<br />
The [[Kart/Daughterboard|daughterboard]] is then fed with the 5V to provide an extra 3.3V rail.<br />
<br />
Finally, an ADC converter provides the [[kart/Motherboard#Power state|battery level]] as both the battery voltage and consumed current can be read from it.<br />
<br />
=== FPGA board ===<br />
<br />
The [[Kart/Daughterboard|daughterboard]] is equipped with an [https://www.mouser.ch/datasheet/2/268/Microsemi_DS0110_IGLOO_nano_Low_Power_Flash_FPGAs_-1592764.pdf Igloo AGLN250] FPGA in a VQ100 package.<br />
The clock is rooted to the FPGA from a 10 MHz quartz.<br />
<br />
It is designed as an SODIMM-200 RAM stick to be easily interchangeable and plugged into various motherboards.<br />
<br />
=== Sensors ===<br />
<br />
The sensors connected to the I/Os of the motherboard are:<br />
* 1 to 2 [[kart/Sensors#Hall_sensors|hall sensor(s)]]<br />
* 1 [[Kart/Sensors#Ultrasound_ranger|ultrasound ranger]]<br />
* 1 [[Kart/Sensors#End_of_turn_switch|end of turn]] contact switch<br />
* up to 4 [[Kart/Sensors#LEDs_.2F_Low-consumption_outputs|LEDs or digital outputs]]<br />
* up to 16 [[Kart/Sensors#Buttons_.2F_Digital_inputs|buttons or digital inputs]]<br />
<!--<br />
* 0 to 4 [[kart/Sensors#Proximity_sensors|VCNL4000 I2C Distance/Ambience Light Sensor]]<br />
--><br />
<br />
== Additional Information ==<br />
<br />
* Additional informations [[kart/professor|for collaborators]]<br />
* [[kart/toDo|To do list]]<br />
* When preparing the labs, follow the [[kart/setup|setup guide]]<br />
<br />
<br />
[[Category:Bachelor]] [[Category:SummerSchool]] [[Category:Pr1]] [[Category:Kart]]</div>Christop.metraillhttps://wiki.hevs.ch/fsi/index.php5/KartKart2020-08-25T09:13:21Z<p>Christop.metraill: </p>
<hr />
<div>{{private}}<br />
{{TOC right}}<br />
<br />
The Kart module (214_Pr1) is a Summer School module for students between the 2nd and the 3rd semester.<br />
It is a home-made model car remotely controlled by a smartphone.<br />
<br />
<!--[[File:Kart I2C.jpg|400px|center|Demo Kart]]--><br />
<br />
<gallery><br />
File:Kart I2C.jpg|HES-SO Valais/Wallis Demo Kart<br />
File:SummerSchool_17.jpg|Summer School '17<br />
File:SummerSchool_15.jpg|Summer School '15<br>[https://www.youtube.com/tv#/watch?v=i8vwEgQDNDM -> Video by Baptiste Cavin]<!--[[Media:Kart_Teaser.wmv|-> Video by Baptiste Cavin]]]]--><br />
File:SummerSchool_13.jpg|Summer School '13<br />
File:SummerSchool_12.jpg|Summer School '12<br />
File:SummerSchool_09.jpg|Summer School '09<br />
File:SummerSchool_05.jpg|Summer School '05<br />
File:SummerSchool_04.jpg|Summer School '04<br />
</gallery><br />
<br />
The work of the students can be summarized in four main tasks:<br />
* design and assembly of the chassis<br />
* analysis of the motor driver circuits (DC and stepper)<br />
* configuration of the controlling FPGAs<br />
* completion and extension of the control GUI on the smartphone<br />
<br />
== System Architecture ==<br />
<br />
The kart is controlled by a smartphone via Bluetooth.<br />
<br />
=== Distributed boards ===<br />
<br />
A Bluetooth receiver on the kart communicates via an [[kart/serial link|RS232 serial link]] with the FPGA control board.<br />
This board stores the control values in a set of [[kart/serial link#Registers|registers]] and dispatches them at a regular interval on an I2C link.<br />
The master also reads data values from the slave boards, stores them into a second set of registers and sends the corresponding information at a regular pace over the RS232 with a very simple [[kart/serial link#Serial link protocol|protocol]].<br />
<br />
The control is distributed over several FPGA boards connected together via [[kart/I2C link|I2C]].<br />
These base boards each hold a slave function board:<br />
* A [[Kart/Bluetooth|Bluetooth RS232 modem]] sits on the [[Kart/FPGA board|I2C master FPGA]]<br />
* A [[Kart/DC motor controller|DC motor controller]] receives a speed value and builds a PWM and a direction control.<br />
* A [[Kart/stepper motor controller|stepper motor controller]] receives the desired angle and builds the coil controls signals.<br />
* A [[Kart/sensor board|sensor board]] manages I/O comprising proximity sensors, hall sensors (for the driving speed) and LEDs.<br />
== Tasks ==<br />
<br />
The [[Media:Programming_Introduction.pdf|programming introduction]] gives an overview about the structure of the software/hardware and the students' tasks.<br />
They comprise:<br />
* [http://en.wikipedia.org/wiki/Field-programmable_gate_array FPGA] design for driving the hardware and reading the sensors<br />
* [https://www.android.com Android] application development for the remote control<br />
<br />
The students receive FPGA boards preprogrammed with a functional solution and androïd phones with a demo application.<br />
This allows to start the development either with the FPGA design or the Android application development.<br />
<br />
=== FPGA Design ===<br />
<br />
A [https://classroom.github.com/g/s3xpuVfh FPGA design environment] is available, based on:<br />
* [http://www.mentor.com/products/fpga/hdl_design/hdl_designer_series/ HDL designer] for graphical design entry<br />
* [http://www.mentor.com/products/fv/modelsim/ ModelSim] for simulation<br />
* [http://www.microsemi.com/products/fpga-soc/design-resources/design-software/libero-ide Libero IDE] for synthesis and programming<br />
<br />
{{TaskBox|content=<br />
clone the Git repository or download the corresponding <code>zip</code> and install it,<br />
preferably to your personal drive (<code>U:\</code>).<br />
}}<br />
{{WarningBox|content=<br />
Make sure that there is no space character in the path to ELN_kart.<br />
}}<br />
<br />
With this, the following designs have to be completed:<br />
* the [[Kart/DC motor controller#FPGA design|DC motor controller FPGA]] has to generate the PWM and direction signals for the propulsion motor<br />
* the [[Kart/stepper motor controller#FPGA design|stepper motor controller FPGA]] has to generate the 4&nbsp;phases to turn the steering wheels to the desired angle<br />
* the [[Kart/sensor_board#FPGA_design|I/O control FPGA]] has to count the propulsion wheels' rotations and can count the ultrasound ranger distance.<br />
<br />
=== Android App ===<br />
One goal is to implement an Android application that controls and monitors the kart.<br />
<br />
==== Introduction ====<br />
<br />
The installable package of the (or rather a) solution can be found here: [[Media:Kart.apk|Kart.apk]]<br />
<br />
==== Starting point ====<br />
<br />
* You can download the Kart project with the minimal interface here: [[Media:Kart.zip|Kart.zip]]<br />
* You can find the instructions how to open the project in Android Studio in the [[Media:Programming_Introduction.pdf|programming introduction]] presentation...<br />
* The online documentation of all Java classes that are at your disposition is [[http://kart-javadoc.hevs.ch here]]<br />
* If you need timers, please do not use Java standard Timer and TimerTask, we provide a dedicated Timer class in the package <b>ch.hevs.utils.Timer</b>.<br />
* To be informed when a register is modified by the kart (i.e. the hall sensor counter value has changed), your application has to implement the KartStatusRegisterListener interface. This will force your application to have a method (statusRegisterHasChanged) that will be called when a register value has changed. Don't forget to register your listener to the Kart (kart.addStatusRegisterListener(...)).<br />
<br />
==== Common Problems ====<br />
* Don't block the main thread with an infinite loop<br />
* Don't change the orientation of the display during the execution, it can crash the BT communication. Do it in the Manifest.<br />
<br />
==== Virtual Kart ====<br />
If you need to test your Android application against a Kart and your Kart is either not build yet or not available at the moment, you can install the '''Virtual Kart''' application and use the Kart Bluetooth to USB adapter.<br />
<br />
* Windows version [http://kart-javadoc.hevs.ch/Virtual%20Kart-2019.8-win64.exe here]<br />
* macOS version [http://kart-javadoc.hevs.ch/Virtual%20Kart-2019.8-macOS.dmg here]<br />
<br />
== Components ==<br />
<br />
=== Power supply ===<br />
<br />
The [[Kart/power supply|power supply board]] provides the 5&nbsp;V and the 3.3&nbsp;V to the other boards.<br />
This is generated from two 6&nbsp;V battery packs.<br />
<br />
The power supply board also comprises an ADC which provides the [[kart/battery level|battery level]].<br />
<br />
=== FPGA boards ===<br />
<br />
The [[Kart/FPGA board|FPGA motherboards]] are equipped with an AGL125 [http://www.microsemi.com/products/fpga-soc/fpga/igloo-overview IGLOO] in a VQ100 package. The clock passed to the FPGA comes from a 10 MHz quartz.<br />
<br />
They hold daughterboards which drive different parts of the Kart.<br />
The motherboards are interconnected via an [[kart/I2C link|I2C link]].<br />
<br />
The FPGA motherboards can be tested with the help of a dedicated [[Kart/FPGA_board#Test|test board]] which runs a signal from one I/O pin to the next.<br />
<br />
=== FPGA daughterboards ===<br />
<br />
Existing daughterboards are:<br />
* a [[Kart/Bluetooth|Bluetooth interface board]]<br />
* a [[Kart/DC motor controller|DC motor controller]]<br />
* a [[Kart/stepper motor controller|stepper motor controller]]<br />
* an [[Kart/sensor board|I/O board]] for the sensors<br />
* an [[Kart/FPGA_board#Test|FPGA test]] board<br />
<br />
=== Sensors ===<br />
<br />
The sensors connected to the I/O board are:<br />
* 1 to 4 [[kart/sensors/VCNL4000|VCNL4000 I2C Distance/Ambience Light Sensor]]<br />
* 1 to 2 [[kart/sensors/SS311PT|SS311PT Hall Sensor]]<br />
* 1 [[Kart/sensors/HCSR04|ultrasound ranger]]<br />
* 1 [[Kart/sensor board|end of turn]] contact switch<br />
<br />
== Additional Information ==<br />
<br />
* Additional informations [[kart/professor|for collaborators]]<br />
* [[kart/toDo|To do list]]<br />
* When preparing the labs, follow the [[kart/setup|setup guide]]<br />
<br />
<br />
[[Category:Bachelor]] [[Category:SummerSchool]] [[Category:Pr1]] [[Category:Kart]]</div>Christop.metraillhttps://wiki.hevs.ch/fsi/index.php5/Main_PageMain Page2020-08-25T09:12:04Z<p>Christop.metraill: Remove the old Kart project page</p>
<hr />
<div>{{TOC right}}<br />
[[File:hesso_logo.png|left|200px|HESSO Valais Wallis Logo|link=http://www.hevs.ch]] Welcome to the knowledge database of the [http://www.hevs.ch HES-SO Valais Wallis] Bachelor Degree Course of Systems Engineering ([http://www.hevs.ch/de/hochschule/hochschule-fur-ingenieurwissenschaften/systemtechnik/bachelors/der-studiengang-1043 Systemtechnik] | [http://www.hevs.ch/fr/hautes-ecoles/haute-ecole-d-ingenierie/systemes-industriels/bachelors/presentation-1043 Systèmes industriels], SI).<br />
<br />
[[File:Icontexto-inside-rss.png|link=Help:http://wiki.hevs.ch/fsi/index.php?title=Special:RecentChanges&feed=rss|48px]] [http://wiki.hevs.ch/fsi/index.php?title=Special:RecentChanges&feed=rss Sign up to our RSS Feed to stay up-to-date]<br />
<br />
<br />
= Modules =<br />
Use the ''Navigation'' to the left or jump directly to your course using the links below.<br />
<br />
== Bachelor ==<br />
=== Semester 1 ===<br />
* [[eln|Digital Electronics (Numerische Elektronik / Electronique Numerique, ElN)]]<br />
** [[chrono|Chrono]] project<br />
** [[cursor|Cursor]] project<br />
** [[Eln/support|Support]] material<br />
<br />
=== Summer School ===<br />
<!-- * [[Kart|Kart (214_SS1)]] project --><br />
* [[Kart 2020|Kart 2020 (214_SS1)]] project<br />
<br />
=== Semester 6 ===<br />
* [[SEm|Embedded Systems (Eingebettete Systeme | Systèmes Embarqués, SEm)]] module<br />
<br />
== Master ==<br />
*[[HiRel|High-Reliability Electronics (HiRel)]] module<br />
**[[HiRel/CanSat|CanSat]] project<br />
*[[SwiSSC|Swiss Space Summer Camp]] : a summer school in cooperation with [http://www.bmstu.ru/en/ Bauman University] in Moscow<br />
<br />
== Demonstration ==<br />
* EPTM / BFO [[EMVs/AudioAmp|audio amplifier]] project day<br />
* EPTM / BFO [[EMVs/RemoteControl|remote control]] project day<br />
<!-- * Besuchstag BFO BM [[Chrono|Konfigurierbare Hardware]] ProbeLabo --><br />
<br />
= Tools =<br />
* [[Tools/EDA/Install|Installation of EDA tools]]<br />
* [[LinuxInstall2016| Installation of Linux for DR01/DR03]]<br />
* [[Linux Install| (old) Installation of Linux for DR01/DR03]]<br />
<br />
<br />
[[Category:Bachelor]] [[Category:Master]]</div>Christop.metraillhttps://wiki.hevs.ch/fsi/index.php5/Kart_2020Kart 20202020-08-24T11:44:36Z<p>Christop.metraill: Update Youtube link, remove unused items and section for the 2020 edition</p>
<hr />
<div>{{TOC right}}<br />
<br />
The Kart module (214_Pr1) is a Summer School module for students between the 2nd and the 3rd semester.<br />
It is a home-made model car remotely controlled by a smartphone.<br />
<br />
<!--[[File:Kart I2C.jpg|400px|center|Demo Kart]]--><br />
<br />
<gallery><br />
File:Kart I2C.jpg|HES-SO Valais/Wallis Demo Kart<br />
File:SummerSchool_17.jpg|Summer School '17<br />
File:SummerSchool_15.jpg|Summer School '15<br>[https://youtu.be/hSTDnhofl60 Youtube teaser movie]<br />
File:SummerSchool_13.jpg|Summer School '13<br />
File:SummerSchool_12.jpg|Summer School '12<br />
File:SummerSchool_09.jpg|Summer School '09<br />
File:SummerSchool_05.jpg|Summer School '05<br />
File:SummerSchool_04.jpg|Summer School '04<br />
</gallery><br />
<br />
The work of the students can be summarized in three main tasks:<br />
* design and assembly of the chassis<br />
* completion and extension of the control GUI on the smartphone<br />
<br />
== System Architecture ==<br />
<br />
The kart is controlled by a smartphone via Bluetooth.<br />
<br />
=== Distributed boards ===<br />
<br />
A Bluetooth receiver on the kart communicates via an [[kart/serial link|RS232 serial link]] with the FPGA control board.<br />
This board stores the control values in a set of [[kart/serial link#Registers|registers]] and dispatches them at a regular interval on an I2C link.<br />
The master also reads data values from the slave boards, stores them into the second set of registers, and sends the corresponding information at a regular pace over the RS232 with a very simple [[kart/serial link#Serial link protocol|protocol]].<br />
<br />
The control is distributed over several FPGA boards connected together via [[kart/I2C link|I2C]].<br />
These baseboards each hold a slave function board:<br />
* A [[Kart/Bluetooth|Bluetooth RS232 modem]] sits on the [[Kart/FPGA board|I2C master FPGA]]<br />
* A [[Kart/DC motor controller|DC motor controller]] receives a speed value and builds a PWM and direction control.<br />
* A [[Kart/stepper motor controller|stepper motor controller]] receives the desired angle and builds the coil controls signals.<br />
* A [[Kart/sensor board|sensor board]] manages I/O comprising proximity sensors, hall sensors (for the driving speed), and LEDs.<br />
== Tasks ==<br />
<br />
The [[Media:Programming_Introduction_2020.pdf|programming introduction]] gives an overview of the structure of the software and the students' tasks.<br />
They comprise:<br />
* [https://www.android.com Android] application development for the remote control<br />
<br />
The students receive FPGA boards preprogrammed with a functional solution and androïd phones with a demo application.<br />
<br />
=== Android App ===<br />
One goal is to implement an Android application that controls and monitors the kart.<br />
<br />
==== Introduction ====<br />
<br />
The installable package of the (or rather a) solution can be found here: [[Media:Kart.apk|Kart.apk]]<br />
<br />
==== Starting point ====<br />
<br />
* You can download the Kart project with the minimal interface here: [[Media:Kart.zip|Kart.zip]]<br />
* You can find the instructions on how to open the project in Android Studio in the [[Media:Programming_Introduction_2020.pdf|programming introduction]] presentation...<br />
* The online documentation of all Java classes that are at your disposition is [[http://kart-javadoc.hevs.ch here]]<br />
* If you need timers, please do not use Java standard Timer and TimerTask, we provide a dedicated Timer class in the package <b>ch.hevs.utils.Timer</b>.<br />
* To be informed when a register is modified by the kart (i.e. the hall sensor counter value has changed), your application has to implement the KartStatusRegisterListener interface. This will force your application to have a method (statusRegisterHasChanged) that will be called when a register value has changed. Don't forget to register your listener to the Kart (kart.addStatusRegisterListener(...)).<br />
<br />
==== Common Problems ====<br />
* Don't block the main thread with an infinite loop<br />
* Don't change the orientation of the display during the execution, it can crash the BT communication. Do it in the Manifest.<br />
<br />
==== Virtual Kart ====<br />
If you need to test your Android application against a Kart and your Kart is either not build yet or not available at the moment, you can install the '''Virtual Kart''' application and use the Kart Bluetooth to USB adapter.<br />
<br />
* Windows version [http://kart-javadoc.hevs.ch/Virtual%20Kart-2019.8-win64.exe here]<br />
* macOS version [http://kart-javadoc.hevs.ch/Virtual%20Kart-2019.8-macOS.dmg here]<br />
<br />
== Components ==<br />
<br />
=== Power supply ===<br />
<br />
The [[Kart/power supply|power supply board]] provides the 5&nbsp;V and the 3.3&nbsp;V to the other boards.<br />
This is generated from two 6&nbsp;V battery packs.<br />
<br />
The power supply board also comprises an ADC which provides the [[kart/battery level|battery level]].<br />
<br />
=== FPGA boards ===<br />
<br />
The [[Kart/FPGA board|FPGA motherboards]] are equipped with an AGL125 [http://www.microsemi.com/products/fpga-soc/fpga/igloo-overview IGLOO] in a VQ100 package. The clock passed to the FPGA comes from a 10 MHz quartz.<br />
<br />
They hold daughterboards that drive different parts of the Kart.<br />
The motherboards are interconnected via an [[kart/I2C link|I2C link]].<br />
<br />
The FPGA motherboards can be tested with the help of a dedicated [[Kart/FPGA_board#Test|test board]] which runs a signal from one I/O pin to the next.<br />
<br />
=== FPGA daughterboards ===<br />
<br />
Existing daughterboards are:<br />
* a [[Kart/Bluetooth|Bluetooth interface board]]<br />
* a [[Kart/DC motor controller|DC motor controller]]<br />
* a [[Kart/stepper motor controller|stepper motor controller]]<br />
* an [[Kart/sensor board|I/O board]] for the sensors<br />
* an [[Kart/FPGA_board#Test|FPGA test]] board<br />
<br />
=== Sensors ===<br />
<br />
The sensors connected to the I/O board are:<br />
* 1 to 4 [[kart/sensors/VCNL4000|VCNL4000 I2C Distance/Ambience Light Sensor]]<br />
* 1 to 2 [[kart/sensors/SS311PT|SS311PT Hall Sensor]]<br />
* 1 [[Kart/sensors/HCSR04|ultrasound ranger]]<br />
* 1 [[Kart/sensor board|end of turn]] contact switch<br />
<br />
== Additional Information ==<br />
<br />
* Additional informations [[kart/professor|for collaborators]]<br />
* [[kart/toDo|To do list]]<br />
* When preparing the labs, follow the [[kart/setup|setup guide]]<br />
<br />
<br />
[[Category:Bachelor]] [[Category:SummerSchool]] [[Category:Pr1]] [[Category:Kart]]</div>Christop.metraillhttps://wiki.hevs.ch/fsi/index.php5/Kart:Android:TimerKart:Android:Timer2015-08-21T12:54:16Z<p>Christop.metraill: Fix a bug in the scheduleOnce fct</p>
<hr />
<div>{{TOC right}}<br />
<source lang="java"><br />
package ch.hevs.utils.timer;<br />
<br />
import android.os.Handler;<br />
<br />
/**<br />
* Schedules one-shot or recurring tasks for execution.<br />
*<br />
* You have to extend this abstract class and implement the method onTimeout().<br />
*<br />
* The timer runs inside the Android main UI, so there will be no problems when using UI elements<br />
* from the timer's onTimeout() method. If the UI main thread is busy, timer execution may be<br />
* subject to delays.<br />
*<br />
* One-shot timers are scheduled to run after a relative delay.<br />
*<br />
* Periodically timers are scheduled with a fixed period and the very first time they are executed<br />
* immediately.<br />
*<br />
* This class does not offer guarantees about the real-time nature of task scheduling.<br />
*<br />
* @author Michael Clausen (clm@hevs.ch)<br />
* @version 2.2 - 2015<br />
*/<br />
public abstract class Timer {<br />
/**<br />
* This method will be called either once after the specified delay or periodically whenever<br />
* the timer expires.<br />
*/<br />
public abstract void onTimeout();<br />
<br />
/**<br />
* Schedules the timer once to expire after the given delay.<br />
*<br />
* Note that if the timer has already scheduled, this method will do nothing at<br />
*<br />
* @param delayMs The delay in milliseconds.<br />
*/<br />
public void scheduleOnce(final int delayMs) {<br />
if (interval == 0 && delayMs > 0) {<br />
continuously = false;<br />
interval = delayMs;<br />
handler.postDelayed(runnable, delayMs);<br />
}<br />
}<br />
<br />
/**<br />
* Schedules the timer continuously using the given interval. Note that the first time the timer<br />
* expires immediately.<br />
*<br />
* @param intervalMs Interval between the points in time the timer expires.<br />
*/<br />
public void schedulePeriodically(final int intervalMs) {<br />
if (interval == 0 && intervalMs > 0) {<br />
continuously = true;<br />
interval = intervalMs;<br />
handler.post(runnable);<br />
}<br />
}<br />
<br />
/**<br />
* Stops/cancels/pauses the pending timer. If the timer was scheduled once and did not already<br />
* expire, it will canceled. Periodically timers will be paused.<br />
*<br />
* You can reschedule timers, but you need to wait until the ready() method returns true.<br />
*/<br />
public void stop() {<br />
interval = -1;<br />
}<br />
<br />
/**<br />
* If this method returns true, it is save to schedule the timer.<br />
*<br />
* @return True if the timer is ready to be rescheduled.<br />
*/<br />
public boolean ready() {<br />
return interval == 0;<br />
}<br />
<br />
private boolean continuously = false;<br />
private int interval = 0;<br />
private final Handler handler = new Handler();<br />
private final Runnable runnable = new Runnable() {<br />
@Override<br />
public void run() {<br />
if (interval > 0) {<br />
if (continuously) {<br />
handler.postDelayed(runnable, interval);<br />
}<br />
onTimeout();<br />
}<br />
if (interval == -1) {<br />
interval = 0;<br />
}<br />
}<br />
};<br />
}<br />
</source></div>Christop.metraill