Go Down

Topic: Controlling slots cars with a mosfet (Read 1 time) previous topic - next topic

bobster

Ok let me apologise for being a newbie.
I am in the middle of a project for work and I am stuck on a power control issue

I am trying to automate the speed of a Scalectrix car using a Freetronics N Mosfet - http://www.freetronics.com/products/n-mosfet-driver-output-module#.UJeukRin5Ak
controlled by a Ethermega http://www.freetronics.com/collections/all-products/products/ethermega-arduino-mega-2560-compatible-with-onboard-ethernet#.UJeuwRin5Ak

I seem to have the Mosfet wired in OK. I had it controlling a 9v led, fading up and down perfectly. When I wire it up to the 16v track i get a strange result - the mosfet can no longer be switched off and the voltage ranges from 16v and 24v when a PWM signal is altered.

Can someone give me clue if I have the right mosfet or if there is a better way of doing this.

Thanks for any help that can be offered.

Runaway Pancake


I seem to have the Mosfet wired in OK. I had it controlling a 9v led, fading up and down perfectly. When I wire it up to the 16v track...

Just how are you doing that?
Which PWM pin are you using?
If you digitalWrite a "1" to it does it go full on, and, if you digitalWrite a "0" to it does it go off?
It's running a motor, basically, but I'll bet there's no "flyback" diode across +V and that module's D terminal.
"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

bobster

the very basic sketch i have been using for testing is here, I've been altering the output to pin 9 from 0 to 255. Should I be using a digitalwrite?
I'm not sure about the diode but I thought the module dealt with that?



void setup()  {
  pinMode(9, OUTPUT);
  analogWrite(9, 0);
}

void loop(){}

dc42

Post a schematic showing how you have connected the Arduino, mosfet, motor, and motor power supply together. A hand-drawn one will do.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Runaway Pancake


the very basic sketch i have been using for testing is here, I've been altering the output to pin 9 from 0 to 255. Should I be using a digitalwrite?
I'm not sure about the diode but I thought the module dealt with that?

void setup()  {
  pinMode(9, OUTPUT);
  analogWrite(9, 0);
}

void loop(){}


If you have the motor/slot between +V and the FET module's "D", then there ought to be a diode across the motor/slot as previously described. (There's nothing on the board that way, it's an off-board consideration.)

Code: [Select]

void setup ()
{
   pinMode (9, OUTPUT);
}

void loop()
{
  digitalWrite (9, HIGH);
  delay (1500);
  digitalWrite (9, LOW);
  delay (1500);
}


Code: [Select]

void setup ()
{
   pinMode (9, OUTPUT);
}

void loop ()
{
   // ramps up and back down, then takes a 2 sec
   // rest and starts over
   analogWrite(9, 10);
   delay (1000);
   analogWrite(9, 75);
   delay (1000);
   analogWrite(9, 150);
   delay (1000);
   analogWrite(9, 250);
   delay (1000);
   analogWrite(9, 150);
   delay (1000);
   analogWrite(9, 75);
   delay (1000);
   analogWrite(9, 10);
   delay (1000);
   analogWrite(9, 0):
   delay (2000);


Anyway, do show your work, sketch and photo your set-up.
D5 and D6 have a situation where very low PWMs are greater than the numbers (that's mentioned in the 'Reference'), that's why I asked how digitalWrite worked.  Just trying to help you wring this out.
"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

jwbriney

Has anyone found a solution to this issue.  It seems to me that the issue is most likely a wiring one with the mosfet and not a software issue.  Any help would be appreciated and I'll post a schematic of how we're running it in another reply.

dc42

It's not possible for me to diagnose the problem without seeing a schematic of how the system is wired up.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Go Up