Trouble with MOSFET solenoid driver.

I am attempting to recreate a project seen on JameCo.com that uses solenoids to tap on random objects (link), for an art show starting on Friday. I bought the parts they list (enough for 15 driver circuits), then successfully tested one of breadboard. I tested one driver on perfboard and had no problems, so I built a total of 10 drivers on the same perfboard using common +12V and GND rails. However, now none of them are working!

I created a simple sketch that simply flips one pin of my Arduino (a Teensy++ 2.0 from PJRC.com) HIGH for 5 seconds, then LOW for 1 second. Using a multimeter, I see that the indeed works just fine. When I run a wire from this same pin to the input of one of the solenoid drivers, I only measure ~1V coming from the microcontroller when it's supposed to be HIGH! As a result, I never am able to measure +12V across the terminals leading to the solenoid, and am obviously unable to get a solenoid to activate at all through the drivers.I have since removed all but one driver from the power rails in order to verify my earlier results, but am unable to do so. I just keep seeing ~1V from the microcontroller pin.

My schematic: http://i.imgur.com/EF1QJ.png
PCB layout (exactly how I wired it up on perfboard): http://i.imgur.com/Q2XPH.png
Album of pictures of my perfboard wiring: Imgur: The magic of the Internet

General information:
MOSFET = RFP12N10L from Jameco (link)
Here is the article from Jameco: http://www.jameco.com/Jameco/workshop/diy/crashspace.html

I am truly at a loss for what exactly to think about / research at this point, as I have not had much prior experience w/ MOSFETs. Any advice or debugging help would be GREATLY appreciated (did I mentioned this is for an art show starting on Friday? :slight_smile: )

Need to see the testing sketch you are using. Sounds like you might have forgot to set the pin mode for output mode for the pin you are testing. A digitalWrite(pin#,HIGH) will measure as a +5vdc output on a meter, because that turns on the internal pull-up resistor, but it can't supply much current.

If you just want to test your hardware, run a test wire from +5vdc and touch it to each gate one at a time and see if it's associated solenoid turns on or not, lift the wire and the solenoid should turn off.

Lefty

Hi,

  1. What value are you using for R1 in your schematic?

  2. On your pcb you have one of the Arduino inputs marked +. In fact the one you have marked + should be connected to Arduino GND, and the other one to the Arduino output pin.

@retrolefty: The sketch is extremely simple - nevermind the pin names, they are used for the Teensy++ 2.0

void setup() {
  pinMode( PIN_F1, OUTPUT );
  pinMode( PIN_D6, OUTPUT );  
}

void loop() {
  digitalWrite( PIN_F1, HIGH );
  digitalWrite( PIN_D6, HIGH );
  delay(5000);
  digitalWrite( PIN_F1, LOW );
  digitalWrite( PIN_D6, LOW );
  delay(1000);
}

I will try to trigger the gates using a straight 5V source soon, that should help.

@dc42
1: 10k
2: That plus mark is actually a registration mark for the Eagle part, you are correct about which one is actually ground and so on :slight_smile:

I put a 7805-based 5V regulator on breadboard, then ran the output to the gate of one of the MOSFETs, and the solenoid indeed activated just fine.

I have a hunch right now that perhaps the power sources are 'compatible'. I am using a standard 12V@3A brick-style power supply for the solenoids, but I am powering the Teensy++ 2.0 straight from USB. I have tie both systems' ground lines together, but it doesn't seem to help. When I separate the ground lines, I am able to measure +5V on my microcontroller pin, but when they connected, I only see ~1V.

Should I run the Teensy off the same power supply, through a 7805-based 5V regulator? I will try to do so and see what happens, but just curious if that is the problem or not.

When I separate the ground lines, I am able to measure +5V on my microcontroller pin, but when they connected, I only see ~1V.

Should I run the Teensy off the same power supply, through a 7805-based 5V regulator? I will try to do so and see what happens, but just curious if that is the problem or not.

Something sure doesn't seem right about that. As long as the ground of the solenoid power supply is wired to the Teensy's ground, it shouldn't matter how the Teensy is powered.

I would double/triple check your wiring between the Teensy and the PCB. One volt output on a Teensy output pin could mean it is driving too much current into some kind of low resistance path to ground and might damage the output pin(s). You need to solve this first before proceeding much further. Perhaps taking a quick series DC current reading from a Teesy output pin while it's in the 1vdc high state and see how much current (or if any current) is being drawn somewhere? There should just be the 10k ohm resistor load to ground for each output pin, so just .5ma when at +5vdc HIGH state.

Perhaps first when you are testing using the regulator +5vdc output to test gate input, measure the series current being drawn by the gate circuit for each solenoid circuit.

Lefty

h4t:
When I separate the ground lines, I am able to measure +5V on my microcontroller pin, but when they connected, I only see ~1V.

  1. Are you sure that the output from your 12v power supply is floating, i.e. neither side of the output is connected to earth before you connect the grounds together?

  2. When you connect the grounds together, does the +5v on the Teensy still read +5v wirth repect to GND?

  3. Are you sure the resistor really is 10K? If in any doubt, check it with a multimeter. Resistors with 1% or 2% tolerance and 5-band colour codes are all too easy to read backwards.

I will need to get a hold of some equipment to measure the current draw, my multimeter fuses were blown long ago.

In the meantime, answers to dc42's questions:

  1. Not sure I completely understand the question - how can I tell if something is connected to earth? Like I said, I have the Teensy being powered by USB, perhaps that goes to earth.
  2. Just measured this, and was able to get +5V across the Teensy power pins when all grounds connected.
  3. Yes, I just measured it w/ multimeter, definitely getting 10k

I'm wondering whether there is something strange about the Teensy add-on for the Arduino IDE that means that your pinMode calls are not working. If the pins were still behaving as inputs, then the internal pullup resistor in combination with your 10K resistor might produce the same symptoms (see retrolefty's comment).

Here are a couple of things you could try:

  1. With the mosfet driver disconnected from the Teensy and the grounds not connected either, connect a 10K resistor between the output pin and ground. What voltage do you get at the output pin when it is supposed to be high?

  2. If you remove the pinMode calls in setup(), do you still get the same behaviour i.e. same voltage of ~1v at the output pin?

Sounds like the +5V of the computer's USB supply is grounded somehow. Try powering the Arduino another way?

Also that perfboard circuit needs decoupling capacitors for the relay supply...

Looks like this is going to have to wait another couple weeks. I tried applying 5V through a 7805 voltage regulator to my Teensy, and apparently destroyed it in the process. Now I've got to desolder the damn thing and buy a new one. Still not sure at all what happened or why, but such is electronics.