Connect with us

Need guidance; newbie project - LED controllable steps

Discussion in 'LEDs and Optoelectronics' started by bugs181, Jul 11, 2013.

Scroll to continue with content
  1. bugs181

    bugs181

    7
    0
    Jul 11, 2013
    Doesn't seem to be a FAQ section here on the forum or at least I didn't see one. I'm kinda new to electronics but have a pretty good understanding of how most things work. If not, theres google. ;)

    Before we begin let me explain what I'm looking to make with the following project but need some guidance on what components would be best suited for my needs. IE; which microcontrollers, etc

    So ideally, the project would go as follows. See schematic for better explanation.

    There are 12 steps, each step would have an LED controller with an LED on each side of step along with one sensor (motion, IR, etc) per step. As a person is walking on the steps, 3 steps at a time are dimmed up then down depending on placement. As the person moves to another step, the last step not in array 3 would dim to off. Ideally the step that is being stepped on is the brightest, which could be two or more steps at a time.

    Schematic:
    Code:
              __
           __| 4
        __| 3
     __| 2
    | 1
    
    
    Use case:
    If user steps on 1, then 1 has full brightness and 2 will be half lit, 3 and 4 are still 0V.
    If user steps on 2, then 2 has full brightness while 1 and 3 will be half lit, 4 is still 0V.
    If user steps on 3, then 3 has full brightness while 2 and 4 will be half lit, 1 is 0V.

    and repeat for how many steps there are.

    This project could be as simple as pairing each step to each sensor, and if the sensor is high/low then that step will adjust the LED brightness accordingly.

    As for sourcing the components. I'm fairly confident that I will need one or more microcontrollers. I could probably get away with 2 controllers that have 15 I/O pins each. One controller for the 12 sensor inputs, one controller for 12 LED outputs and 3 pins to communicate with the two controllers of which sensor is being triggered. If my math is correct 3 pins would get me 3 * 3 * 3 output variations?

    The microcontrollers that I have on hand are:
    ATTINY45V-10MU
    ATTINY45V-10MUR
    ATTINY45-20MU
    ATTINY84-15MZ

    I haven't looked at the specs yet as their all still packaged in the moisture barrier bags. I'm not sure if any of these have the amount of I/O pins I require.

    As for controlling the LED's would a relay or transistor be better for the job? Im guessing the latter would probably be the way to go.

    To make my life easier here are a few questions:
    Is there a single microcontroller that would do this job?
    Is there a type of LED controller strip that could control a set of LED's using it's own microcontroller?

    Any and all help is appreciated. I understand that learning more about electronics first would help me but that never works out in my favor. Usually I learn by hands on.

    Thanks for taking the time to read this.
     
  2. duke37

    duke37

    5,360
    765
    Jan 9, 2011
    I do not understand quite what you wish to do. If you have a signal at each 'step' and just need to light a led, then all you need is a led driver which would probably be a transisor.

    To half light an adjacent led, then another driver with a larger series resistance will do it.

    The drivers will need to be fed with diodes to stop cross signals.
     
  3. BobK

    BobK

    7,682
    1,685
    Jan 5, 2010
    I see no reason this could not be done with a single microcontroller. It sounds like you need 12 inputs and 12 outputs. A 40-pin micro should give you plenty of extra pins.

    Bob
     
  4. bugs181

    bugs181

    7
    0
    Jul 11, 2013
    Thanks!

    Thanks for the replies guys!

    Aha! This sounds exactly like what I need. I know it comes down to preference but could you recommend such a mcu? Along with the mcu to drive the LED's would transistors be needed or would the mcu output enough voltage? I'm doubtful it could as each LED requires about 3V to 5V. 2 Per stair step and 12 steps would be quite a bit of power, not counting the mcu's required power.

    MCU power + 3/5V * 2 * 12 = 75V to 120V, or am I way off?

    Edit: This is assuming we were doing something fancy like lighting them all up in succession, strobe effects, chasers, etc. On average only 3 steps at a time would be lit up which would be 3/5V * 2 * 3

    Also the above is leaving out the required voltage for the sensors.

    Keep them coming!
     
    Last edited: Jul 11, 2013
  5. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,384
    2,771
    Jan 21, 2010
    Each LED is powered individually, so if the uC is operating from 5V, that is sufficient to drive a LED from every output if you wand (package dissipation limits aside).
     
  6. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,268
    Nov 28, 2011
    You don't really need a microcontroller. If you want to avoid one, you could use an LED dot-graph IC like an LM3914. Or is it the 3915? Whichever one has a linear response. (For 12 steps, you'd actually need two of them.)

    The control voltage would be selected according switches connected to a resistor ladder, with a capacitor to retain the current position. Adding a triangle wave to the control voltage would give PWM control for the three LEDs involved at each step; the one above and the one below would be ON for say 15% of the time each, and the centre LED would be on for the remaining 70%.

    If you connect a resistor before the smoothing capacitor, the brightness will travel smoothly between steps over a short period of time. This would make for quite a nice visual effect.

    If you want more specific information, let me know.

    Even if you do use a microcontroller, you can probably save I/O by using an ADC to determine which step is being stepped on if you use the resistor ladder idea. You have to consider the possibility that two steps are being trodden on simultaneously; this will produce a voltage half way between the two individual step voltages.

    You should describe how you plan to detect the presence of a foot on the steps.
     
  7. daGenie

    daGenie

    43
    0
    Jan 23, 2012
    This project sounds VERY INTERESTING!!! I'm kinda impressed that you could think of such a thing to do.

    This project comprises of 2 parts: the hardware and the software.

    The hardware deals with the sensors, the microcontroller, and the LEDs. Note, it may also comprise of transistors, depending on the number of LEDs you use for each step.

    You may also require a 5-volt power supply. This is because most microcontrollers require a voltage of 5 volts to be powered. You could build one using a transformer, a bridge rectifier, a capacitor, and a 5-volt voltage regulator (7805). You could also build one with a battery (maybe a 9 volt battery) and a 5-volt voltage regulator (7805). You could also use a wall wart that supplies 5 volts dc, but it's up to you! BTW, I would use a multimeter or voltmeter to test if the supply voltage is 5 volts.

    Connect all the hardware parts to a breadboard. This way, you can ensure that all that is remaining is the code for the microcontroller. Once the code is burnt, the microcontroller can easily be fixed onto the board and powered for testing.

    Next is the software. For ease of development, I would recommend a simulator like Proteus. Using a simulator can help you debug your code quickly and easily, and they are, for the most part, very accurate. On the simulator, you could represent sensors with switches. All other components should be in the simulator.

    Next part of the software is actual CODE. I would recommend a high-level programming language like C or BASIC. The way I would break this down is like this (being a C programmer, I'm taking this from a C programming perspective :D ):

    1. First, initialize all ports and SFRs that are required.

    2. Next, set numbers that represent each step. I would call this number the numerical representation of the step.

    3. Create a function (called "getStep()" for instance) that checks for the state of each sensor. It should take no parameters. If any of the sensors give an output, make the function to return the numerical representation of the step. The returned value should be an integer. Save this value in a variable (called "step", for instance).

    4. Pass this function value into another function (called "lightUpLeds()", for instance) that would take three parameters: the first parameter would be "backStep", the next parameter would be "currentStep", and the last parameter would be "frontStep". All the parameters should be integers. The arguments passed into the function would be "(step - 1)" for "backStep", step for "currentStep", and "(step + 1)" for "frontStep". The function would then set the brightness of each LED.

    5. The tricky part about this "lightUpLeds()" function is the PWM part that has to be coded. This would determine the brightness of the LEDs. Unforturnately, low-cost microcontrollers normally don't have up to the 12 PWM modules needed. However, you can create the PWM required by using delay functions.

    6. Without going to in-depth about the implementation, the last step would be to ensure that these two functions are placed in the endless loop to ensure the tasks are done over and over again.

    7. Test your code on the simulator and correct where necessary.

    8. Once you are through, burn the code onto the microcontroller, and slot the microcontroller into the breadboard. Power the circuit and you should receive positive results if all connections were made correctly and the microcontroller was programmed properly.

    Well, this is my two cents! If you have any questions about what I just said, feel free to ask. Anyway, good luck!!!
     
  8. bugs181

    bugs181

    7
    0
    Jul 11, 2013
    Woah, thanks for the heeps of help and info guys!

    Yes indeed. I've been pondering on this idea and many many others for a long time now. Mostly since I was a kid. As for being impressed I'm not sure whether to take that as an insult or compliment. lol. Don't get me wrong, I don't have the slightest clue about mcu's and such mostly for the fact that I've never done anything like this. Gotta start somewhere though, right? ;) But don't take me for a dummy. I'm a college student, know how to research and implement - and as I've said before, I have a pretty good understanding of software AND hardware.

    Actually, I had planned on using some sort of power supply, just wasn't sure which. Those USB adapters are pretty neat and I already have a bunch of those so I may just end up using something along those lines. Thanks for the idea on the voltage regulator (7805)!

    Already on top of it! lol. But appreciate the recommendation none-the-less.

    Another great idea! Thanks for the tip on the simulator.

    I actually know how to program so I'll probably be using C. In fact, it's my current job. I already have a pretty good idea of how I want to code the software side of things but again, I appreciate the advice.

    Thanks a bunch for taking the time to write up your post!
     
  9. daGenie

    daGenie

    43
    0
    Jan 23, 2012
    My apologies if you took what I said as an insult. I was just trying to say that it is a great project. From all that you said, you seem to have everything in your favor, you know, being a C programmer already and having a good idea of what to use and all. I wish you all the best. Good luck!
     
  10. bugs181

    bugs181

    7
    0
    Jul 11, 2013
    No apologies necessary! I'm just giving you a hard time. I appreciate all the info you've given me. Thank you for the luck and I'll be sure to keep everyone posted.
     
  11. sirch

    sirch

    109
    1
    Dec 6, 2012
    As KrisBlue says, my first thought on reading your post was you don't really need a MCU. Think of it from a sensor perspective rather than an LED perspective. Each sensor controls 3 LEDs, exluding the first and last which only have two (the sensors just happen to share some LEDs). The big advantage of not using an MCU is you can extend it to any number of steps without having to change the hardware or software.
     
  12. BobK

    BobK

    7,682
    1,685
    Jan 5, 2010
    An advantage of the uController though is that once you have the hardware hooked up, you can play with the software to get addditonal effects. For instance it might be cool to have the leds on all the stairs strobe in a chaser pattern in the direction the person is walking. With a uC, this is trival, with 12 separate modules, not so.

    Bob
     
    Last edited: Jul 15, 2013
  13. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,268
    Nov 28, 2011
    I agree Bob. I suggested using a dot-graph IC because it would avoid the need for programming. If the OP wants to use a microcontroller, then he should. That would give the most flexibility and power. I don't think that avoiding the MCU makes it easier to extend; I think the opposite.
     
  14. bugs181

    bugs181

    7
    0
    Jul 11, 2013
    Hey guys, to clear up some confusion - I'd really like to use a uC because this is mostly a "fun" and "learning" project. Basically this will be my introduction into microcontrollers. And as BobK has stated, in the future by using a uC we could add additional effects and even a wireless module of some sort to get real-time feedback or even control it from a distance. Just thinking out loud here!

    I do appreciate everyone offering more solutions though because it could come in handy in the future. Thanks again to everyone taking the time to stop by and post.
     
  15. bugs181

    bugs181

    7
    0
    Jul 11, 2013
    Project Update

    Hey guys! It's been a while since I've given this project a status update. Trust me, I haven't forgotten! Just been so dang busy. I came across a REALLY interesting idea that I think might just do the trick and possibly be the cheapest solution at the same time.

    I'm thinking something along the lines of a resistor type setup under the carpet of each step. Heres a link that explains in a LOT more detail about how a set up like this would work:
    http://www.nerdkits.com/videos/weighscale/

    or the link for the youtube video directly:


    Pair that up with a low powered Bluetooth 4.0 module and we just might be on to something!
     
  16. bugs181

    bugs181

    7
    0
    Jul 11, 2013
    Another small update,

    I came across these handy little capacitive touch sensors. There are a few variations but there is only some small differences between them like timing pins, etc.

    They are: AT42QT1010, AT42QT1011, and AT42QT1012
    Here's a product sheet that lays out the differences: http://www.atmel.com/Images/doc8287.pdf

    These things are VERY low power. also should be mentioned they are also VERY TINY. You will need a pick and place or something of the sort in order to handle these little guys.

    Since the output is only about 20mA, we will need an amplifier, and the AD620 will do just fine.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-