ChatGPT Creates Arduino Drivers in the Style of Adafruit's Ladyada – Tom's Hardware

When you purchase through links on our site, we may earn an affiliate commission. Here’s how it works.
Lady “AI”da
Writing libraries to support our favorite microcontrollers is a big task, but what if ChatGPT could lend a hand? Adafruit’s own Limor “Ladyada” Fried has tasked ChatGPT to write Arduino drivers in her own style, creating a “mini-Limor” bot to handle the task.
Ladyada spends a lot of time writing Arduino libraries, and has produced hundreds of libraries to support Adafruit’s impressive range of boards (many of which feature in our best Grove and Stemma QT page). GPT-4 has already been trained using many of Adafruit’s drivers found on GitHub. These drivers are written in the “Ladyada style” (Adafruit_BusIO) and that means it can create drivers using this template.
The workflow involves a lot of datasheet references, binary tables and bit insets, all of which need to be understood and converted into C or Python code. This task isn’t easy (trust us, we have tried it our self). There isn’t a standard format to get this data. Datasheets can be wildly different.
For “mini-Limor”, Fried’s workflow involves asking ChatGPT to “[write] an arduino library in the same style as ladyada / limor fried”. In the example Fried tasks ChatGPT to create a driver for the VCNL4020 ambient light and infrared sensor, an I2C based sensor. The workflow uses a free PDF parsing plugin (AI PDF) that reads a datasheet, extracts register names, values, creates enum tables and text for comments.
Fried then asks ChatGPT to create a skeleton file for the VCNL4020 which it was partially successful in creating. Then Fried asks it to create the registers, using data directly from the datasheet. After that Fried moves on to making the library.
Is this a faster process? Well, no. According to Adafruit’s blog post, “The amount of time it takes for ChatGPT to write a driver is about the same as it would take Ladyada” and the resulting driver requires human interaction to check that it is valid, as Fried states in the video, ChatGPT can sometimes “hallucinate” and introduce mistakes. That being said, it does free up Fried to undertake other tasks.
The produced work is based upon Adafruit’s own prior work, but Adafruit has confirmed that when any Large Language Model (LLM) is used, it will be disclosed and linked to.
Good drivers form the basis on which learners can cut their teeth without getting too technical, especially with I2C, SPI and many other protocols. If the process can be refined and automated, then it could help developers such as Adafruit to create drivers and libraries for many of the popular programming languages. The process could be used to address third-party software support with the Arduino Uno R4 range of boards. Fried also mentions that this process can also be used with CircuitPython, meaning that the Raspberry Pi Pico range of boards. 
Adafruit has a blog post and links to the entire process, including ChatGPT logs for reference.
Join the experts who read Tom’s Hardware for the inside track on enthusiast PC tech news — and have for over 25 years. We’ll send breaking news and in-depth reviews of CPUs, GPUs, AI, maker hardware and more straight to your inbox.
Les Pounder is an associate editor at Tom’s Hardware. He is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training program “Picademy”.
Arduino Co-Founder Will Take Your Questions Live on the Pi Cast
Arduino Uno R4 Review: The Maker’s Muse
Best Gaming Laptops of 2023
By Ash Hill
By Mark Tyson
By Zhiye Liu
By Zhiye Liu
By Zhiye Liu
By Ash Hill
By Anton Shilov
By Mark Tyson
By Les Pounder
By Ash Hill
By Anton Shilov
Tom’s Hardware is part of Future US Inc, an international media group and leading digital publisher. Visit our corporate site.
© Future US, Inc. Full 7th Floor, 130 West 42nd Street, New York, NY 10036.

source

Jesse
https://playwithchatgtp.com