Completely new at this

Thread Starter

32_d3gr33s

Joined Oct 29, 2011
35
everyone kinda dissapeared out of here... I'm thinking about trying a microcontroller, but im not sure how that would be set up? would it be the same as with the timers, but have to controller in place of the timers and diodes? really want to get some parts ordered, but still kinda lost on what to get. What micro controller is good to use? How many outputs would i need to do the lightbar like in the first video i posted? I downloaded the picaxe software, but am not quite sure what to do with it... if i buy one of the kits, does it come with instructions on how to begin programming?
 

Wendy

Joined Mar 24, 2008
22,178
One by one you've hit the point where various people like me can't help. :D That and the project is much harder than you thought when you first saw it.

"Help me tracecom, your my only hope!"
 

elec_mech

Joined Nov 12, 2008
1,500
Since you opted for the micocontroller (uC) route, I assumed Tracecom was helping you. He may be busy, but I've programmed before, so I can at least give you some guidance.

First, all uCs offer downloadable manuals so you know what you're getting before you buy so you don't buy the wrong thing. PICAXE does too. If you buy a kit, it will either come with a CD with the same manual you can read online now or it will come with a piece of paper telling to go to their website for the manual. Take a look at their manuals here: http://www.picaxe.com/Getting-Started/PICAXE-Manuals/

The first manual seems to focus a lot on the technical aspects, but look at page 7 - this shows you what your program will look like in a nutshell as you're flashing LEDs. Then I suggest looking at the Section 2 (second manual) which focuses on the BASIC commands.

When selecting an uC, you need to define the total number of inputs (switches, sensors, etc.) and outputs (LEDs, buzzers, motors, etc.) you need as well as speed, analog to digital (ADC) conversion if any, etc. For your project, even the slowest uC will still have plenty of speed to do what you want, so there is no problem there. You do not need ADC. You do need a minimum of 3 outputs, possibly 4. I do not know if you want to change the speed with a switch or knob or if you plan to only change the speed by reprogramming the chip. That is something to consider.

Tracecom said he used a PICAXE-08M, a -08M2 now I presume. This is a small 8 pin IC with 4 outputs with a couple of inputs if you need it, so it is probably a good choice to stick with. It appears to be available in an SMT size as well, though I couldn't quickly locate a U.S. supplier.

Two of your output pins will be used to control the left and right side red/blue LEDs. You can control the yellow/white sets with either with two independent outputs (one for each set) OR one output if you're okay with one set coming on whenever the other set is off. This is what I did in my discrete logic circuit by tying the output signal to an NPN MOSFET and a PNP MOSFET. When the signal goes high, the NPN MOSFET is on (PNP is off) and one set of yellow/white LEDs is on. When the signal goes low, the PNP MOSFET is on (NPN is off) and the other set is on.

Because a uC will not be able to provide enough current to the LEDs, you can use MOSFETs as I've shown in my digital logic solution. You can use my circuit as a reference, just eliminate the diodes and ICs. The uC can be connected directly to the MOSFET gates. Tracecom used a transistor array (ULN2803) to demonstrate and it will work, but there will be a voltage drop going to the LEDs and current consumed by the transistor array which all leads to a shorter battery life. Using 3-4 individual MOSFETs should take up less board space as the ULN2803 is a 18-pin IC and should give you better battery life, i.e., longer run time.
 

tracecom

Joined Apr 16, 2010
3,944
The schematic for my PICAXE solution is attached. Note that it is not the exact circuit that I prototyped, but should work the same way (although it may require some minor troubleshooting.) The reason that I am not posting the exact circuit that I prototyped is because I tried to reduce the component count in order to meet the PCB space constraints.

Here is the very simple code required to flash the LED's in the triple flash pattern shown on the video. Other patterns will require different programming.

Note that the LED group numbers in the code (and in the schematic) refer to the groups defined in the drawing in post #6. In addition, the designations for the LEDs on the schematic include a color reference as the last letter in the designation.

Rich (BB code):
'Drive LED's in police car pattern
    'Triple flash red, triple flash blue, wig-wag white and yellow.
'PICAXE-08M or 08M2; see schematic: Lightbar Controller 2.jpg

symbol delay = 50    'pause duration in milliseconds
let dirs = %10110    'sets pins 4, 2, and 1 as outputs
                'pin 3 is always an input; pin 0 is always an output

flash:
    let pins = %00101    'LED groups 1 and 3
    pause delay
    let pins = %00100 'LED group 3
    pause delay
    let pins = %00101    'LED groups 1 and 3
    pause delay
    let pins = %00100 'LED group 3
    pause delay
    let pins = %00101    'LED groups 1 and 3
    pause delay
    let pins = %00100 'LED group 3
    pause delay
    let pins = %10010    'LED groups 2 and 4
    pause delay
    let pins = %10000 'LED group 4
    pause delay
    let pins = %10010    'LED groups 2 and 4
    pause delay
    let pins = %10000 'LED group 4
    pause delay
    let pins = %10010    'LED groups 2 and 4
    pause delay
    let pins = %10000 'LED group 4
    pause delay
    
    goto flash        'endless loop
As I posted at the beginning of this thread, an electronics beginner will be very challenged to complete this project. I don't have the time to provide the needed assistance, but elec_mech seems willing and very capable.

Thanks for that.

ETA: Note that the regulator circuit was designed to work with a wall wart; as such, it contains more filtering than will be needed if it always has a battery input and elimination of the electrolytic caps is one possible way to reduce the component count and save some PCB space.
 

Attachments

Last edited:

Thread Starter

32_d3gr33s

Joined Oct 29, 2011
35
Thanks guys for all the help. I guess im at the point now, where i need to give it a shot. I really appreciate all the time and help you guys put into this. This is all quite interesting to me, but im more of a hands on type of guy. I need to get it in front of me and do some tinkering, and hopefully ill catch on! Ill post an update once i get it all sorted out, and have given it a try. I more than likely will be back with a few questions before then though! Thanks again!
 
Top