By continuing to use this site, you agree to our use of cookies. Find out more
Forum sponsored by:
Forum sponsored by CML

Arduino programming for beginners.

Are there any recommended guides / tutorials?

All Topics | Latest Posts

Search for:  in Thread Title in  
Chris Bott - Moderator13/07/2020 21:02:25
avatar
Moderator
6838 forum posts
1429 photos
1 articles

I've had a couple of questions sent to me about where to start with Arduino programming.

To paraphrase, they go a bit like this:- "I'm happy building other peoples projects, using the IDE, compiling and uploading sketches, but I've no idea where to start with writing something of my own. How did you get started?"

Now, I did indeed find it quite impenetrable to start with, and I know I have hardly scratched the surface yet, and have had some very welcome help here on this forum.

So, how did you start? What would you suggest to a beginner?

Are there any recommended guides or tutorials that quickly take the reader through the basic structure, using comments, void setup/void loop, ending lines with semi-colons and all those things that will trip them up before they've even started etc etc.

Then, where is the best place to go to learn about programming, it's self?

Any thoughts would be very welcome, I'm sure.

Steve J13/07/2020 21:29:48
avatar
1976 forum posts
54 photos

I found Michael Margolis's Arduino Cookbook useful for the Arduino specific side of things.

Graham Davies 313/07/2020 21:58:03
66 forum posts
39 photos

Hi Chris,

with my work, I decided our company needed to understand Arduino/ Internet of Things and all the other 'stuff'. I bought an Arduino MKR 'kit' which included lots of bits and pieces, went to the arduino website, and followed a few projects. The first one took me ages, but then I started to understand what it was all about.

I created various projects that were work related. Such as scrolling messages on an LCD screen that changed when switches were pushed and triggered indicator lights (My company manufactured the switches and lights).

I recommend 'playing'. Try buying the MKR1000 kit as it has everything you need (even a mini servo!), and then google 'arduino projects' to get an idea on what the collective genii in the world are imagining. when your kit arrives, follow the basic instructions and try out the basic projects they give you.

It's surprisingly easy. If I could do it, anyone can!

Graham

Peter Christy13/07/2020 21:59:06
1829 forum posts

Whilst I can read - and tweak, when required - both Arduino code and "C", I would hesitate to write either from scratch!

I was taught programming on an IBM mainframe, running Fortran and a DEC PDP-8 running Focal. Neither of these helped me very much when I started playing with early computers like the UK101 or BBC "B"! I did get quite proficient at 8-bit machine code, but modern programming languages seem to work in a whole different way!

No doubt I could do it if I put my mind to it, with a lot of studying. My problem is that it is something I would only use occasionally, and by the time I wanted it again, I would have forgotten what I did the last time!

I know enough to get by, and that keeps me occupied and content! wink

It certainly helps to learn something like Basic. It may not be directly applicable to something like an Arduino, but it does teach you the importance of logical thinking and planning, and is relatively easy to debug!

Once you can get your head around Basic - or a similar interpreted language - then working with compiled languages becomes easier. At least your brain is partially tuned to the right wavelength....!

smiley

--

Pete

Kevin Harton14/07/2020 07:35:42
1 forum posts

Hi Chris,

I'm very new to the Model flying forums and relatively new to Arduino and have completed various projects including scrolling Max7219 Matrix's and various types of Word clocks some using Real Time Clocks and NTP time with Wemos D1's etc etc, i'm now working on projects with stepper motors and servo's, the servo project is using EasyVR3 and an Arduino uno.

I struggled initially due to not having the correct Libraries or the correct version of the ide where a sketch was initially compiled and also if there are tabs with the sketch at times they don't all come in with the sketch, i found this was due to the fact that the file heading must be exactly the same as the zipped master, say if you renamed the un-zippped sketch as something else, the tabs wont come with the sketch, sounds so simple but very frustrating at the time.

My reference book to start learning Arduino was "Beginning C for Arduino", Second Edition by Jack Purdum it has some good pointers but on the whole this guy is talking a different language to me and iv'e struggled to get my head round it i guess i must be a more Arduino for Dummies type of person.

Initially what with the Hello World and a blinking LED i nearly didn't pursue Arduino any further, i'm glad i did.

Are there any scenarios within model flying where Arduino could be useful? i know you yourself have Arduino projects like the Servo Exerciser and Watt meter, i know Arduino is pretty useful in the Model Railway setups as well.

Kev

Steve J14/07/2020 08:37:09
avatar
1976 forum posts
54 photos
Posted by Kevin Harton on 14/07/2020 07:35:42:

Are there any scenarios within model flying where Arduino could be useful?

Homebrew telemetry sensors for people who use telemetry.

Lighting controllers.

Edited By Steve J on 14/07/2020 08:39:00

perttime14/07/2020 09:31:53
avatar
161 forum posts
11 photos

I don't do it....

For other things in coding, it is sometimes good to start from something that already exists and make the changes that you want.

I recall an incident where an Arduino bug in a big multicopter caused significant bodily damage.

EarlyBird14/07/2020 10:17:27
186 forum posts
146 photos

I started in the early 70s on what I thought was an ICL PDP10 using Basic as an introduction to computer programming.

In the early 90s this came useful when working on desktop computers Intel 8080 8 bit chips if I remember correctly also dabbled with machine code in the absence of suitable compilers and Interactive Development Environments.

Next came the microcontroller with IDE and compilers still used basic though.

Today Basic is old hat and any form of C will be useful in the future.

I had to switch to C# when I was using Visual Studio to create Web Sites. I also programmed touch screen PLCs.

Learn C in some form, find a project that is of interest to you and go from there.

And never give up.

You never know where it will lead.

Steve

dave windymiller25/07/2020 21:03:25
avatar
109 forum posts
148 photos

I have to agree with Kevin re "Beginning C for Arduino" was a bit hard going. Ive found the best education has been having a specific task to achieve and searching the web for examples or similar functionality and tweaking them until it does what you want. My first arduino project was an altimeter about 18 months ago (i posted it in this forum) and now at work im using arduinos for a variety of tasks, one of which has 40 arduinos talking to each other simulating a power station milling systems instrumentation.

20200205_215648.jpg

Modelling wise I am also developing a cockpit display for a jet project 25mmx25mm, again adapted from a totally different example found on the net (pilots please excuse any errors in its readings as there is artistic license in play!) I can see it wouldnt be that difficult to have a display that actually worked using various sensors (but lifes too short)!

unknown.jpg

At work i am now circuit boards using the ATmega328 chip directly but using arduino C to program them. This sub board (hand soldered prototype in picture) replaces 2 ics that are no longer available in one of our products. The key thing again was having an idea and end result to aim for and searching the web. I still find myself grabbing hold of the blink sketch from time to time (Blink is example 1 in the examples). Stick with it as its a fascinating subject, im glad i did as my job has totally changed as a result. I have never written a sketch from scratch by the way.

20190930_152921.jpg

Max Z26/07/2020 09:57:18
avatar
555 forum posts
248 photos

I did initially learn how to program in Arduino from the Arduino website. Most if not all of the information is there, but I have to say navigating to the core tutorial(s) is a bit hard. Probably the best way to start is to upload the ubiquitous "Blink"-sketch and start HERE to learn how it functions. You can then work your way up with the Reference Page to learn about all other functions, variables and structures.

But the main ingredient is and will always be perseverance. You have to enjoy creating stuff in Arduino, do not see it just as a quick way to create a custom piece of electronics to suit your immediate need. And you have to do it often to stay in form, but even then you have to refer to quite basic things now and then (I know I do). In that respect it is the same as designing stuff in 3D cad (one of my other hobbies).

I never felt the need to learn any C-language, my only background is a bit of Basic in the distant past (for my MSX computer). But you have to have a mind for structuring a program, with all the (nested) decision and looping functions. It is not impossible to create that structure in Arduino from scratch, but it often helps to work out the process in a block diagram.

I have to add that I am in no way an expert, my creative work in arduino is pretty basic. And I often use other people's creations to learn from and customize it to suit my preferences. HERE is a nice forum, with an arduino-oriënted section that I visit frequently. A lot of these projects are way over my head in complexity, but there are some that I copied and customized successfully.

Max.

Edited By Max Z on 26/07/2020 10:36:32

Nik Harrison29/07/2020 13:31:03
avatar
85 forum posts
161 photos

Posted by Kevin Harton on 14/07/2020 07:35:42:

Are there any scenarios within model flying where Arduino could be useful?

I used the Arduino Nano to give voice announcements to my early model Dx8. See Voice Synth Here. I did post as "Giving voice to my Spektrum Dx8"

Bob Burton29/07/2020 14:13:42
184 forum posts

Plenty of help available on the Arduino forum of which I am a moderator (UKHeliBob)

Let me know if you need any help

Mike Blandford29/07/2020 15:28:31
avatar
645 forum posts
25 photos

I have a few available, see **LINK**:

ServoReverser: allows a servo signal to be reversed, and/or to be slowed down.

SPortToHub: poll SPort sensors and output hub protocol.

SbusToPpm: 16 channel SBUS decoder.

APM_Mavlink_to_FrSky: Convert Mavlink telemetry to FrSky, either SPort or Hub protocol.

Note that most of these override standard Arduino libraries so I may have accurate control of timing.

Mike

Nik Harrison29/07/2020 18:36:46
avatar
85 forum posts
161 photos

Other uses for hardware/software in our sport.

1. Arduino used to make a 2.4Ghz version of an old time reed Tx.

2. Same for single channel units.

3. I used a PIC micro to operate cargo doors and paratroopers on the TN A400 using only one channel.

4. Same for servo reverse and servo slows. I know you can buy such devices but making your own is more fun.

Once you acquire such programming skills the projects you come up with will surprise you. I regard it as just another part of our sport.

Nik

Phil Green29/07/2020 23:36:02
avatar
1609 forum posts
341 photos
Posted by Bob Burton on 29/07/2020 14:13:42:

Plenty of help available on the Arduino forum of which I am a moderator (UKHeliBob)

forum.arduino.cc is quite the least friendly forum I have ever used. In fact I'd go further than that, a lot of responders are aggressively dismissive. Pick any topic at random and you'll see. Really discouraging for beginners who at best get an 'RTFM' and are dismissed as an inconvenience.

Cheers
Phil

Nik Harrison31/07/2020 19:50:58
avatar
85 forum posts
161 photos

I have to take umbrage with the last posting. I had problems with some coding that was sorted with a simple email. I would not fault the forum. When the IDE stopped working - again the forum sort me out. By the way I did not even know there was a manual.

Cheers,

Nik

Bob Burton31/07/2020 22:52:11
184 forum posts
Posted by Phil Green on 29/07/2020 23:36:02:
Posted by Bob Burton on 29/07/2020 14:13:42:

Plenty of help available on the Arduino forum of which I am a moderator (UKHeliBob)

forum.arduino.cc is quite the least friendly forum I have ever used. In fact I'd go further than that, a lot of responders are aggressively dismissive. Pick any topic at random and you'll see. Really discouraging for beginners who at best get an 'RTFM' and are dismissed as an inconvenience.

Cheers
Phil

That really is not my experience. Long term members of the forum do get annoyed when people do not read the sticky topics on how to post programming questions, which results in code being posted in italics (if it is posted at all) and no details being given of the hardware being used. That certainly leads to advice to read the sticky topics but unless questions and code are posted properly then it is very difficult to provide help

The equivalent here would be a post saying "I have problem with my transmitter. Can you help me ?"

Advice, including writing code, is freely available on the forum but members are expected to do some work for themselves. It is not unknown, for instance, for school, and even University assignments to be posted in full in the expectation that someone will write the code for them.

If anyone here has any Arduino based questions please feel free to ask them here or via PM and I will do my best to help. I would be interested to know how many members here are also members of the Arduino forum

Phil Green31/07/2020 23:58:18
avatar
1609 forum posts
341 photos

I could post examples, some responders are downright rude, arrogant and dismissive but reading between the lines I gather that you're 'politely aware' of that Bob. As a well established enthusiast (and a microelectronics teacher) I found their treatment of beginners (some only kids) was appalling and so I avoid it - unless its improved over the last few years.

Cheers
Phil

Bob Burton01/08/2020 07:47:30
184 forum posts

If it was a while ago that you used the forum then I believe that you may have a particular individual in mind. He had a habit of being right but in an arrogant way and did not suffer fools gladly. Note the past tense

Phil Green01/08/2020 14:17:35
avatar
1609 forum posts
341 photos

thumbsup.jpg

All Topics | Latest Posts

Please login to post a reply.

Support Our Partners
electricwingman 2017
Slec
CML
Sussex Model Centre
Sarik
Advertise With Us
Latest "For Sale" Ads
Has home isolation prompted you to start trad' building?
Q: The effects of Coronavirus

 Yes - for the first time
 Yes - but Ive bashed balsa before
 No - Ive existing projects on the bench
 No - Im strictly an ARTF person

Latest Reviews
Digital Back Issues

RCM&E Digital Back Issues

Contact us

Contact us

Magazine Locator

Want the latest issue of RCM&E? Use our magazine locator link to find your nearest stockist!

Find RCM&E!