My first Arduino project

So now I have a smattering of components that have cost me less than a tenner, the question is what I can do with them in the form of a project. Immediately I go searching the internet for massive and complex projects, such as weather systems and security keypads, but it is only right that I start somewhere simple. You can get much simpler than a blinking light so this is the way I go.

Of course it would help to know much ore about how electronics work. While I feel I already have a rudimentary understanding of electronics, it never hurts to have a recap. I’ll be paraphrasing some of my findings as i go along, but Intructables have a great blog post here to get anyone started.

The Arduiono site has a wealth of tutorials so i’ll be following the first of these tutorials, which is the ‘blink’ lesson. The only difference is that I am using a breadboard and extra leads to make the process a little more clear and easier.

Hardware Required

  • Arduino
  • LED
  • 220 ohm  to 1k resistor
  • breadboard
  • leads

Introduction

To make a blinking LED you don’t even need anything other than the Arduino itself, as the Arduino has a number of led status light that can be controlled. However, as I wanted to create my own closed circuit, I opted to get this code working with an external LED.

To make a closed circuit, I attach a lead to the ground port of the Arduino to position a1 of my breadboard. The LED is straddled across position b1 and b2, with the resister straddled across position c2 and c15. Another lead is put in position c15 and put into pin 13 of the Arduino board. The setup looks like this:

IMG_20160129_132437

What this means now is that we have a closed circuit from the Arduino, linking the resistor and the led in the process, to pin 13. We can then use a small program to program pin 13 and therefore control the circuit.

The program

/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.

Most Arduinos have an on-board LED you can control. On the Uno and
Leonardo, it is attached to digital pin 13. If you’re unsure what
pin the on-board LED is connected to on your Arduino model, check
the documentation at http://www.arduino.cc

This example code is in the public domain.

modified 8 May 2014
by Scott Fitzgerald
*/

// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}

Read More

IMG_20151113_063932

The Electronics Present

I’ve not done any kind of electronics since my secondary school days when I cobbled together some basic circuits for a lamps which would switch off after a minute once you activated the timer. To be honest, I don’t really remember how it was supposed to work as my teacher, Mr Bayliss, actually took over and designed the circuit for me. It’s quite lucky that the damned thing never worked in the first place, but I always enjoyed doing it and the concept of actually making something useful is still very appealing to me.

 

The Raspberry PI CamJam Kit

My wife, bless her, bought me a little tin of electronics called the CamJam Edukit, for my birthday. This little beauty was numbered #2 sensors and the contents of such can be seen below:

IMG_20151113_063932

The issue I have is that this package was bought for me in October, and I haven’t as yet even opened the thing to explore the insides. Now it is a whole month later, I thought I’d better do something with it, and so I will begin to follow some of the tutorials found on the CamJam site:

You can also buy this box here.

Bear in mind you do need a Raspberry Pi to undertake this project, so if you haven’t got one of these, I suggest that you get yourself one now. I will have a blog post later about the wonders of the Pi, as it does so many things other than being a part of an electronics, but for now, just get yourself one from the official seller here and I will return to this subject at another time.

Anyway back to the CamJam package, which upon opening, we can see the numerous components which can form the basis of a few exciting projects. The kit when laid out looks like this:

Kit Contents:

  • 1 x Breadboard
  • 1 x Immersible temperature Sensor
  • 1 x PIR Sensor
  • 1 x LDR
  • 1 x Active Buzzer
  • 1 x Red 10mm LED
  • 1 x Blue 10mm LED
  • 1 x 4.7K Resistor
  • 2 x 330 Resistor
  • 10 x M/F Jumper Wires
  • 4 x M/M Jumper Wires
  • 1 x Presentation Tin

So now, I have everything I need to start my electronics project, right? Well being the unabashed spending machine that I am, I couldn’t help but continuing to buy more things until I had absolutely everything that I needed. My thinking was that while I knew I could use a Raspberry Pi to do my programming, A lot of tutorials are geared towards using something called an Arduino board, particularly the Duo. You could read all about it here, but in short, here is a little excerpt about the Arduino:

What is Arduino?

Arduino is an open-source prototyping platform based on easy-to-use hardware and software. Arduino boards are able to read inputs – light on a sensor, a finger on a button, or a Twitter message – and turn it into an output – activating a motor, turning on an LED, publishing something online. You can tell your board what to do by sending a set of instructions to the microcontroller on the board. To do so you use the Arduino programming language (based on Wiring), and the Arduino Software (IDE), based on Processing.

Basically the choice for me seems to be use the Raspberry Pi with its IO ports directly or use a computer with the Arduino IDE to program. I shall be trying to explore both.

Arduino and other bits

After a brief shopping foray on Amazon and eBay, I managed to get the following:

IMG_20151113_064608

A big bag of breadboard cables Male to Female and Male to Male

IMG_20151113_064541

A USB to serial converter board. You can also get drivers from here for the mac.

IMG_20151113_064458

A miscellaneous bag of components (resisters, leds, variable resistors, capacitors)

IMG_20151113_064641

An Arduino Uno Compatible Revision 3 board

Instead of buying a standard Arduino board for £17 or so, I opted for a cheap Chinese derivative for a fraction of the cost. However, I had so much trouble getting this to work on my Mac but i just didn’t know why. I tried this driver available here which was available on the Kiguino blog post, but it didn’t work for me.

It turns out it might not have been a great idea as the drivers that i need to use for this board to program it from my Mac are not fully supported, as Mac El Capitan does not allow unverified drivers. Ouch. Back to the old un-secure windows instead it seems which after installing the drivers, worked first time.

UPDATE:

There is a driver now that works with El Capitan here.

In part two, I will be trying to make a basic circuit.

Read More