Pages

Friday, March 29, 2013

Police LED Light Bar

Well, where to start. Ok, Let's start with Why I created Police light? First of all I really like police, fire and all kind of that light. I could watch it whole day. lol So I decided to make one for my personal use. One reason was because I like it, and second was it can help you when you stuck in traffic just turn on and everybody let you go. I was looking on internet for PIC or ATmega328, and I decided to use ATmega328 (Arduino) due to simplicity of writing code. PIC has more complicated process to program and upload code. I bought Arduino from some England seller on ebay. It was about 30 bucks. When it came for 2 weeks I started creating patterns with 4 LED-s on Breadboard with my own jumper wires. After I learned more and more I made one with 10 LED-s. With 10 LED I couldn't put it in CAR before I connected TRANSISTORS (for 12V) between Arduino and LED after i connected it I tried to put it in CAR but always one wire broke and I always need to solder it. That get irritated and I started think about to make PCB with ATmega328 and TRANSISTORS which can be easy to connect with LED. First I will show you my PROTOTYPE board and after that REVISION 1 where I changed TRANSISTORS MJE13005 with ULN2003A. How, Why, Where? I'll explain below!   



Parts 

  • 1 - ATmega328P-PU - Microcontroller
  • 2 - C1,C2 - 22pF - Capacitor (Come with Crystal)
  • 2 - C3,C4 - 100nF - Capacitor ( Filter for power supply)
  • 1 - D1 - 1N4003 - Diode
  • 1 - MC7805T - Voltage stabilizer (From 12V to 5V for Microcontroller) 
  • 2 - R1,R2 - 10kOhm - Resistor
  • 1 - R3 - 1MOhm - Resistor (come parallel with Crystal)
  • 2 - U1,U2 - ULN2003A - Transistors 
  • 1 - XTAL1 - Crystal (quartz) oscillator 
  • 1 - SW1 - Switch button (For changing patterns)
  • 1 - J1 - Header 2-pin for power supply
  • 1 - JP1 - Header 2x20-pins (IDE cable in computers)  

Here is Scheme of my prototype board.
I'll explain every segment of this scheme below.




1. Let's start with power supply
As you can see on schematic,  +12V and +5V is connected with Capacitor. Now someone will ask. Why do we need capacitor? Well, here is capacitors only used like filter of voltage, as we know that voltage isn't 100% smoothed. Capacitors must decrease bumps of voltage as much as possible then we can get smoothed voltage which will be used for circuit. All circuit can work without these capacitors but if you can to put it into your schematic I deeply recommend. It's usually used 100nF capacitors for power supply. MC7805T is voltage stabilizer with 3 pin (Vin, GND, +5V) it's very easy to connect. I'll show you how to connect in Tutorial

 

2. ATmega328P-PU
He contains all my programs (patterns) for light and with switch we can change them. What we need to be careful? When we creating Schematic with Microcontrollers, ALL +5V(pin 7 and 20) need to be connect together and also ALL GND(pin 8 and 22). And another thing is RESET pin MUST BE CONNECTED, you can do it like me or you can put one more switch button. How? I'll show you in tutorial.



























3. RESET
Like I wrote above, RESET MUST BE CONNECTED. I don't know how it works in other Schematic/ PCB programs but if you didn't connect RESET PIN in ALTIUM DESIGNER. He won't make PCB before you connect RESET. My reset contains diode parallel with 10k resistor and all connected to +5V but also you can put switch button.


4. CRYSTAL with CAPACITORS and RESISTOR
Someone will ask why we need CRYSTAL, CAPACITORS and RESISTOR circuit can work without these components but ANSWER IS NO. Microcontroller CAN'T WORK WITHOUT THESE COMPONENTS. Why? Because without crystal processor(atmega328p-pu) is dead. Crystal with his own OSCILLATIONS creates frequency (tact,beat whatever) necessary for stable work of processor. If you don't have crystal your processor hasn't frequency for normal working and he won't work.



5. SWITCH BUTTON
Switch button is connected with 10k Resistor and he always hold state '0' when we press button, +5V make a little voltage drop on resistor and the rest voltage (3.6V-5V) go to ATmega328 which he reads like state '1' with changing states we change programms on LED. Can we put smaller resistance? Theoretically yes, but we want switch without errors. So if you put Smaller resistor, there will be bigger voltage drop and the rest of voltage (required 3.6V-5V for state '1') will be smaller and you risk mistake on ATmega328. If that voltage drop is in NEUTRAL border of  2.2V - 3.6V Atmega328 doesn't know which state it is. I usually use 10k Resistor. Here below is table of which state is which voltage.
STATE                   Voltage       
   '0'                      0V - 2.2 V
Neutral              2.2V - 3.6V
   '1'                    3.6V - 5V


 

6. MJE13005, RESISTOR 4K7
Why we need MJE13005? This circuit is planed to put it in car like i wrote in introduction. I had 12V LED but Arduino or ATmega328 can give maximum of 5V with 5V LED can't work (flash) so i need transistor to connect 12V from car to LED  without destroy microcontroller. How i connected MJE13005? Signal from ATmega is connected to BASE (1), EMITTER (3) to GND and COLLECTOR (2) goes to CATHODE(-) OF LED,  12V goes to ANODE(+) of LED. As you can see on Picture. What is GOOD TO KNOW ABOUT MJE13005?  You need to know that if you are working with some fast patterns that loops 2 or more times in 10ms-20ms, MJE13005 is too slow for that fast switching he will do it 2 times but if you go to more and more loops he doesn't work properly. Also you can read all specs in MJE13005 DATASHEET.




7. HEADER 40X2 (Computer IDE cable)
It's an usual IDE cable which everybody have in computer (HDD to Motherboard). Why i used this header? I don't know, i had some motherboard on the desk and i thought that will be accessible to everybody who want to make one, also practically to connect and don't take so much space. Maybe someone don't understand why is there +12V, like i said +12V goes from car directly to Anode(+) of LED.








Here is Prototype board in Altium Designer 10



















































PROTOTYPE BOARD IN 3D















 This is LED MODULE his feature is to facilitate connection between LED and MAIN BOARD.
Schematic


How it looks in Altium Designer 10

3D



REVISION 1 SCHEMATIC
Only difference between Prototype Board and REVISION 1 BOARD is that i changed transistors MJE13005 with ULN2003A. Why? Only reason was in speed, MJE13005 is too slow for fast patterns (10ms-20ms), ULN2003A satisfies all requirements for fast loops and that's why i changed it.


REVISION 1 In Altium Designer 10







 Board in 3D



Also Everything above you can find in PDF file below, with Rules Check, Components and much more but if you want to make board from PDF file i must WARN you that everything in PDF isn't in 1:1 Proportion. Just send me Email or message and i will send you Altium File.
First is Prototype Board after Revision 1

Police LED Light bar Prototype Board.pdf

Police LED Light bar REVISION 1. pdf


The Famous CODE for this Project.

Police LED Light Bar - Code


And The Results Is HERE




I Hope that Will be helpful. If you don't understand something or something missing please Send Email or message. Please like, subscribe, comment. New project will be here soon.

42 comments:

  1. Replies
    1. Sorry, it's fixed now and work properly!! :)

      Delete
    2. Code link works fine, which file you need?

      Delete
    3. Police LED Light bar Prototype Board.pdf

      Police LED Light bar REVISION 1. pdf
      it can not download

      Delete
    4. rev 1.pdf is uploaded again, you should be able to download it normally.

      Delete
  2. Thank You for sharing your work!!
    Tony

    ReplyDelete
  3. can you send me the altium file please? tskoziel@gmail.com

    ReplyDelete
  4. Would you send me the altium file please? bartonfisher@att.net

    ReplyDelete
  5. can you send me the altium file please? djlarry44@gmail.com. Thanks

    ReplyDelete
  6. How can I make this on my arduino uno? Thanks for your time.

    ReplyDelete
  7. Is the Altium file available and what is P1-P6 on the LED module?

    ReplyDelete
  8. Bro3112 would you be able to put up the revision 1 pdf file link again please?

    Thanks

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. Plz upload the Police LED Light Bar - Code the link is not work thx

    ReplyDelete
  11. Hi Bro3112, how are u? The links of the files dont work. Please upload again. Thx

    ReplyDelete
  12. Hi Bro3112, how are u? The links of the files dont work. Please upload again. Thx

    ReplyDelete
  13. Hi, great tutorial. I'm trying to put everything together, but how do you connect the LEDs? Also did you used 5mm LEDs? Thanks!

    ReplyDelete
    Replies
    1. Hi, I used 12V LED strips, So you connect 12V to positive side of LED and negative side of led to Collector of transistor

      Delete
  14. Thanks! Do you sell lenses or cases for lightbars?

    ReplyDelete
  15. What is the purpose for U1 and U2.

    ReplyDelete
  16. Thanks a lot for this Project, I have made this project on a breadboard with Aduino Uno R3, It is working well, Got a request from you, How can I add a siren to the code.

    ReplyDelete
  17. I’m going to read this. I’ll be sure to come back. thanks for sharing. and also This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice article... montypythonlive.com

    ReplyDelete
  18. Hi, I find reading this article a joy. It is extremely helpful and interesting and very much looking forward to reading more of your work.. christmas-laser-lights-work

    ReplyDelete
  19. Positive site, where did u come up with the information on this posting? I'm pleased I discovered it though, ill be checking back soon to find out what additional posts you include. wista floodlights

    ReplyDelete
  20. Share great information about your blog , Blog really helpful for us . We read your blog , share most useful information in blog . Thanks for share your blog here .
    โคม ไฟ โรงงาน

    ReplyDelete
  21. Hi Bro, you are so talented!

    Police LED Light bar Prototype Board.pdf
    Police LED Light bar REVISION 1. pdf
    it can not download. Could you send it to my email yumoyuan00544@gmail.com.

    Thanks in advance
    Sam

    ReplyDelete
  22. I wish more authors of this type of content would take the time you did to research and write so well. I am very impressed with your vision and insight. Best Computer For College Student:Expert Advice(2019)

    ReplyDelete
  23. Electronic security gadgets are frequently costly, so the mechanical gadgets is regularly utilized. it offers nearly a similar security on a lower cost. used car dealerships

    ReplyDelete
  24. Hello, I have browsed most of your posts. This post is probably where I got the most useful information for my research. Thanks for posting, maybe we can see more on this. Are you aware of any other websites on this subject. modern l shape desk

    ReplyDelete
  25. Having a far flung control automobile is an unbelievable enjoy for most youngsters or even grown-ups. ... INTEY RC motors Amphibious remote vehicle 1:12. .... Get your RC energized tyke this amazingly fast car constrained with the manual of an outlandish brush 540 cars ... It I Buy Prextex RC Police Car with Lights and Realistic Police Siren

    ReplyDelete
  26. It should be noted that whilst ordering papers for sale at paper writing service, you can get unkind attitude. In case you feel that the bureau is trying to cheat you, don't buy term paper from it. https://edmdownload.org/

    ReplyDelete
  27. Through this post, I know that your good knowledge in playing with all the pieces was very helpful. I notify that this is the first place where I find issues I've been searching for. You have a clever yet attractive way of writing. E-COMMERCE MLM SOFTWARE

    ReplyDelete
  28. This comment has been removed by the author.

    ReplyDelete
  29. It is rather very good, nevertheless glance at the data with this handle. garagebible.com

    ReplyDelete
  30. Electronic security gadgets are frequently costly, so the mechanical gadgets is regularly utilized. it offers nearly a similar security on a lower cost.
    먹튀폴리스

    ReplyDelete
  31. Tiras de luces LED al por mayor, Neon LED Flex y Custom Neon Sign, también pueden proporcionar soluciones profesionales de luces LED inteligentes. Luces LED para exteriores

    ReplyDelete