suburb of Chicago, IL
Offline
Newbie
Karma: 0
Posts: 20
Arduino newb.
|
 |
« Reply #15 on: January 12, 2011, 04:37:01 pm » |
Does anyone know of a tutorial or guide to explain the menu library? I'm having a hard time figuring it out.
I'll look into those mosfets, there are some local electronic stores still around here so I'm going to see what they have as well.
|
|
|
|
|
Logged
|
|
|
|
|
South East England
Offline
Newbie
Karma: 0
Posts: 27
Arduino rocks
|
 |
« Reply #16 on: January 12, 2011, 05:21:11 pm » |
If you scroll down on the page given there is example code. SHould be able to figure it out but basically.
* you set up all menu items as variables * in the setup() method you add them to the correct places * when a user selects an item it calls the method menuUsed()
you put your code in place of the Serial.println()
hope this helps
|
|
|
|
|
Logged
|
|
|
|
|
suburb of Chicago, IL
Offline
Newbie
Karma: 0
Posts: 20
Arduino newb.
|
 |
« Reply #17 on: January 13, 2011, 03:10:45 pm » |
I'll have to take a look at the code again. Also, this mosfet should work right? http://www.sparkfun.com/products/10213
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 282
Posts: 15435
Measurement changes behavior
|
 |
« Reply #18 on: January 13, 2011, 03:22:14 pm » |
That's a good logic level N-channel mosfet with lots of beef and can be controlled directly with a arduino ouput pin.
Lefty
|
|
|
|
|
Logged
|
|
|
|
|
suburb of Chicago, IL
Offline
Newbie
Karma: 0
Posts: 20
Arduino newb.
|
 |
« Reply #19 on: January 13, 2011, 03:23:54 pm » |
Awesome! Because I got a $30 coupon from sparkfun during their Free Day a couple of hours ago. Time to go shopping!
|
|
|
|
|
Logged
|
|
|
|
|
suburb of Chicago, IL
Offline
Newbie
Karma: 0
Posts: 20
Arduino newb.
|
 |
« Reply #20 on: January 19, 2011, 03:15:40 pm » |
So I got my mosfets in today but when I tried to test them they just stayed "on" regardless of if there was 5v on the gate or not. I tried running both sides (12v & gnd) through it and both times it would just turn on.
Anyone have any ideas?
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 282
Posts: 15435
Measurement changes behavior
|
 |
« Reply #21 on: January 19, 2011, 04:47:48 pm » |
Anyone have any ideas? Can you post a drawing and are you sure you have identified the base, source and drain terminals correctly? Lefty
|
|
|
|
|
Logged
|
|
|
|
|
suburb of Chicago, IL
Offline
Newbie
Karma: 0
Posts: 20
Arduino newb.
|
 |
« Reply #22 on: January 19, 2011, 05:10:16 pm » |
I used the data sheet from the manufacturer to identify the pins, but I also used other combos of pins just to test it. Here's the drawing of how it "Should" work according to the data sheet.  The pins from left to right are: Gate, Drain, Source
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Boston area, metrowest
Offline
Brattain Member
Karma: 269
Posts: 17031
Available for Design & Build services
|
 |
« Reply #23 on: January 19, 2011, 07:30:55 pm » |
The N-Channel MOSFET wants to act as a switch for the LED ground. You appear to be wired up for a P-Channel MOSFET, which wants to act a switch for the + supply.
You should have this instead: 5V to resistor to gate. 12V to resistor to LED anode. LED cathode to Drain. Source to ground. Arduino ground, 5V supply ground, 12v supply ground, all connected.
If you have 12V to resistor to LED Anode, LED Cathode to ground, the LED should turn on. If not, your LED is bad, or your resistor is too high.
I would not drive a single LED with 12v, 5V is better. With 12v, you should be driving at least 2 LEDs, 3 would be better. With 12V you may not see the LED turn all the way off, many LEDs will not withstand that much reverse bias.
|
|
|
|
|
Logged
|
|
|
|
|
suburb of Chicago, IL
Offline
Newbie
Karma: 0
Posts: 20
Arduino newb.
|
 |
« Reply #24 on: January 19, 2011, 08:46:10 pm » |
I used one LED as an example, I'm actually running a strand of 12v leds that are made for automotive applications.
I also tried switching the ground and again the led would turn on as soon as I applied power.
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 282
Posts: 15435
Measurement changes behavior
|
 |
« Reply #25 on: January 19, 2011, 10:51:59 pm » |
Wire it as CR posted, source lead of mosfet must go to common ground.
Lefty
|
|
|
|
|
Logged
|
|
|
|
|
suburb of Chicago, IL
Offline
Newbie
Karma: 0
Posts: 20
Arduino newb.
|
 |
« Reply #26 on: January 19, 2011, 10:54:55 pm » |
I actually JUST figured it out.
What was happening was when I tested it I didn't have the gate attached to anything, so it couldn't "drain". So once I put ground on the gate, it would turn off the leds. So I'll have to add a 10k pull down resistor between the gate and gnd.
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 282
Posts: 15435
Measurement changes behavior
|
 |
« Reply #27 on: January 20, 2011, 12:10:50 am » |
So I'll have to add a 10k pull down resistor between the gate and gnd. Yes, helps prevent a floating gate situation. It's also a safety factor to force the mosfet off in cases where the arduino might be powered off but the mosfet's external voltage is still on. Lefty
|
|
|
|
« Last Edit: January 20, 2011, 12:13:45 am by retrolefty »
|
Logged
|
|
|
|
|
|