Project Sanity Check

Hi all,

I've been a programmer for many years but I got an Arduino last year to teach myself electronics. I had a blast making a heap of things such as a 1 handed keyboard and laser beam obstacle course. Reading all the tutorials and helpful posts on this site has been a GREAT help since I've had no formal electronics training. I've now decided to make something a little more power hungry and before I spend the cash and get soldering I'd love it if someone could just sanity check my set-up. Since I'm fairly new and mostly self taught there is bound to be some (or lots) of things I've forgotten or screwed up :slight_smile:

For this project I want to turn on/off a few sets of LEDs with a pressure sensors. It reads the pressure sensors with analogue input and use the PWM output to fad in/out the LEDs. Think extremely small/limited version of a 70's disco dance floor. Press a "tile", pressure sensors register touch, a bunch of LED's inside the tile turn on (proportionally to the pressure).

I've have a demo set-up with 1 sensor running 1 led and it works great. But to make it light up a bigger tile brightly I'm going to need more LED's - I guessing at 10 or 20 per tile. My understanding is 1 PWM pin can't handle the current required for that many LEDs. Arduino pins can output 20mA max I believe so going by the LED wizard at http://led.linear1.org/led.wiz, with 15 LED's in parallel I need 300mA ... which clearly a no no. So the LEDs will need to be powered separately.

I've looked at LED controller specific chips but they're mostly about being able to control each LED individually. Since I only want to turn 1 set of LED's on and off I don't believe I need that (and I'd like to build as much as I can myself). My arduino has enough analogue inputs, and PWM outputs to cover the number of tiles I want, it's just the power it can't handle. After looking around an n-channel mosfet that I control from the arduino seems like a good solution.

Circuit Diagram is attach. Important parts are:

Power supply: http://www.jaycar.com.au/productView.asp?ID=GH1379&form=CAT2&SUBCATID=1000

  • Output: 12VDC @ 5 Amps total

LED: Super Brights Australia | Little Bird Australia

  • 3.4V, 20mA

MOSFET: http://www.jaycar.com.au/productView.asp?ID=ZT2400

  • 2N7000 n-channel, 200mA, 60v

So back to LED Wizard page. With 12volt source, 3.4v LED drop and 20mA current for 15 LEDs I get: 5 parallel sets of 3 LEDs in series, which a should draw 100 mA. If the 2N7000 has a max current of 200ma, then I don't think I'll destroy the mosfet with this setup (and 12v is way below the 60v limit).

Now if I'm using 100mA per "tile" with 15 LED's, then the power supply at 5Amps should be ok with supporting 5 tiles all in parrallel. That will be 500mA, well below the 5A limit (circuit diagram only has 3 sets of LED blocks but the idea for 5 sets is identical).

Then I'll hook up the Arduino PWM outputs to the gates of the mosfets, to turn each set on/off (with a pull down resistor so that the PWM pin don't float when the Arduino is off).

Ok - so what have I screwed up? There's always something. Or anything that can be improved? All comments welcome, thanks!

(Please excuse my Australian links, since I live in Australia shipping cost of shipping from US/EU is sometimes 2x or 3x the price of the parts so it's much better if I can source stuff locally and Jaycar is only 10minute driver)

*** Attachment doesn't seem to have worked: Uploaded it here instead! ***

Seems like you've done your homework. Looks pretty decent to me. But, I may be missing something too...?
Someone else may be able to give you a better idea as to the value of pull-down resistor and IF you may need a resistor between Arduino and Base of FET.

And....I'm assuming you're using an Arduino board (not just chip) so you will have Arduino powered by something other than how it's shown in schematic?

Other than that, I would just recommend breaking it down into chunks when building/testing....instead of building all at once and praying it works.
Example— Check that LED arrays will run from power supply. Check that FET can turn LEDs on/off. Check Arduino will turn FET on/off. Check that Arduino will read pressure sensors. Etc...etc....

Just get each small section working by itself before adding to the full project, right?

Good Luck!

After a recent discussion on another thread, I suggest you put a 150 ohm resistor in series with the gate of each MOSFET. That limits the current surge through the gate (ie. out the Arduino pin) to 33 mA. Maybe use slightly higher even (220R?), to protect the output pin a bit. They are really rated for 20 mA continuous, and in a PWM environment they will be switching on and off a lot.

The gates of MOSFETs look like fairly good-sized capacitors, and it's never a good idea to
connect a capacitor directly to an output pin. Best to isolate using 150-330 ohms or so
series-R.

For that matter, it's always safer to use a series-R in all the I/O lines.

Thanks everyone for the replies! I'll also be sure to put a resistor in between the Arduino IO pin and the mosfet gate pin so I don't kill it (and then remember that trick in future). Your time/effort spent reading my post is appreciated!

@1ChicagoDave: I do have a full Arduino board as you thought, not just the chip so it's all setup with power etc. While building I also will definitely do the build in chunks, effectively unit testing all the different sections as I go. Many years of software dev have taught me the evils of simply writing/soldering everything for hours then running it for the first time once its complete - that never ends well! I'm also not exactly sure how many LEDs I'll need to give a nice glow so I'll be testing that too along the way.