Arduino – First Experience

All across the web I see these Arduino projects, Arduino here and Arduino there, so I wanted to try it myself. Exactly then, Coursera offered me to try a course called “The Arduino platform and C programming”, by University of  California, Irving, taught by prof. Ian Harris.

This course didn’t give me a lot of new information, but I can say that Ian Harris is an excellent teacher, and if you know nothing about Embedded systems, then this course is for you.

So I ordered a “clone” of the Arduino Uno – Arduino is an open hardware project, so anyone can build it himself. I bought it from “Freenove”, and there is actually no difference between this one and the “original”… except of the price. Freenove’s Uno costs third of the original (which isn’t much anyway).
It came with an A-B USB cable for connecting the Arduino to the PC.
I put an AA battery alongside the Arduino to demonstrate its small size.

img_20161018_234148

I installed the “Arduino Studio” software. The development is done in C (C++ actually, but knowing C is enough), and there are built-in library functions for doing stuff like assigning a value to a pin and checking a value of a pin, all described in Arduino’s reference. This enables an easy access to all of the embedded features of the platform.

After playing a little with the “blink” tutorial “sketch” (Arduino project), I tried to build my own “Hello world” project – Magnet “detector”.
In my project there’s an LED and a magnet switch – A switch that is turned on only when a magnet is nearby. The LED light will be on, and when a magnet is detected, the LED will go off.
Actually, you can build a very simple circuit that does exactly this without using any embedded stuff, but nevermind. Here is my “schematics”:

img_20161018_234831

I didn’t even bother to check the exact values for the resistors. It was few hundreds for the LED, and few K’s for the switch.
P9’s value is passed to P8. When the switch is OFF, the value in P9 is HIGH, and the LED light is on. When there’s a magnet near the switch, it turns on, and P9 value becomes LOW, so that the LED light will be turned off.

There are two parts for an Arduino “sketch” – “setup” and “loop”.
In “setup” you initialize all the stuff that needs initializing. In our case, we need to set P8 as output and P9 as input.
In “loop” you put the logic itself. In our case, reading P9 and setting the read value to P8.

[Yeah, I know I should have insert a delay in the loop (to save power), but again – “Hello world”, didn’t bother]

This is the program I wrote, I took a screenshot in order to give a look of the “Arduino Studio”:program

All in all, it took my less than 10 minutes to build and test the whole projects (including looking for the HW components in my workbox…). So I definitely can say that the Arduino seems like a really easy-to-use development platform.

And I’ll end this post with a demonstration of my a-m-a-z-i-n-g project:

Amnon.

2 thoughts on “Arduino – First Experience

  1. Arduino has simplified the embedded programming and taken it to masses. However, that simplicity is great for small little projects, but it kills the power and flexibility of the AVR / ARM chips.

    Like

  2. For sure. Also, the electronics is probably an overkill for these kinds of projects, and the cost is high too (as opposed to building the same project from scratch).
    But I prefer looking at it the way it is designed to. The greatness of this platform is that you don’t even need to know that you’re programming an AVR – Someone without any knowledge of microcontrollers architectures, and with basic programming knowledge, can create really cool projects.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s