ChatGPT Creates Arduino Code

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
can chat GPT program and Arduino this is Dave in the shop stay tuned and find [Music] out so a friend of mine asked me to make a video showing him how to make a digital thermometer using an Arduino he has no coding experience whatsoever so what we're going to do is we're going to use chat GPT to write the code for this little project to build this project we're going to use an Arduino Uno we're going to use a LCD panel and it has the backpack board on the back so this allows it to Be A Serial interface which makes it very easy to interface into the Arduino we'll also need a Dallas semiconductor BAS based temperature probe so this one's already made up with a cable on it which makes it super easy and they're very inexpensive to pick up and of course we'll need a little bit of wiring so we've got these wiring pieces with the uh ends already terminated so that'll make it super easy and then of course we need a power cable and a power module uh this is a USB standard power module 5 volts so that's all it'll take to do this project let's get started so our first step is going to be to launch chat GPT so we'll go into our browser chat GPT and that brings us into chat GPT so now we've got down at the bottom of the screen the ability to enter in our prompt the key thing with the prompt is you've got to be very descriptive you've got to really tell it exactly what you want it to do what parts you want it to use uh as much information as you can so a good paragraph well written will give you a good outcome so in my prompt I'm telling chat GPT to write an Arduino program using using an Arduino Uno and an LCD display and a Dallas semiconductor temperature probe and I'm telling it to write the program so that it measures the temperature and displays it on the screen I've also asked it to provide a wiring diagram and a written description of the program and we can see chat GPT going to work there's the Arduino program telling us about the wiring and now it's giving us an explanation about the program and now it's generating a diagram and then it's generated a very nice diagram showing all of the wiring we're going to do this test with a already installed Arduino um IDE integrated development environment there's lots of videos out on YouTube of how to install the um the this IDE programming environment and how to configure it so the Assumption here is you've already got that set up uh there's also uh some libraries that are used to e extend the language and uh this environment already has those Library set up again lots of videos out on YouTube of how to do that and now the next step is I'm going to copy the code section out of the chat GPT response and I'm going to open up notepad and just copy that into notepad save it as a file that way we'll have that so we can reuse it um and then we'll use that to uh copy into the Arduino programming IDE screen so what we'll do is we'll load the code that was generated by chat GPT and then we'll run the compiler and see if this code will compile so we'll copy the code out of notepad and then paste it into the Arduino IDE and then we'll click the check mark to do a test compile and it worked the next step is going to be to get the code loaded into the Arduino so my Arduino is plugged into the USB port and uh is powered on uh by the by the USB connection I've also gone and set up the Arduino so I've configured it so it knows that it has the Arduino uh the right one selected uh and it knows the comport that it's talking to it uh there is a little tool in the IDE that lets you uh interrogate the board to find out what version it is that's a great test to make sure that you got a good active connection on it so the next step is going to be let's run the compiler and see if it will install the program into the board so we'll click the arrow to start the compile and and upload and down in the status section we can see that it's compiling the sketch the status bar shows that it's working we've got progress so we've had a successful compile now it's uploading the program to the board and it's done uploading all right so we got a successful compile and install to the board now the next thing is going to be to hook up all of our uh parts and pieces so that we can test it see if it actually does what we asked it to do so in addition to the parts that we spoke up spoke about before uh the program and the wiring diagram says that I need a 4.7k ohm resistor for this project so I happen to have a nice box full of lots of resistors there's 4.7k ohm so we will get one of those resistors uh for this build um the other thing make sure I put it back in the right spot the other thing that we'll have to do is our temperature probe it has bare wire ends and those don't plug in well onto the Arduino so we'll do a little bit of soldering where we'll solder some little of these jumper pins cut a couple of these wires and solder them on that'll make it very easy uh to plug the probe into the board uh we'll also use these jumpers for the screen to plug it in and that will just make it very easy to connect so we'll do a little bit of connecting work and get this assembled then we'll be ready to test out the code I'm following the wiring instructions given to me by chat GPT that'll be part of the test to make sure that uh the instructions do in fact work all right we've got everything wired up at least I believe it's wired up correctly so put these things aside and let's plug in the Arduino see what happens all right success so we um we connected up our wiring put in the resistor uh as it suggested and uh there we go we've got a display on the screen reading the temperature and um if I were to put my my hand on the probe and we see the temperature going up so it's updating once every second and doing what it was said to do um key thing with this was that I had to make sure that my Arduino environment had all of the um correct Library files installed and once that was all done done then I was able to compile the program as written by chat GPT and then um was able to load that into the Arduino just a few thoughts about this whole project I wanted to see you know could chat GPT um actually program an Arduino well the answer is that it was able to generate some code now it's not able to hook up the Arduino it's not able to do the wiring that's needed for the sensor and the display um but it was able to tell us what we needed to do from a from a wiring standpoint um the other thing about this is it wrote a program that does exactly what I told it to do now if I want to do some customization to it you know adjust the way the display looks uh adjust the way the thing uh you know operates maybe if I needed push buttons or other things on it um I still think there's value for someone to be able to that knows how to program an Arduino to go into the code and make uh uh tiny tweaks certainly if the code didn't work or one of the parts or pieces didn't work uh then there's debugging uh that uh that I think still it's going to take a human to do that um it's very interesting though the proposition is that I think this could save a a lot of time I can get the I can tell it what I want it to do as far as a base program it gives me the code for that and then I'm well on my way to um uh to customize and modify and create the final product that I want one other thing uh to take note of the thumbnail screen for the video with the robot and the and the and the Arduino that was generated by uh chat uh GPT as well now I'm using version 40 the latest version just came out so it has the ability to um send information over to the doll e um AI service that can generate the graphics but I thought it did a really cool graphic and and it was a simple prompt uh about one sentence uh to get that and then I pulled it in and added my overlays and put it on the video so again very cool stuff uh where this is all going to go I don't know uh but I am excited about the capability I think the way that I'm looking at this right now is it's like a power tool so if I use an analogy here in the shop um you know I've got a hand saw up here on the on the wall and I could grab an 8ot long Tu before and rip it down into two pieces with that Handa it take me a good bit of time but I also have my table saw and with a table saw I can rip a bunch of Tu fours in the amount of time that it takes uh to do one with the hand with a handsaw is it going to replace us anytime soon no it still takes a human to to understand what we want to do and kind of set the parameters of what we want to do uh and as you can see with this project uh Chachi GPT is not going to go solder my wires and plug them together so this is Dave in the shop playing with power tools remember like And subscribe that really helps the channel helps it get it out there so that more people can can see the content [Music]
Info
Channel: daveintheshop
Views: 2,665
Rating: undefined out of 5
Keywords: Arduino, Dallas Semiconductor, LCD Backpack, Temeprature Probe, ds18b20, ChatGPT, ChatGPT 4o, Aduino Code, Generative AI, DALL-E, AI, Code Generation, Project Build, Arduino IDE, Notepad, UNO, Arduino UNO, Maker, Making, is coding dead, nocode, Arduino program
Id: MBX009FZB80
Channel Id: undefined
Length: 15min 16sec (916 seconds)
Published: Sat May 18 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.