Making controller for LP Player

Hi all. I found an LP player with out Motor speed controller. So i m trying to make it with a nano board and irf520. The problem is that with analogwrite the Motor Doesn’t Spin. I can ear some High frequency vibration. The led On The led on irf blinks. Its connected to pin 11. Using Digitalwrite it goes on and off. Its possibile to set pwm to 10 hz? Im a beginner

giradischi.ino (1009 Bytes)

Can you show us a diagram of your circuit?

What kind of motor? Some of them don't like being controlled with PWM.

I don't know about 10Hz for PWM but you could bit-bang it really easily.

Start by not using an irf520 transistor. They are not "logic level" transistors and require 10V on the base to fully turn on. The Nano can only supply 5. If you get the IRL520 (note 'L' or logic level) you will be in much better shape.

Also, if you read the sticky post at the top of the forum about how to properly post your code using code tags, it will help more people help you. Many never bother opening attachments. Then you get code like this

int motore = A0;
int s16 = 7;
int s33 = 8;
int s45 = 9;
int pot = 10;
int v1 = 120;
int v2 = 180;
int v3 = 220;
int p = 0;


int vel = 0;
int velf = 0;
int pint = 0;
int pintold = 0;
int oldvel = 0;

void setup() {
  Serial.begin(9600);
  pinMode(motore, OUTPUT);
  pinMode(s16, INPUT_PULLUP);
  pinMode(s33, INPUT_PULLUP);
  pinMode(s45, INPUT_PULLUP);
}


void loop() {
  int sw1 = digitalRead(s16);
  if ((sw1 == 0) && (p  != 1)) {
    p = 1;
    vel = v1;
    Serial.println("VEL 1");
  }

  int sw2 = digitalRead(s33);
  if ((sw2 == 0) && (p  != 2))
  {
    p = 2;
    vel = v2;
    Serial.println("VEL 2");
  }
  int sw3 = digitalRead(s45);
  if ((sw3 == 0) && (p  != 3))
  {
    p = 3;
    vel = v3;
    Serial.println("VEL 3");
  }
  pint = map(analogRead(pot), 0, 1024, -5, 5);

  if (pint != pintold) {
    velf = vel + pint;
    pintold = pint;
  }
  if (velf != oldvel) {
    analogWrite(motore, velf);
    Serial.println(1023);
    oldvel = velf;
  }
  delay(200);
}

Thanks.i m not able to put a schematic
For wiring the mod is well connected on gnd and pin 11 (not A0 as in the code). The Motor is a 2000 rpm with pulley and it works between 3 and 5v. Can simeone tell me a sample code to test some lower freq on pin 11? I am Almost Sure That the Motor can work well with Lower frequency

Why do you want to go lower? If this is just a DC motor, it will just see the average of the PWM signal.

blh64:
Why do you want to go lower? If this is just a DC motor, it will just see the average of the PWM signal.

Well, I did some test in place and with the sane power supply, wiring and mosfet when using pwm Motor makes a kind of ‘beeeeeep’ and no more. With a simple test with analogWrite(11,HIGH) it start running at maximum speed, so I figure it s a frequency issue…

Well thinking.... It could be the mosfet.... At 5v of digitalwrite High it s like a switch bit cant manager Fast switching at low gare voltage... I m going to interpolate a transistor to drive it better

I already told you the IRL520 is not "logic level" compatible and should be driven by an Arduino. Get a transistor that is logic level compatible.

blh64:
I already told you the IRL520 is not "logic level" compatible and should be driven by an Arduino. Get a transistor that is logic level compatible.

Yes i ll order AN irl o è. You think a tip102 could be used for test? I found two of them at home

Danilopizzini:
You think a tip102 could be used for test? I found two of them at home

Yes. Those are rated for 5V Vbe so an arduino can drive them directly. Why order something else? A TIP102 will work just fine.

blh64:
Yes. Those are rated for 5V Vbe so an arduino can drive them directly. Why order something else? A TIP102 will work just fine.

Found an irl44z.
Final code is

int motore = 11;
int s16 = 7; 
int s33 = 8;
int s45 = 9;
int pot = 10;
int v1 = 196;
int v2 = 235;   
int v3 = 246;
int p = 	0;


int vel=0;
int velf =0;
int pint=0;
int pintold=0;
int oldvel =0;
void setup() {
    Serial.begin(9600);
    

   
  pinMode(motore, OUTPUT);
  

  pinMode(s16, INPUT_PULLUP);
  pinMode(s33, INPUT_PULLUP);
  pinMode(s45, INPUT_PULLUP);
 
 }  


void loop() {
   int sw1 = digitalRead(s16);
	if((sw1==0) && (p  != 1)){
 	p =1;
 	vel=v1;
   Serial.println("VEL 1");
 	}
  
   int sw2 = digitalRead(s33);
 if((sw2==0)&& (p  != 2))
 {
 	p =2;
 	vel=v2;
   Serial.println("VEL 2");
 	}
  int sw3 = digitalRead(s45);
 	 if((sw3==0)&& (p  !=3))
 {
 	p =3;
 	vel=v3;
     Serial.println("VEL 3");
 	}
 pint =map(analogRead(pot),0,1024,-2,3); 

if(pint != pintold){
  Serial.println(pint);
	velf=vel+pint;
  Serial.println(vel);
  Serial.println(pint);
  Serial.println(velf);
  }
 else  velf=vel;

 pintold=pint;


if(velf != oldvel){
 	analogWrite(motore,velf);

    
     oldvel=velf;

}  
  delay(200);
}  
/code]