Author Topic: EEVblog 1531 - Can ChatGPT generate all the code for my Macgyver Project?  (Read 3687 times)

0 Members and 1 Guest are viewing this topic.

Online EEVblogTopic starter

  • Administrator
  • *****
  • Posts: 37740
  • Country: au
    • EEVblog
Can ChatGPT generate all the code for my Macgyver Project?
Does ChatGPT understand what 7 segment displays and shift registers are, and can it integrate that knowledge with Arduino programming? Let's find out!

This is Part 3 of the Magyver project.

 
The following users thanked this post: thm_w

Online xrunner

  • Super Contributor
  • ***
  • Posts: 7517
  • Country: us
  • hp>Agilent>Keysight>???
Re: EEVblog 1531 - Can ChatGPT generate all the code for my Macgyver Project?
« Reply #1 on: February 23, 2023, 02:16:48 pm »
How many human coders would get it exactly right from scratch the first time it's compiled and run? It's seems to be good for a starting point which isn't a bad thing. It also depends on how well the human describes the problem.

Also, remember that ChatGPT is not even a finished product at this time, and it will be better and better as time goes on.
I told my friends I could teach them to be funny, but they all just laughed at me.
 

Online artag

  • Super Contributor
  • ***
  • Posts: 1070
  • Country: gb
Re: EEVblog 1531 - Can ChatGPT generate all the code for my Macgyver Project?
« Reply #2 on: February 23, 2023, 03:14:55 pm »
It's 80% there ..  and there's 80% left to do. Just like real software engineering.
 
The following users thanked this post: Brumby, tooki

Offline Psi

  • Super Contributor
  • ***
  • Posts: 9951
  • Country: nz
Re: EEVblog 1531 - Can ChatGPT generate all the code for my Macgyver Project?
« Reply #3 on: February 24, 2023, 02:22:44 am »
yeah, expecting an AI to be 100% perfect first time is unrealistic, just like expecting a human to be 100% right first time.

But it got the vast majority of it correct and considering AI chat is a relatively new tech its amazing that it's this good this soon.
And AI is only as good as the amount of training data it has. Every day humans write more and more stuff on the internet and so AI can be trained on a larger and larger dataset information. It can only get better and better. Probably quite a lot better.

Definitely going to change the face of programming, as well as other industries.

You can actually see how coding in the future might be done by speaking to your computer and getting it to write and tweak functions for you. You'll still have to understand how to code and type out some 'glue logic' but the time to write stuff should be greatly reduced.
« Last Edit: February 24, 2023, 02:29:49 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline YurkshireLad

  • Frequent Contributor
  • **
  • Posts: 365
  • Country: ca
Re: EEVblog 1531 - Can ChatGPT generate all the code for my Macgyver Project?
« Reply #4 on: February 24, 2023, 02:35:02 am »
It's 80% there ..  and there's 80% left to do. Just like real software engineering.

The last 10% takes 90% of the time.
 
The following users thanked this post: tooki

Offline Psi

  • Super Contributor
  • ***
  • Posts: 9951
  • Country: nz
Re: EEVblog 1531 - Can ChatGPT generate all the code for my Macgyver Project?
« Reply #5 on: February 24, 2023, 02:49:20 am »
It's 80% there ..  and there's 80% left to do. Just like real software engineering.

The last 10% takes 90% of the time.

Yeah, but that is assuming the AI will only generate you the 'easy' stuff.
I'm not sure if that's a true statement.

AI is not bound by easy vs hard it's bound by the pool of training data.
When you train it on something like stack overflow you are training it on the bits that people find difficult and ask for help on.

Not saying you're wrong, just that i dont think it's as clear cut as that.
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 7733
  • Country: ca
Re: EEVblog 1531 - Can ChatGPT generate all the code for my Macgyver Project?
« Reply #6 on: February 24, 2023, 03:10:44 am »
How many human coders would get it exactly right from scratch the first time it's compiled and run? It's seems to be good for a starting point which isn't a bad thing. It also depends on how well the human describes the problem.
I pulled this off just once.  Though I was showing off to a friend and I was being ultra careful.
I don't think I could ever do it again...
 
The following users thanked this post: xrunner, tooki

Online xrunner

  • Super Contributor
  • ***
  • Posts: 7517
  • Country: us
  • hp>Agilent>Keysight>???
Re: EEVblog 1531 - Can ChatGPT generate all the code for my Macgyver Project?
« Reply #7 on: February 24, 2023, 03:33:06 am »
How many human coders would get it exactly right from scratch the first time it's compiled and run? It's seems to be good for a starting point which isn't a bad thing. It also depends on how well the human describes the problem.
I pulled this off just once.  Though I was showing off to a friend and I was being ultra careful.
I don't think I could ever do it again...

Yea I maybe did it to flash an LED.  :-DD

I've done quite a few microcontroller projects but there's no way I could have done any of them perfectly the very first time. I think breaking down the project for ChatGPT is the best way to do it (like we teach students ... Hmmm).

To be ridiculously simpleminded tell it you want a function to add two variables passed to it and return the result. It'll get that correct the first time. At some point the function will be prone to errors due to the complexity of the function and/or the explanation the human provides to ChatGPT, and due to it's misunderstanding. So, if you break down the programming project into functions for ChatGPT to work on it will probably get you farther to the correct full-functioning program.  :P
I told my friends I could teach them to be funny, but they all just laughed at me.
 

Offline bob808

  • Frequent Contributor
  • **
  • Posts: 281
  • Country: 00
Re: EEVblog 1531 - Can ChatGPT generate all the code for my Macgyver Project?
« Reply #8 on: February 24, 2023, 03:33:38 am »
So ChatGPT is (maybe not yet) an abstraction layer?
 

Online xrunner

  • Super Contributor
  • ***
  • Posts: 7517
  • Country: us
  • hp>Agilent>Keysight>???
Re: EEVblog 1531 - Can ChatGPT generate all the code for my Macgyver Project?
« Reply #9 on: February 24, 2023, 03:39:11 am »
Follow up

Me: can you write for me a c function. I want to pass it two variables and the function needs to add the two variables and return the result

ChatGPT: Certainly! Here's an example of a C function that adds two variables and returns the result:

int add(int a, int b) {
    int sum = a + b;
    return sum;
}

No errors ... But continue to make the function more complex and it will make an error eventually.
I told my friends I could teach them to be funny, but they all just laughed at me.
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 9951
  • Country: nz
Re: EEVblog 1531 - Can ChatGPT generate all the code for my Macgyver Project?
« Reply #10 on: February 24, 2023, 03:46:44 am »
No errors ... But continue to make the function more complex and it will make an error eventually.

So will a human, but in this case the AI is only a few years old.

Ya, have to think of an AI or neural nets like an imperfect entity at a fundamental level
« Last Edit: February 24, 2023, 03:48:29 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Online artag

  • Super Contributor
  • ***
  • Posts: 1070
  • Country: gb
Re: EEVblog 1531 - Can ChatGPT generate all the code for my Macgyver Project?
« Reply #11 on: February 24, 2023, 08:40:09 am »
When you train it on something like stack overflow you are training it on the bits that people find difficult and ask for help on.

At least it tries to be polite, unlike the downright unhelpful stack overflow mods :).

Bing is getting a reputation for the opposite. Maybe they trained ChatGPT on git and Bing on Stack overflow.
 

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 7733
  • Country: ca
Re: EEVblog 1531 - Can ChatGPT generate all the code for my Macgyver Project?
« Reply #12 on: February 25, 2023, 03:00:39 pm »
How many human coders would get it exactly right from scratch the first time it's compiled and run? It's seems to be good for a starting point which isn't a bad thing. It also depends on how well the human describes the problem.
I pulled this off just once.  Though I was showing off to a friend and I was being ultra careful.
I don't think I could ever do it again...

Yea I maybe did it to flash an LED.  :-DD

No.

Mine was a home made state machine processor for a PIC microcontroller which generated a set of output controls based on a sequence and timing of door sensors for an alarm system.  Yes, pulling it off surprised us both as we both were software engineers.  Made a simple 1.5k$ cash on that bet for 1.5 hour work.
« Last Edit: February 25, 2023, 03:14:59 pm by BrianHG »
 

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2007
  • Country: us
Re: EEVblog 1531 - Can ChatGPT generate all the code for my Macgyver Project?
« Reply #13 on: February 25, 2023, 03:40:30 pm »
Can ChatGPT generate all the code for my Macgyver Project?
Does ChatGPT understand what 7 segment displays and shift registers are, and can it integrate that knowledge with Arduino programming? Let's find out!

Does this mean you will not be doing the 74-series hardware solution?
 

Offline Marco

  • Super Contributor
  • ***
  • Posts: 6721
  • Country: nl
Re: EEVblog 1531 - Can ChatGPT generate all the code for my Macgyver Project?
« Reply #14 on: February 25, 2023, 04:35:59 pm »
There are legal/PR limitations on how good they can make Codepilot type systems (in the absence of AGI).

Bing improves on GPT by putting it in a hybrid expert system with some guided search results as context/citations, but it has the law and PR on its side. Codepilot probably uses guided search results as context same as Bing, but it can't really provide citations and lift the curtain ... whether the law is on its side remains to be seen, PR wise it would certainly a disaster.
« Last Edit: February 25, 2023, 04:50:52 pm by Marco »
 

Online xrunner

  • Super Contributor
  • ***
  • Posts: 7517
  • Country: us
  • hp>Agilent>Keysight>???
Re: EEVblog 1531 - Can ChatGPT generate all the code for my Macgyver Project?
« Reply #15 on: February 25, 2023, 04:42:01 pm »
How many human coders would get it exactly right from scratch the first time it's compiled and run? It's seems to be good for a starting point which isn't a bad thing. It also depends on how well the human describes the problem.
I pulled this off just once.  Though I was showing off to a friend and I was being ultra careful.
I don't think I could ever do it again...

Yea I maybe did it to flash an LED.  :-DD

No.

Mine was a home made state machine processor for a PIC microcontroller which generated a set of output controls based on a sequence and timing of door sensors for an alarm system.  Yes, pulling it off surprised us both as we both were software engineers.  Made a simple 1.5k$ cash on that bet for 1.5 hour work.

That's pretty good! In my career I wrote utility stuff in C but that wasn't my main job so I have an excuse.  :P I guess now I could leverage ChatGPT and perhaps get it right the first time.  :-DD
I told my friends I could teach them to be funny, but they all just laughed at me.
 

Offline laureng

  • Newbie
  • Posts: 7
  • Country: au
Re: EEVblog 1531 - Can ChatGPT generate all the code for my Macgyver Project?
« Reply #16 on: February 28, 2023, 04:54:08 am »
On the theme of Dave trying out AI tools for electronics engineering, what about the DeepPCB AI autorouter? (Although some people were claiming it was fake human-in-the-loop due to the 24-hour turnaround time).

I've just gotten done routing a moderately complicated mixed-signal board. There sure is a lot of engineering know-how that goes into routing for signal integrity so the end-result has good performance and low noise, and you use completely different techniques depending on whether you're routing two layer or four+ layer. The end result is both art and science. I do get the feeling, though, that if AI trains up on enough existing human-routed boards that it will eventually do a half-decent job.

Anyway, might make for an interesting idea for another video in the Dave-does-AI series...

For the record, I only came across DeepPCB today in a Google search and have never used it, so this isn't an endorsement, but curiosity.
 
The following users thanked this post: EEVblog

Online thm_w

  • Super Contributor
  • ***
  • Posts: 6384
  • Country: ca
  • Non-expert
Re: EEVblog 1531 - Can ChatGPT generate all the code for my Macgyver Project?
« Reply #17 on: February 28, 2023, 10:18:18 pm »
On the theme of Dave trying out AI tools for electronics engineering, what about the DeepPCB AI autorouter? (Although some people were claiming it was fake human-in-the-loop due to the 24-hour turnaround time).

I've just gotten done routing a moderately complicated mixed-signal board. There sure is a lot of engineering know-how that goes into routing for signal integrity so the end-result has good performance and low noise, and you use completely different techniques depending on whether you're routing two layer or four+ layer. The end result is both art and science. I do get the feeling, though, that if AI trains up on enough existing human-routed boards that it will eventually do a half-decent job.

Anyway, might make for an interesting idea for another video in the Dave-does-AI series...

For the record, I only came across DeepPCB today in a Google search and have never used it, so this isn't an endorsement, but curiosity.

https://www.eevblog.com/forum/projects/deeppcb-beta-tensorflow-based-machine-learning-pcb-routing-online-free-trial/

thinkfat is saying its fake. Probably worth trying, but, remember that all it does is route. It does not claim to provide good signal integrity, etc.
If we are just talking routing signals from A to B, a human can easily be beaten with enough CPU horsepower.
Profile -> Modify profile -> Look and Layout ->  Don't show users' signatures
 

Online EEVblogTopic starter

  • Administrator
  • *****
  • Posts: 37740
  • Country: au
    • EEVblog
thinkfat is saying its fake. Probably worth trying, but, remember that all it does is route. It does not claim to provide good signal integrity, etc.
If we are just talking routing signals from A to B, a human can easily be beaten with enough CPU horsepower.

That's kinda lame if it can't finish a known previously routed placement.
That would be the best way to test it I think, get an existing design wiht all the constraints and rip up all the traces.
 

Offline Dave

  • Super Contributor
  • ***
  • Posts: 1352
  • Country: si
  • I like to measure things.
Maybe as an idea for a followup video: Try doing the exact same test with GitHub Copilot. It's supposedly significantly better at generating code.
<fellbuendel> it's arduino, you're not supposed to know anything about what you're doing
<fellbuendel> if you knew, you wouldn't be using it
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf