Newbie help - 10 led chaser with pir sensor activation

Hi all! This is a bit of a big ask, but I'm fairly certain someone here will be able to help me. I'm totally new to arduino and electronics, but am pretty handy and able to turn my hand to most practical things.

Simply put I want to make a display of 10 leds (5mm, white) light up and flash in various patterns - triggered by a mini pir sensor. Ideally it should be battery powered - either by 3 AA batteries or a single 9v battery.

The help I would like is to:

  1. Make a list of suitable components - which leds, which resisitors, etc.
  2. Some guidance as to the wiring locations - where the various components should be connected to the arduino nano.
  3. Some guidance as to how to program the display to execute various patterns when triggered by the sensor.

Many thanks, Daniel

Neither option will be suitable. Nano needs 5V to run, assuming you mean a classic Nano V3.

4xAA 1.2V NiMh can power the Nano through it's 5V pin, but you must take care never to use non-rechargeable batteries by mistake, because that would be 6V and would damage the Nano.

So am I right to assume that you've never written an Arduino sketch before?

Hello dandesign70

Welcome to the best Arduino forum ever :slight_smile:

Take a search engine of your choice and ask the WWW for "10 led chaser +arduino", simply.

This forum will help you make that list but will not do it for you. This is your project, your learning opportunity. Why not come up with the list and the forum will check it for you and advise any changes or additions.

What components do you already have? Please post links to the specs for anything that isn't a genuine Arduino board or clone.

In order to calculate the resistors for the LEDs, you will need to know

  • The forward voltage of the LEDs
  • The maximum continuous current of the LEDs
  • The maximum current of your Arduino board's pins.

Yes, never before - but I'm looking forward to learning how to.

I'd read on various places on the web that a Nano can be powered by a supply or batteries up to 12v - when wired up to the correct terminals....

Thanks PaulRB - a fair and useful comment. I have used some time to look around for similar projects online, but found that the (large) gaps in my own knowledge hindered my progress - hence coming here. I don't have any components yet but can certainly draw up a list for checking by forum users like yourself.

OK. Then I would strongly recommend you set aside the intended project for a while and work your way methodically through some basic, simpler projects. You could start with the Blink sketch from the built in examples.

Good advice - thanks Terrypin!

You still haven't confirmed what type of Nano you are talking about, and details are incredibly important in electronics. Unfortunately and confusingly there are many models called "Nano" these days with different capabilities.

If, as I asked before, you are taking about classic Nano V3, then, yes, you can power with between ~7V and 12V through the Vin pin. But if you power with, say, 10V, then half of the power will be wasted as heat by the Nano's regulator, and this can become a problem. The more power/current your circuit needs, the more that wasted power becomes a problem and can burn the Nano.

If you power the Nano with 12V and your 10 LEDs are on together, each drawing 20mA, the Nano's regulator will need to dissipate (12V-5V) * 10 * 0.02A = 1.4 Watts which will quickly burn out its regulator.

But if you powered with 7V, the dissipation would be (7V-5V) * 10 * 0.02A = 0.4W which is not ideal but should be ok I think.

The point is, don't ask the Nano's regulator to do any heavy lifting!

Ok - I've put together a diagram - which very likely contains some errors. It'd be great to get some pointers as to where I might fix any potential problems.

Hello dandesign70

Just a quick question while I'm drinking my morning coffee: :slight_smile:

Have you checked your design against the specifications of the Arduino V3 data sheet?

Hi paulpaulson,
I have had a look through the datasheet, but probably lack the knowledge and experience to ascertain whether the info there flags up potential problems with my design. I've ordered but haven't yet received (my first) Arduino, so can't do any real testing with actual components yet. One thing I'm unsure of (and can't seem to find a simple answer to) is what voltage is supplied through contacts D3 to D12 in my design - where each of the 10 leds are connected. From what I've read online it is probably 5V - but if I'm wrong then my resistor calculation is of course also wrong...

You cannot have 12V to the LEDs, maximum voltage to any pin of the Nano is 5V.
In your current configuration, the LEDs will dim and not go out, and some damage may be done to the internal protection diodes of the Arduino IC.

Easier to use a 5V supply for the controller and LEDS.

Tom.... :smiley: :+1: :coffee: :australia:

Hi TomGeorge,

Thanks for the advice - you echo what a number of forum users say - that it is easier to use a 5V supply in this case. Just out of interest, as it is possible to power the Arduino with up to 12V, for what kind of applications would this be the best choice?

Hi, @dandesign70

The Vin pin needs at least 7V or 8V to provide the onboard 5V linear regulator with enough voltage to have it produce a constant regulated 5V, However that regulator is not very efficient and does not have a heatsink, so it cannot supply much current.
I fact the higher the input voltage the more power is lost to the regulator as heat.

5V supplied directly to the 5V on the Nano is more efficient and economical hardware wise.

Tom.... :smiley: :+1: :coffee: :australia:

It is 5V but your current for the LEDs is too high. 10 LED at 30mA each is 300mA and that will destroy the Nano.

Hi jim-p,

Thanks for your comment. This is somewhat confusing as I've seen examples of Arduino Nano projects where up to 20 LEDs are running - as a random flasher setup for example...but I realise that I may be missing something here as I'm new to Arduino and electronics in general.

I've ordered some bits and pieces to get myself going practically - including some LEDs which are rated at 20mA each rather than 30mA, which as I understand it, would be within the module's maximum amount (200mA).

I'm hoping to sequence a few different flashing patterns where only briefly would all of the LEDs be lit simultaneously. Does the length of time for several, or all of the LEDs being lit have any consequence for the Nano?

200mA is just for the processor and includes the current used by the processor and current sourced by other pins as well. Plus you never want to be at or close to the maximum allowed current.

Personally I woud use a driver IC for the LEDs if you want 20mA and not stress the microcontroller, otherwise cut back to 10mA