Introduction: Arduino Multi Light Controller

About: This is the account for the Greenwich school of design, Run by workshop staff catering for Architecture, Graphics, Animation, Computing students and more

A colleague and artist Jim Hobbs was planning to build a freestanding installation for an exhibition he was putting together. This installation would consist of 8 shelves forming a parabolic shape. Each of the 8 shelves was to have 10 light bulbs mounted to it. These 8 groups/shelves of light bulbs would need to be automatically and individually switched so we could create patterns of illumination. The piece references the light testing racks at General Electric.

We worked together on the technical side of the piece, and decided to have the controller centrally located on the structure and based off of an Arduino nano.

Although this is all very specific, the principles and code involved in this tutorial give a good starting point for using arduino with relays to control higher voltage or current loads. there are also a lot of possibilities with a controller like this if it were to be pushed in a slightly different direction. Have a look at the last step 'scope and possibilities' for some ideas!

High voltage electrics can be dangerous and should only be carried out by competent persons. If you are at all inexperienced in this field or unsure, please have the electrics checked over by an electrician prior to plugging in.

Supplies

Parts (alternatives to the linked parts are available)

- Arduino Nano

- 5v Relay module 8 channel

- Mini breadboard

- [30x] terminal blocks 2.5mm

- 1.5mm single core flex (cable)- in brown, blue, yellow/green

- [8x] outlet sockets

- fused inlet socket

- crimp terminals

- 1A 12v power supply

- 20cm male-female jumper cables

-Enclosure

Tools

- Precision screwdriver set

- Fine cut saw

- Dremel/rotary multi tool

- Drill

- Multimeter

- Ruler or combination square

- Allen/hex keys

- Spanner/socket set

- Crimp terminal tool

- Wire stripper

- Needle nose pliers

Step 1: Making the Mounting Plate and Layout.

We need to make a plate to sit at the bottom of our enclosure in order to mount our components to. I used a piece of 6mm plywood, you can use almost any sheet material but ensure it is rigid and not conductive. Thinner materials make mounting easier and take up less room. Some enclosures are supplied with base plates, these will adhere to various standards relating to conductivity and fire properties.

now you have your correctly sized mounting plate, you can place the components on top to figure a layout. Getting this step right is crucial to ensuring the rest of the build is easy, and the wiring is neat. Think about cable runs, giving enough room between parts, power outlet height etc.

Once you are happy with positioning, mark up the positions, drill the relevant holes and mount your components. I oiled the plywood prior to mounting.

Step 2: Cut Holes for Inlet/outlets in Enclosure

The power outlets are mounted to the enclosure itself. I chose to use IEC sockets as they are reliable and relatively universal, however they are a difficult shape when it comes to cutting the holes for mounting. I have attached a PDF template for both types of sockets used here. This can be printed and used to mark out prior to cutting, alternatively you can make your own template from cardboard like I did.

There is a tool for cutting these sockets out, but if you're reading this Instructable you're not likely to have access to one. I don't own one so instead drilled holes in the centres of the marked out area and used a Dremel to nibble out the perimeter.

We are using a male socket for the power inlet, and female sockets for the outlets. This is to eliminate the possibility on having any exposed live pins. Live pins should be concealed as they are on the female sockets. This principle should normally be used when using connectors with high voltages.

Step 3: Wiring Up High Voltage Side

WARNING - High voltage electrics can be dangerous and should only be carried out by competent persons. If you are at all inexperienced in this field or unsure, please have the electrics checked over by an electrician prior to plugging in.

Use the 1.5mm tri-rated flex cables for all of the following. Use colours applicable to the standards in your country. In the UK we generally use brown, blue, and yellow/green for Live, neutral, and earth respectively - this may differ in your locality.

Start by wiring up your bus bars using rows of 8x terminal blocks. These will distribute power to each of the power outlets. We do this by making up jump leads to join each terminal on one side.

once you have made your bus bars, run a cable from each of the terminals (Live, Neutral, earth) on the power inlet to the first terminal of the respective L, N, and E terminal block bus bars.

You can run cables from the Live and Neutral bus bars directly to the power outlets, using crimp terminals on the ends to join them to the socket's terminals.

We will be using neutral for switching, so run cabling between the central (Common) terminal on each relay to each of the terminals on the neutral bus bar.

You will then need to run another cable from the NO (Normally Open) terminal on each of the relays to each of the power outlets. This means the circuit will be 'Normally Open' and we will need to activate the relay using the Arduino to 'close' it and thus switching the lights on.

you will need to connect up the Brown and Blue cables on your 12v power supply to provide it with a feed. These can be crimped into the terminals directly connected to the main C14 power inlet, or can be connected to the L + N bus bars.

Neatness is key here.

Step 4: Wiring Up the Low Voltage Side

The Arduino is used to activate the relays and close the circuit. The Arduino works off of a 'logic level voltage' which means it outputs around 5v when a pin is set to 'HIGH' (on). However, we can power the Arduino itself using between 9-12v into the VIN pin. I often choose to use a 12v supply as I have done in this case because it's quite a standard and there are lots of components available that run on 12v. You can also power the Arduino with a USB that provides a 5v supply.

We have chosen to use a 5v relay module as this matches the 5v output the Arduino gives to power and switch it.

So to start, push the Arduino Nano onto the breadboard, ensuring it crosses the centre so the pins on either side are not connected.

Note - You will be able to see I have soldered my jumper cables onto the relay module, using male to female jumper cables is easier but I didn't have any.

Push the red and black wires from the 12v power supply into the breadboard rows adjacent to the VIN, and GND pins respectively to provide the Arduino with power.

Run a black jumper cable from a slot in the breadboard on the GND row of the Arduino to the GND pin on the relay module

Run a red jumper cable from 5v on the Arduino to VCC on the relay module.

Run (different coloured if available) jumper cables from D2-D9 on the Arduino to 1-8 on the relay module. These will be used to activate/switch the relays.

Step 5: Coding and Testing

For testing you can download the attached code (open it using the free to download Arduino IDE software). It's very basic but lays the foundation for modification. This code simply switches each outlet socket on (from 1 through to 8) at 10 second intervals, then finally turns all off before repeating. This allowed for simple testing. As Jim has all of the lightbulbs I tested using a multimeter on the pins but it'd be easy enough to wire up a test bulb which could be more reliable.

Jim wanted the light switching to follow a 'choreography' so I simply changed the switching and durations to meet his requirements. The code for this is similar and no more complex than the testing code albeit with longer loops.

Step 6: Final Installation

We mounted the control box in the centre of the lighting structure and simply had to wire the feeds to the lighting shelves into flex from their junction boxes, and terminate into a male IEC c14 socket, this time not a panel mount style IEC.

We used these plug/socket combinations to make the installation easy to assemble and disassemble as it may be installed in future shows. However there would be no problem hard wiring in the lights and avoiding the cost of the sockets if it were a permanent fixture.

Step 7: Scope + Possibilities

This project is a good initial step into using relay modules and learning to connect together split voltage systems with the Arduino. However I think it's also a good basis for creating projects that take it a little further with a few additions and modifications. The Arduino is very versatile and easy to use, here's some quick ideas for projects based upon this one I came up with whilst writing this tutorial...

- Controlling other items. The relay modules can take a lot of current. A setup like this could be used to control all kinds of things. Connecting and switching 8 food processors to make a sound track? turning on your kettle for when you wake up?

- Using a sensor and creating a feedback loop. The Arduino has Analog inputs for the use of sensors. Many are available that are aimed at use with the Arduino making them easy to use. A control box like this with a light sensor could be used to turn on a variety of lights when the outside light levels got to certain points, motion sensors could turn on different bulbs when you moved into different areas of a space or building, current sensors could be used to turn on a washing machine when your phone is fully charged. A buzzer could sound when your dog breaches a perimeter, etc. See some sensors to get your ideas flowing here

- Using data from the web. Various organisations and websites will release API keys (Application Programming Interface) which allow you to use their various services and data for your own application. You can use various sets of live data to provide data for a feedback loop for your Arduino. For instance you could use LAQN's air quality network to gauge air quality in your locality, which could result in a light bulb turning on when carbon dioxide levels were at a low point, so you could take a trip to the shops during optimum air quality levels. More useful ideas are available. Check it out here

- Using buttons or a keypad - The lights connected to the controller could be switched using a number of buttons (most obviously 8). This functionality could be built into a synthesiser that made sounds as well as switching lights when played for a whole visual, audible experience.