Category Archives: For beginners

Self-made Arduino shield – making a PCB

Sooner or later, everyone bitten by Arduino bug would want to make his own extension. At the beginning Proto Shield may be sufficient.

When we have a working prototype, we might want to convert it into a series model, so PCB board will be needed.

PCB

Time for self-made PCB CC by http://www.flickr.com/photos/odinhg/

On Arduino Forum there is a link to a very nice tutorial, how to make our own PCB board, especially for Arduino shields.

Aaron Eiche, author of the article is a member of DorkbotPDX group, which makes orders for PCBs and everyone can order with them the price is quite attractive – $5 for square inch of a double sided board + $15 for shipment (worldwide). It must be ordered in multiples of 3.

Galvanic isolation: optocouplers

For sure, you have heard the term galvanic isolation many times. In brief, it’s about separating the source of signal from the microcontroler in order to prevent it from unwanted and dangerous voltage spikes, while allowing to read the signal.

Such a separation is provided by optocouplers. The optocoupler contains in common package both infrared LED diode and photodetector, such as photodiode or phototransistor.

How to utilize this invention? On Australian hacker’s blog there is a tutorial explaining what is an optocoupler and how to read its parameters.

Tilt sensor

Nettigo offers tilt sensors with 30° and 60° (exactly from -30° to +30°) operating range.
Tilt sensor is a kind of switch. The difference between it and regular switches is that the current starts to flow through it when it’s tilted. Such a sensors are commonly user in car alarm system They are monitoring car’s position and triggering the alarm when the car is dragged by a wrecker truck, for example.
It looks like this:

Hardware

Utilizing the sensor isn’t difficult. It’s similiar to every ordinary switch. Only a free Arduino digital pin is needed. When the pin is in input mode, its state remains unknown (random) until a certain voltage is applied to it. Applying a “GND” sets it into “LOW” state, and providing 5V causes “HIGH” state.

If we have the sensor wired to a digital pin and “GND”, we know the state will switch to “LOW” when the current will begin to flow. When the current doesn’t flow, the state is going to be reversed – “HIGH”. Presently, the state is undefined. Thus, to define the state we will use built-in “Pull Up” resistor. It causes setting a pin into “HIGH” state when no voltage is applied to it.

Software

We’re taking advantage of the sensor reading the state of a selected digital pin. First, we must set the pin as “INPUT” in “setup” section.

pinMode(pin_number, INPUT);

And activate internal “Pull Up” resistor.

digitalWrite(pin_number, HIGH);

After that, in “loop” function you can read pin’s state and thus the sensor’s position with “digitalRead” function.

variable = digitalRead(pin_number);

Example program, lighting the “L” diode up during a tilt.

// Defining a pin for the tilt sensor
#define SENSOR_PIN 2
// Defining a pin for the LED diode
#define LED_PIN 13

void setup()
{
	// Setting sensor's pin as input
  pinMode(SENSOR_PIN, INPUT);
  // Turning internal Pull Up resistor on
  digitalWrite(SENSOR_PIN, HIGH);
  pinMode(LED_PIN, OUTPUT);
}

void loop()
{
	// Checking sensor's state
  if (digitalRead(SENSOR_PIN) == HIGH)
  {
  	// Action if off
    digitalWrite(LED_PIN, HIGH); // Turning the LED on
  }
  else
  {
  	// Action if on
    digitalWrite(LED_PIN, LOW); // Turning the LED off
  }
}

Assembled module

A task

As every man well knows, a woman holds in her purse only treasures. These are so valuable, that no-one is allowed to browse it. In order to protect poor ladies from nosy people I resolved to build a purse alarm.

Elements

The following parts will be needed:

  • Tilt sensor for sensing the position of the purse
  • Piezo buzzer for alarming

I assembled the elements as on the following schematic. I used pin 2 as sensor’s input, pin 3 as output for piezo buzzer and pin 13 for LED diode.

The code isn’t much different from the previous, except from additional sound procedures.

First of them is “tone”, turning the sound on.

tone(speaker_pin_number, frequency);

The second – “noTone”, turning it off.

noTone(speaker_pin_number);
// Defining a pin for the tilt sensor
#define SENSOR_PIN 2
// Defining a pin for the LED diode
#define LED_PIN 13
// Defining a pin for the piezo buzzer
#define PIEZO_PIN 3

void setup()
{
  // Setting sensor's pin as input
  pinMode(SENSOR_PIN, INPUT);
  // Turning internal Pull Up resistor on
  digitalWrite(SENSOR_PIN, HIGH);
  pinMode(LED_PIN, OUTPUT);
}

void loop()
{
  // Checking sensor's state
  if (digitalRead(SENSOR_PIN) == HIGH)
  {
    // Action if on
    digitalWrite(LED_PIN, HIGH); // Turning the LED on
    tone(PIEZO_PIN, 600); // Alarm sound
  }
  else
  {
    // Action if off
    digitalWrite(LED_PIN, LOW); // Turning the LED off
    noTone(PIEZO_PIN); // Turning alarm sound off
  }
}

It’s easily noticeable that the alarm is too sensitive and every shock (even foot stamping) causes “screeching” of the buzzer. This would not appeal to the purse’s owner.

What is the difference between shocks and poking around in a purse?

The easiest way to distinguish them is switching speed of sensor. Shakes are switching it in thousandths of a second, while moves caused by a lifter – from tenths of a second to a few seconds. So, the time in which the sensor turns on must be counted and, if it’s longer than 0.1 s (moving the purse), the alarm should be triggered.

For this case, I used “millis” function, which returns how many miliseconds have elapsed from turning Arduino on. It could be applicated to storing the time from turning the sensor on. When a previously set value is reached, the alarm is turned on.

// Defining a pin for the tilt sensor
#define SENSOR_PIN 2
// Defining a pin for the LED diode
#define LED_PIN 13
// Defining a pin for the piezo
#define PIEZO_PIN 3
// Defining sensitivity time
#define SENSOR_TIME 100

// Variable storing the switching time
unsigned long sensor_time;

// Function invoked, when the alarm is on
void alarm_on()
{
	digitalWrite(LED_PIN, HIGH); // LED on
  tone(PIEZO_PIN, 600); // Alarm sound
}

//  Function invoked, when the alarm is off
void alarm_off()
{
  digitalWrite(LED_PIN, LOW); // LED off
  noTone(PIEZO_PIN); // Turning alarm sound off
}

// Function checking sensor's state
void check_sensor()
{
  // Checking sensor's state
  if (digitalRead(SENSOR_PIN) == HIGH)
  {
    // Action if off

    if (sensor_time == 0) // Checking if the state was changed
    {
      sensor_time = millis(); // Storing the sensor's activation time
    }
    // Checking if the state of sensor has been lasting for a specified time
    else if (millis() - sensor_time > SENSOR_TIME)
    {
      alarm_on();
    }
  }
  else
  {
    // Action if on
    sensor_time = 0;
    alarm_off();
  }
}

void setup()
{
  // Setting the sensor's pin as input
  pinMode(SENSOR_PIN, INPUT);
  // Turning internal Pull Up resistor on
  digitalWrite(SENSOR_PIN, HIGH);
  pinMode(LED_PIN, OUTPUT);
}

void loop()
{
  check_sensor();
}

Real alarm

Our purse alarm has one more disadvantage. It turns off immediately when the purse returns to its position. This is not a way real alarm works!
Professional alarm systems also have varied sounds. Here we will use “millis” function again. In the first place we are going to count, how much time was elapsed since triggering the alarm. It will be set off only when a certain amount of time will elapse, in order to deter and attract attention more effectively.
In the second place I employed time measuring to check the duration of signal tone, so as to switch it cyclically between high and low pitches. This way our purse alarm will be better distinguished from other noises.

// Defining a pin for the tilt sensor
#define SENSOR_PIN 2
// Defining a pin for the LED diode
#define LED_PIN 13
// Defining a pin for the piezo
#define PIEZO_PIN 3
// Defining sensitivity time [ms]
#define SENSOR_TIME 100
// Defining alarm duration time [ms] (5000 ms = 5 s)
#define ALARM_TIME 5000

// variable storing sensor's switching time
unsigned long sensor_time;
// variable storing alarm duration
unsigned long alarm_time;
// variable storing pitch change time
unsigned long signal_time = 0;
// variable storing the pitch value
// 0 - no sound
// 1 - first tone
// > 1 - second tone
byte sound_tone = 0;

// alarm siren function
void alarm_signal()
{
  if (sound_tone != 0) // checking if the siren should be turned on
  {
    if (millis() - signal_time > 750) // checking tone duration
    {
      signal_time = millis(); // storing the time when the tone was turned on
      sound_tone = ~sound_tone; // turning on the second tone
    }

    if (sound_tone == 1) // first tone
    {
      tone(PIEZO_PIN, 600);
    }
    else // second tone
    {
      tone(PIEZO_PIN, 1200);
    }
  }
  else
  {
    noTone(PIEZO_PIN); // Sound off
  }
}

// Function invoked when the alarm is off
void alarm_on()
{
  alarm_time = millis(); // storing the time when the tone was turned on
  digitalWrite(LED_PIN, HIGH); // LED on
  sound_tone = 1; // Turning alarm siren on
}

// Function invoked when the alarm is off
void alarm_off()
{
  if (millis() - alarm_time > ALARM_TIME) // checking alarm duration
  {
    digitalWrite(LED_PIN, LOW); // LED off
    sound_tone = 0; // Turning alarm siren off
  }
}

// function checking sensor's state
void check_sensor()
{
  // checking sensor's state
  if (digitalRead(SENSOR_PIN) == HIGH)
  {
    // Action if off

    if (sensor_time == 0) // checking if the state was changed
    {
      sensor_time = millis(); // storing sensor's activation time
    }
    // Condition, if sensor's state lasts for a specified time
    else if (millis() - sensor_time > SENSOR_TIME)
    {
      alarm_on();
    }
  }
  else
  {
    // Action if off
    sensor_time = 0;
    alarm_off();
  }
}

void setup()
{
  // Setting the sensor's pin as input
  pinMode(SENSOR_PIN, INPUT);
  // Turning internal Pull Up resistor on
  digitalWrite(SENSOR_PIN, HIGH);
  pinMode(LED_PIN, OUTPUT);
}

void loop()
{
  check_sensor();
  alarm_signal();
}

This is only one of many applications of tilt sensor. If you have any ideas or questions – leave a comment or use the mail.

Source codes:

Pin header soldering

During meetings with readers I found out that many of them like the Arduino project, but the greatest barrier is soldering.
Some are literally scared of this – their hands are trembling. In this article I would like to make soldering more familiar.

Some of electronic parts available as printed circuit boards with ready-to-use devices (modules) has already terminals in form of holes on the board. It only lacks of connectors or wires. For use with Arduino, the best idea is to solder pin header into these holes.

Pin header is a kind of connector with pins aranged in a line. In most cases the raster (gap between two pins) is the same – 2.54 mm (0.1 inch).
Pin header fit very well to a breadboard.
In this article we’ll be talking about soldering pin headers to Ultrasonic distance meter.

Components

To solder we need:

Soldering iron

If you are amateur electronic-hobbyist, you don’t have to buy advanced and expensive tools. I myself am using simple and cheap 40W soldering iron from long time ago. It’s available in electronics shops for a few dollars. Of course, I reccomend a “pencil” type, not transformer. The second type is better for wires soldering than for small elements, so excluding them, you will avoid many problems.
The most important thing in using a soldering iron is to know, which end gets hot. Grabbing the unproper may end badly.
The iron heats approximately for 2 minutes. It’s ready when solder melts on the soldering iron’s tip.

Solder

Solder is a kind of wire made from tin and lead with specific chemicals added. Solder is usually available in a form of spool with wire in a sort of diameters.
I reccomend diameter up to 1mm. We should realize that the smaller is the diameter of solder, the smaller parts can be soldered. However, when diameter is too small, a considerable length of solder will be needed for soldering bigger parts, what could be uncomfortable.
I use 1 mm solder and in the lfollowing example it will be a bit too thick.

Pin headers

Pin headers are available in a sort of configurations (from one to a few rows). We will settle for one row. Usually they are sold in 50 pins pieces.
If a device requires less pins, the remaining are broken up.

Preparing

Holes and soldering pads should be degreased with a cloth soaked with alcohol, solvent or water. Most of the manufacturers reccomend the last option, but you must be careful, because water can easily short the circuit an slowly vapors from thin gaps like places under ICs.

We are breaking up desired number of pins,

and trying on, whether they fit to the board.

Further preparation

In fact, you could begin soldering right now, but yet one thing would be helpful – a “third hand”. There is quite difficult to hold a part in place, when we have soldering iron in one hand and solder in the second. Pin headers can’t be soldered straigthly (at 90° angle) when the module leans against it.
Fortunately, many ways to solve this problem exist. The most popular is magnifying glasses with “crocodile” grips tightened to a table.
Though, I used…

…a small vise.

The board shouldn’t be tightened by the vise directly. This could corrupt it, otherwise it wouldn’t be held stabily. So, I suggest to cover jaws of the vise with something like foam used to isolate pipes.

What to do with pin headers falling out from the board?
I suggest to glue the plastic ends to the board with “Super Glue”, for example.

Soldering process

The soldering consists in putting hot soldering iron tip to the junction point. Next, solder is applied there. It must melt and flow down, filling the junction.

You have to remember not to heat one point too long (the soldered parts could be damaged). Manufacturers reccomend max 2-3 s.
If the solder will accidently flow over two pins, melt it and divide quickly, using something like a toothpick or match.

Properly soldered junction is cone-shaped.

The most common mistake in soldering is applying too less (the soldering pad isn’t well covered) or too much (there is a bead instead of a cone) solder to the junction.

My soldering

To finally dispel the fear of soldering, I decided to record in on a video
As you can see, dear reader, this isn’t so difficult.

Temperature and LCD

In Nettigo recently appeared LCD kit for Arduino – it is 2×16 alphanumeric LCD with soldered connector fitting to a breadboard and 10 kΩ linear potentiometer for contrast regulation.

LCD kit in action

LCD kit in action

The LCD module has HD44780-compatible controler, what means LiquidCrystal library will be able to handle it. How to connect it?

Let’s begin from the code:

#include <LiquidCrystal.h>

float temp;
LiquidCrystal lcd (12,11,10,9,8,7);

void setup() {
  analogReference(EXTERNAL);
};

void loop () {
  temp = analogRead(0)*3.3/1024.0;

  temp = temp - 0.5;
  temp = temp / 0.01;
  delay(500);
  lcd.print("Temp: ");
  lcd.print(temp);
  lcd.print("        ");
  lcd.setCursor(0,0);
};

Basic LCD handling boils down to connecting (I’ll tell about it later) and initializing it:

LiquidCrystal lcd (12,11,10,9,8,7);

The code above defines lcd variable, which will be used for communicating with the module. We will assume the simplest form here, so we are wiring it up:

  • RS pin of the module
  • ENABLE pin of the module
  • Data pins of the module: D4, D5, D6, D7

In this example 12 – RS, 11 – ENABLE, 10-7 D4-D7. Apart from this we need to connect R/W signal to ground (we won’t write anything to it) and power. Even if we’ve connected it all, the display shows 32 little black squares. We need also to set the contrast, providing voltage in range 0 – 5V to Vo pin of the LCD. To be able to adjust it, we will use a potentiometer included in the kit. Everything illustrated in Fritzing (the transistor works as MCP9700, because there isn’t such a part in Fritzing, package is the same – TO-92):

LCD connection schematic

LCD connection schematic

After that, in loop we are reading temperature form MCP-9700 (described in this post). Having the temperature already, we are showing Temp: text and the reading, and going back to the beginning.

How to improve the temperature measurement?

Temperature reading (in form of voltage measured by analog input 0) is given by MCP9700 with accuracy dependent on voltage converter in Arduino. It’s 10-bit and measures voltage from 0 to 5V by default. 10 bits mean that we have 1024 steps in voltage reading. Thus, the voltage is measured with 4.88 mV (5/1024) resolution.

MCP9700 sensor has 10 mV / degree resolution, so it virtually means that we have 0.5 degree accuracy (it’s not about sensor’s quality, it’s about how Arduino measures the voltage).

Arduino’s A/D converter is able to be provided with external reference voltage (AREF – the peripheral pin in the digital outputs row), which replaces 5V. This voltage can be higher or lower than 5V EDIT: Unfortunately, I made a mistake here – converter’s datasheet tell that maximum reference value is the supply voltage – for Arduino it means 5V. If someone needs to measure higher voltage, then voltage divider always could be used…

WARNING!
Potential risk.
According to the reference of
analogReference function, the default setting (when analogReference isn’t invoked at all or invoked with DEFAULT value) could damage the microcontroller on Arduino board when using external AREF!

MCP9700 datasheet shows that maximum output voltage is 500 mV+ 125*10mV = 1.75V. It would be best to force the converter to measure voltage in range 0-1.75V, but it requires to add a voltage divider. This is not difficult, but in order not to complicate, we will use a simple measurement quality improving method, without any additional elements. We will exploit the fact that Arduino provides a 3.3V voltage, apart form 5V and we can improve measurement resolution without any problems.

Because of this in setup the analogReference(EXTERNAL) (it’s not enough to supply a voltage to AREF) function is invoked and in loop the tempreature calculating formula is changed. After changing the reference voltage we have 3.2 mV step, which means the temperature is measured with 0.3°C accuracy and not 0.5°C, like before.

NOTE – the improvement affects only the reading, not the measurement itself. The sensor still has +-2°C accuracy :) . This thick will improve only our mood, because the reading doesn’t jump so much :)

Of course, change of AREF affects all of the analog inputs…

Arduino’s eye, or about a photoresistor, not Tolkien’s mythology

Arduino’s eye – sounds like a quote from J.R.R. Tolkien, while it’s about connecting photoresistor to Arduino. With this article I would to begin short course dealing with basics of electronics.

Photoresistor is a element whose resistance is dependent of amount of light falling on it. What only remains is to measure this resistance. In which way?

For a playful use we will ignore accuracy, assuming simplified model.

How it looks?

Simple circuit built on breadboard

Simple circuit built on breadboard (click on the picture to see notes on Flickr)

Circuit diagram looks like the following:

Circuit diagram

Circuit diagram

What is depicted here is so called voltage divider. You can read on Wikipedia, how it works.

Briefly speaking, voltage on the junction point between two resistors will be varying according to resistance of the photoresistor. And this is what we will be measuring with our program.

This is its code:

// pin, from which we read the voltage
int photoPin = 0;
//the reading
int val = 0;

//initial configuration
void setup()
{
  pinMode(photoPin, INPUT); // setting the pin as input
  Serial.begin(57600);
}

void loop()
{
  //reading and standarizing to range 0-7
  val = analogRead(photoPin)/128;
  for (int i=0;i<=val;i++) {
    Serial.print(".");
  }
  Serial.println();
  delay(90);
}

Program (as hardly every on Arduino) consists of the section preparing the device to work (setup) and main loop (loop) evoked as long as the power is available…

In main loop the voltage is measured, then the reading is converted in range 0-7 (because Arduino reads voltage as a number from 0 to 1023, so dividing it by 128 and rounding down gives digit from 0 to 7) and appropiate number of diodes is lighted up. Short break, and loop again…

The result:

Arduino IDE during execution of our program

Arduino IDE during execution of our program

While the program is running, I’m covering the photoresistor with my hand, changing its resistance, and thus the voltage being read by Arduino from pin 0. The number of dots is proportional to the reading.

Part list:

Coming soon – how to physically show varying reading.

LED diodes – how to flash and light

Recently there was silence on Starter Kit, because before holidays I was preparing to Bootstrap 9.4, what took most of my free time. Now, taking advantage of free day I’m making up for it.

Previously, we were dealing with reading from external sensor (photoresistor). Now we will try to show this reading.

We will use 7 LED diodes arranged in a line making a kind of indicator – the more light falls on the photoresistor, the more diodes will light. Beginning from the end – how it looks in action:

Arduino’s Eye from Starter Kit on Vimeo.

Forgive poor quality, but mobile phone camera is the only tool I can use to perpetuate my experiments with Arduino.

But despite of that the effect is visible. Behind the frame I zoom in and out the photoresistor to a lamp as the diodes are lighting up and fading out.
Continue reading

Arduino – play!

A long silence on the blog is just broken! During the last few months I was strongly engaged in projects not connected with Arduino, whole time was absorbed by keeping the Arduino shields shop, servicing customers, searching for new suppliers, etc.

Now I have a bit time which I can spend by documenting experiments with Arduino, thus I hope to add some examples with Starter Kit soon.

Silence, go away!

As we have to break the silence, so więc let’s begin from controlling so called buzzer a tiny speaker able to produce not very loud sounds, with the Arduino. Let’s start from final product:

Arduino buzzer from Starter Kit on Vimeo.

Buzzer is controlled by Arduino, playing simple melody. Playing speed depend on reading from photoresistor (the more light, the slower it plays).

How it’s made?

I wrote, how to read values from photoresistor in one of previous posts. Buzzer is stimulated to play by properly applied high and low voltage. For (Arduino output port) safety a 220 Ohm resistor is added to lower the current passing through (from PDF with documentation appears that it’s not obligatory – at least 14 Ohm resistance should not generate current higher than 36 mA – lower than the limit value for Arduino I/O port – 40 mA).
Thankfully Arduino is open source and there are many ready to use elements. So, playing melody (note) issue is described in Melody tutorial. We will take advantage of it and add only part reading value from photoresistor and converting it to adequate delay.

The only modification of Melody tutorial (except from setup) is a line in loop:

 tempo=analogRead(analog)/3+100;

It divides the voltage reading by 3 and adds 100. This way we will obtain value in range from 100 to 1023/3+100=441. Original tempo was delay 300. Only the schematic remains:

The device schematic

The device schematic

For beginners – a detailed description, how to connect the wires:

Physical connections

Physical connections

Detailed part list (Fritzing has only piezo buzzer in basic library, so it is used on the schematics):

Fritzing Bill of Materials

Sketch: 	buzzer.fz
Date: 	Tue Sep 29 01:11:59 2009

Arduino1      Arduino Diecimila
Breadboard1   Tiny Breadboard
J1            Piezo Speaker
R1            220 Ω Resistor
R2            10k Ω Resistor
R3            Basic Photo-Resistor (Photocell)

Shopping List

Quantity	Part

1		10k Ω Resistor
1		220 Ω Resistor
1		Arduino Diecimila
1		Basic Photo-Resistor (Photocell)
1		Piezo Speaker
1		Tiny Bre

And finally – the code used in example: melody.zip

PS
How do you like the diagrams and pictures designed in Frizting? For me, it’s perfect software for documenting experiments with Arduino. I reccommend – check it.

How to measure temperature with Arduino and MCP9700

One of the sensors included in Arduino Starter Kit is a temperature sensor. It’s analog device which doesn’t need any additional elements to work (it’s exactly MCP9700-E/TO). So, briefly speaking, after connecting ground and power supply we are already able to measure temperature. On the sensor’s page in Nettigo shop there is PDF datasheet in Files bookmark. So, let’s begin from terminals:

MCP9700 pinout

MCP9700 pinout

Important – the terminals are showed from the bottom of the sensor. To the first we connect supply voltage (both 3.3V and 5V from Arduino would be OK), ground (GND) goes to the third and the second terminal should be connected to Arduino Analog0 pin. As we can read from the datasheet (first page), sensitivity equals 10 mV/ºC. On the second page we have Output Voltage, 500 mV for 0°C. That’s all we should know to write a simple program:

float temp;

void setup() {
  Serial.begin(57600);
};

void loop () {
  temp = analogRead(0)*5/1024.0;
  temp = temp - 0.5;
  temp = temp / 0.01;
  Serial.println(temp);
  delay(500);
};

The program measures temperature and sends the reading to Serial, from which we can read it using serial port monitor in Arduino IDE. How the temperature is calculated? I divded the whole process in three steps to make it easier to understand:

  1. temp = analogRead(0)*5/1024.0; Reading value from analog input and converting it to voltage. Maximal voltage Arduino is able to measure equals 5V and the A/D converter’s resolution is 10 bits, which means 1024 values, thus voltage value on Analog0 input is the value returned by analogRead multiplied by the voltage equaling one step of A/D converter. You have to remember, that dividing 5 by 1024 would be interpreted by compiler as integer operation and the result in this case will equal 0. Because of this in the code appears 1024.0 and thanks to this entry, the compiler will treat the dividing as floating point operation.
  2. temp = temp - 0.5; Calibrating to 0°C – the difference between voltage read from the sensor and 500 mV is linearily dependent on temperature.
  3. temp = temp / 0.01; This difference is divided by 10mV/step and now we have temperature

As you can see, the MCP9700 sensor is very simple to use and beginners-friendly. Now everyone can measure temperature with Arduino.

Let’s play, daddy – Family Feud

I was inspired by a simple DIY game seen on the web (I can’t find the link now) and despite the fact that original version was based on greatly simpler PIC I decided to build it with Arduino Starter Kit.

The rules are simple – the one, who will press his button faster after a diode lights up, gets a score. If the button will be pressed before the diode lights up, a point goes to opponent. The game continues, until someone gets five points. Let’s see it in action:

Simple game with Arduino from Starter Kit on Vimeo.

Beside the diode, which will be watched, we need also two diodes to indicate who gets the point and who has won the whole duel, buzzer to play simple melody at the end of the game and two buttons.

Continue reading