Practical Electronics For Makers

All about Arduino and electronics

Getting Started With Arduino Using the Small, Inexpensive Nano Board

What Do You Need To Know To Get Started With Arduino?

You don’t need any prior electronics experience.  You just need to know how to do basic things with a computer like download software and install it.  

I will walk you through each step of building the beginning circuits that are a part of the article and I will explain what you are doing and what it means as we go.  I’ll also point you toward other resources if you want to deepen your knowledge on topics we touch upon.

What Will You Learn From This Article?

This article will provide you with a walk-thru tutorial which will take you through all the steps from gathering everything you need through getting your Arduino Nano to do something.

Final Project

The final project will include a stand-alone circuit running the Nano from a battery.  This will provide the user with the complete experience of how they might design and create their project and then actually use it in the wild.

Pictorial Walk-thru Provides Experience

I will use numerous pictures in attempt to make the reading of the article a part of your experience, even before you sit down and work through the projects yourself. There are 28 images in this article to help the reader visualize what is happening.  I’m doing this in an effort to provide the reader with an easy way to determine if she wants to get involved more with Arduino development. My hope is that the article will convince the reader that the content :

  • Won’t be overwhelming
  • Will keep her interest
  • Will open up the entire idea of embedded programming so she can see how easy it really can be.

What Will You Need?

I always like to know what I’m going to need ahead of time for my projects so I’ll list all those things here for you.  That way you can get the supplies together ahead of time and have everything you need to get to the end of the article. I’ll also provide Amazon links (I’m a Prime member) so you can see the items and their prices and estimate your costs.

Supply List

Here’s what you’ll need so you can try all of the experiments in this article.

Arduino Nano - You can get three of them at Amazon (https://amzn.to/2JHO58N) for only $13.  That’s barely more than $4 a piece.  Compare that to the Arduino Uno (about  which most beginners start with.

To connect the Nano to your computer, you will need a micro usb cable.  You probably have one laying around somewhere. Here’s a cheap one you can pick up for $5 (https://amzn.to/2y0pzvg)

This cable is how we attach the Nano to our computer so we can upload our Arduino Sketches (programs) to it so the Nano can run them.  If you have an older Playstation (PS3 I believe) you may have some of these because they used Micro USB connectors.

Breadboards - These make your life much easier as you do your experiments because you don’t have to solder anything.  (https://amzn.to/2JFQtgx) About $9.  Instead, you just push the end of the wire into a hole to make a connection.

Wire - For our experiments using bread boards we prefer solid core wire (not stranded) so you can easily push the wire into the bread board.  Here’s the wire pack I ordered and I am very happy with (https://amzn.to/2JsVKsz). About $20.   It’s a good amount of wire in various colors so you can keep your connections straight.  You’ll learn how important that is when you make a project that has a lot of connections and you need to check them.

Wire cutters / strippers - You need a fast way to cut wire to appropriate lengths and to strip the wire.  Here’s a very inexpensive but nice pair of cutters / strippers : (https://amzn.to/2xW9Yg9) About $7.

Resistors : You really only need one 220 Ohm resistor but here is an inexpensive set ($7.99) which will give you numerous useful values https://amzn.to/2HJjeDY They are the ones I use for my experiments.

LEDs : Again you only need one but here is a nice set https://amzn.to/2sNoT7p ($6.49)

If you are not sure you’re going to do more in the future then maybe you just want to buy some jumper wires so you don’t have to cut or strip wires.  These are ready to be plugged into your projects (https://amzn.to/2MeoZNA) About $8.

We are going to do a bit of soldering to get your Nano ready for our experiments, but I promise it won’t be scary.  Here’s a decent soldering iron that includes various tips and some solder, all for only $17.99 : (https://amzn.to/2HDulOR)

9V battery

9V battery connectors : (https://amzn.to/2JPoOtB) $4.94

First Look At Arduino Nano

Let’s jump right in and take a look at what you’ll find when you open up your Nano after receiving it.

You will find that there are actually three additional pieces that come with the Nano.  If you’ve never seen them before it may be a bit confusing. These are called header pins.  They are specifically provided to make it easier to use your Nano on a breadboard. You solder these header pins to the Nano and then it is much easier to connect to your breadboard and then connect other things electrically to each pin on the Nano.

We Call Them Pins Even Though This Board Has Holes

Also, notice that even though we refer to the pins on the Nano, if you do not add the header pins then you basically just have those holes.  However each of the holes you see in the Nano actually leads back to a pin on that square chip in the middle of the board. That square chip on the middle of the board (see next image)  is actually the chip we are programming. On a Nano it is the ATMega328P chip.

Here’s another snapshot of the Nano that I’ve labeled to show what some of the things you are seeing are:

The Micro USB is the connector I mentioned earlier which you will use to connect to your computer.  If you were to count each one of the silver pins coming out of the ATMega328P you would find that there are 8 on each side of the square for a total of 32 pins.That format of the ATMega328P is called QFP (Quad Flat Package).  The chip also comes in other formats like the DIP (Dual Inline Package https://en.wikipedia.org/wiki/Dual_in-line_package).

Each of those pins on the chip provides an interface to control the chip -- to make the chip behave in different ways by reading input from the pin or writing output.  Each of those pins is mapped to the holes along the sides of the Nano.

That is done entirely to make the pins more accessible for your experiments.

If you count the holes on each long side (top and bottom as we are viewing the Nano in the previous picture) you will find that there are 15 on each side for a total of 30.  

There are actually a few other pins on the left side of the Nano that are also mapped to the ATMega328P chip in the middle.

That block of 6 holes (pins) also has a seperate header pin block which can be added to the Nano for easier access.

Reset Button and Indicator LEDs

You can see that the Nano also provides an extremely small button that can be pressed to reboot the chip.  When you press that button the Nano will stop running your program then repower and start your program from the beginning again.

Those extremely small LEDs are very helpful since the second one from the top one (as we are viewing the chip) is a power indicator.  That one will be red when there is sufficient power to the Nano.

The nice thing about this little board is that it will be powered from your computer’s USB port when you connect the cable.   That means while we are developing our project we don’t have to worry about having another power source. You will see that the Nano and other connected devices (like our LED in our first experiment) will be powered from the USB port.

Connect It To Your Computer

Let’s go ahead and see what the board will do when you connect it to your computer, straight out of the package.

This isn’t a great picture, but you can see that the power indicator light is on.  Most Nanos will also already be running a program from the manufacturer called Blink.  

The Blink program is running on mine and it blinks the top LED (above the power indicator) one time every two seconds.  It’s just a simple test app most manufacturers add so you can know the Nano works right out of the package.

What Is Arduino Programming?

If you’ve written software for computers you know you can write a program and run it.  That’s because the inputs (keyboard, mouse) and outputs (display, file system, etc) you need are generally available to you on any computer system.

Things are quite a bit different when programming the Arduino.

With the Nano connected to our computer, we could start up the Arduino IDE (Integrated Development Environment) and send programs to the Nano.  However, writing programs and uploading them to the Nano is only one part of the process. That’s because the Nano doesn’t provide any operating system, no file system (or hardware to capture files on) and not even a display system of any kind beyond the flashing LEDs you’ve seen.

We are actually engaging in a lower level type of programming known as embedded programming.  We will control things at a much lower level than we do when we write software on a computer system like Microsoft Windows.

There are basically two parts to developing an embedded system:

  1. Hardware - build the circuit

  2. Software - write the program which will activate or automate the circuit.

This means there are now two challenges to designing a solution.  The way to manage those challenges is to break them down into small pieces you can work on.  

Understanding Two Things Opens Up How It All Works

A lot of knowing how to design your final product or project is related to knowing:

  1. What capabilities the hardware you’re dealing with has -- what functionality does each ATMega328P pin expose, how much memory does it have, etc.?

  2. What kinds of I/O devices (sensors, displays, etc) can you attach to the pins and how do you work with them?

Everything comes back to connecting things to the pins on the Nano because that is how we can read sensors or output a signal to display something.  That’s why we want the ability to construct circuits around the Nano’s pins.

That’s why we want to solder the headers onto our Nano.

What About Those Header Pins?

The first thing you need to do to make your electronics experimenting life easier is to solder on the header pins. I know.  I know. I felt the same way just a year or two ago. I was worried I’d toast the thing because I don’t have great soldering skills.  I’m going to show you a trick that will allow you to solder the pins on in about ten minutes.

Please Note: I need to solder header pins on a different (but very similar) Arduino board (Pro Micro) so the images where I’m doing the soldering is going to include the Pro Micro board but that doesn’t matter because the way we do the soldering is all the same.

The first thing you want to do to become familiar with your header pins and the Nano is simply try sliding them into the board.  You want the shorter side of the pins to go into the bottom of the board which will expose them slightly at the top. When you have them in properly it will look like the following.  Notice that I’m not going to add the six pin block at the back at this time.

Insuring that the shorter portion of the pins is just sticking through (as it is in the picture) makes it so the pins are long enough to go into the breadboard properly and it makes it far easier to use as little solder as possible to connect the header pins to the pads (holes) on the Nano.

The First Trick To Make The Soldering Easy

The trick to making this all easy is to take the Nano on the header pins and push it into your breadboard, before you do your soldering.  This insures your pins are all aligned nicely and everything will be held nicely so your hands will be free for soldering.

You can see that the pins at the bottom are now pushed securely into the breadboard.  That’s how we’ll use it when we experiment too.

To get the pins pushed down into the breadboard, I sat the Pro Micro on the pin headers and pushed down and rocked as I did.  The Pro Micro one went in fairly easily. But the first time you try it you will probably feel like you are going to break the board.

Another Try Wasn’t So Easy

I decided to go ahead and put a Nano on this same breadboard and solder header pins on it also and I had a bit of a problem with the Nano one.

You can see that at the top there is a pin that is sticking up too far.  As I rocked the Nano a couple of pins (one on the front right also) didn’t quite go down far enough.  If this happens just take something made of metal (maybe even a coin) and push down on each pin until it is level with the others.

If they go too far, you can remove the Nano and grab them with the front of your wire strippers and pull them out a bit. The wire strippers have a nice gripping tool at the front.

None of this is difficult.  It’s all part of the experience.  It’s also a lot of stuff that you don’t see explained very often.

A Warning

It would be kind of nice if we could just start our experiments now without the soldering.  But do not try that. The connection between the pin and the pads is not clean enough before soldering and it will drive you crazy as things work and don’t work due to loose connections.

Here’s How Easy The Soldering Is Now

Here are the steps get your soldering area set up.

Gather everything you need:

  1. Solder

  2. Soldering iron

  3. Soldering iron stand

  4. Nano on breadboard.

Plug in your soldering iron and allow it to heat up.  Please use all proper safety precautions like having a proper stand for the soldering iron and never leave the iron while is it hot.

Extra Soldering Tips

Once your soldering iron is hot keep the following things in mind:

  1. You want to touch the tip of the iron to the pad and the pin and heat them both up (see next image).

  2. Next you want to touch the solder to the pad and the pin so that the pad and the pin melt the solder and “absorb” it into one complete connection.  

  3. When the drop beads up, pull your iron away immediately and the bead of solder will harden.  It should only take 1 or 2 seconds for the pin & pad to heat and solder to melt.

Keep in mind that you don’t want to keep the iron on the pin and pad for long minutes because the heat will trace back up the connections in the board and can heat up the ATMega328P chip and kill it.  Or you could simply melt through the board itself since it is so small.

If you do all of this properly (and I’m sure you will) then a drop of solder will connect the pin to the pad and that is all there is to it.

Want More Soldering Help?

Check out the fantastic SparkFun site and this resource which explains all the details of soldering.  

How to Solder: Through-Hole Soldering - learn.sparkfun.com[^]

Here’s mine. If you look closely you can see a small (duller looking) bead of solder on each pin.

I will assume that you were successful.

Here’s another snapshot of it so you can see that now the pins align with the holes in the breadboard and it’ll be easy to add the Nano to any breadboard whenever I want to do experiments.

One more hint: I like to solder outside to keep everything ventilated.  But if you cannot for some reason then you can also put a little fan pointing at your soldering area to blow the solder smoke away from you.

A Good Idea

A good idea is to take out a multimeter and set it to Continuity Test and touch one multimeter probe to the top of the pin (above the board, where you soldered) and another probe to the bottom of the same pin (under the board) to insure that every pin really is soldered properly.  If the pin is soldered properly then the multimeter will beep to indicate it is a complete connection and you never have to worry about the Nano header pins again since you’ll know they are right.

Now, we’re ready to light this thing up!

Arduino IDE (Integrated Development Environment)

The first thing you need to do is download the Arduino IDE.  It’s not too big and you can get it at the official Arduino site (http://arduino.cc) for free.   Arduino - Software[^]

Download the software and install it.  I won’t show you how to do all of that here, because it basically an installation wizard and is self explanatory.

Once you download it and install it go ahead and start it up.

You’ll see something like the following:

 

This is a basic Arduino program which they call a Sketch. Of course any program we write is going to be paired with some hardware (the Nano, LEDs, displays, potentiometers and more) that we build on our circuit board.

That’s the real power of these embedded chips -- these miniature computers. They allow us to get input from other devices (temperature sensors, etc) and to control other hardware devices like relays or LEDs and more.

Let’s Get Our Nano To Do Something

The easiest thing to get our Nano to do is to light up an LED.  The Blink program that is most likely already on your Nano blinks an on-board LED, but it’s a bit more educational to see the Nano light up an LED that is separate from the board.

The value of this first simple experiment is that the process and the result is basically the same thing you will do whenever you want to control any attached device.  There will just be more details to work through with more advanced devices.

FirstNano : First Experiment

For this first experiment we just need:

  1. your Nano on your breadboard

  2. an LED

  3. a 220 Ohm resistor.

Why Do We Need A Resistor?

Here’s why we need a resistor.  We are going to power your Nano off of the USB port.  The USB port provides 5 volts. The LED will drop that voltage approximately 1.7V.  LEDs are rated at a max current around 20mA (milliamperes).

With no extra resistor, we would have over 500mA flowing through the LED.  We use the resistor to limit the current so we don’t burn out the LED.

With the 220 Ohm resistor included we will only have 15mA of current flowing.

Using Ohm’s Law* we can calculate the current.  

5V - 1.7V = 3.3V

3.3V / 220 = 0.015 (15mA)

*We won’t go into details of Ohm’s law and all the electrical principles here but if you want to read more in depth about electronics try my series of articles here at CP starting with : Practical Electronics For Makers (Part 1 of N)[^]

You will see that we are going to be powering the LED off of one of the pins on the Nano.  That means the current will actually be flowing through that pin and the Nano itself cannot have that much current flowing through it or it will be damaged.  

The max rating for each pin is really only 40mA (milliamperes) so allowing more current to flow would also damage our Nano.

Select A Nano Pin

Now we want to create a circuit where our resistor and LED are connected to one of the pins on the Nano and routes to ground (to create a complete circuit).

We are going to choose a pin somewhat arbitrarily.  We are going to use a digital pin so we can use the Arduino function named digitalWrite().  We could use an analog pin and use the analogWrite() function but again I’m (arbitrarily) showing you how to use the digital pins and digital functions for now.

Why One Pin or The Other

The Nano has a limited number of pins, of course.  So as your projects grow and you use many or all of the available pins, part of your design is in choosing to create your circuit according to what pins are available.

Here’s a zoomed in shot of the Nano so we can take a look at the labels and see which pin is which.

 

I’ve marked one pin (at the top) with a red line that looks like it is labeled V2 or U2 but is actually D2 -- obviously some of the print was scratched off or wasn’t printed properly.  

Digital And Analog Pins

All of the Digital pins are marked DX where X is the pin number.  You can see that most of the digital pins are all on that one side.  The analog pins are marked AX where X is the pin number. You can see that you have more digital pins than analog.  There are Digital pins numbered 2 through 13 (12 total digital pins) and Analog pins numbered 0 through 8 (7 total analog pins).

We are going to use D2 for our first experiment.  We will connect our LED circuit to that pin and we will reference that pin in our Arduino Sketch.

I’ve also marked the GND (ground) pin at the bottom of the Nano (as we’re looking at it) because we are going to use that to complete our circuit.  Every circuit flows from an area of high voltage to a place of low voltage (ground) and so we need our circuit to connect to ground also.

When we connect to the ground pin, we will actually be connecting to the ground supplied by the USB port which is connected to the ground of our computer.  This is only true when we are powered off of the USB port. If we want to run the Nano from batteries (which is possible) then we would have to tie the Nano’s ground to the common ground of our battery supply.

Creating the Simplest Circuit Possible

Now I will create the simplest circuit possible by adding the LED and resistor.  By simplest, I just mean that I didn’t have to add any additional wires to get a complete circuit. I made sure I could get the legs of the LED and resistor to reach properly.

Here’s what it looks like.  

I’ve connected the positive leg of the LED to D2.  (LEDS are polarized and must be aligned properly or they will not allow current flow.)  

I’ve connected the 220 Ohm resistor to the negative leg of the LED. (Resistors are not polarized and work either way.)

I then connect the other end of the resistor to the ground pin (GND) on the Nano to complete the circuit.  

If you need more information on how breadboards work you can read my article here at CP that explains them in depth:  Practical Electronics For Makers (Part 2 of N)[^]

BEWARE : Make sure the legs of your LED and resistor do not touch any of the other pins sticking up off the Nano or you will get a short circuit and possibly strange behavior or possibly even destroy the Nano.

At This Point: Nothing

If we plug the Nano in it still will not do anything.

 

I had to cover the indicator LED up for the picture because it was shining through our separate LED and making it look like it was on.  The LED is not on, because we haven’t written a program or uploaded it to our Nano to turn on pin D2. Let’s do that now.

Back In The IDE

Go back to the Arduino IDE (Integrated Development Environment) and we will type in some code.

In the Setup() function which only runs once, we set the D2 pin for output with the following code.  Since you can read or write from a pin you have to tell it which purpose you are using it for.

void setup() {

 pinMode(2,OUTPUT);

}

We call the pinMode() function that takes a pin value and a special pre-defined constant (OUTPUT) which sets up our pin so we can write to it.  Writing to a pin means setting voltage to a high level which is 5V for the ATMega328P.

That code just sets the pin up but doesn’t do anything to make the LED turn on. For that we need to add some code into the loop() function.

The loop() function code runs continually while the Nano has power.

We want to write to the pin so we use the Arduino function called digitalWrite().

When we call that function we tell it which pin we want to write to. In our case it is D2 which is the same pin we set up for output in the setup() function, of course.  We also want to tell it that we want the pin to go high (5V). There is a pre-defined value of HIGH for that so our digitalWrite looks like the following:

digitalWrite(2, HIGH);

Next, we want to turn the LED off. To do that we will write a low (0V) to the pin.  There is also a pre-defined value for the 0V value which is LOW. These pre-defined values are case-sensitive so low will not work in the code and will give you an error.

digitalWrite(2, LOW);

However, we want to pause before we turn the LED off so we can actually see the LED go off and on so we need to call a function that can make the program pause.  That function is called delay() and it takes the number of milliseconds (thousandths of a second) that you want to pause the program.

I will pause the program ¾ of one second so I will use 750 as the value I send in to delay().

Here’ the entire code listing for the loop():

void loop() {
  digitalWrite(2,HIGH);
  delay(750);
  digitalWrite(2,LOW);
  delay(750);
}

Here’s the natural language explanation of what that code does.

  1. Turn the LED (connected to pin D2) on.

  2. Wait 750 milliseconds (ms) (LED stays on that long).

  3. Turn LED off

  4. Wait 750 ms (LED stays off that long).

  5. Back to step 1.

Go ahead and save your Arduino Sketch as NanoFirst (or download the code from the top of this article and open it with the Arduino IDE -- NanoFirst_v001.zip).

Choose the Correct Arduino Board

If this is the first time you’ve used Arduino IDE or the first time you’ve built code for a Nano, we need to set the Arduino environment so it knows to build the code for the specific board and chip (ATMega328P) we are using.

It’s very easy to do.  Just go to the Tools menu at the top of the IDE and then slide down to the [Board >] menu item.  The Nano board may already be chose, but if not when you slide over that item another menu will pop out with a large number of choices.  Slide down the Arduino Nano and click it to select it.


 

The IDE should automatically select the “Processor: ATMega328P” for that board, because it is the newer processor used on these boards.  However, you want to make sure it is selected properly.

The next image shows you how to select the proper processor.

 

These two options insure that the IDE will build the code that is correct for your board.  

Notice that the bottom status area of the IDE (shown in previous image) confirms that you are building for the Arduino Nano with an ATMega328P and the device is connected to COM1.

Now, we are ready to build the program.

Build the Program

Once you’ve got the code written and you think it is correct, you can have the Arduino IDE check it for you.  You do that by attempting to build the program. To build the program you select the Sketch menu at the top of Arduino IDE and then choose the first menu item, [Verify/Compile].

 

When you do that the Arduino IDE turns your high level language code (that you understand) into machine language instructions that the ATMega328P understands.

As the program is compiled (depending upon the speed of your computer) you will see some status information at the bottom the Arduino IDE.

When it completes successfully you will see something like the following:

 

You can see that it tells you that it is complete and there is some status info that lets you know the the size of your application and how much memory will be left on the chip.  Memory is of utmost importance because it is so limited on these little computers. Keep in mind that we’ve only built the program at this point but we still haven’t uploaded it to our Nano.  

What Happens If There Are Errors?

Programming can be a lonely endeavour and the most important thing that lonely devs can learn is what to do when you encounter an error.  The better you are at understanding errors and resolving them the better dev you are.

I’ve introduced an error on purpose so you can see what the IDE will look like when you compile and it encounters an error.

It tries to help you to show you where it thinks the error is.  In this case it highlights the problematic line in pink. Then in the output window at the bottom it gives you some error information.

Error Messages Are Sometimes Confusing

Error messages can sometimes be confusing though because at times they will give you what ends up being a guess by the compiler.  In this case it tells us:

‘DigitalWrite’ was not declared in this scope

What!?!

Basically you just have to know that it is saying, “I don’t know what DigitalWrite is and I’ve never heard of it before.”  That’s because computers and computer languages are very specific. And in the Arduino language (which is based upon C/C++) is case-sensitive.  That means when you see that error you should think, “hey do I have something typed wrong? Am I referring to something that the Arduino IDE doesn’t know about?”

Of course, all we have to do to fix it is change the capital D in DigitalWrite to a lowercase one and build the program again.

Upload the Program

To get the Nano to run our program, we need to upload the program to it.  We can compile the program separately as we’ve been doing and then upload it.  But we can also tell the IDE to compile it and send it to the Nano all in one click.  To do that you simply click the right-pointing arrow.

 

When you do that, the IDE will determine if the code has been changed and if it is it will compile it and then send it to your connected Nano.

If you click that button and your Nano is not connected the program will compile but you will get an error because the IDE cannot upload the program.

The IDE will tell you about the trouble and try to give you some hints to fix it.

 

 

You may also get that problem, if for some reason the Arduino IDE guesses incorrectly about which COM (communications) Port your Nano is connected to. This could occur in rare occasions if you have other devices connected to other USB ports and the IDE gets confused.

You can try other COM ports without hurting anything so you can just drop the menu and see what choices you have and try a different one.  

Here’s what mine looks like because I do have multiple Arduino devices connected to my computer.

 



Once you get everything working, when you click the Upload button the program will be compiled and sent to your Nano.

Once that happens your Nano will start running your program.  

The Real Code That Is Written To Your ATMega328P

Keep in mind that the IDE does not send the text you have typed into the IDE to the Nano.  It sends pure machine language program to it and writes it into the flash memory of the Nano.

Behind the scenes when the IDE builds the app it saves all the work it does to a temp folder on your computer.

The path is %localappdata%\Temp\arduino_build_<generated_number>

If you go to %localappdata%\Temp\ you can usually easily find the latest updated folder after you build and find the app if you want to.  You can copy and paste %localappdata%\Temp into your File Explorer and it will take you to that folder.

The NanoFirst.ino.hex file is that file that is uploaded to the Nano.

You can open it with a text editor and look at it.  Here’s what it looks like:

Yeah, pretty boring unless you know machine language for the ATMega328P.

Watch A Video Of It In Action

If everything went well your program is running on your Nano and your red LED is flashing on and off.

I made a very quick video and posted it to youtube to show you the circuit in action: Getting Started With Arduino Using the Small, Arduino Nano - YouTube[^]

What Next?

Now, you’ve written a program, but it may not seem that amazing, because it is still connected to your computer.  After the program is uploaded to the Nano, the Nano does not need the computer for anything except power. What I mean is that the Nano is doing all the work to turn the LED on and off and the computer doesn’t control any of that code.  That’s because the Nano is a little computer itself.

Very Small System On A Chip

The thing that is fascinating to me is that the ATMega328P is far more powerful than the MOS 6502 that Steve Wozniak built his Apple ][ computer around.

The 6502 could execute about 1.2 million instructions per second (1.2 MIPS).  While the ATMega328P running at 16Mhz can do about 16 million instructions per second (16 MIPS).

Of course the ATMega328P has far more memory at 32K (32 thousand bytes) too.

The ATMega is an entire system on a chip while the 6502 was not, so there was much more work to do (wiring up memory for program storage).  

Everything you need is right on the Nano.   It is amazing that Woz had so many barriers and still succeeded in building a complete and usable computer.  In contrast, we have far fewer barriers and most of the time cannot come close to what Woz did.

The important thing about having all this computing power on such a small device is that it consumes far less energy than you computer does.  That means you can build a small device and run it off of battery power instead of plugging it in. That’s a major key to IoT (Internet of Things) because you can have numerous standalone computers that have provide a specific service.

I think seeing our own circuit run off battery power is very instructive as a progression into understanding how you’ll really use your Arduino-based devices to create final products.

Run On Battery Power

Let’s see how we can run our Nano off of battery power.  It is not difficult at all. You just need to supply 5 Volts and it will run.  Supplying 5 Volts isn’t too difficult because we can get approximately 6 Volts from 4 AA batteries.  

Or, we can use a 9V battery with a very simple connector.  The datasheet on the Nano says that it can take 6V-12V on pin 30 (VIN -- Voltage In).

I’m going to use a 9 Volt battery because it will be easier for you.  You can get a simple connector that you snap on a 9V battery and you are ready.

Snap that onto a 9V battery like so.

Do not allow those two wires to touch each other or it will create a short circuit and your battery will become very hot and could hurt you.

Now we connect the battery to the breadboard to power the Nano.  Make sure you disconnect your Nano from your computer. Do not have both battery and USB connected to the Nano.

I’ve connected the black wire to the ground rail on the breadboard (blue side).  I’ve connected the red (positive) wire to the positive rail on the breadboard. Then I’ve connected a green wire (colors are just to keep things straight) from the positive rail to the VIN (pin 30) on the Nano.  

Finally I connected a black wire to the GND pin on the Nano to create a complete circuit.

I was able to snap the pic right as the LED flashed on.

Here’s a closer look at the wires that are connected to the Nano for ground and voltage in.


Stand-alone Device

Now that we have the ability to build a stand-alone device you can begin to dream up projects that can run on their own powered only by a small battery power supply.

Now, go an do your own great projects. You have the power!  

History

First publication: 2018-06-12

 

Loading