When it comes to the field of artificial intelligence, the pace of technological advancement seems to be speeding up by the day. In particular, Large Language Models (LLMs) have dramatically improved in their ability to answer a wide range of questions and generate text that mimics human writing in the past year. One AI model, in particular, has been making waves in industry, popular culture, and beyond – OpenAI’s ChatGPT.
Since its release, this AI model has been increasingly integrated into various industries, including healthcare, customer service, and marketing. And with all of the buzz around this technology, it has also served as a first introduction to the power of machine learning for many people that are otherwise not connected with the field. As people experiment with LLMs, many new use cases for these models will be discovered, and naturally, the Hacksters of the world will want to build their own devices with ChatGPT’s capabilities integrated into them.
Using the web-based interface is one thing — but how does one integrate this tool into a project with, for example, an Arduino development board? Thanks to an engineer named Eric Nam, that is now as simple as making a function call in an Arduino sketch. He has developed a library for Arduino IDE that leverages the ChatGPT API on the backend to make interacting with this LLM a snap.
Nam has released the source code on GitHub under the very permissive MIT license. There, he outlines how to set up an API key with OpenAI, and then how to install and configure his library in Arduino IDE. Once that is out of the way, asking ChatGPT a question from an Arduino board is as painless as calling the chat_gpt.simple_message() function from your own code.
One of the possible applications for this technology mentioned by Nam is the integration of sensor readings with the knowledge contained in the LLM. For example, with temperature and humidity measurements captured from sensors attached to (or onboard) the Arduino, you might ask the model what clothes would be appropriate for the day ahead. Or perhaps you might ask what some good recreation options would be for such a day.
Since ChatGPT is being called via the API, this is the same, full-featured model that you are used to interacting with via the web interface. But of course this also means that the device will not operate without an Internet connection, so it will generally not work on the go. At least not without additional hardware for cellular connectivity.
The idea of integrating sensors with ChatGPT interactions is very interesting and we expect to see lots of projects doing exactly that here on the pages of Hackster in the coming weeks. One word of caution, however — use of the ChatGPT API is not free, so be sure to check into the pricing model before you start hacking. For most users, the cost will be measured in pocket change, but you will want to make sure you are careful to not, for example, run a request in an endless loop and walk away for a few days, or you can wind up with a nasty surprise. With that word of caution out of the way, start warming up your soldering irons. We can’t wait to see what you make!