So you want to learn Arduino? So does one of my mates, Tim.
In this first video episode you can learn along with Tim.
Tim’s goal is to build an automatic firing mechanism for his Nerf guns. I suggested to him that he bases the control of his Nerf gun on an Arduino microcontroller. In so doing he opens up a world of modding possibilities.
Everything that we will cover in this video series will help you to do the same, no matter what your project goals are.
If you have any questions or comments feel free to ask on Facebook or YouTube.
Part 1: What am I Learning?
The first part covers what you are about to learn in this video series:
- Know how to program an Arduino.
- Know how to receive input.
- Know how to control outputs.
- Basics of programming.
- How you can use the Arduino in your project.
The assumption with this course is that you have some very basic knowledge of electronics.
For example; you know what an LED does, and are familiar with the words capacitor, resistor, etc.
The advantages of using an Arduino, (or Arduino based board) are:
- It’s cheap: A very low investment cost.
- It’s easy to program: All you need is a computer, USB cable, and programmer.
- It’s easy to learn: With thousands of examples and tutorials online to help you.
The Arduino board used within these videos is the Teensy 3.0, although any Arduino or Arduino supported board can be used. You may need to install additional software, or perform some additional steps, but the principles are the same.
The Teensy has many GPIO, (General Purpose Input/Output), ports to use. Enough for anyone starting out.
If you can’t get your hands on a Teensy, then I’d suggest getting the Arduino Gemma.
The reason for this is that the Gemma is the cheapest Arduino around, is small, and supports attaching a LiPo battery so you can use it when not attached to your computer. This is very important!
However, the Gemma only has 3 GPIO pins. If you require more, then I’d next suggest the Blend Micro, Arduino Micro, or the Arduino Uno. Each of these coming in at around the same price.
Part 2: Arduino basics
The Teensy 3.0 has a number of GPIO pins that you can use that provide various functions. The image below shows the possible options that each of the pins have:
These pins can be set to either input or output.
As inputs they expect either a 0v, (logical LOW), or 3.3v, (logical HIGH), on them.
There is a voltage range at which the ATmega will consider the input LOW or HIGH, so you can attach anything that will generate 3.3v or 0v.
Uses: Simple buttons, switches, inputs from other MCUs, (Micro-Controller Units).
As outputs you can set the pins to be either LOW or HIGH.
Uses: Light up an LED, outputs to other MCUs/devices, control a motor, (you will need a motor driver chip for this!).
These pins allow you to read an analog voltage, (non-digital).
When a pin is defined as an analog pin, it can only be an INPUT. That is you cannot generate an analog voltage as the low end ATmegas don’t have a DAC, (Digital to Analog Converter). However, you can read any voltage that is present on the pin.
Uses: Sensors: Light (Lux), Accelerometers, water level, pressure, etc.
Pulse Width Modulation pins:
PWM is a method in which you can pulse a pin a predefined rate. You can adjust the HIGH and LOW times, so for example you could make the pin high for 1 second, then low for 2 seconds.
The advantage to using PWM is that you don’t have to write any code to make it do that all the time. The ATmega will happily continue pulsing that pin no matter what you are doing in your code until you tell it to stop.
Uses: Motor control, strobe lighting, variable brightness of LEDs, etc.
Touch Sense pins:
You can connect up your Arduino to a touch panel, which will provide tactil control. There are a number of touch panels and screens that can be used. Anything larger than 2″ will start to get expensive, however.
There are three serial ports on the Teensy allowing you to communicate bi-directionally to a computer, GPS (Global Positioning System), or anything else with a standard serial port. Communication
s bi-directional, and you can send and receive at the same time.
I2C / SPI:
There are two ports that are designed specifically for communicating to other chips and micro-controllers. The I2C (Inter Integrated-circuit Communications), and SPI (Serial Port Interface), ports allow connectivity to such peripherals as accelerometers, temperature sensors, motor controllers. There are many many chips that use these busses, and you can place several chips on the same bus each with a different address to allow free bi-directional communications.
Depending on the board you are using you will see more or less pins, however they all have very similar capabilities.
Is Arduino a chip?
When people talk about “Arduino” they are generally referring to the whole environment. That is: The hardware or board that you are using, and the programming software or IDE (Integrated Developer Environment). You can get Arduino and Arduino compatible boards and they will be referred to as “Arduino”, but a number of boards and processors are coming out that aren’t classic “Arduino”.
For example from version 1.6 of the Arduino IDE the ARM (Advanced Risk Machine) MCUs are now supported. All you have to do is download the support library for the device and you can start programming it from the Arduino IDE. You will find ARM MCUs in devices such as smart phones, video recorders, and cameras to name a few.
So the word “Arduino” generally now refers to the whole system of being able to easily program an embedded device from your computer using the Arduino IDE.
All of the boards that you can buy will most likely have:
- A USB port.
- A reset button.
- An LED.
Part 3: Plugging it in.
Once you have your Arduino board you can plug it in. It won’t break anything, but you can see what it does.
Usually the board will be pre-programmed with a “Hello World” program to let you know that it is working. This will usually just flash the LED at a predetermined rate.
Your computer will try to recognize the new USB device, but until you have the software installed you won’t be able to do anything with it. You will have to download the Arduino IDE and any support libraries. If you have, for example, an ARM based board.
The next episode:
In the next episode Tim will be installing the software, getting the Arduino environment up and running, and making changes to the default “Hello World” program to change the behaviour.
If you like this YouTube channel please subscribe by clicking the in-video button, or the little red “Subscribe” button in your browser or app. You can also get updates by subscribing to me on Facebook, Twitter, Google+, Pinterest, and also Tumblr.