Engaging Students in Project-Based Learning with MATLAB Mobile and ThingSpeak

As told to MathWorks by Dr. André Knoesen and Dr. Marina Radulaski, UC Davis

In Engineering Problem Solving, first-year engineering students at University of California, Davis (UC Davis) learn programming basics and solve problems in which the problem statement is only partially defined. When the COVID-19 pandemic forced a transition to online learning, we found ourselves doing some creative problem-solving of our own. How would we keep the students engaged when the course moved online?

We decided to de-emphasize exams and in-class assessments and give more time and weight to the final project, in which student teams use their MATLAB® skills to build an application of their choosing (Figure 1). We incorporated MATLAB Mobile™ and ThingSpeak™ into the course so that students could capture data from their mobile devices and interact easily with team members at different locations. ThingSpeak also enabled the students to build apps that would themselves facilitate remote interaction. Despite the difficulties imposed by remote learning, end-of-course surveys and the high quality of the apps confirmed that students were enjoying the class and were actively engaged in learning the material. 

Figure 1. MATLAB apps created by students in Engineering Problem Solving. 

Groundwork for Online Learning

We’ve been teaching Engineering Problem Solving with MATLAB for several years, in part because MATLAB enables students to learn programming quickly, even if they’ve had no prior experience. The MATLAB based materials and tools that we had been using well before the pandemic laid the groundwork for the transition to online learning. When teaching in person, for example, we assigned a weekly reading in the Introduction to MATLAB zyBook1. Each reading was followed by exercises testing comprehension of the concepts covered (Figure 2). Student work was automatically graded with MATLAB Grader™, enabling us to provide immediate, individualized feedback.

Figure 2. Array indexing exercise. Image credit: Introduction to MATLAB zyBook.

In lectures, we reviewed the material from the reading and walked through examples using interactive MATLAB live scripts. With the Live Editor open, we demonstrated simple coding examples for each topic covered in the course, including array processing, data analysis, flow control, procedural and object-oriented programming, and UI design. 

At the end of the quarter, students were applying what they learned throughout the course in their final projects. These projects involved creating apps using App Designer. User interface design reinforces object-oriented programming concepts, since the graphical elements are all controlled programmatically as objects. It also gives students the opportunity to express their creativity in communicating information.

Easing the Transition with ThingSpeak and MATLAB Mobile

The zyBook and live scripts eased the transition to online learning because they support interactive, self-paced learning. We knew, however, that some course changes would be necessary. We supplemented our group of nine graduate teaching assistants (TAs) with two undergraduate TAs who had recently taken the course. In online forums, the undergraduate TAs shared tips and offered guidance based on their experience. We also offered a combination of asynchronous (recorded) and synchronous (live) lectures, using live scripts to introduce and demonstrate material.

In addition to allowing students more time to design and implement their applications, we wanted to make the experience interesting for the teams, even though social distancing requirements prevented them from working closely together. We found our solution in ThingSpeak and MATLAB Mobile.

Designed as an IoT analytics service, ThingSpeak provided a convenient and easy-to-implement mechanism for first-time programmers to store and share data in the cloud. More importantly, it enabled our students to interact with each other remotely on a group project. MATLAB Mobile, meanwhile, enabled teams to acquire GPS and other real-world data such as position, velocity, and acceleration from the built-in sensors in their mobile devices. 

Students could choose their final project from within three categories: a card game, a dice game, or a sensor-based app. Card and dice games were required to use ThingSpeak to exchange information between players, such as the suit and number of the card played or the number of the dice rolled. The students used MATLAB Mobile to obtain sensor data from a mobile device, MATLAB Drive to store sensor data in the cloud,  and ThingSpeak to store and retrieve data segments for implementing a web- based game. Students read and wrote data in ThingSpeak channels using thingspeakread and thingspeakwrite functions. Some students also used ThingSpeak to trigger actions such as sending tweets and for creating visualizations. Students communicated with ThingSpeak through the interactive apps they created with App Designer.

In addition to building an app, each team also had to create a video to demonstrate the app and explain how their code worked. Recent projects have included implementations of the Crazy Eights card game, Yahtzee, and an app that tracks the user’s position, speed, and acceleration over time (Figure 3). We’ve been continually impressed with the creativity and sophistication of both the apps and the videos. Clearly, the students found working directly with tangible data on real-life applications highly motivating.

Figure 3. A student-created MATLAB app that captures and tracks GPS sensor data.

One team integrated a map visualization into their channel view to show live results from real data (Figure 4, left). The team was able to use their own personal data and see the processed results right away. Another team used numerical display widgets on the ThingSpeak channel (Figure 4, right), enabling them to debug their shared game quickly.

Figure 4. ThingSpeak channel views from student final project video presentations.

Preparing for a Return to In-Person Instruction

When, as a step toward a full reopening, UC campuses adopt a hybrid model that combines classroom and online learning, we plan to retain many of the course changes we have implemented. For example, we will retain the undergraduate TA program, which was overwhelmingly well-received by the current students, and will probably continue to have students complete some lab work and final projects remotely using MATLAB Mobile and ThingSpeak. With these technologies, we can offer students exposure to hardware in what is essentially a theoretical programming course. The tools work well in classes with hundreds of students; since students can use the sensors in their own devices, we don’t have to supply sensor hardware, and because these tools do not require any hardware setup, students can get started with data acquisition quickly. As ever, our primary goal is to continue building our students’ self-confidence by showing them that in just 10 weeks they can create sophisticated, interactive applications that collect, exchange, and analyze real-world data.

Comments from Our Undergraduate TAs

Mostafa Ibrahim and Teodora Petrovic served as undergraduate TAs for Engineering Problem Solving. Having recently completed the course and built the app shown in Figure 3, they helped classmates by creating videos in which they explained how they designed their app, how they approached working as a team, where they got stuck, and where they found answers to their technical questions. (The forums on MATLAB Central, they noted, were extremely useful sources of information.)

Ibrahim and Petrovic continue to apply the MATLAB skills they learned in the course and while serving as TAs. “Having a background in MATLAB has helped me as part of the UC Davis Formula Racing team, where we use MATLAB for data analysis and visualization,” Ibrahim says.

Petrovic adds, “It’s true that we learned a lot about MATLAB that we can use in clubs and other classes. We also learned how to search for and find answers—and more importantly, we learned to keep trying when something doesn’t work, because when you finally get it, it’s very satisfying.”

1 Dr. André Knoesen co-authored Introduction to MATLAB.

About the Instructors

Dr. André Knoesen is a professor and chair of the Department of Electrical and Computer Engineering at UC Davis. His research interests include the development and application of sensors and sensor networks to enhance interaction between humans and electronic systems.

Dr. Marina Radulaski is an assistant professor of Electrical and Computer Engineering at UC Davis. Dr. Radulaski studies light and matter interaction at the nanoscale for applications in classical and quantum information processing.

Published 2021