0
\$\begingroup\$

The TL;DR version of my question is, how do you control 20 pieces of 12V/1A outputs in the most reliable, compact and cost efficient way, with something programmable?

The long version: I got a lightbar (like the ones on top of police cars) which didn't work, turns out it was some cheap Chinese one with a crappy controller which failed, and it could only control 4 lights at a time anyway (space, and cost saving wiring), so I took it apart, threw away the electronics and now I'm rebuilding it.

The problem is, I need 20 outputs for the LED modules, around 5 inputs (more is better) for controlling and I need to store the flash patterns of the lights somewhere.

I broke the solution into 2 pieces, one is a controller, other one is the electronics for handling the current.

For the controller, my initial thought was using an Arduino Mega, which has plenty of I/O, but I had reliability problems with using it in industrial environments, and I'd prefer a 'normal' programming language over Arduino's own, other than that I couldn't find anything commercially available with this many pins. I also thought using shift registers to work around the pin number problem, but I'm worried it might be too slow for rapid flashing. Any ideas for a controller / solution?

For the electronics part, the best method I found was using 20 MOSFETs, because they can be switched quick enough, for now it seems like a good solution but if anybody has a better idea, I'm open to suggestions.

Part-wise I'm only planning on building one controlller unit (maybe two) so the plan is to do it on a solderable prototype board, designing and printing a PCB seems overly complex, but if it can be made simple, saving a few hours of soldering is always a good idea :)

\$\endgroup\$

closed as too broad by Chris Stratton, Voltage Spike, Dwayne Reid, Elliot Alderson, JRE Dec 30 '18 at 20:55

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    \$\begingroup\$ This is very broad and largely comes down to opinion. It's not clear if you can just power the LED modules or if you need to current regulate them. Using an Arduino board does not preclude a fully custom programming approach, but there are plenty of other MCU's with twenty I/Os, and Dev boards hosting them. \$\endgroup\$ – Chris Stratton Dec 26 '18 at 22:03
  • \$\begingroup\$ "Normal" Programming language? Arduino libraries are in 'C', no? \$\endgroup\$ – SiHa Dec 26 '18 at 22:05
  • \$\begingroup\$ Please provide more info. We need to know if the lights are constant voltage or constant current. Do they expect 12V or do they want a constant current driver? Try to post an internal schematic, or good quality pictures of the circuits so we can see how it's wired. Read Misunderstood's comment below my answer, and try to answer his questions. \$\endgroup\$ – peufeu Dec 28 '18 at 19:37
2
\$\begingroup\$

For the electronics part, the best method I found was using 20 MOSFETs,

Yes, best solution...

because they can be switched quick enough

...but wrong reason.

Good reasons to use FETs are: easy to drive, cheap, low RdsON so they don't heat up, you get two in a convenient SO-8 package...

Blinking a light at 10 Hz is really fast visually, but it's really slow from an electronics point. FETs can switch in tens of nanoseconds, which is fast, and completely irrelevant here. If you want to blink a light then you want your FET to switch slowly like 1µs in order to avoid EMI. This is very simple to do, just put a resistor on the gate, a few kOhms.

designing and printing a PCB seems overly complex, but if it can be made simple, saving a few hours of soldering is always a good idea :)

Either spend a few hours designing a pcb and have it printed by a shop like pcbway, or breadboard it... best option will depend on the controller chip which will be difficult to breadboard. Also on a PCB you can use SO8 dual FETs.

For the controller, my initial thought was using an Arduino Mega, which has plenty of I/O, but I had reliability problems with using it in industrial environments

Arduino is not intended for industrial environments.

Picking a microcontroller is a bit of a touchy-touchy topic which can devolve into holy wars. Let's be practical: if you know one already, pick this one.

other than that I couldn't find anything commercially available with this many pins.

Personally I'd pick an I2C IO expander with 8 outputs, and make a board with it and the corresponding number of MOSFETs. I2C is a bus and chips have addresses, so if you make 3 identical boards you get 24 outputs. You can also make a 20-output board, but it is less reusable.

Note this assumes your LEDs are wired with resistors and expect to be driven with 12V. If your LEDs require constant current drivers, then you will need to provide them.

In fact you should probably be able to find such a ready made board online. I made a quick search and didn't find one, though.

Here is another example ; this is a I2C controlled chip with 16 PWM outputs. If you wire this to 16 FETs then you got 16 dimmable outputs.

I also thought using shift registers to work around the pin number problem, but I'm worried it might be too slow for rapid flashing.

This is also an option. Don't worry about the speed, these are about 1000x faster than you need.

In fact your main problem is you got too many options...

\$\endgroup\$
  • \$\begingroup\$ Thanks for the answers, microcontroller-wise (without starting a war), which one would you choose for this application? Given that this can be used in negative temperatures and exposed to direct sunlight for hours (or days, you get the point, it gets hot) \$\endgroup\$ – Rickye Dec 26 '18 at 21:58
  • \$\begingroup\$ Pretty much any microcontroller can meet your requirements, so pick the one you're most familiar with, not the one I am more familiar with. Temperature range will depend more on components like capacitors than on the micro. If you want to store a lot of blinking patterns you might have a requirement on flash size though. \$\endgroup\$ – peufeu Dec 26 '18 at 22:04
  • \$\begingroup\$ How can you recommend a controller when you do not know what features or wattage is needed? An LED chaser circuit could work well for lightbars. Maybe not. Wattage can eliminate many possible solutions. The OP should specify voltage, current, the on-off sequence of each module, explain why there are 5 inputs and 20 outputs. How do you know FETs are "best solution". A buck CC driver is more often the best solution for high power projects. A boost is often the best for high voltage in automotive. Do lightbars need a dimmer? Is a µC even needed? Too many unknowns to even guess at this. \$\endgroup\$ – Misunderstood Dec 28 '18 at 10:11
  • \$\begingroup\$ @Misunderstood, OP specified 12V 1A per light \$\endgroup\$ – peufeu Dec 28 '18 at 11:12
  • \$\begingroup\$ In that case I cannot agree that a FET is "the best solution". It may be the most cost effective. But I still do not know enough about the lightbar to make that statement with any confidence. How is the current regulated? Where is the current sense feedback? Why 5 inputs? How are the LEDs wired? Are there any current limiting resistors? What does this mean: "how do you control 20 pieces of 12V/1A outputs"? Are you controlling output modules or providing the 1 Amp input? I'm not saying your answer is not good, I just could not make any recommendation without knowing the details. \$\endgroup\$ – Misunderstood Dec 28 '18 at 18:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.