Hardware Microprogramming Education Using Raspberry PI and Arduino Technologies

: Hardware control is becoming a dominating topic in the field of engineering. Hands-on experience is one of the most crucial skills a fresh graduated engineer needs in order to find a job in industry or in academia. Raspberry PI is a new, user-friendly, open source, technology that allows developers to design and implement complex embedded systems using a small size and advanced single chip. This paper discusses the integration or Raspberry PI technology in the education of electrical and computer engineering curriculum, and its effect on the career of a freshly graduated electrical and computer engineer.


Introduction
Real time embedded systems, ranging from a simple digital clock to a complex surgical robot are being widely employed, not only by large industry but also by small companies. Microcontrollers, such as 8x50s, PIC, AVR, Freescale families are the core component of real time embedded systems and are mainly designed to solve end-user problems using hardware components. Although some open source software and free examples are available on the web, programming the microcontroller using machine language and assembly remains the biggest challenge to students in engineering tracks. Thus, bringing a simpler method to introduce the concept of microcontrollers to students breaks the ice around the real time embedded systems' concept and gets students more involved in applying microprogramming concepts on real projects, simple and advanced in level, under the supervision of professors before moving on to professional world.

Microprogramming in Electrical and Computer Curriculum
Applications of microcontrollers have been in the track of teaching embedded systems at engineering schools. An important effort has been made and published on the need of involving embedded systems more and more in the educational path [4,7,2,1,6,3,9]. Most of the applications focus on manipulating passive components such as LEDs, stepper motors, DC motors, sensors, and other devices. Programming these microcontrollers require students to possess a relatively advanced level of machine or assembly language programming. It also requires students to have a full understanding of compiling, debugging and assembling concepts. These topics are usually introduced at advanced levels in the educational curriculum such as junior and senior years. While in the sophomore year, students are introduced only to user friendly languages such as C/C++, JAVA, and Python, which are largely used for software development but, not sufficient for embedded systems' design. Proposed in this paper, is the idea of introducing students to some relatively advanced and modern concepts of control of embedded systems using new technologies such as Arduino and Raspberry PI boards. This will allow students to have hands on experience with hardware components, explore the concepts of I/O pin control, explore the major features of embedded systems, test the learned theoretical concepts of control of sensors and actuators using their skills in user-friendly programming languages, without the need to dig deep inside the internal structure of the microcontroller. Introducing the control concepts with tools such as Arduino and Raspberry PI will allow students to focus on designing principals such as analogue to digital converting, pulse width modulation (PWM), internal communications of the integrated circuits. It will also reduce the level of confusion caused by the complexity of the machine language or assembly language.

Arduino Technology
The Arduino technology combines hardware and software skills. It is an open source framework to design, model, and implement smart electronic systems. The hardware boards are equipped with a microcontroller and some embedded LEDs to allow the user to test small designs without the need of any external hardware. The Arduino UNO is the simplest version and features an ATmega328P microcontroller [10], 14 digital I/O pins, 6 of which are PWM outputs, and 6 analog pins. They system has an onboard quartz crystal clock that oscillates at a frequency of 16MHz. The incorporation of a USB port allows the user to connect the device to a computer. The input voltage of the board is 7-12v and its operating voltage is 3.3v or 5v. This makes the board safe for use by non-expert students. Students can download intermediate to complex programs on the UNO board as it has 32KB of Flash Memory (of which 0.5KB is used by the bootloader), 2 KB of SRAM, and 1KB of EEPROM. It can also be easily transported and moved by students because of its light weight of 25g. The software environment of Arduino is open-source and uses C/C++ programming languages. The software takes care of compiling the code and translating between High-Level language and machine language, this reduces the probability of making programming errors by students. All these features and the availability of educational projects provided by the manufacturer [11] would encourage course instructors to suggest using this board in their courses. The Arduino Mega256 offers an intermediate level of complexity in hardware and software design. The device features 54 digital I/O pins, 16 analog inputs and a larger space for sketch code. We recommend the use of this device for junior level mechanical courses, such as mechatronics and introduction to hardware control. The students at this level are relatively advanced enough to understand the concepts of control and coding, however, as mechanical engineering students they are not required to be experts in low level programming languages [9].

Raspberry PI Technology
The raspberry PI board is a single chip microcomputer with a user-friendly operating system. It has the size of a credit card and is capable of being connected to I/O devices such as keyboard, mouse, and screen through USB and HDMI protocols. [12]. With its first arrival to the market in 2012 by its Model B that used Python, Raspberry PI made a big change in the concept of programming embedded systems by using a user-friendly language. The Model B is the original Raspberry Pi with an actual size of product equal to 85x56mm and a memory of 512 MB of SDRAM @ 400 MHz. Model B came with 26 I/O pins and two USB 2.0 ports, an Ethernet jack, a 3.5mm headphone jack, and a standard SD card slot. It is important to note that the Model B didn't incorporate Wi-Fi or Bluetooth in the original design. In 2014, Raspberry PI offered Model B+ which was an advanced version of the Model B. Model B+ incorporated a. total of four USB 2.0 ports, an increased number of I/O pins reaching 40, and a micro SD Card. The Model A+ released in 2015 and is virtually a mini version of the model B+ with dimensions of 65x56mm and 256MB of SDRAM @ 400MHz. The system incorporated 1 USB Port and was considered the cheapest CPU on the market whose cost ranged between $15-$35. Raspberry Pi II Model B released in 2015. This model proved to be an upgraded version of the Raspberry Pi model B+, because there was an increase in the memory size (up to 1GB), and an upgrade to the ARMv7 quad core CPU from the ARMv6 which is used in RP1. This upgrade made the CPU faster and raised the processing speed to 900MHz. Raspberry Pi 3 Model B released in 2016 and was the first model to have Bluetooth and Wi-Fi, as well as an upgraded CPU (ARM Cortex-A53 quad core). This upgrade allowed the system to process data with speed of 1.2GHz. The most recent edition of the Model B+ released in 2018 and includes a CPU speed of 1.4GHz and an upgraded Wi-Fi speed from to 2.4GHz and 5GHz. Taking into account the implementation restrictions especially in sizing the products, Raspberry Pi Zero 2015 was the smallest, thinnest and most affordable board. With 65mm x 30mm x 5mm. with 512 MB of RAM, a Micro-SD card, a mini HDMI port, one USB port, a micro USB Power and a SI camera connector, this model of Pi became suitable for small students' course projects and capstone. The model Zero W 2017 was the original Pi zero with an added Bluetooth 4.1 and Bluetooth low energy it also offered 802.11 b/g/n wireless LAN.

Students' Project
Students' projects can range from controlling a LED and buzzer to complex medical devices such as artificial hand controller or a walking assistant device. Using Arduino and raspberry Pi is being introduced in medical devices [13], [14]. The students in the department of electrical and computer engineering at Marshall University have designed a medical cane that is capable of monitoring the walking activities of a patient and informing the user of improper use by means of visual and audible signs.

Project Description
Stability and falls are major concerns for geriatric patients, as well as rehab patients. Deaths from unintentional injuries are the seventh leading cause of death among older adults, falls account for the largest percentage of those deaths according to [15]. In response to this, geriatric patients use walking devices to improve their stability. Rehab patients, however, use such devices for other purposes; such as to regulate their weight distribution. While in therapy, canes, walkers, and other body weight support (BWS) systems are used to increase patient stability as muscles are strengthened and retrained. The use of BWS systems, is a key phase of rehabilitative therapy. Using such devices after surgery reaches far beyond safety. No longer should walking aides be ditched, doing so has the possibility of creating a walking pattern that could result in a definitive limp [16]. Walking with a limp may not seem like a big deal, but it may lead to a secondary injury or permanently change how you walk [16]. Gait and balance disorders are among the most common causes of falls in older adults and often lead to injury, disability, loss of independence, and limited quality of life [17]. Therefore, it is crucial that older patients get proper therapy after surgery or if they have a gait problem. This work presents a novel system that is aimed at detecting improper cane use by patients and alerting them in hopes of reducing the likelihood of a fall. Therefore, the proposed system will monitor the force applied to a cane and when a preset threshold is passed, the system will send an alert to the patient and/or their caregiver letting them know the patient needs to rest. Reducing falls by using walking canes has been a key topic for researchers in the medical devices field. An alarming device has been proposed in [18] to warn the patient of a potential fall basing on data recorded as long as the patient is walking. The inconvenience of the proposed system is the fact that it alarms the user when he is actively falling but not before. The use of personal devices, that support wireless connection facilities, of patients to provide guidance for their assistive canes has been proposed in [19] and [20]. The advantage of the proposed work is the real-time communication with the patient. However, the drawback of this work is its full dependence on the wireless connection between the walking cane and the personal device of the patient (smartphone, tablet, etc.) that can be down for some reasons unmanageable by the patient. Center of Pressure Fall Detection (COP-FD) and leg-motion Fall Detection (LM-FD) have been introduced in [21] to implement a fall detection system. This system is only used to monitor the motion of a patient in special centers furnished by the needed equipped. It also requires the user to go to the center to monitor their gait. In a similar aspect of gait monitoring, a more user friendly device has been proposed to observe the human walking. The load force applied to a walking device such as a cane, and the orientation of the shaft have been employed as key factors to provide information about a human's gait. In [22], ground truth data has been collected using sensors and used for the calibration of remote-sensing data, as well as for providing understanding and analysis of an experiment. As force is applied to the cane handle, the system calculates the grip force used by the patient and the resultant is correlated to the fatigue level of the user. This project proposes the use of weight applied to a load cell installed at the bottom of a walking device in contact with a microcontroller-based system to detect any abnormal behavior and warn the user of their need to rest before reaching a status of fatigue that necessitates a caretaker to take an action.

Design Approach
The proposed system is a microcontroller-based system that (1) monitors the force applied by the patient to a load cell implemented at the bottom of the cane, (2) compares the applied force with a predefined pattern representing the normal behavior of the user, and (3) informs the user and of unexpected actions when any abnormal behavior is detected. A block diagram of the main system components is illustrated in figure 1.

Implementation Using Arduino
Initially, the Arduino load cell system is implemented on a breadboard rather than the actual cane. A preliminary Arduino program is designed and uploaded onto the board. The system monitors in real-time the data acquired by the load cell and once it reaches a defined threshold, the system alerts the user of their misuse via a message on a display embedded in the cane and audible tone. A key challenge of the implementation is to embed the entire system in a discrete fashion inside the cane.

Equipment Used
The components used to realize the system are described below.

System Evaluation and Validation
Real data has been gathered through walking with the cane normally and abnormally. The normal walking data is examined, and false positive rate is calculated. The abnormal walking data is also examined, and the miss rate is calculated accordingly. The alert system is tested to ensure properness of its execution.

Results and Outcomes
The implementation and experimentation of a fully functional prototype of the system illustrates its ability to detect fatigue as originally planned. These preliminary outcomes lead to the ultimate final outcome of the project, which is to have a fully functional product ready for use by the consumer.

Students Feedback
A survey was proposed to students to evaluate their overall experience working with Arduino and a positive feedback has been received. Students mentioned that they feel well skilled in designing and implementing hardware embedded system, using high level programming language. It was also mentioned that this project has motivated students to self-learning about recent control technologies, as it was simple enough to help them understand and advanced enough to challenge them as future engineers. It has been mentioned by the project supervisor that it would be important to include an introduction of embedded control technologies such as Arduino and raspberry PI in the curriculum of engineering to walk students through the technologies step by step to speed up their advance in understanding the material.

Conclusion
This paper discussed the integration of Arduino and raspberry PI boards in electrical and computer engineering curriculum for sophomore year projects and for junior mechanical engineering students. The paper explains the main features of the different systems and why they are suitable for the engineering curriculum. The proposal of this paper has been tested in a student project done at the department of electrical and computer engineering department at Marshall University as a capstone project. Feedback from students and advisors has been discussed to asses and improve this experiment.