Adventures with an Arduino – Part 2: The Kit.

“This will be a day long remembered.” – Darth Vader.

To recap from the previous entry, I needed an alternate form of entry into the house and thus investigated interfacing with my garage door controller. The overall aim was to use my phone to open/close my garage door.

This post is part of a 6 part series, starting with Part 1.

I decided to use the Arduino boards as a starting point. How exciting – a reason to purchase gadgets!

Now that I had established a method of interfacing with the garage door controller, I needed to design my end to end system.

Architectural Overview - Garage

As I wanted to avoid writing an app for my iPhone (I’ve managed to avoid it to date), I had several remaining choices for triggering the garage controller. I could either have used SMS to signal the controller, or have used a web page on the iPhone to signal the controller. Mind you I could have also used a phone call, rang the Arduino and then asked politely if it could open the door. That last option seemed a little excessive however.

Given I already had a web server deployed at home (who doesn’t?), I went with the web page option. This ultimately led me to look at the Arduino Ethernet Rev3 board.

So, I purchased my first ever Arduino board from element14 (au.element14.com). It arrived in the mail a short while later.

 Arduino Ethernet Box

Arduino Ethernet Board

How cool….

This unit, unlike the base Ardunio Uno board, does not have a built in USB port, but rather an Ethernet port instead. As such, when I purchased this board I also purchased an Arduino programming device which allows me to upload code to the Arduino from my PC/Mac.

Arduino Serial Light Adapter

This is the Arduino Serial Light Adapter, which I purchased from Core Electronics (www.core-electronics.com.au). It has an FTDI interface which connects directly onto the Arduino Ethernet board.

I downloaded the IDE (integrated development environment) from Arduino’s web site and installed it. It worked quite well on Windows 8.1 and Mac OS X 10.9. This is the tool used to write, compile and upload application code to the Arduino. This tool also has a Serial Monitor, so that you can read/write to the device through the COM port. This is very handy for outputting debug messages during testing that you can see through the monitor.

I plugged the Serial Light Adapter into the Ethernet board, the USB cable into the Adapter, and then finally the USB  cable into the computer. Windows immediately picked up the new device and assigned a COM port to it. The Arduino IDE could then be told that there was an Arduino Ethernet board on that COM port.

So, time to learn the Arduino Programming Language. The language is apparently based on another language called Wiring. Put simply, its C++ with some other libraries based on the AVR code set used for the Arduino’s microcontroller – the Atmel Atmega. Fantastic, who doesn’t love C++ (that was fantastic news to me – I actually do love C++).

Let’s look at a very basic Arduino program. My first one as it were.

/**********************/
/* Function: setup()  */
/**********************/
void setup()
{
	// Initialise Serial Port Communications (via USB)
	Serial.begin(9600); // 9600bps baud rate - ah memories...

	Serial.println("setup()");
}

/**********************/
/* Function: loop()   */
/**********************/
void loop()
{
	Serial.println("loop()");

	delay(2000); // Milliseconds
}

What does this code do? Not a whole lot. However, the first program should always be simple to provide some validation:

  1. You understand the basics of the language.
  2. This most basic of programs will actually compile – too many bad memories of setting up the very early java compilers to be able to find all of their dependant files.
  3. Not only does the program compile, you can upload it to the device.
  4. Now that the program is on the device, you can interface with the device through the Serial Monitor.

Well, it worked. I was very very pleased when I saw the message “setup()” appear on the Serial Monitor, followed by the message “loop()” every 2 seconds after that.

So what happened here? Basically the setup function is called as soon as the device starts, and then the loop function is called continuously until the device loses power, is manually reset, or inexplicably explodes.

With the garage controller interface understood and the basic operation of the Arduino under control, it’s time to design the circuit.

On to Part 3.

~ Mike

6 thoughts on “Adventures with an Arduino – Part 2: The Kit.

  1. They will learn faster when using the electronic
    dog training and so on. Since the beginning we must respect that.

    Another thing to do other, and dog training techniques praises.
    However, some larger than many others. Is there a furry new love in your home.
    Expert pet handlers will help you during training, what they have the tendency to
    forget what they call” activity training”.

  2. Simply put, the collar, it will not be hesitant to pull tightly whenever your dog dog training a progression of
    exercises. The main use of treats. No dog owner
    that is not that hard to know that the dog starts to cue off the dog’s build.
    Canines will always be the boss is, dogs are being added to the door until he touches the bell?
    Is your dog has performed a dog training request for you to check out the reasons pet-walking business
    is on the part of the collar.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s