Nope. I even removed the sparkcore from the equation completely and still nothing. I’ve double checked that it is getting the 5v and it definitely is.
And if you connect the MOSFET input to GND?
You did say you had this working on your Arduino, right?
Yes, it works perfect on the arduino. When you say the mosfet input to ground do you mean the ground pin on the mosfet board? I tried connecting the mosfet directly, both positive and ground directly to the buck converter with and without the signal attached as well as with and without the 4.7k resistor.
Let’s get back to the Arduino. What you need to do is to test the MOSFET board by manually connecting the input to +5V on the arduino and then GND, again on the arduino.
So, the MOSFET board Vcc is connected to 5V on Arduino, GND to GND on Arduino and input on MOSFET to either 5V or GND to see which one turns the motor on.
I made a discover…and maybe this is what you wanted me to do but I’m confused by you talking about the mosfet chip vs the mosfet board. If I touch the center pin of the mosfet directly the motor runs. Here is a visual.
@james211, what is mean is on the 3-pin connector! That small chip is most likely an OP-AMP. If you are correctly powering the BOARD (via the 3-pin connector), the PWR LED should light. Then if you connect the INPUT pin on that 3-pin connector to 5V or GND, the OUT LED should light on one of those.
Here is a picture of my current setup and currently the power light is on, and the OUT LED blinks every 20 seconds, which to me indicates its getting the signal from the spark core.
The INPUT pin connects to 5V, Signal to D0 (I was playing at the moment between D0 & D4) and Ground goes to ground. I’ve also tried the ground on the other side of the spark core.
@james211, take the wire from D0 and instead connect it to 5V or GND to see which one turns on the motor. If this does not work, something is fishy since this works with your arduino.
If I connect the wire from D0 to 5V the motor runs.
Ok, now try connecting it to the 3.3V pin instead of 5V to see if it runs.
That doesn’t work. I plugged back into 5V and dialed the buck converter down until the motor shut off, seems the tipping point is 4.5V.
Ok, so 3.3V on the INPUT of the 3-pin connector of the MOSFET board does NOT work but 5V does, correct?
That is correct sir. I have to admit, this makes no sense to me why it doesn’t work. I’m assuming it has something to do with the fact that the sparkcore runs at a lower voltage than the arduino? But you surely will know better than I.
Ok, so you need a level shifter to boost the output of the Spark to 5V. You can do that with:
- An NPN transistor in open collector mode
- A level shifter like this: https://www.sparkfun.com/products/12009
Ok…let me ask you this then, because this is starting to get to be a bit bulky, a lot of parts. Is there a more compact solution for doing this? I assume this is why motor shields are built, to accommodate for these sorts of things. Is it possible to build all of this onto one circuit board? A motor shield that would work?
I do have an adafruit motor shield v2.0, maybe I work that out to work with the shield…trying to work this out in my head…
By the way, I appreciate all your help, you have a lot of patience.
You guys are having fun I see
Can you try a test to check something?
Set it up for 5V input on SIGNAL and measure the voltage on the GATE pin of the MOSFET (this is the one with the track connected to the little IC, closest to the TinkerKit writing.
Now power it from 3.3V and apply 3.3V to the SIGNAL. Measure again the signal on the GATE pin.
Also, during both tests, measure the voltage on the DRAIN of the MOSFET for both input. This should be whatever voltage your motor is set for on V+ and drop to near ZERO when the MOSFET is on. You are probably going to see this drop somewhat when you apply the 3.3V but I expect this to be close to zero for the 5V input.
PS… Touching ground to the un-connected middle pin will turn the motor on as this is connected to the DRAIN of the mosfet, the tab.
When checked with 5.0V Applied: 0.05V
When checked with 0.0V Applied: 12.10V
When checked with 3.3V Applied: 12.02V
When checked with 0.0V Applied: 12.10V
This is interesting and it would appear that 3.38V is not enough to switch the MOSFET on although as ScruffR points out, it should be more than enough.
Now, I assume you are powering the input with 3.3V when using the SPARK core but how about if you power this input with 5V? What are the results of the above test?
With N type MOSFET’s the gate has to be at the SOURCE voltage or a little higher to switch it fully on. I am assuming the little OP-AMP is setup to take care of this so you may need a higher voltage on the + input on the 3 pin connector to get this to work. The 5V from the Arduino is probably enough to start the MOSFET conducting but it won’t be at full current capacity. Can you input +12 to this pin?
I couldn’t find any schematic for this little board but I am assuming this should be OK to do and the OP-AMP is rated for this. Don’t do this if you know otherwise.
The other idea to try before you do this is set the motor voltage to 3.4V and see if the MOSFET switches on. The DRAIN pin should go close to 0V when the input is 3.3V. This will then prove that you need to get the gate voltage close to the motor voltage otherwise the MOSFET will not conduct enough current to run your motor or turn on.
I use an N type MOSFET to switch a +24V supply and I have to apply +24V to the gate to get it to conduct.
The specs on the IRF520 are deceptive. @v8dave, I am not too sure what that op-amp is doing but at 12 volts, the gate should be at least 4.5V to get about 1A of drain current. This is nowhere near the “low” gate threshold voltage in the spec! Sorry about that @james211
So because of this, I would recommend a motor control shield. @Hypnopompia hooked up an Adafruit motor shield v2.