Newbie needs help with a lights project

Hi all,

I am very new to electronics and need help with a project.

I have 40 LED lights powered by 3 AA batteries (the type you buy for small indoor Christmas tree), what I want to do is have these lights go on when “knocked” three times.

Is this possible with the aruduino? and as I am a complete novice, if someone can guide me on how to do this I would really appreciate it.


Should be! Are you planning on having the arduino control the on/off switch that controls the lights now? That would be pretty straightforward.

Do you have a microphone or some other way of sensing "knocks"?

Hi CrossRoads, thanks for replying.

Yes, so have the arduino turn the lights on when knocked three times, and then have them go off on one knock.

Am totally new to this so thought (think I read it somewhere) the arduino had the ability to sense "knocks"

Am totally new to this so thought (think I read it somewhere) the arduino had the ability to sense "knocks"

By itself, no it doesn't. You'd need to add a microphone of some sort or accelerometer.

can you recommend which parts I would need for this, I have looked but just so many variations am not entirely sure which ones, also which do you guys think would work better for a "knock" an accelerometer or a microphone? this all needs to fit into an area of about 3" x 5" with a depth of 1"

It really depends where your strengths are (hardware vs. software) and how much time and effort you want to expend.
A simple I2C accelerometer is more expensive than a microphone, but has much simpler interconnects and may be a single device solution.
I could even have knock detection built-in.

my strengths are definitely software rather than hardware, and havent got that much time. a single device solution sounds better to me, so what you recommend purchase wise?

thankyou again for helping

Sparkfun has a whole series of accelerometers, both the 'chips' individually, as well as on boards. Gravitech also carries one that has pins installed already for breadboard use, altho if you have a soldering iron it is not hard to add pins to the sparkfun board.

Hi Cross Roads, I know this will sound really basic to you guys, but I am not sure how this will all plug together.

So I need:

1 x Arduino board 1 x acceleratometer Led lights which run on 4.5v (3 AAs)

Do I use the breadboard to get it all working?

Wire up the accelerometer per its required interface (+5, GND, Clock, Data, etc).
How are you turning on the LED lights?
One way would be like this:
Wire the relay Common & NO pins across the LED control box light on/off switch.
A 5V relay, 1N4004 diode, and 470 ohm resistor and 2N2222 transistor would do the trick.
Might be able to use just the resistor/transistor, hard to say without knowing more about your box.


hey dude, this is way beyond me, I am a mere simpleton when it comes to electronics and alot of this has gone over my head.

I might start by buying an arduino board and experiment with real basic things like making the LED go on and off.

And then try do what I need, as it stands I dont really understand how to do what I want.

But you indicated you had software strength?
This is pretty straight forward. Do some browsing for I2C interface.
With the gravitech part, you are going to connect 4 wires: +5, GND, SCL and SDA.
SCL & SDA connect to specific pins on the Arduino.
SDA is Analog4
SCL is Analog5.
Then you will invoke Wired.h in your sketch Using IIC (I2C) for interfacing to MAX6953
/ *
Arduino analog 5 - I2C SCL
Arduino analog 4 - I2C SDA
#include <Wire.h> // bring in Wire Library

and use commands like:
// write intensity10 register
Wire.send(0xEE); // E = 15/16 (max)

to talk to the part. Read the spec on the part for the addresses and format to use.
I2C is a little funny - you do some writes, one of the writes will indicate that the device will transmit during the next transmission, and there are smarts on the exernal device to do that.
There may even be library code that you can invoke to take of all that for you. I have been writing the lower level code like my example to do it explicitly. Search the playground, see what you can find.
Order the aruino, order the accelerometer, do some reading while you wait for delivery.
As for the LEDs - you have them separeated? They are still in their original congifuration?
Search for a recent post by Mowcius on how he hacked an old MP3 player to install a transistor across its switches to make it play.
You may be able to do that, or you may need a couple more parts like I showed, really depends on your box.

If you are just driving the LEDs individually, i.e. you disassembled the unit, that is simple too. Just need some 270 or 330 ohm resistors.
Wire them up on series: +Voltage source (can be the arduino 5V) to resistor, other end of resistor to LED Anode, LED cathode to arduino pin.
When the pin goes low, the LED turns on. Wire up the resistor to the LED and experiment with +5 & GND (instead of Arduino pin) to start.
It will only turn on one way.

Here are some example hookups you can make. Note that SDA & SCL are supported by hardware in the ATMega chip, they must be connected there.

If you bring in power like this, be sure not to connect it backwards. This bypasses the regulator and the Reverse Voltage protection that would normally take in 9-12V and create 5V.


cool, so which arduino board should I get?

How much stuff are you hooking up? Are you planning to make it part of something permanent? Or just a temporary project? Are you capable with soldering iron or other assembly tools? I use a duemilanove for development and prototyping with some solderless breadboards for sticking parts into. I then build Prominis into final projects that are now hung up in my fencing club. I suppose other projects may fall somewhere in that range. What are your plans?

I am going to be hooking up the 40 LED lights (Christmas tree type) powered by 3 1.5v AA batteries. I am ok with basic soldering.

The whole thing is a permanent fixture, the board, accelerometer and the batteries will be concealed so only the lights will be showing. Only doing this as a one off so it doesn't have to look too pretty, just needs to work.

If you can guide me on what you think I should get to start with it would be really appreciated, I just dont want to buy something which will end up being totally the wrong thing to get.

Sorry for being so rubbish at all this, just very very new at this.