Project A
Electronics Engineering Technology Project A
ELTR2302: Embedded Systems III XXXXXXXXXXStudent Name: ____________________________
ELTR2302.ProjectA Page 1 of 3
Outcomes of this Project
1. Interpretation and co
ect use of data specification sheets.
2. Implement a simple embedded system circuit design, interfacing a microcontroller with
the following analog/digital devices:
a. A 4x4 matrix mem
ane keypad.
. Two Servo Motors
c. An Analog thumb joystick
d. Two LEDs: one red and one green.
3. Write firmware (software) for a microcontroller embedded system application.
Project Description and Procedure.
ABC Engineering has completed a preliminary embedded system design using a joystick to
control two servo motors using an Arduino Nano (Microchip 328p) microcontroller.
The lead engineer has spec’d out the required components for use with the system. They
include the following:
Parallax Inc 4x4 Matrix Mem
ane Keypad (#27899)
Keypad Li
ary for Arduino by Mark Stanley and Alexander Brevig (IDE download)
Adafruit Analog 2-axis Thumb Joystick with Select Button + Breakout Board (ID: 512)
FeeTech FS90 Micro Servo Specifications => Servo Additional Information
Red and Green LEDs
The engineer has also provided the required pinout and connection diagram for the
implementation of the design that must be followed. No deviations are permitted.
https:
www.parallax.com/sites/default/files/downloads/27899-4x4-Matrix-Mem
ane-Keypad-v1.2.pdf
https:
playground.arduino.cc/Code/Keypad
https:
www.adafruit.com/product/512
https:
www.pololu.com/file/0J1435/FS90-specs.pdf
https:
www.pololu.com/product/2818
Electronics Engineering Technology Project A
ELTR2302: Embedded Systems III XXXXXXXXXXStudent Name: ____________________________
ELTR2302.ProjectA Page 2 of 3
ABC Engineering has requested ELTR2302 students to build a prototype of the embedded
system as well as write the firmware (software) required for its operation. The lead engineer
has provided the following requirements in keeping with ABC’s internal programming
standards used with all of their firmware.
Firmware guidelines.
The program is to be written in a modular format with each state of operation self-contained
in a function. The three required states of operation for this system are as follows.
State0 => The initialization
eset condition
State1 => The keypad entry
State2 => The joystick and servo-motor operations.
The program is to have the following structure. Again, no deviation is permitted as this is
ABC’s standard program structure.
#include, #define, and system variable definitions first.
void setup()
Setup the system for operation
void loop()
Main program loop
void State0()
State0 function
void State1()
State1 function
void State2()
State2 function
ISR()
Appropriate Inte
upt Service Routine as required.
Firmware Details
A system-wide variable (global variable) called OP_State (short for operational state) is to be
used to keep track of the cu
ent system state. Upon initialization
eset, this variable should
e zero (0).
The void loop() function template is given as follows:
if (OP_State ==0)
call the state0 function
if (OP_State ==1)
call the state1 function
if (OP_State ==2)
call the state2 function
Electronics Engineering Technology Project A
ELTR2302: Embedded Systems III XXXXXXXXXXStudent Name: ____________________________
ELTR2302.ProjectA Page 3 of 3
The void state0() function pseudo code template is give as follows:
Set the Red and Green LEDs as off.
In an infinite loop, toggle the Red LED on and off using the appropriate PIN function
Use the millis() function to determine the on and off time such that the period is 500ms.
The delay() function is not permitted.
Breakout of the infinite loop if the OP_State changes to 1, via the ISR() function.
The void state1() function pseudo code template is give as follows:
Ensure the Green LED is off and turn the Red LED on solid.
Wait until a key is pressed from the keypad. (use the waitForKey() function)
If the keypress is not ‘*’, change the OP_State back to State0 and exit the function
If the keypress is ‘*’ key, enter two additional key presses.
If the 2 digits match the predefined access code ‘4A’, change the OP_State to State2
and exit the function
(Note: The 2 digit access code is globally defined as an a
ay or string of characters.)
Otherwise change the OP_State back to State0 and exit the function.
The void state2() function pseudo code template is give as follows:
Ensure the Green LED is on solid and the Red LED is off.
In a continuous loop, change the position of the servo-motors via the joystick X-Axis and
Y-Axis values. Check the status of the keypad for the ‘#’ key (use the getKey() function
for this). Note: The servo motor must be controlled by configure the appropriate
timers, not using servomotor li
ary functions.
The continuous loop should end if the ‘#’ key was entered. Then reset the OP_State to
State0 and exit the function.
The appropriate ISR() function pseudo code template is give as follows:
The ISR is entered when the Joystick pushbutton is pressed. If the cu
ent state is 0, then
the OP_State is changed to 1, when the button is released.
If the joystick button is pressed when not in OP_State 0, the button press is ignored.
The course instructor is the main contact with the lead engineer from ABC Engineering.
They require students to present their designs to the course instructor to verify co
ect
hardware and firmware operation of the circuit. A project completion guide will be provided
separately. Best of luck with your design.