10 Things to Know Before Starting Your Arduino Project
Contributed By DigiKey's North American Editors
2017-01-12
You have seen what people are doing with Arduino boards, it looks like fun, and you are ready to try it for yourself. You’ve ordered an Arduino board, jumper wires, a power supply, some LEDs, and a kit full of accessories. However, to make sure you too have fun, here are some things to keep in mind that will save you time and frustration along the way.
One of these tips may even keep you from outright rage, quitting and chucking all that fresh new gear into the garbage.
1: Arduinos are great for experimentation and learning
They lend themselves beautifully to small, dedicated tasks. Arduinos are like an experimenter-friendly version of what you would find inside of a smoke detector. The microcontrollers in these types of applications have a relatively short task-list. It just isn’t necessary for your thermostat to have the power to run Linux or do large calculations. If your intention is to write code for applications that run in an OS, then maybe think about a single-board-computer like a Raspberry Pi or a BeagleBone Black.
For those of you who intend to focus on mobile and Internet of things (IoT) types of designs, all Arduino boards can be portable, but some boards are better suited for it because of their smaller physical size and lower power demands. The Adafruit Trinket, Gemma and the Arduino Mini are great for projects like this.
2: Write a sketch
Programming for Arduino boards involves writing a “sketch” in the Arduino development environment and uploading it to your board (Figure 1). These sketches are written in C and so the sketches use the same control structures. If you don’t know what anything I just said means, don’t despair. It’s good news for you. It means that if you know some C or C++, writing sketches will be a very familiar. Conversely, it means that by learning how to write sketches, you will also be learning the fundamentals of C. It’s a win either way.
Figure 1: Programming in Arduino requires that you write sketches in C. This is a screen capture of the development environment. (Source: DigiKey)
A note about the Arduino development environment: it does not have a debugger built into it. If you are used to repairing code with the debuggers built into development environments like Eclipse or MPLAB, then you are just going to have to get clever. You will have to employ more primitive methods for troubleshooting, like inserting a line of code to return some text, or activate an LED when a section of code has been reached. The lack of a debugger is probably a good thing as far as developing your problem solving skills.
3: Use name-brand shields and accessories
You probably procured an Arduino because you had a project in mind and/or you wanted to learn more about electronics. It is going to be much more difficult to learn if your learning aids have poor documentation and support. You should be concentrating on the lessons and concepts, not troubleshooting gear.
By the way, troubleshooting is an important and inevitable part of the journey, but you shouldn’t handicap yourself right when you are getting started.
Sparkfun, Adafruit, and Seeed Studio are great vendors for shields and accessories. Not only do these guys make great products, but their popularity is part of their strength. If you are having trouble with something, there is a very good chance that someone else already had the same problem, solved it and posted it in a forum. Take advantage of that.
4: Keep good notes of what you do as you learn and develop
This is especially important as you experiment with different iterations of the same program. It will be very easy to lose track of which version did what, and why. You may think you won’t need these revision notes, but I assure you that you will. The number of changes and iterations you may make over just a weekend of trying to get a project just right could number in the hundreds.
I come from a background of extensive CAD use so I draw my circuits up in DraftSight. Another option is DigiKey’s Scheme-it® (Figure 2). I use DraftSight out of habit, however, a purpose-built tool like Scheme-it is a much better option, and I am starting to migrate over to it.
Scheme-it has the advantage of being directly linked to DigiKey’s massive inventory of components. It also has numerous options for making notes. You can place notes on the main sheet or associate them with specific components. It is also cloud based, so your data is backed up and available to you anywhere you have an Internet connection. Or, you can keep notes and drawings in a notebook, but I really like to keep all relevant information electronic.
Figure 2: A simple circuit drawn up using DigiKey’s Scheme-it. (Source: DigiKey)
5: Go easy on yourself
Master individual techniques and concepts first. Start with blinking an LED using the “Blink” example included in the Arduino IDE. Then blink an LED that you wired up to an output. Then, write a sketch to blink several LEDs at once. Then make the LED blink when you push a button. Then write a sketch that does an analog read from a potentiometer to control the LED blink speed.
Any project you ultimately want to accomplish is reducible to smaller tasks. For example, by putting little jobs such as de-bouncing a button press, outputting to an LCD, reading a temperature sensor, and blinking an LED together, you can make a temperature-controlled switch.
Each concept you learn is a like a brick, and your project is a wall made of those bricks.
As a final note, before you turn your nose up at the lowly blinking LED, let me share something with you. I have been an electrical engineer for well over a decade and no matter what board or microcontroller that gets thrown at me, the first thing I usually do is blink a couple of LEDs. Those flickering lights let me know that I have initialized the chip at least partially correct, and that I am beginning to exert a measure of control over the hardware.
6: Watch out for the clock-speed ceiling
The Arduino UNO has an internal clock speed of 16 MHz. That is 16 million clock ticks per second. That sounds like a lot, but consider the following: Each instruction or check in a sketch uses clock ticks. The more tasks you have your sketch do, the faster they eat up that seemingly endless surplus of clock cycles; and before you know it, amazingly, the Arduino is missing input signals or maxing out output pulses. It literally does not have enough time to do everything you expect of it.
For basic jobs this will rarely become an issue, but as your projects grow you are going to encounter it. The clock speed ceiling really becomes apparent when you start trying to control stepper motors or when handling the encoder feedback from servo motors.
If you anticipate running out of clock cycles, then you may want to spring for an Arduino Zero, which has a 48 MHz clock.
Offloading some of the processing to a shield is another approach to the issue. Trinamic Motion Control has a cool stepper motor control shield, the TOS-100 V1.1, for just this purpose.
7: Learn how to use Arduino Libraries
What if large chunks of the code you need was already written and available? Wouldn’t that really speed up your time to project completion? Well, that code is out there and it is just waiting for you to grab and load into your sketches. These collections of code are called libraries.
To really explain libraries will take a lot more time and space than is available in an article on quick tips, but here is an analogy to help you wrap your mind around the concept. A library is like a box of tools for a related set of tasks. You just have to include the toolboxes that contain the tools you need in your project.
For example, included with the Arduino development environment is the library “wire” (Figure 3). Wire is a toolbox full of tools for I2C serial communications. The wire tools automate most of the tasks involved in I2C communications. You could write code to do all this yourself, which is definitely worth doing for the learning experience, but you don’t have to do that if you learn to effectively employ libraries.
Figure 3: Wire library included in a sketch. (Source: DigiKey)
8: Learn the basic ports, and be mindful of parallel communication
Learn parallel, and specifically serial communication. Look up what the acronym UART means (it is like a universal serial telephone for a microcontroller). Look up SPI (serial peripheral interface) and I2C, pronounced eye-squared-see. Atmel, the people who produce the chips at the heart of most Arduino boards, have some very helpful application notes on the subject of SPI and I2C communications. Most of the sensors and other accessories you will end up using will communicate with your Arduino via an SPI or I2C serial connection. Learning these communication techniques will make it a lot easier to use these accessories.
For projects, beware of accessories, such as displays, that require parallel communication. Parallel COM ports use a lot of pins compared to serial COM ports. You may find out that your Arduino doesn’t even have enough pins for it, and if it does, you may end up using so many pins that there aren’t any left for anything else. If you are just learning how to control a parallel communicating LCD then go for it, but devices like this may be too I/O heavy for projects involving multiple devices.
9: Don’t forget your memory limits
Most people just starting out will begin with one of the basic boards like the UNO or a Trinket. Eventually you will fill up the memory and max out the RAM. Hitting this limit is a good thing. That statement may sound ridiculous, but allow me to explain.
Inevitably, novice and experienced coders alike, are going to make disorganized, sprawling code that takes up more resources than necessary. There are almost always ways to tighten up code. The goal is to make it as compact as possible, and to really get the most out of what resources you have. Until you bump up against a barrier, why would you stop to figure any of this out? Hitting the memory limit forces you to get clever. It forces you to reexamine what you have already done and seek ways to improve it. If you just move onto a board with more memory, you will be depriving yourself of this experience.
Eventually you may have to get a board with more RAM and more memory, but don’t rush it.
Here is a small tip to get you started: If you do find that you are running out of RAM, try this trick for reading text strings directly from program memory rather than from RAM:
Serial.println(F(“your text here”));
The F macro inserted here between the parentheses, prevents the text from being loaded into RAM at the program start. The string is read directly from the flash memory when needed.
10: Some Arduino boards do not have native USB capability
I know it doesn’t make sense at first glance. You may point out that you program your Arduino, which has a USB jack, by plugging it into your computer’s USB port. This is correct, but for some Arduino boards there is some very clever software pirouetting going on behind the scenes. Boards like the Adafruit Trinket have a bootloader pre-installed that lets the microcontroller act enough like a USB device to load sketches. It is a really cool bit of ad-hoc coding.
Most microcontrollers don’t handle USB communications innately. There are two ways this is usually circumvented, and one less-common way used by the Trinket. The first common workaround is to place a separate chip on the board to handle the USB communication. This chip also converts data from the USB connection into a form that is understandable by the main microcontroller’s UART. The other common method involves a separate piece of hardware that plugs into the micro when you want to communicate to the micro via USB.
I am specifically referencing the Trinket in this tip because of an incident I had at work where some Trinkets were ordered to use as the interface between a PC running LabVIEW and an experimental control box. When the Trinkets came in, we realized that they didn’t have on-board USB control hardware.
It was an easily remedied problem. We just ordered some Arduino UNOs. These have a dedicated ATmega chip on-board for handling USB communication. It was a minor issue, but one that could have been avoided had I read this tip before the hardware had been ordered.
In short, if you intend to use the USB port on your Arduino to connect to a computer or a camera or a USB drive, make sure that the board you purchase has an included USB controller. Or, you can add USB capability with a USB host shield.
Conclusion
Arduino has proven to be a great learning environment for anyone, novice or engineer, wanting to code and implement an electronic system. It is both fun and useful, and with the right up-front information and approach, it can be an enjoyable learning process. But remember tip number 5, “Be easy on yourself.”

Disclaimer: The opinions, beliefs, and viewpoints expressed by the various authors and/or forum participants on this website do not necessarily reflect the opinions, beliefs, and viewpoints of DigiKey or official policies of DigiKey.