Connect with us

Making a dancing light device

Discussion in 'LEDs and Optoelectronics' started by kourosh daryaee, Sep 7, 2016.

  1. kourosh daryaee

    kourosh daryaee

    38
    4
    May 12, 2016
    Hello again
    I want to make light device but a bit more complicated than the first one :
    https://www.electronicspoint.com/threads/increasing-voltage-or-current.278975/

    I decided to use a microcontroller so can play with different patterns of lights.
    now I have some questions to ask if you do not mind:
    First of all what kind of hardware do I need to start programming a microcontroller . like debugger or programmer etc..
    Second what kind of microcontroller should I use AVR or PIC since I just started to use microcontrollers.
    Third ,I have simulated ATMEGA 16 on Proteus and programmed it on Codevision before.but now I am making something on the electronics board not on the simulation software. so what kind of software I need ? I mean for designing the board , programming ,debugging (i prefer C language over assembly if its possible)
    and last question what model of microcontroller should i use i want to play with 10 SMD's I need 10 output and some input for signals (if i am right?)

    Thanks
     
    Last edited: Sep 7, 2016
  2. Harald Kapp

    Harald Kapp Moderator Moderator

    9,137
    1,846
    Nov 17, 2011
    You'll need a programmer. Which one will depend on your choice of controller. A debuggerr is nice to have, but probably prohibitively expensive.

    Since you already are at least a bit familiar with the ATMEGA 16, an AVR is an obvious choice.

    The number of inputs and outputs is only one factor in the equation. The number of inputs and outputs can easily be increased by using I/O-expanders or multiplexing. Another, very important factor is the size of the integrated memory which needs to be large enough to hold your code. As long as you stay within a family of compatible controllers, it is usually straight forward to start with a small model and switch to the next bigger one should memory not be enough. You can often do this step within a simulator before actually buying the hardware.

    If you want an easy start, use an off-the-shelf microcontroller board like e.g. the arduino (AVR based) or similar. These boards often come with a built-in boot loader so you simply connect them via USB or serial port to your computer and download the program using the programming environment (IDE).
     
    kourosh daryaee likes this.
  3. kourosh daryaee

    kourosh daryaee

    38
    4
    May 12, 2016
    Thank you, MR.Kapp
    I ordered an Arduino UNO, module(am i right ? it called module?) and right now I am reading about it.
    but one new problem i found is that the seller of SMD light doesn't know what type of SMD they are he just sell it, now how can I measure the voltage and amps the SMD needs to be turned on? are they same as LED's?can i drive them as I did on the leds?
     
    Last edited: Sep 7, 2016
  4. Harald Kapp

    Harald Kapp Moderator Moderator

    9,137
    1,846
    Nov 17, 2011
    You can use a series resistor and a variable voltage source to drive the LEDs and see at which current the light is good and the temperature of the LEDs is not too hot. But that can be only an approximation and can not replace a datasheet. No two LEDs are the same, so you cannot simply use another LED's datasheet.

    For Iload use the real current (30 mA9, not the max. current in the datasheet.
    For hfe use 100 for a bit of safety margin.
    For Vbesat use 800mV. This value is in between the two datasheet values for IC=10 mA and Ic=100 mA

    Ibase= Iload/hfe = 30 mA / 100 = 300 µA
    R = (5 V - 0.8 V) /Ibase = 4.2 V / 300 µA = 14 kΩ
    The value for Rbase is not critical. Using 12 kΩ or easily available 10 kΩ will work fine and keep the transistor in saturation (fully on).
     
    kourosh daryaee likes this.
  5. Jouellet

    Jouellet

    86
    19
    Feb 2, 2015
    Why don't you consider the Arduino Nano ? They come with their own USB/Serial converter.

    You can get some "chinese" version, for 3US$ on Ebay !

    Also, do some research on the "MSGEQ7" ; you might want to use that as well !
     
    kourosh daryaee likes this.
  6. kourosh daryaee

    kourosh daryaee

    38
    4
    May 12, 2016
    Thanks for advice
    but it's a little late now since I wanted something to be little smaller nano would be a better choice.
    but having both of them make it a heaven I can programme on UNO and when I want to assemble using nano.
    and MSGEQ7 sound like a heaven for me !!!! but all I know about multiplexing is some symbols if you can
    show me a link about how to do them on out of the paper I will be thankful.
     
  7. Harald Kapp

    Harald Kapp Moderator Moderator

    9,137
    1,846
    Nov 17, 2011
    kourosh daryaee likes this.
  8. kourosh daryaee

    kourosh daryaee

    38
    4
    May 12, 2016
    I want to use Arduino Nano as a decoder for MSGEQ7 and controller of light
    does the whole idea make sense?


    [​IMG]
     
    Last edited: Sep 9, 2016
  9. kourosh daryaee

    kourosh daryaee

    38
    4
    May 12, 2016
    what kind of potentiometer i should use? the input is 5v and DC Current per I/O Pin is 20 mA ,I want to use it as the controller for light's
    I searched the web but every project I found they just said use a potentiometer not what value it must have?
    does a 50 kohm will work as an input for Arduino Uno?
     
  10. Jouellet

    Jouellet

    86
    19
    Feb 2, 2015
    google "MSGEQ7" and "schematic"

    You will get everything you need ! That how I got started with that chip !

    You will even find sample sketches for the Arduino.

    Keep in mind that people will help you up to the point where it seems like you are not making you own research !!!
     
    kourosh daryaee likes this.
  11. kourosh daryaee

    kourosh daryaee

    38
    4
    May 12, 2016
    I have a problem with driving Smd led ,I found that they are 3 volt ,1-watt LEDs, which i think it means their currents consume is 350 ma.
    now according to
    so I used 2n2222 transistor so for 350ma current
    hfe =40
    Iload =350ma
    Vbe = 2
    Ibase = Iload/hfe= 350 / 40 =8750 μa
    since i need 350 ma ,I set Vbe as 2 according to datasheet
    so R=(5-2)/Ibase = 3 /8750μa =342Ohm

    but according to
    so
    R = ((5-2)*40)/(350ma*3) =114 Ω
    I used 1kΩ and 10kΩ and 80Ω and 380Ω as R for the circuit but on all of them led keeps on, with Ibase signal Low or High.
    First why there is 2 equation with different results for the same circuit?
    i checked the circuit multiple times so i can be sure there's no fault in wire's ,etc
    Can you tell me where is my fault?
     
  12. Harald Kapp

    Harald Kapp Moderator Moderator

    9,137
    1,846
    Nov 17, 2011
    Do you understand the meaning of "n" an d why you use n=3?

    It's not all to clearly stated in the reference you use but n=2...10 is an arbitrary value to ensure the transistor is really completely turned on (saturated). 3*114 Ω = 243 Ω, this is where the difference between your two calculations comes from. By using hfe=40 you use the minimum specified hfe for the 2N2222. The real hfe will be higher, which already gives you a safety margin. The max. specified hfe is 300, so the real value will be somewhere in between.
    Assume hfe=100 and you get Rbase = 855 Ω. That's why you see the LED on with Rbase=1 kΩ or 380 Ω in your tests.
    Also Vbe=2 V is the max. value (worst case). The real value is likely to be much less, around 0.6 V ... 0.8 V. You can simply measure this value with a multimeter. Less Vbe means the voltage drop across Rbase is higher, therefore Ibase is higher and the transistor is easier saturated.
    Rbase = 80 Ω completely drives the transistor into saturation, meaning there will not be more collector current due to increased base current (lower Rbase) as the transistor is already fully on.
    With RBase = 10 kΩ the LED will still be on. I'd expect a slight difference in intensity when you compare directly one LED where Rbase = 10 kΩ with another where Rbase = 1 kΩ.

    Using worst case parameters (e.g. hfe=40, Vbe=2 V) of a datasheet is good design practise to produce a circuit that works under "all" circumstances. However, as you noticed, it involves design decisions that lead to possibly unreasonable results (e.g. component values, power dissipation). You'll have to take a close look at the parameters and the conditions under which these are valid (or defined).
    If you look at e.g. this datasheet from OnSemi, you will find a graph of hfe vs. Ic which shows that hfe declines rather sharply for Ic > 100 mA, but for IC = 350 mA, hf >=70 is much more than the worst case hfe=40 for Ic=500mA.
    Reading and understanding a datasheet is an art by itself :D
     
    kourosh daryaee likes this.
  13. kourosh daryaee

    kourosh daryaee

    38
    4
    May 12, 2016
    Hi, I have got a weird problem and that is when I plug the arduino to power my speaker starts a noise.
    since both of them are connected to the car battery i think they make a circuit . but how the arduino can
    affect the sound that comes out of the speaker? that is my question.and if you have any idea how can i solve this problem I will be thankful.
    last time i used a Ground Loop Isolator but that was for to isolate sound input , this time, the noise comes from power plug will the ground loop isolator work?
     
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

-