Go Down

Topic: Motors work with arduino UNO, don't work with 101 (Read 371 times) previous topic - next topic

moodydog

Hi,

Currently have two parallel motors connected to digital pin 9 on UNO. Works perfectly, have the same electrical configuration, swapped the board to a 101, same connections, motor doesn't work. Have tried on a number of digital pwm pins (I'm controlling via a MOSFET so I can alter the speed).

Any ideas as to why it doesn't work? Is the code slightly different for the 101 to control motors?

Code: [Select]


#include <Servo.h>

Servo myservo;

int pos = 50;

const int motorPin = 9;

void setup() {
  // put your setup code here, to run once:
  myservo.attach(5);
  pinMode(motorPin, OUTPUT);
}

void loop()
{
 
  digitalWrite (motorPin, HIGH);
   
  for (pos = 50; pos <= 120; pos += 1){
    myservo.write(pos);
    delay(30);
  }
  for (pos = 120; pos >= 50; pos -= 1){
    myservo.write(pos);
    delay(30);
  }

}


CrossRoads

What's the MOSFET?
Uno has 0/5V level outputs. What does 101 have? 0/3.3V perhaps?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

moodydog

It does :)

I am using ths;

Minimum gate thresh' is 1V ; Max 2V

http://uk.rs-online.com/web/p/mosfet-transistors/5411196/?searchTerm=541-1196&relevancy-data=636F3D3126696E3D4931384E525353746F636B4E756D6265724D504E266C753D656E266D6D3D6D61746368616C6C26706D3D5E5C647B337D5B5C732D2F255C2E2C5D5C647B332C347D2426706F3D313426736E3D592673743D52535F53544F434B5F4E554D4245522677633D4E4F4E45267573743D3534312D3131393626

CrossRoads

"The board operating voltage and I/O is 3.3V but all pins are protected against 5V overvoltage."
So you need a logic level MOSFET with a gate voltage < 3.3V.
You may need to go to a surface mount part
http://www.digikey.com/product-search/en/discrete-semiconductor-products/fets-single/1376381?k=n-channel%20mosfet
Or change your design to bring the 3.3V level up to 5V level and let that switch a part like AOI514:
http://www.digikey.com/product-search/en?keywords=aoi514

Got a datasheet for IRL520NPBF?
http://www.irf.com/product-info/datasheets/data/irl520npbf.pdf
At 2V Vgs, it barely turns on. 
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

DrAzzy

IRF3708PBF works pretty well at 3.3v on gate. It's not rated for that, but per the graphs in the datasheet, it's pretty good at 3.3v - it's the best through-hole MOSFET I was able to find for 3.3v gate voltages and a decent amount of current.
ATTinyCore for x4/x5/x61/x7/x8/x41/1634/828/x313 megaTinyCore for the megaavr ATtinies - Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

moodydog

Aah, OK

So I've swapped the transistor around, as I also had a couple of IRF520NPBF, and it seems to work so I'll use it for the while. I'll look into the IRF3708PBF!

Thanks,


Go Up