How Generative AI Can Aid in Agriculture Through Microcontroller Programming

Payton Owens, left, and Wyatt Graves collaborating on electronics projects in a classroom setting, focused on their tasks and learning together.
Artificial intelligence tools such as ChatGPT show promise as a useful means in agriculture to write simple computer programs for microcontrollers. Computer programming is not typically taught in most undergraduate agricultural majors, but microcontrollers like Arduinos are now commonly used in climate and irrigation controls, food processing systems, as well as robotic and drone applications. Don Johnson, University Professor of agricultural education, communications and technology, published a study in the Natural Sciences Education journal with fellow faculty members that showed agricultural students can use generative artificial intelligence to write code to solve moderately difficult programming problems without any deep knowledge of programming.

The Problem

Computer programming has typically not been taught in most undergraduate agriculture majors, but the inclusion of microcontrollers as components of agricultural equipment and systems has become more common. 

 

The Work

Don Johnson, University Professor of agricultural education, communications and technology, began investigating the topic of Artificial Intelligence-assisted programming in 2022 when ChatGPT was released, and he learned that it could write code for microcontrollers like Arduinos. Microcontrollers are commonly used in climate and irrigation controls, food processing systems, as well as robotic and drone applications.

In 2022, Johnson conducted a preliminary study comparing the abilities, interest and confidence between two groups of undergraduate agriculture students as they programmed a microcontroller to blink two LEDs in a particular sequence. One group of students wrote their own programs while the other group used ChatGPT.

A follow-up study in 2024 focused solely on undergraduate agricultural students without significant computer programming experience to determine the confidence in their ability to use ChatGPT to write Arduino code for a more advanced problem than in the first study. This second study required students to use ChatGPT to program the Arduino to turn on a transfer pump when the level of solution in a heating tank fell 8 inches or more below a sensor and then turn the pump off when the tank refilled to within 3 inches of the sensor.

ChatGPT coaching in both studies involved informing the students what made a good prompt for the generative AI platform. A good prompt, Johnson explained, would clearly describe the situation, components and connections, and the desired outcome.

Johnson published the results of the follow-up study in the Natural Sciences Education journal in August 2024. The article is titled “Agriculture students’ use of generative artificial intelligence for microcontroller programming Natural Sciences Education.” Co-authors included Christopher Estepp, associate professor, and Will Doss, assistant professor, both in the agricultural education, communications and technology department.

 

The Results

Results of the follow-up study indicated undergraduate students could use ChatGPT to write Arduino programs to control moderately complex operations. The study also showed that students writing their own programs developed greater Arduino programming confidence and ability than novice students using ChatGPT. However, both groups had the same level of success and interest in learning more about the microcontrollers and coding.

Johnson said there will always be a demand for individuals who have deep expertise in computer programming, but the focus of the studies was to explore how people without deep expertise can use microcontrollers in their academic and professional careers.

 

The Value

Generative AI programs such as ChatGPT have the potential to increase productivity in all areas, including education and agriculture, Johnson said. “Generative” refers to the tool’s ability to create content.

The potential to use generative AI in microcontroller programming may attract the interest of additional users who may benefit but are intimidated by the complexities of computer programming, Johnson said. Educators and researchers should continue to explore appropriate and effective uses of generative AI in college classrooms, so graduates are equipped to adapt to and benefit from this technology, Johnson added.

Read the Research

Agriculture students’ use of generative artificial intelligence for microcontroller programming
Natural Sciences Education
Volume 53, Issue 2 (2024)
https://doi.org/10.1002/nse2.20155

Supported in part by

The research was supported by the U.S. Department of Agriculture’s National Institute of Food and Agriculture grant number 1024473.

About the Researcher

Portrait of Don Johnson with glasses, wearing a blue checkered sweater and a light-colored collared shirt.

Don Johnson

Professor of Agricultural Education, Communications and Technology

Ph.D., Agricultural Education with cognate in Agricultural Systems Technology, University of Missouri-Columbia
M.A., Agricultural Education with minor in Agricultural Mechanization, Western Kentucky University
B.S., General Agriculture, Western Kentucky University

Christopher Estepp

Associate professor in the Agricultural Education, Communications and Technology

Ph.D., Agricultural Education, University of Florida
M.S., Agricultural Education, Texas A&M University
B.S., Animal Science, Texas A&M University

 

Will Doss

Assistant professor in the Agricultural Education, Communications and Technology

Ph.D., Agricultural Communications and Education, Texas Tech University
M.S., Agricultural Leadership, Education and Communications, Texas A&M University
B.S., Agricultural Science, Texas A&M University