Arduino boards, and the many affordable microcontrollers that came in their wake, changed hobby electronics forever. What was once the domain of the super geek, armed with extensive knowledge of electronics and computing, is now available to all.

The price of the hardware is always dropping, and the online community is always growing. We've previously covered getting started with an Arduino, and there are lots of great beginner projects to get you acquainted, so there's no reason not to jump right in!

But today, we will cover a few mistakes frequently made by folks who are new to this world, and how to avoid them.

Power Up!

Most Arduino boards have a power regulator on board, meaning you can power it from USB or a power supply. While each board differs in exactly what it can take, it is typically 7-12v input through a DC barrel jack or through the VIN pin. This brings us nicely on to our first mistake:

1. Externally Powering the Board "Backwards"

This first one catches people out all the time. If you are powering your board from a battery or power supply you must make sure that V+ goes to the VIN pin, and the Ground wire goes to the GND pin. If you get this backwards, you are pretty much guaranteed to fry your board.

arduino mistake vin correct wrong

This seemingly obvious error happens more frequently than you would think, so always check your power setup before switching anything on!

When the air smells of fried Arduino, more often than not this is the main reason. The second most likely is because something tried to draw too much current from the board. Knowing how much power your components need compared to how much your board can provide is essential.

Before we dive into this, let us take a quick look at the theory behind power.

Current Affairs

An essential part of working with microcontrollers is knowing the basics of electronics. While you don't need to be a genius electrical engineer, it is important to understand Volts, Amps, Resistance, and how they are linked. Sparkfun have an excellent primer to electronics, along with several videos explaining Voltage, Current (Amps) and Ohm's Law (Resistance).

Understanding exactly how much power a component will need is an essential part of working with Arduino boards.

2. Running Components Directly From Pins

This one catches a lot of folks out who are eager to dive right into projects. It is possible to use some low powered components directly with the Arduino pins. In many cases though, doing this can pull far too much power from the Arduino, risking destroying your microcontroller.

The worst offender here is motors. Even low power motors pull such a varied rate of power that they are usually unsafe to use with the Arduino pins directly. For a truly DIY way to use a motor, you need to use a H-bridge. These chips allow you to control a DC powered motor using your arduino pins, without risking frying your board.

arduino mistake hbridge
Image Credit: http://www.w11stop.com

These small chips separate the power supply from the Arduino, and allow the motor to move in both directions. Perfect for DIY robotics or remote control vehicles. The easiest way to use these chips is as part of a shield for your Arduino, and they are available for under $2 from Aliexpress, or if you are feeling adventurous, you could always make your own.

arduino mistake diy shield
Image Credit: ASCAS @ Instructables.com

For beginners using motors with Arduino, Adafruit have tutorials using both the chip itself and their breakout motor shield.

Relays and MOSFETs

Other electrical components and appliances may draw more predictable amounts of power, but you still do not want them attached directly to your microcontroller. Even 5v LED strips can be dangerous. While attaching a few directly to the board for testing can be ok, it is generally better practise to use an external power source, and control them through a relay, or MOSFET.

While there are differences between the two, they are functionally the same for many applications within hobby electronics. Both can act as a switch between a power source and component, which is turned on or off by an Arduino. A relay is completely isolated from the circuit which controls it, and functions solely as an on/off switch. Dejan Nedelkovski has a good video introduction to using Relays taken from his tutorial article.

A MOSFET allows for different amounts of power to be passed through by using pulse width modulation (PWM) from an Arduino pin. For a primer on using MOSFETs with LED strips, check out our Ultimate Guide to connecting them to an Arduino.

3. Misunderstanding Breadboards

A common error when starting out is managing to cause short circuits. These occur when parts of the circuit are joined in places they shouldn't be, giving the power a simpler route to follow. This will at best result in your circuit not acting like it should, and at worst with fried components or even a fire risk!

To avoid this when using a breadboard, it is important to understand how a breadboard functions. This video from Science Buddies is an excellent way to get acquainted.

The important aspect here is remembering how the rails work on each board. On full and half size breadboards, the outer rails work horizontally and the inner rails vertically, with a gap in the middle of the board. Mini breadboards only have vertical rails.

The easiest way to avoid causing a short on a breadboard is simply to check your work before powering up your device. That last-minute glance can save you a multitude of woes!

4. Soldering Mishaps

The same problem can happen when soldering Arduinos or components to protoboard, especially with smaller boards like the Arduino Nano. All it takes is a tiny blob of solder between two pins to cause a short which could wreck your microcontroller. The only way to avoid this is to be vigilant, and practise soldering as much as possible.

When just starting out, soldering can seem quite a delicate and daunting task, but it gets much easier with time. Our project guide for beginners should help anyone out who is moving from the breadboard into the world of prototyping!

5. Wiring Things Up to the Wrong Pins

Working with microcontrollers means working with pins. Most components and many boards come with pins to attach them to protoboard. Knowing which pin does what is essential to making sure things work the way you want them to.

A common example is the previously mentioned MOSFET. The three legs on a MOSFET are called the Gate, Drain, and Source. Mixing any of these up could cause power to flow in the wrong direction or cause a short circuit. This can destroy your MOSFET, Arduino, appliance, or if you are really unlucky, all three!

arduino mistake labelled mosfet
Image Credit: Adafruit.com

Always look for a datasheet or pinout of a component before using it to determine exactly which pin goes where, and how much power it requires to use.

6. Syntax Errors in Code

Moving away from the hardware side of Arduino, there are plenty of mistakes to be made when coding. The most typical errors include:

  • Missing semicolons at the end of lines
  • Missing/wrong type of brackets
  • Spelling errors

Any one of the above problems, while minor, will stop your program working as it should. Take the Blink sketch for example. Below is the simple Blink.ino sketch included with the Arduino IDE, with the help text removed. At first glance it looks more or less OK, doesn't it?

            void setup() {
  pinMode(LED_BUILTIN, OUTPUT)
}

void loop {
  digitalWrite(LED_BUILTIN, HIGH);
  delay{1000};
  digitalwrite(LED_BUILTIN, LOW);
  delay(1000);
    

This code will not compile, and there are 5 reasons why. Let's go over them:

  1. Line 2: Missing semicolon.
  2. Line 5: Missing function brackets.
  3. Line 7: Wrong type of brackets.
  4. Line 8: DigitalWrite function spelled incorrectly.
  5. Line 8/9: Missing closing curly brace.

Here's what that code should look like:

            void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  digitalWrite(LED_BUILTIN, HIGH);
  delay(1000);
  digitalWrite(LED_BUILTIN, LOW);
  delay(1000);
}
    

Each one of these errors, though minor, will stop your program from working. It can be quite frustrating at first to tell exactly what is wrong, though it does get much easier with time. A good tip to getting used to Arduino programming is to have another program open which you can refer to, as in most cases the syntax and formatting is the same between different programs.

If coding an Arduino is your first foray into coding, welcome! It's a rewarding hobby to learn, and given how certain types of programmers are in demand, it could be a great change of career! There are good habits to learn as a coder, and these habits apply to all programming languages so it's worth learning them early.

7. Serial Nonsense

The serial monitor is the Arduino's console. It is where you can send any data taken from the Arduino's pins and display it as friendly to read text. Unfortunately as many of you probably already know, it is not always this simple.

arduino mistake serial nonsense

In the early days of trying to get things working, there is nothing more frustrating than setting up your microcontroller to print to the Serial monitor and getting nothing back but utter nonsense. Fortunately, there is almost always an easy solution.

When initiating the Serial monitor in code, you also set its baud rate. This number simply refers to the number of bits per second that are sent to the serial monitor. In the below example, the baud rate is set to 9,600 in code. Make sure you set it to the same value using the drop down menu at the bottom of the serial monitor too, and everything should display properly.

arduino mistake serial correct

You may notice in the serial monitor that there are several speeds to choose from. There is rarely any need to change the baud rate, unless you are transferring large chunks of data. At 9,600, the serial monitor can print close to 1,000 characters per second. If you can read that fast, congratulations, you are clearly a wizard.

8. Missing Libraries

The extensive and ever growing list of libraries available for Arduino is one of the things that makes it so accessible for newcomers. Libraries written by experienced coders and released for free make it possible to use complex components such as individually addressable LED strips and weather sensors without needing to know complex coding.

You can install libraries straight from the IDE by selecting Sketch > Include Library > Manage Libraries to bring up the library browser.

arduino mistake ide library manager

Once you have installed your libraries then you can use them in any project, and many come with example projects of their own. There are two possible pitfalls here.

  • Using code that requires a library you do not have.
  • Trying to use parts of a library that you have not included in your project.

In the first instance, if you find a piece of code that seems perfect for your project, only to find it refuses to compile once you have it in your IDE, check that it doesn't include a library that you have yet to install. You can check this by looking at the #include <xxxx> at the top of the code. If it includes something you haven't installed yet it isn't going to work!

In the second case you have the opposite problem. If you are using functions from a library you have installed onto you computer and the code refuses to compile, it may be that you forgot to include the library in the sketch you are currently working on. For example, if you wanted to make use of the fantastic Fastled library with your Neopixel LED strips, you would need to add #include "FastLED.h" at the start of your code to let it know to look for the library.

9. Floating Away

For our penultimate mistake, we'll look at floating pins. By floating, what we really mean is that the voltage of a pin fluctuates giving an unstable reading. This causes particular problems when using a button to trigger something on your Arduino, and can result in unwanted behavior.

This is due to unwanted interference from surrounding electronic devices, but it can be easily countered using the Arduino's internal pull up resistor.

This video from AddOhms explains the problem, and how to fix it.

10. Shooting for the Moon

This one isn't a specific problem, and more a question of patience. Arduinos make it very easy to jump in and get started prototyping ideas. While it is true that difficult projects make for quick learning experiences, it is worth starting small. If the first project you attempt is uber complicated you will likely fall foul of one of the above problems, leaving you frustrated, and potentially with fried electronics.

The great thing about working with microcontrollers is the sheer amount of projects available to learn from. If you plan on making a complex lighting system, starting with a simple traffic light system will give you the basis to move on. Before creating a huge LED strip light show, maybe try something smaller as a test run like the inside of your PC case.

Each little project teaches you another aspect of using Arduino controllers, and before you know it you'll be using these clever little boards to control your whole life!

Learning Curve

The learning curve for Arduino can seem quite daunting to the uninitiated, but its dedicated online community make the learning process much less painful. By watching out for easy mistakes like the ones in this article, you can save yourself a multitude of frustrations.

Now that you know which mistakes to avoid, why not try building your own Arduino, there's no greater way to learn how they work.

For more, take a look at Arduino coding with VS Code and PlatformIO.

Image Credit: SIphotography/Depositphotos