Public Lab Research note


How to Set up and Test An Arduino

by wmacfarl | October 22, 2019 00:14 22 Oct 00:14 | #21249 | #21249

Purpose

The Arduino is a very popular microcontroller platform for hobbyist electronics and citizen-science projects and is used by many members of the Public Lab community.

This activity walks you through the process of connecting an Arduino to your computer and uploading a simple example program. This is always a good thing to do before you start working on a new Arduino project.

If you verify that the board is working before you get started it is easier to troubleshoot any problems you find yourself having later on down the road.

Step 1: Download+Install Arduino Software

We will use the Arduino IDE to program our Arduino and to read data from it. You can download it here.

Installation instructions can be found on the Arduino website for Windows, Mac, and Linux.

If you are using one of the cheaper clone Arduino boards you will probably also need to install the CH430 drivers. You can find them here.

Step 2: Connect Arduino to Computer by USB

The Arduino uses a USB cable to connect to your PC. We will use this USB connection to send the program that we want the Arduino to run from our computer and to allow the Arduino to send data back to our computer.

The Nano and the Uno have different form-factors and use different styles of USB cable but they both have a built-in USB port for programming and charging that you can plug a cable into.

Step 3: Upload and run a test program

The next thing we want to do is to upload and run an example program from the Arduino IDE so that we can see that the board is working and our program is running.

The Arduino website has instructions to do this for the Uno and the Nano.

If you are having trouble getting your first test program uploaded to the board, the Arduino webpage has a long troubleshooting section that you can look at. The most likely cause of trouble, though, is that your computer just isn't seeing the Arduino through the USB port.

You may get an error message when you press the upload button (usually it will say something like "An error occurred while uploading the sketch" or "Problem uploading to board.")

image description

If you get an error like this, you will probably solve it by performing the following steps:

  1. Check to make sure that your Arduino has power. There should be a power indicator light on the board that should be ON. If it is not on that means your board isn't getting power over USB. Try switching USB cables (because the cable might be broken) and try all of the different USB ports on your computer.
  2. If the board is getting power but you still have an error message, you probably don't have the correct port selected. Go to the Tools->Port menu and try to switch to a different COM port. Try them all and try uploading your sketch with each one.
  3. If your board is getting power and you've tried all of your available ports and you still get these errors when you try to upload your sketch, you should try unplugging the board and plugging it back in again, testing all the available USB ports on your computer as you do so.

This will solve the vast majority of your problems. If this doesn't help, you should have a look at the Arduino troubleshooting guide.


I did this Help out by offering feedback!


People who did this (0)

None yet. Be the first to post one!


1 Comments

Just testing out the idea we discussed about entering data directly from an arduino (emulating a keyboard) into a graph on the site!

[graph:data:text/csv,column1,column2,column3 1,2,3 1,2,3 2,3,4 5,7,7]

Attempt 2:

CSV

The second attempt worked!

[graph:data:text/csv,column1,column2,column3\n1,2,3\n1,2,3\n2,3,4\n5,7,7]

We could set up a webapp to collect this, deal with the tab vs. comma issues and the newlines, and then open a research note with your data, like:

https://publiclab.org/post?body=

CSV

Is this a question? Click here to post it to the Questions page.

Reply to this comment...


Login to comment.