The Kart module (214_Pr1) is a Summer School module for students between the 2nd and the 3rd semester. It is a home-made model car remotely controlled by a smartphone.
The work of the students can be summarized in four main tasks:
- design and assembly of the chassis and the body
- analysis of the DC motor
- configuration of the controlling FPGAs
- completion and extension of the control GUI on the smartphone
Take a look at the karts gallery !
The kart is controlled by a smartphone via Bluetooth.
An Honor10 Lite running Android acts as the interface for the user.
The design is separated over four different modules:
- A DC motor controller is controlling the propulsion motor.
- A stepper motor controller is responsible for the Kart to turn.
- A sensor controller controls various I/Os (LEDs, buttons, range finder, hall sensors ...).
- A control registers manager retrieve and control various status information (bluetooth connection, hardware directions ...).
The programming introduction gives an overview about the structure of the software/hardware and the students' tasks. They comprise:
- FPGA design for driving the hardware and reading the sensors
- Android application development for the remote control
The students receive the FPGA board preprogrammed with a functional solution and Android phones with a demo application. This allows to start the development either with the FPGA design or the Android application.
A FPGA design environment is available, based on:
- HDL designer for graphical design entry
- ModelSim for simulation
- Libero IDE for synthesis and programming
Make sure that there is no space character in the full path to the project files.
HDL may hang while booting or files not loading/saving correctly.
Three of the different modules must be completed:
- The DC motor controller receives a prescaler and a speed value to build the corresponding PWM and direction signals.
- The stepper motor controller receives a prescaler and the desired angle and builds the coil controls signals.
- The sensor controller manages I/O comprising hall sensors (to retrieve the driving speed) and a range finder (to get the distance from an obstacle).
One goal is to implement an Android application that controls and monitors the kart.
The installable package of the (or rather a) solution can be found here: Kart.apk
- You can download the Kart project with the minimal interface here: Kart.zip
- You can find the instructions how to open the project in Android Studio in the programming introduction presentation...
- The online documentation of all Java classes that are at your disposition is [here]
- If you need timers, please do not use Java standard Timer and TimerTask, we provide a dedicated Timer class in the package ch.hevs.utils.Timer.
- 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(...)).
- Don't block the main thread with an infinite loop
- Don't change the orientation of the display during the execution, it can crash the BT communication. Do it in the Manifest.
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 dongle directly in a USB port.
The main power is drawn from two 6 V / 2400 mAh battery packs in series The motherboard provides two connectors for the batteries, along with an extra one to wire an NiMh charger.
Make sure to shut the circuit off while charging to avoid higher voltage on the 12V rail.
The charge rate should be of around 0.05C => 120mA here.
The 12V is reduced to a 5V rail through a buck converter.
The daughterboard is then fed with the 5V to provide an extra 3.3V rail.
Finally, an ADC converter provides the battery level as both the battery voltage and consumed current can be read from it.
It is designed as an SODIMM-200 RAM stick to be easily interchangeable and plugged into various motherboards.
The sensors connected to the I/Os of the motherboard are:
- 1 to 2 hall sensor(s)
- 1 ultrasound ranger
- 1 end of turn contact switch
- 1 to 8 LEDs or digital outputs
- 1 to 16 buttons or digital inputs
- 0 to 4 VCNL4000 I2C Distance/Ambience Light Sensor