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

Adafruit's writing drivers with ChatGPT
(Image credit: Adafruit)

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.

Les Pounder

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".

  • ezst036
    Looks like AI will be capable of starting to eliminate software developer jobs after all.

    It used to be that the automators eliminated menial jobs. Now where do the automators go when their automation eliminates their own job? Do many developers refuse to do any kind of AI at all because it's basically an economic suicide pact?
    Reply
  • Hooda Thunkett
    ezst036 said:
    Looks like AI will be capable of starting to eliminate software developer jobs after all.

    It used to be that the automators eliminated menial jobs. Now where do the automators go when their automation eliminates their own job? Do many developers refuse to do any kind of AI at all because it's basically an economic suicide pact?
    To be quite honest, I really don't think that most of the people working on AI tools are self-aware enough to stop themselves from making themselves redundant. Right now they're thinking "they're always going to need my skills!" Then they'll be successful in making these tools, and they're first going to think "wait, that wasn't supposed to happen to me!" and then a few years later some of them are going to think "wow, was I ever an idiot!"
    Reply
  • derekullo
    Building a house without a hammer would probably be near impossible.
    Hammers haven't replaced construction workers.
    Even if you developed a smart hammer mounted on some kind of robot you would still want a human with knowledge of the buildings plans to double check its work.
    Reply
  • tgandalph
    No, ChatGPT does not free up time. It frees up from some of the cognitive load. That's great but it also means new engineers must still learn all the tech bc otherwise they will not know how to review ChatGPT code. That said ChatGPT is a tool, not a replacement. It will drive more demand for better qualified engineers, not less.
    Reply
  • tgandalph
    ezst036 said:
    Looks like AI will be capable of starting to eliminate software developer jobs after all.

    It used to be that the automators eliminated menial jobs. Now where do the automators go when their automation eliminates their own job? Do many developers refuse to do any kind of AI at all because it's basically an economic suicide pact?
    Using a tool to be more productive is an economic power. Those who refuse to learn and use a new tool are pushing themselves out of the market. They will not be replaced by the tool, but by someone who uses it.
    Reply
  • ezst036
    derekullo said:
    Building a house without a hammer would probably be near impossible.
    Hammers haven't replaced construction workers.
    Even if you developed a smart hammer mounted on some kind of robot you would still want a human with knowledge of the buildings plans to double check its work.

    A hammer isn't the equivalent of an AI. A 3d printer is much closer for comparison. And if you'll note, 3d printers have been used to build buildings of some note; and is perhaps a low level AI of sorts. China is planning on printing a dam for a river.

    What used to take a whole team of humans with jobs, is now one or three people doing a design and pressing "print".

    So effectively, yes, AI has destroyed those construction jobs. And note, those are all low level jobs for poor and working class. So that's who gets hurt the most in this scenario, working class people.

    And as for your "smart hammer mounted to a robot"?

    https://www.extremetech.com/aerospace/humanoid-robot-can-fly-a-plane-just-by-reading-the-manual
    In the end that would mean one single human builds a towering building downtown, whereas previously it took hundreds, if not thousands of humans to do this work. Maybe you can call this a win for efficiency but wow that is a lot of destroyed jobs.

    Yes. Destroyed. That is the correct word. Destroyed.
    Reply
  • ezst036
    tgandalph said:
    Using a tool to be more productive is an economic power. Those who refuse to learn and use a new tool are pushing themselves out of the market. They will not be replaced by the tool, but by someone who uses it.

    It is a mistake to compare an AI to a tool.
    Reply
  • derekullo
    ezst036 said:
    It is a mistake to compare an AI to a tool.
    Made by humans to help humans ... a tool.
    Reply
  • derekullo
    ezst036 said:
    A hammer isn't the equivalent of an AI. A 3d printer is much closer for comparison. And if you'll note, 3d printers have been used to build buildings of some note; and is perhaps a low level AI of sorts. China is planning on printing a dam for a river.

    What used to take a whole team of humans with jobs, is now one or three people doing a design and pressing "print".

    So effectively, yes, AI has destroyed those construction jobs. And note, those are all low level jobs for poor and working class. So that's who gets hurt the most in this scenario, working class people.

    And as for your "smart hammer mounted to a robot"?

    https://www.extremetech.com/aerospace/humanoid-robot-can-fly-a-plane-just-by-reading-the-manual
    In the end that would mean one single human builds a towering building downtown, whereas previously it took hundreds, if not thousands of humans to do this work. Maybe you can call this a win for efficiency but wow that is a lot of destroyed jobs.

    Yes. Destroyed. That is the correct word. Destroyed.
    And what do hammers and 3D printers have in common?

    They are both tools!

    As for the jobs lost/Destroyed;

    Wasting time shouldn't be rewarded if the job could be done easier and cheaper with a different tool.
    Reply