98. Space and Time

“Space and Time” 1: Out the box

So, our lighting project needed some sort of computer-based controller. I chose an Arduino, because they are low cost (£10 for the Uno model), easy to use and have plenty of connections for lights and other devices. They run at 16 MHz, which is snail-speed compared to a PC, but still over-specced for switching a few lights.

I also bought a “breadboard” – the cream-coloured plastic block on the left. This is basically rows of holes with metal strips underneath. It’s like the stripboard from the previous post, but there’s no soldering, you connect components by simply pushing their wires into the (appropriate) holes, so you can create and test circuits in seconds.

I connected 5 LEDs to try it out. The outputs from the Arduino switch between zero volts and 5 volts, and can deliver up to 20 milliamps (mA) of current. You can’t just connect an LED to an output (and to negative) because more  than 20mA would flow, likely damaging both the LED and the Arduino, so there’s a 1,000 Ohm resistor (1k) in series with each LED to limit the current. The red wire connects all the LEDs to negative.

I also wrote a simple program (for Arduinos it’s called a “sketch”, or you could call it an “app”) that switched sequentially between the lamps. The Arduino is powered by a USB cable to a laptop, which is also used to write and transfer the sketch to the Arduino.

Sketches are written in the programming language “C”. The sketch for this is shown below. Basically, the setup function runs first when you reset it or turn on the power, and then the loop function runs – if it reaches the end it just starts again.

I should mention that I once worked in commercial programming, so I have rather a lot of experience in this area.

I like the Arduino. It’s simple yet versatile. I found it easy and intuitive to work with, and I’d recommend it to anyone wanting to control any sort of electrical devices.


// Art lighting program V1.0
// Paul Rudman, December 2015

// The setup function runs once when the sketch begins
void setup()
   for (int i = 0; i < 5; i = i++)  // Cycle through first five outputs
      pinMode(i, OUTPUT);    // Define five pins as digital outputs
      digitalWrite(i, LOW);  // Make sure the outputs are turned off

// The loop function runs over and over again forever
void loop()
   for (int i = 0; i < 5; i = i++)  // Cycle through the outputs
      digitalWrite(i, HIGH);  // Turn an output on
      delay(3000);            // Wait 3 seconds (3000 milliseconds)
      digitalWrite(i, LOW);   // Turn the output off
      delay(3000);            // Wait 3 seconds (3000 milliseconds)

// End of program



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