Team UV

Redefining the classical concept of an underwater vehicle.

  • Home
  • About
  • Member Bios
  • Contact/FAQ
  • Sponsors & Donations

Learning Arduino Part 3: Our First Project

Posted by Andrew (Team UV) on November 13, 2014
Posted in: Presentations. Tagged: Arduino, Computer, Education, Electrical Engineering, Electromechanical Engineering, Engineering, Fun, Light, Mechanical Engineering, Presentation, Technology.

Blinking Light Courtesy of Batsocks

As with many things in life, you must learn to crawl before you can walk.  Learning how to actually use an Arduino board is no different therefore we will continue our Arduino Journey by completing a simple project.  The first thing a novice should learn is how to control an LED.  Light-emitting diodes (LEDs) are small, powerful lights that are used in many different applications such as notification lights in our phones, displays, and in sensors.  Designers most often times don’t want their LEDs to always be on or at their full brightness so controlling an LED’s state will be the focus of this project.

The first thing an inventor needs to do is gather all necessary components to build the project.  This includes the following:

1 x LED (any color)

1 x 330 ohm resistor

Various jumper wires

Arduino Uno (or similar board)

Protoboard (to place your components)

Arduino Code (I’ll cover this after hooking everything up!)

Most beginner kits will have these basic components already but if you are missing anything your local electronics store should carry it.  The setup of the circuit is very straight forward as shown below.  NOTE: Be smart with your decisions!  We are not responsible for misuse of electronics and injury!  Before connecting anything together, it’s safe practice to disconnect the Arduino board from your computer or power source.  This essentially cuts power to the board allowing the user to move things around without the risk of shock.  Place a jumper wire from the 5V output on the Arduino to the red positive vertical strip on the protoboard.  Do the same for ground; running a jumper from GND to the negative strip on the protoboard.  The two vertical columns on the side of the protoboard are all connected to together.  Anything placed on the vertical positive column will be charged to 5V.  Anything placed along the negative ground column will be grounded.  Conversely, the middle rows of the protoboard are connected horizontally.  Anything placed along the same row will be connected together.

Courtesy of Vilros Starter Kit Guide by Sparkfun

Courtesy of Vilros Starter Kit Guide by Sparkfun

Place a jumper wire from any pin (such as pin 13) to any location in the middle of the protoboard.  Now we place our LED.  The two legs of our LED are of different lengths.  The longer leg should be connected to positive (+) and the shorter leg should be connected to negative (ground).  LED’s are diodes which mean that the current is meant to flow from positive to negative, so knowing which leg is which is important.  The positive leg of the LED is connected in the same row at the jumper from pin 13.  Now that we have placed our LED we can place our resistor.  Resistors are components that reduce current flow and act to lower voltage in circuits.  It is used in this project to protect our LED by reducing the current flowing through it.  One leg is placed in the same row as the negative LED leg and the other is connected to ground completing our circuit.  You most likely have to bend the legs of your resistor by 90o  to fit into the protoboard.  If you are lost, just take a look above at the layout diagram to clear things up!

Now that we have hooked up all of our components, we can move onto the code.  For the Arduino code to successfully operate two “functions” are necessary to define.  The first is setup() which essentially sets up all the pins we need to work with.  We can make our pins operate as inputs or outputs depending on what our project needs.  For this specific task all we need to do is set pin 13 (or the pin you’re using) as an output.  This is done by saying: pinmode(13,OUTPUT);

The next function is called loop() which runs indefinitely until we unplug our Arduino board.  Here we place our desired actions, calculations, and operations.  For this project we need to make the LED turn on and then turn off.  This is done by saying: digitalWrite(13, HIGH) and digitalWrite(13,LOW).  Setting our pin HIGH means supplying the pin with 5V, which turns our LED on.  LOW supplies the pin with 0V which turns the LED off.  Adding the delay, as shown in the code below, pauses the loop for a given amount of time (measured in milliseconds).  Adjusting the delay value will change how long the LED stays on versus the time it stays off.  You can simply copy the code below into your code window and it should work.  All that’s left to do is connect your Arduino board to the computer, click verify, click upload, and your project will be up and running!

CODE

void setup()
{
pinMode(13,OUTPUT);
}

//this is setting up pin number 13 on the arduino board as the output pin.
//the first value in the parenthesis is a pin and the second value is the function.

//now we move onto the loop which will run forever until the board is unplugged or reset.

void loop()
{
digitalWrite(13, HIGH); // LED on.

//digitalWrite is a function used to make an ouput HIGH or LOW, 5V or 0V.

delay(1000);
//this pauses the loop for a given amount of time measured in milliseconds

digitalWrite(13, LOW); //LED off.

delay(1000);
}

As I said before, adjusting your delay values will result in different blinking rates so go ahead and try it out!  Keep a look out for my next tutorial on controlling multiple LED’s.

We appreciate all of your support!  Please check out our GoFundMe site to help us complete our senior project.  Thanks!

Share:

  • Tweet
  • More
  • Share on Tumblr
  • Pocket

Like this:

Like Loading...

Related

Posts navigation

← Fundraising Campaign!
The Complexity of Door Lock Design, Not So Simple? →
  • Project SymposiumMay 29, 2015
    The big day is here.
  • Fundraising!

    GoFundMe.com/TeamUV
  • Social Media

    • Team UV Facebook
    • Team UV Instagram
    • Team UV Twitter
  • Enter your email address to follow this blog and receive notifications of new posts by email.

  • Tags

    3D Printing 3rd World 4D Printing 9/11 Acoustics Aerodynamics Aerospace Aerospace Engineering Air Force Airplanes Always Remember America Animals Apparel Arduino Armed Forces Army Art Automotive Ballet Battery Beach Beer Biochemistry Biology Biomedical Engineering Biomimetics Biomimicry Blog Brave Bugs Cancer Cancer Cure Car Cars CFD Challenge Chemical Engineering Chemistry Christmas Christmas Tree Christmas Tree Hairspray Climate Clothing Coast Guard Coatings Color Community Company Competition Computer Computer Programming Conference Control Systems Cosmetics Courage Crazy Creativity Creature Cure Current Cycle Damage Dance Defense Desert Design Diagnosis Disaster Dive Diving DIY Donations Door Locks Drone Drones Dynamics EAF Earthquake Education Electrical Engineering Electrochemistry Electromechanical Engineering Electronics Energy Engineering Engineering A Future Engineering Feats Entertainment Environment Everyday Exploration Explore Explosions Facility Farm Fire Fireworks Fish Fishing Flight Flood Flow Fluid Mechanics Flying Food Fossil Fuels Freedom Fun Fundraising Gears Go Fund Me GoFundMe Hairspray Health Heat Transfer History Holidays Home Hope Hubble Space Telescope Impact Innovate Innovation Insects ISR Jumping LED Light List Locks Machine Design Maintenance Makeup Manufacturing Marine Marine Corps Materials Engineering Materials Science Math Mathematics Mechanical Engineering Mechanics of Materials Mechanism Media Medical Military Mindset Momentum Movies Museum Music Nature Naval Naval Engineering Navy Never forget Nuclear Ocean Office Office Wars One Open Mind Optics Outreach Owl Patriot Patriot Day Photos Polymer Polymers Poverty Power Power Generation Power Plant Presentation Printing Problem Solving Programming Propellers Rail Gun Research Resilient Ride Robotics Robots Rocket Science Roller Coasters Running SCCUR School Science Senior Project September 11th Service Members Shark Ships Simple Simple but Complex Design Small Business Smart Phone Snakes Solar Energy SONAR Space Space Telescope Special Effects Spirirts Sponge Filled Syringe Sponsor Sports Stability Stealth STEM Stress Analysis Strong Submarine Suit Support Our Troops Sustainability Swimming Syringe Team Team UV Technology Textiles Thank You Thermodynamics Top 10 Engineering Feats 2014 Travel Troubleshooting Electronics Turbulence UAV Underwater Coating UUV Venom Veterans Veterans Day Vibration Wakeboard Wakeboarding Water Water Purification Water Sports Waves Welcome Well Read Wind Wind Turbine Wine
  • Archives

    • July 2015
    • June 2015
    • May 2015
    • April 2015
    • March 2015
    • February 2015
    • January 2015
    • December 2014
    • November 2014
    • October 2014
    • September 2014
    • August 2014
    • July 2014
  • Categories

    • Blog
    • Open Mind
    • Presentations
    • Well Read
  • Authors

  • Team UV Timezone: GMT -7 Hours
    24 Hour World Clock
Create a free website or blog at WordPress.com.
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
%d bloggers like this: