Give your Arduino project a chatGPT AI brain - for ALMOST free

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
- ChatGPT, giant super powerful AI. (bell chiming) Tiny little microcontroller. How can I bring this down to here? Is it even possible? Well, I'm working on a project right now and I want to give you a sneak peek of what I'm doing. Okay, here's the deal. I've got an ESP32 here. It is a wifi enabled microcontroller, a development board, that I can program with the Arduino IDE, so I can connect to the internet with this microcontroller development board. And these are like, I don't know, hardly even 10 bucks. So here's the plan. I take a keyboard, you know, like just an old school keyboard. I connect it to my ESP32, so that when I type this records what the key presses are, and then it displays what I type in on a little OLED display, then when I press Enter, my input gets turned into a string and sent up to the cloud via the internet, 'cause again these are wifi connected. Then I send that input up to the OpenAI API, its super powerful AI does its thing, generates a response and sends it back to my board, and I display that response on the OLED. So nothing's connected to a computer here, all the work is being done with the microcontroller over Wi-Fi. So let me show you what I got. So here is the old school keyboard, This is like, you know, some IBM old school keyboard, it's a PS/2 keyboard, that's important 'cause I had to use the PS/2 library and whoever had this man, they were a smoker, there's like all types of burn marks over the, anyway, okay. So then I've got this and I've got it connected to a USB cable adapter. All right, and it's connected to a breadboard. And then this right here is my ESP32, and I've got a, let's see, I can get, there's the battery right there, and then here's the OLED. So what I'm gonna do is I'm gonna type on this keyboard, you can see it's not, it's just being powered right now with the battery. So, it's not connected to the computer it is connected to to Wi-Fi though. All right. So I'll say, what is Arduino? And now it's making the call, and then you can see it responds, just like that. I could ask you something like, I don't know, what is an apple, now still working again on getting the text to display appropriately, so that's a work in progress, but. Okay, well, I gotta say, I think this is pretty fun. So I'm just gonna talk real quick through this whole process one more time. So the first step is you go to OpenAI and you sign up for a developer account, they give developer accounts anyway they gave one to me, so they'll probably let you have one too, it doesn't cost anything. And then you get a key that you use to authenticate with the ChatGPT API, actually, I should say with the OpenAI API, and API stands for Application Programming Interface, and API is what allows different software online to allow third parties to like access their data, and their information, and their tools, right? So OpenAI has all these different models like they've got ChatGPT, they've got these text completion models, they've got all these different, like they've got image classifier models, all this stuff. Anyway, and this one, this project right now, is using a text completion model. And so each one of those different models has a different API that you can go to, and call, and get responses from. So that's really all you need to do on the OpenAI side. And then roughly what I did in this project and I can kind of talk you through the libraries a little bit just to show you what I'm doing here. So I'm using the WiFi library in the HTTPClient and WiFiClientSecure libraries for the ESP32, so that's allowing me to connect to the internet securely, and that's also allowing me to make an HTTPS request up to the API. So those were the libraries I used for that. Then I used ArduinoJSON library, so the response you get back from the web is gonna be an a JSON format, and the ArduinoJSON library makes it easy to get that data out to parse out that data. And the JSON library is pretty cool, Programming Electronics Academy is actually a sponsor. (bell chiming) So then once you have the data then you kind of want to display it on the screen, and then I'm using the universal 8-bit graphics library version two for working on the OLED, it works for monochromatic OLED LEDs, basically like one color LEDs. And then finally, in order to get the keyboard input, I am using the PS2KeyAdvanced library, that reads the input codes from a PS/2 keyboard. As you can imagine, there's a ton of details in this. If this sounds foreign to you or something like, man, what is going on? I assure you it's not as complicated as it looks. If you're interested in learning about this Arduino stuff the next video you should watch is this one right here, it's the Arduino in 90 minutes video, it's gonna introduce you to all of this cool Arduino stuff, this whole ecosystem where just regular people can start tinkering with cool electronic stuff. It's this video right here. It's fantastic for getting you up
Info
Channel: Programming Electronics Academy
Views: 297,481
Rating: undefined out of 5
Keywords: Arduino, Arduino(Brand), Arduino Tutorial, Arduino Lesson, Open Source Hardware Group, Learning Arduino, Microcontrollers, Electronics, Arduino IDE, Arduino Sketch, Computer programming, C++, Programming Electronics Academy
Id: dv9cyqVv0CI
Channel Id: undefined
Length: 5min 30sec (330 seconds)
Published: Thu Mar 02 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.