week 02

  • Who is here?
  • Did you bring your Arduino, cables, etc?

Arduino Basics

Note: Demonstrations in class will use the Arduino Uno Rev3 board. You can use other boards for your project of course.

Arduino

Hardware

Power

Operating voltage is 5V, input voltage 7-12V (recommended). Limits are 6-20V, don't exceed these, you can harm your board.

What is the difference between USB and external power supply power (VIN)?

  • The external can give you more current and you can operate the Arduino without your computer.

  • Is your computer safe? ‘If more than 500 mA is applied to the USB port, the fuse will automatically break the connection until the short or overload is removed.’ (source). Also, new computers will sense when more current is trying to be drawn, therefore they disconnect (source). An option for adapter use here. Remember, you can also have a battery pack.

What is DC Current per I/O Pin?

  • 40mA (0.040A). This is how much current (Amp) you can access through the pins. ‘This is enough current to brightly light up an LED, or run many sensors, for example, but not enough current to run most relays, solenoids, or motors.’ (source)

If you need more current (Amp)for a device you need the main circuit (5V and ground).

Why should you never pull a full 40mA from one digital pin? What does this mean?

  • ‘running high current devices from them (digital pins), can damage or destroy the output transistor in the pin, or damage the entire Atmega chip. …’ (source)

What is the total current I can access through a a) single I/O pin, b) all I/O pins, c) 5v when USB, d) 5v external power adapter?

How do I find out whether I have enough current for my sensors, servos?

  • When you buy something make sure you check the specifications. The info should indicate how much current (Amp) your sensor will use (check). For most of our examples, the USB will give you enough current to operate a few sensors.

When to use a resistor and which one?

The Arduino operates on a 5V circuit. You don’t need a resistor in case you use a component e.g. a sensor that is designed to work in a 5V circuit (IR sensor – check the data sheet for operating voltage). However, sometimes you want to use a component e.g. an LED, which needs less than 5V electric pressure to operate on. In this case, you need resistor. You can use Ohm’s law to calculate what resistor you need.

I/O (analogue and digital)

Analogue: 0-5V is scaled to 0-1023

Further info: analogRead, ADC;

Digital: HIGH (5V) or LOW(0)

Further info: digitalRead, digitalWrite, digital pins;

Can the analogue inputs be used as outputs?

Can I output analogue signals?

Yes, you can use Pulse Width Modulation (PWM). Used with LED, Servo, …we’ll look into this later.

Software

What is the Arduino language?

Arduino C. ‘The C you are about to learn is not standard C. Rather, you will be learning a robust subset of standard C. A few standard C features are missing. But the absence of those features is not a crippling blow by any means. You will soon discover that the subset version of standard C, which we will call Arduino C, is more than able to perform just about any task you can throw at it. The missing features can easily be worked around, albeit sometimes in a less elegant manner.’

Source: Purdum, 2012 Beginning C for Arduino

Learning Material

Stech 01 Sensors

Demonstration of learning material. You should also start building your Arduinos while the demo.

Multimeter

Multimeter

What can we use the multimeter for?

  • Measure voltage of Arduino;
  • Measure resistance of resistor, LDR, potentiometer;
  • More info can be found here.

I never teach my pupils. I only attempt to provide the conditions in which they can learn. ~ Albert Einstein