ChatGPT Taught Me How To Build A Robot From Scratch

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
In this video, I'll be building  a robot using minimal effort by   utilizing the conversational AI bot, ChatGPT. I'll give it simple prompts and follow its   instructions to try creating an autonomous, line-following robot without doing any software   programming, electronic circuit design, or even CAD modeling.  This video is sponsored by PCBWay. Before we get too carried away blindly building   robots for an artificial intelligence, I want to start with something a little simpler.  Let's see if ChatGPT can teach me how to  blink an LED on and off using an Arduino.  I'll start off by asking what components I need. Not only does it provide information I explicitly   ask for, but it also inferred  that I may want instructions.  Okay, let's put these to the test. Step 1.  Connect the positive leg of the LED, the longer  leg, to a digital output pin on the Arduino.  Step 2. Connect the negative leg of the LED,   the shorter leg, to a resistor. Step 3.  Connect the other end of the  resistor to ground on the Arduino.  Step 4. Use the Arduino   software to write a sketch that will turn  the LED on and off at the desired frequency.  Wait, but how do I actually program an Arduino? I have everything wired up.  Can you write the program for me? Brilliant.  Not only does it provide code, it also  provides details on the uploading procedure.  Let's give it a shot. Copy the sketch into the Arduino   IDE and click upload. It works!  Okay, let's take off the training wheels.  Do you think you could tell me the steps to  building a line following robot using Arduino?  Wow, this is amazing! It's literally giving every step that I need.  This honestly looks pretty robust.  Let me go grab the components  that are listed here.  Okay, so I have most of the components here  with me, but I want to see if I can substitute  in the L298N motor driver instead of  using the recommended L293D motor driver.  I also want to see if it will allow  me to use a set of AA batteries as   opposed to a 9-volt battery. Let's see what it says.  At first pass, this looks like a brilliant answer. It signs off on my requested substitutes, but this   is also where ChatGPT slips up for the first time. These statements about needing an external voltage   regulator like a 7805 are actually false. Since the L298N motor driver already has   a 5-volt regulator on board. In fact the 5-volt regulator   on the board is literally the 7805  it recommended we add externally.  It's asking for the exact component  that's already on the motor driver.  I would say that this is the  biggest downfall of ChatGPT.  When it's wrong about something,  it is confidently wrong.  Let's see what happens when  I challenge that response.  Thanks for the info, although I think the L298N  already has a 5-volt regulator on the board.  Okay, this looks better. I'll wire it up   following the chatbot's recommendations. Positive battery terminal to input VCC, negative   battery terminal to ground, and then the 5-volt pin from the L298N to the V-in pin on the Arduino.  Wait a minute, this is another mistake. The V-in pin on the Arduino that we're told to   connect 5-volts to only has a recommended range of 7-volts to 12-volts.  Instead we really want to  connect to 5-volts directly.  So this is another place that ChatGPT has  spoken incorrectly with confidence, but for  the moment I'm going to just brush it aside. Let's go ahead and finally   connect ground to ground. We now need to connect the motors.  Again, the bot gives information that could  work, but definitely isn't the proper procedure.  This method would only allow the motor to spin  in one direction, instead of both directions.  This time I'm not going to brush it under the rug. No ChatGPT, that is wrong!!  I have to admit it's pretty neat how you  can have a conversation with the bot similar  to a human interaction, and if you would  disagree on something you can rationalize your  argument by presenting facts in a logical manner. However this only works if you have   pre-existing knowledge in the field. To use ChatGPT effectively, you'll need to   act as a curator, researching and validating information from third-party sources.  I'm going to skim over the next few questions  for the sake of brevity, but if you want  to go through the entire chat log check  out the link in the description below.  Basically I'm just asking it about wiring a  second motor and which pins on the Arduino  I should connect to. I then go on to ask about   connecting the infrared sensor array. Here's the final wiring of the robot.  It looks good, but it's lacking a bit of form. ChatGPT mentioned earlier in our conversation   that I need a robot chassis. Maybe it can help design and build one?  My local makerspace has a laser cutter, so  let's design an SVG file for laser cutting.  I'll start with a simple test by asking  for an SVG file of a 25mm square.  ChatGPT gives me a set of instructions  to create a file for myself in Inkscape.  While these steps do sound good, I'm lazy. I want you to do it for me, ChatGPT.  Can you write the SVG file for me? Not only does it write the file,   it remembers the laser cutter  context from the conversation  and tells me to save it with a  .SVG extension in a notepad editor.  And then it tells me that I can import  the file into the laser cutter software.  Absolutely brilliant. But let's now do something more useful.  I want to create footprint files  for each of these components.  The motor drive is a 43mm  square with 3mm mounting holes.  Here I'm giving the chatbot the dimensions  and requesting it return an SVG file.  Opening it up, and sure enough,  it matches the motor driver.  I'm not going to bore you to death.  This part that I'm skipping over quickly is  me just asking it to create footprints for  the rest of the components, and  these are the resulting SVG files.  Now with all the individual components drawn,  let's create a new file for the chassis  itself, measuring 220 by 150mm  and import the footprint files.  Another annoying limitation of ChatGPT is that  it truncates answers beyond a certain length.  Fortunately I can ask it to just continue from the last line. Copying this answer again and opening it  up, I guess you could say it kind of worked.  It imported all the footprints and ensured there  were no overlaps between any of the components.  However, their placement was an exactly  conducive to efficient robot locomotion.  I'm sure I could go back and forth with a bot  and move everything into place, but I ultimately  decided it was more efficient just for  me to manually edit the files myself.  And here's the final design after  everything was shuffled around.  Throwing the file on the laser cutter, This is what came out.  Now this isn't actually the first time  I've built a line following robot.  I actually teach an Intro to Robotics class  here in Vancouver, BC using this exact robot.  And as a side tangent, if  you are based in Vancouver   and would like to learn Intro to Robotics from a real person and not an AI chatbot,   then consider checking out some of my classes that include robot kits like this one,   link in bio. But based on this experience, I also know   that I need some 3D printed brackets to mount the wheel and infrared sensor on.  I initially tried re-creating these components  as STL files using chatGPT, but honestly,  it was a hair pulling frustrating activity. I couldn't even build a simple   cube with closed faces. I'm sure you could wrestle the chatbot   into submission and get primitive STL files, but I ultimately decided to cheat and just use the   existing mounting brackets that I already had. Please forgive me.  This still counts as a mostly  AI-generated robot, right?  And with this, everything was assembled together. We're ready to program this robot and bring   it to life using code generated  by an artificial intelligence.  But before getting to that, we have a  segment from this video's sponsor, PCBWay.  But this time, I'm going to  get ChatGPT to help me out.  Write an ad read for a 30-second sponsored  segment from PCBWay in a YouTube video.  Bring your ideas to life with PCBWay. PCBWay is the go-to destination for   fast turnaround times, affordable  prices, and high-quality PCBs.  Whether you're a maker, hobbyist, or engineer,  their PCBs are designed to meet your needs.  With a strong reputation for providing excellent  customer service, PCBWay is the perfect choice.  So why wait? Visit PCBWay   today and get started on your next big project. It's absolutely insane what this chatbot can do.  I will quickly add that if you've never built  a PCB before and want to learn how to do  that, I have an entire series on my  channel, so check that out if you want.  But for now, let's move on to the software, and  this is the part that I was most worried about.  But my fears were misplaced,  because check this out.  Based on the electronics and the pin allocations  we discussed earlier, please write an  Arduino program with five functions. Drive forward, reverse, left, right, and stop.  Include a variable for  storing the PWM drive speed.  This program should loop through the five  different drive functions with a two-second  delay between each. In just several seconds, the chatbot has   given me a program to test out the robot's drive train functionality.  As requested, it has five functions for each  of the directions and has a variable called  DRIVE_SPEED for the PWM speed control. Testing it out, and it's perfect.  Okay, let's go for it. The full robot program.  Let's get it to add in the infrared sensor  input and write an algorithm to follow a black  line over a white surface.  We want to use the sensors to detect when  the robot drives off course by crossing over  the line and then correct  steering to get back on the line.  Let's give these instructions to  ChatGPT and see what it generates.  Okay, so we have the full program, and I  see we have some conditional logic functions  in here. But will it work?  Perfect. It works so well, I'm so happy.  The robot detects the line and then  turns to stay right on top of it.  Honestly, I don't even know why Tesla is having  such a hard time creating full self-driving  mode. I should just give ChatGPT the code base.  So I do concede that this robot  wasn't technically built by AI.  I had to definitely lead a helping hand  and redirect it when it was left astray.  But it was still wildly impressive  what we were able to achieve.  Stay tuned for more projects,  I'll see you in the next one.
Info
Channel: Will Donaldson
Views: 2,554
Rating: undefined out of 5
Keywords: PCB, Electronics, diy, robotics, circuit, Arduino, line following robot, infrared sensor, AI, chatbot, openAI, ChatGPT, Dalle
Id: 7zEOnuckTdQ
Channel Id: undefined
Length: 11min 31sec (691 seconds)
Published: Wed Feb 01 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.