Needing help

I'm a beginner in electronics who wants to design my own simple PCB with one sensor accelerometer, that controls one servo. The thing is I'm confused about using Arduino code and boards.

The thing is I am tempted to learn Arduino (I know some) but I know companies like Boeing or SpaceX don't use it and use languages like C++, C, or Python. I've been debating for a long time because I'm really confused about wanting to design my own simple circuit board that has sensors that control servos, but not knowing weather to use Arduino or C++, C, or Python.

Basically I want to start designing a PCB with a sensor that affects servos and code them with a programming language like C++, (maybe or maybe not Arduino) and don't know where to start or what language to start learning.

I know this is really confusing but I'm also really confused and need help. I


(Sorry if I posted this in the wrong forum I couldn't find anywhere else better to post this)

The Arduino actually uses C++ but it's non-standard C++. Standard C++ expects standard I/O (a keyboard & screen) and an operating system complete with a file system and disc drive, etc.

And standard C++doesn't include functions to read/write an I/O pin or any of the low-level hardware related stuff the Arduino is good at. In fact, standard C++ doesn't include any graphics or color, or sound, or the mouse. All of the GUI/Windows stuff is additional libraries on top of C++.

So, you won't "learn C++" by learning the Arduino, but IMO it's one of the best-easiest ways of getting started with programming,* especially if you already know some electronics, or if you're interested in learning some electronics. You can learn all of the basic concepts like loops & conditional execution that are used in all programming languages. Your first programming language is the hardest! :wink:

In the old days (before Windows) I would have recommended learning BASIC. Computers used to come with BASIC or it was included on a floppy disc and regular-old command line basic is a fairly simple language. with something like 30 instructions (if I remember correctly.) Visual basic (for Windows GUI programming) is a different animal. I've programmed in several languages, but never Visual Basic or Python.

Standard C is also "manageable". The C Programming Language book by K&R covers the entire language (300 pages) but it's mostly a reference.

C++ builds on C and it's HUGE. The only "book" I've found that covers the entire language is the actual ANSI/ISO language standard, although there are some complete online references. And again, that still doesn't include any GUI.

If you want to learn C or C++ for the computer, I started with Sam's Teach yourself C in 21 Days by Jones & Aitken and Sam's Teach Yourself C++ in 21 Days by Jesse Liberty (Both may be out-of-print.) They don't teach you everything but you really can learn the basics in 21 lessons and I liked the self-teaching style with a quiz at the end of each chapter (day) with answers in the back. (You don't have to learn C before C++.) also has some very-good beginning tutorials and information about how to install a compiler/IDE and "get started", and they have a forum.

* Actually, programming the Arduino can be deceptively simple. You can probably read-through the entire [u]Arduino Language Reference[/u] in a couple of hours (but you won't understand much of it until you've been through some of the [u]Examples[/u]. (You can go beyond the language reference with additional libraries and/or Assembly/machine language programming.)

In general, programming is HARD! It's different from every other field-of-study and not everybody is good at it and not everybody enjoys it. ...Professional programmers probably make more mistakes every day than any other professionals (but they find and correct most of them in short-order).

C++, and start with Arduino.

Or, Python, and start with Raspberri Pi.

With Arduino, you can start with a simple processor like Atmega328P, an accelerometer chip, and a servo.

With a Pi, you start with, well a Pi. It’s a more complex processor, and not something you can easily break down to its components.
You could start with a Pico, it’s schematic doesn’t look too bad to duplicate.

The Arduino is programmed in C++ with specific extensions (which you don't have to use, these functions are abstractions that do make it very easy to work with).

Boeing likely have their own toolkit in house, for whatever microcontrollers they use in their aircraft. They likely employ a good number of different programming languages as well, depending on the job at hand.

To start learning Arduino, start with finding a project that you'd like to build. Then start figuring out the parts you'd need, and how they'd be wired together and have to interact. Finally you get to the programming part - and you get to use whatever language is called for. In the meantime you have had to deal with mechanics, electronic circuit design, PCB design, user experience (someone will be using your project!), and a few other topics as well.

Mind also, there's "learning programming" and "learning C++/Python/Java/Pascal/Fortran/...". This are two related but actually very different things. You learn programming through one of those languages, but when you learnt programming and you have to switch to another language then it's just that, another language. Do that a few times and it becomes "yet another language". The language is just the tool to get the job of programming done, and in case of the Arduino C++ is the correct tool for that.

So If I want to code physical things like make motors spin with C++ I should stick with Arduino correct?

If you stay with this long-term, you will probably end up learning both Arduino and Pi. There are advantages to each and you will learn from each.

The Pi "feels" like a full-blown computer (because it is one), and will enable you to learn Python, which is a good language to start with because it uses a very natural syntax. You can focus on program architecture without getting bogged down in fussy details like pointers and typing required in other languages. However, interfacing to hardware with the Pi is a headache because its I/O is 3.3v and you will fry inputs if you connect them directly to 5v logic.

Arduino boards like the Nano and Uno use 5v logic, making them easier to interface with hardware. But they are usually programmed in C, which is a relatively low level and "fussy" language. It is not hard to learn the basics of C, but expect to be presented with lots of weird behavior from cryptic code bugs which can be difficult to diagnose. These are otherwise known as "learning experiences."

If you pursue programming and electronics either as a vocation or a major hobby for many years, you will almost certainly end up learning multiple languages and platforms anyway. But it's not as bad as learning Indian and Russian, because the many of the core concepts are the same. Becoming a serious guru is something that will probably take years ... but you don't need that level of understanding to get meaningful work done .. and to have a blast doing it.


Physical things are more straightforward with Arduino.
Getting the Pi IO to do stuff is awkward. We found it easier to use Pi's USB to Arduino and let Arduino's 5V IO control hardware.
A simple Promini with FTDI Basic for programming (or to receive commands from the Pi) is easy to use to control stuff.

Thanks everybody. Also I create these Arduino projects with long breadboards and they are very heavy and bulky. Is there a way to convert it all to a light and thing PCB? What microcontroller would I have to use?

Use an Arduino for that. The Pro Mini and Nano boards are designed for soldering onto a PCB (perfboard, stripboard, or your custom design).

When you delve deeper into the matter you may want to start using other microcontrollers of the Atmel line, and start building your own PCBs from scratch. The ATtiny processors are truly small - down to SO-8 package, or even a 3x3mm QFN if you really want it small. But that's for when you have a few years of experience building projects with the regular boards.

One-off projects I tend to solder on perfboard (sometimes with ATtiny soldered on appropriate breakout board but more commonly a Pro Mini or Nano for convenience). Those that I need more of likely go on custom PCB.

The ESP8266 and ESP32 are two other great controllers, those are what you want for anything WiFi.

You can build an Arduino into your board, but since you are a beginner that is more difficult - there are several Arduino's that are small form factor 0.75 x 1.25 inches - just put headers on them and plug into the board -then all you need to do is worry about the circuit on the breadboard - you can also buy circuit boards from Adafruit, Sparkfun and others with a pattern that matches the breadboard except you solder the parts on the board - then no custom printed circuit board -great for one off's and such - there are also other boards you can solder to

So If I want to code physical things like make motors spin with C++ I should stick with Arduino correct?

Yes. Arduino uses a version of C++ with training wheels, but it’s basically still C++. The training wheels are that the Arduino IDE hides some of the stuff that every C++ program has anyway and simplifies the program architecture:

#include <Arduino.h>

int main(void)

#if defined(USBCON)
    for (;;) {
        if (serialEventRun) serialEventRun();
    return 0;

You can also buy a micro:bit and use it in the Arduino IDE, as it already has an accelerometer built in.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.