paint-brush
What’s The Deal With Programming In Arduinoby@evgeniy-lebedev

What’s The Deal With Programming In Arduino

by Evgeniy LebedevJune 11th, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Arduino is an amazing platform to get into hardware development and programming. But there are a few things you need to know before you start.

Company Mentioned

Mention Thumbnail
featured image - What’s The Deal With Programming In Arduino
Evgeniy Lebedev HackerNoon profile picture

Arduino is an amazing platform to get into hardware development and programming. But there are a few things you need to know before you start.

What is Arduino?

Arduino is a platform that helps you build DIY projects with electronics. You take an Arduino board, some electric and radio components, some wire, and maybe a soldering iron, and you can make things like:

  • a weather station,
  • an alarm clock,
  • a smart remote-controlled power outlet,
  • a home security system,
  • a plant-watering system,
  • a smart light that turns on when it gets dark,
  • an LED lighting system for your home that reacts to events on your computer,
  • a robot
  • and much more.

Inside, Arduino has three basic parts:

  1. A set of sockets that can either output or accept electricity
  2. A processing chip that routes electricity to and from the sockets, and also does some basic logic and math
  3. A board that holds all of this together.

Why Arduino is awesome for beginners

Arduino is great for beginners for three reasons:

The projects are easy to build. You can use the sockets on the Arduino board to attach wires and components. So, you don’t need a soldering iron to attach those things (although it’s a good idea to have a soldering iron and know how to use it).

When you do projects with Arduino, you also don’t need to solder stuff directly to a controller or use custom-built PCBs (permanent circuit boards). Your projects may not always look nice, and there may be wires everywhere, but the projects will work.

The programming language is accessible. The code for Arduino resembles the language C, but actually uses a framework specifically designed for talking to the Arduino. And it’s much easier to work with this Arduino framework than with raw C.

There are tons of reference materials and projects. Arduino has a thriving community, and there are thousands of projects available for you to use and re-use. Check out the site instructables.com—there’s a whole universe of awesome things built on Arduino.

The downsides

Arduino is a DIY learning platform, not suitable for commercial or mission-critical projects. It’s consumer-grade in everything, from how well it’s built, to how fast it runs. However, Arduino gives you a good idea of how controllers work. So, once you’ve learned how to prototype in Arduino, you can start making your way in professional robotics.

Arduino is slow. It only runs single-threaded processes (one command at a time) at a frequency of 16 Megahertz. You can overclock your Arduino a bit (modify it to run at higher speeds than the official one), but that won’t make a huge difference. Arduino’s speed is enough for you to do simple math or read a sensor every 0.1 seconds, but you can’t get your Arduino to play 3D games or stream video. It is fast enough to play audio, though.

How Arduino works

You get an Arduino board, download some very simple software that you can use to program the board, and write your first program. Usually, people start with a program that makes an LED light blink at a certain rate, but hey, that’s already something cool!

Arduino programs are basically written in C, but there’s also a handful of commands that help you talk to the inputs and outputs of Arduino.

At its core, an Arduino program can do these things:

  • Take a reading from a certain input
  • Send some current to a certain output
  • Wait for some amount of time
  • Do logic and math

With external libraries and components, Arduino can do other things too, like output text to an external LCD screen or operate an LED light panel.

The magic of Arduino happens when you realize how these basic things add up to make useful projects.

For example, here is a simple outline of an Arduino program that helps detect intruders and fires up a red warning light whenever someone approaches your space:

  1. Take a reading from input 1, where you have a proximity sensor
  2. If that reading is above a certain value, then send electricity to output 3, where you have a red warning light; then do nothing for 10 seconds
  3. Else, pause for 0.5 seconds and go back to step 1.

This simple security system will keep you informed whenever someone approaches your room or desk. If you have a light connected to output 3, that light will fire up. If you have a buzzer connected, it will buzz. You can hook up many things to your Arduino, and they will work the way you design them to.

With Arduino, you learn the core concept of all robotics and controlled machinery: you just send electricity here and there. Your motors start turning, your sensors send the data, and the whole system lives—all thanks to the simple logic that you burn into the controller. With Arduino, learning is fun, fast, and intuitive. And from there, you can go a long way.

Getting started

  1. Get an Arduino kit from your local dealer
  2. Go to Arduino.cc for software and manuals
  3. Enjoy 😊

For a simple project using Arduino, check out this tutorial on making the classic game Snake out of hardware.

And if you’re interested in learning even more about programming, feel free to explore the educational resources on Practicum. We offer online education and mentorship to help you build new skills and create an awesome career in tech.