First experiences using ChatGPT for Arduino code

Some thoughts from a very basic self confessed cut and paste Arduino code writer.

In the course of creating a recent Arduino based project a collegue suggested trying ChatGPT. A resource that I really wasn’t sure how to use.

ChatGPT is among many other things, a web based AI code writing resource. In simple terms, you tell it what you are trying to achieve, what hardware you have available and it will, very very quickly deliver code that will satisfy the requirement.

It is not perfect. ChatGPT is only as good as your ability to describe exactly what you want to happen and what the hardware being used is and what the interconnections are. In short the output result is only as good as the input data. It is still likely to be ‘not quite there’ and needs you as the client to try the code and clearly describe and feedback what is happening in the hardware so an iteration of the code can be created ….and then you go round the loop again.

It is all a bit surreal.

You are talking with a machine somewhere in the web infrastructure that you cannot help but give a human personality to. You get all the niceties of ‘Hello’, ‘Bye for now’ etc which adds to this humanisation. It becomes a partnership where the AI source does all the grunt code bashing and you become the project leader directing, testing, evaluating and feeding back.

Some might regard the process as ‘cheating’. My father always impressed on me that if a machine can do something as well or better than a human then a human should not be doing it. I believe this is the case with AI. It is a power to be harnessed to do the donkey work of writing the code while the human directs and assesses the result. The more the human can interpret the code the more successful the partnership and the more efficient the time to success of the project. My coding understanding has improved and anything that I do not understand can on request be patiently explained by my AI friend. It’s nice to be able to ask dumb questions and not be ridiculed by some forum ‘know it all’.

I can also see a looming revolution in the software industry and understand why current code writers are looking nervously over their shoulders with a great deal of discomfort and concern. My feeling is that we should grasp having a partner that can crunch all the boring dross code writing which would take a human hours to do. Instead we should step back and become project managers with intelligent direction and control of the AI source.

I have also found one aspect of a ChatGPT partnership that must be monitored and controlled – mission creep. My AI friend is constantly in need of a handbrake to stop or at least slow the avalanche of code creep that can potentially ensue. Lots of ‘it would be easy to add …’ conversations crop up which need firmly resisting until the core of the project is stable and running to plan.

All that aside I am now able to fulfill Arduino based projects to a level I never could before and with a complexity that I will never be able to fully understand. To me, ChatGPT is a very powerful partnership but with the old caveat of ‘rubbish in rubbish out’.

Links to similar or related post are listed below : –

3V3 to 5V Non Inverting Buffer

I have been deep in Arduino of late with no small amount of support from ChatGPT (that is another story). As I was working with Seeed Xiao SAMD21 devices these are all 3V3 logic operation. I had a number of instances where I needed to step up the Xiao 3V3 signals to drive external parts needing 5V logic levels. My solution uses two complementary digital transistors (these have 10k base resistors embedded), a couple of resistors and an optional LED. Here is the circuit diagram created in Fusion Electronics. Note that the DTC114 and DTA144 are available in all manner of packages so this circuit could be crammed into a very small tile for everyday drop in use.

For those who like a visual of the circuit here is board layout and a 3D render.

Not rocket science but a nice simple interfacing solution.

Links to similar or related post are listed below : –

FlatCAM installer ‘disappeared’

On the face of it FlatCAM has disappeared as a download from BitBucket.

If you dig deeper you will find this post and reply from Marius

https://bitbucket.org/jpcgt/flatcam/issues/715/windows-installer-is-missing

This points to the following link where you can find all the installers.

https://s.go.ro/gwuioxmd

Panic over. Phew.

Links to similar or related post are listed below : –

Eccentric Engineering Turnado freehand turning tool

I have had an Ingram (1905) mechanical clock in for service. A simple clean and set to time which went to plan (for a change). The only niggle was one of the four tapered wooden pegs that hold the dial and movement into the wall case was missing. I could have 3D printed a tasteless replacement but my conscience would not let me stoop that low. It needed to be a wooden part with similar geometry.

Quite some time ago I had ordered a pair of Diamond Tool Holders from Eccentric Engineering in Australia and at the time Gary was doing a special deal on his Turnado hand turning tool. As I was going to be paying a significant carriage cost I decided to consolidate and offset this with the Turnado kit.

On receipt of the package I played with the Turnado but had no needing projects at that time. It is well thought out and allows freehand turning either as freeform movements or movement against a template profile or with a pantograph. Here is a link to Gary’s sales video.

In the process of considering making a 3D printed version of the peg I had dimensioned and drawn a 3D model in Fusion.

Taking the 3D model and opening it in Fusion Drawing mode gave me a 1:1, 2D PDF drawing of the peg. I cut out the 2D image and stuck this to a piece of aluminium with 3M Spray Mount and then nibbled and filed the aluminium to the peg drawing profile.

The profile template was mounted on the Turnado working table and the shape profiled into a piece of 18mm dowel using the Turnado tool on its pantagraph following my profile.

Here is a posed picture of the setup showing the Turnado tool and table with my profile plate, for effect a first attempt at the peg is sitting in the chuck between centres with the original peg (LHS) and the finished peg (RHS). Not quite a total match but more than functional.

Absolute magic. A really useful asset. I just need to remember I have it ….

As Jimmy Diresta would say “Better to have it and not need it than need it and not have it”

Links to similar or related post are listed below : –

Swiss Vapeur Parc Festival Week

Just back from a few days in Switzerland which included a day at the Swiss Vapeur Parc annual fesitval at Le Bouveret. What an extraordinary place. Well worth a visit for those of a model steam persuasion. This link takes you to their webcams.

The annual festival attracts around 150 x 5″gauge model engines from around Europe including the UK. The Parc track layout is extensive and the infrastructure the members have built is quite amazing. You can sit and watch locos going past you in all directions and a full ride around the site takes around 20 minutes or so. We arrived at 10 am and didn’t leave until late afternoon such was the changing interest as more engines were brought into steam. This included a Darjeeling from Leatherhead Club.

We also spent a day on the Bex to Bretaye railway. This is a two hop route up to the mountain tops. The first section is from Bex to Villars where you then change trains for the section up to Bretaye. Both locomotives use a rack and pinion funicular traction drive mechanism. At Bretaye we took the chair lift up to Chaux Ronde at 1987m altitude. This revealed some stunning views of snow covered peaks including Mount Blanc.

A few interesting days with very warm sunshine. Well worth the trip.

Links to similar or related post are listed below : –

Verified by ExactMetrics