Embedded Systems - Pearson Higher Nationals in Engineering
Assignment - Embedded System Design and Development
Learning Outcome 1: Design and implement simple external circuitry, interfacing with a given microcontroller
Learning Outcome 2: Write well-structured code in an appropriate programming language, to simulate, test and debug it
This assignment assesses the learner's ability to produce software for microcontroller-based systems, as well as be able to interface a microcontroller-based system.
Assignment Brief
Case Scenario:
You are a junior computer engineer at a company that manufactures remote control cars, using microcontrollers. Your R&D team is currently working on designing a new line of RC cars, which requires your knowledge on microcontrollers to make integral design decisions for upcoming products. Your manager has asked you to build an initial prototype of the car, given some design requirements, and requires that you document your design process.
The initial prototype of the car contains the following features, which should be considered during design:
- When the car is at rest, wait for a button press to determine forward or backward motion. Motor is off, all LED's are off.
- If forward button is pressed while car is stationary, motor turns in clockwise direction and green LED is on.
- If car is in forward motion and the forward button is pressed, motor accelerates. The motor can decelerate to 60rpm using the brake button. Green LED is on once car is in forward motion.
- If reverse button is pressed while car is stationary, motor turns in anti-clockwise direction and the white LED indicator flashes continuously at a frequency of 2Hz.
- When in forward/backward motion, if brake button is pressed, motor stops spinning. Green/white LEDs turns off and red LED turns on. If brake button is pressed while car is stationary, red LED turns on (no change in DC motor).
After the first iteration, your manager has asked that you improve the design by adding the following requirements:
- If an obstacle is detected in front of the car, the distance of the obstacle from the car is displayed on the seven-segment LED display
- When the distance is within 15cm of the car, the car automatically brakes (i.e. DC motor stops spinning) and brake light (red LED) turns on
- If reverse button is pressed while car is in forward motion, motor should stop, and all LEDs should blink 3 times simultaneously to indicate warning.
Task 1.1
For this task, you are required to do the following:
(i) Design the initial circuit to meet the above criteria, with supporting circuit/schematic diagram and a system block diagram. You should take into consideration how the inputs and outputs are being interfaced with the microcontroller. (P3)
(ii) Implement your circuit design as a breadboard-based prototype. Ensure that you include in your design any necessary protective circuitry. Include in your report, photo evidence of your implementation. (P4)
Task 1.2
For this task, you are required to do the following:
(i) Improve your circuit implementation by adding the improved design criteria for obstacle detection and motor cut-off in the second product iteration (M2). Your implementation should be accompanied by supporting circuit/design diagrams and photographs of the improved circuit. The functionality of this improvement will be assessed during demonstration (M3).
(ii) Make one of the following changes to your circuit and critically evaluate functionality of your implementation (D2):
• Instead of powering the microcontroller from the USB port, introduce a battery powered source, ensuring that you take the necessary precautions. Document your implementation of this change, stating how you included any protective circuitry, if necessary.
• Add a flyback diode as additional protective circuitry for your motor, include this in your circuit diagram and state what effect it has, if any, when used in tandem with an H-bridge driver.
Task 2.1
For this task, you are required to do the following:
(i) Develop an Arduino C++ program using Arduino IDE to meet all the requirements stated in the above scenario. Note that your code should only match the design iteration that you have implemented in Task
1. Your implementation should show evidence of the use of at least two of the following peripherals: Timers, PWM, Interrupts, GPIO. (P5)
(ii) During the project demonstration at the end of the semester, you will be required to make on-the-spot changes to your program, which will, by default, require you to test and debug code via hardware simulation to demonstrate functionality. (P6)
Task 2.2
For this task, you are required to do the following:
(i) Of the three code samples provided on the course Moodle, which contain poorly written, poorly structured code, adapt one of these code samples into your project, ensuring that you improve upon them using good programming practice, based on the principles taught in class. These code samples contain functions which pertain to components of the project. You are required to state your changes in the code comments (M4).
(ii) Create a test suite for the three design criteria of the second iteration of the product and perform a critical evaluation of the corresponding code and how these tests are reflected in the hardware implementation. (D3)