Hello Friends...
I tried first time stepper motor.
I used Wemoıs D1R1+ NEMA17 step motor + A4988 drver + 24V-2A powersupp.
I connected like under below.
Sample & Decuments
its run with 400-430 RPM max.
I used 2 method fro drive.
With the "DelayMicroseconds()" method, there is no jolt, it works with a high pitched voice.
But;
"Micros() counting" method has vibration and noise. It's like a hammer drill. There is a noisy ride.
There seems to be noise in the electricity.
Whats the problem?
I want to use it as in CNC lathe. I want to connect with wifi and learn the location of the engine simultaneously. I want show PC screen live angle pozitions.
There fore need to more free loops for wifi cominications.
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
			
			I tried first time stepper motor.
I used Wemoıs D1R1+ NEMA17 step motor + A4988 drver + 24V-2A powersupp.
I connected like under below.
Sample & Decuments
its run with 400-430 RPM max.
I used 2 method fro drive.
- Micros() counting
- DelayMicroseconds()
With the "DelayMicroseconds()" method, there is no jolt, it works with a high pitched voice.
But;
"Micros() counting" method has vibration and noise. It's like a hammer drill. There is a noisy ride.
There seems to be noise in the electricity.
Whats the problem?
I want to use it as in CNC lathe. I want to connect with wifi and learn the location of the engine simultaneously. I want show PC screen live angle pozitions.
There fore need to more free loops for wifi cominications.
			
				Micros() counting method:
			
		
		
		Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'Public variables can be accessed from all modules.
    Public Serial1 As Serial
    Private wemos As D1Pins
    Private Pindir As Pin
    Private Pinstep As Pin
    Private PS As Boolean
    Private DS As Boolean
    Private bekle ,syc ,xx As UInt
    Public Serial1 As Serial
    Private Timer1 As Timer
    Private d1, d2 As ULong
    Private RPM As UInt
End Sub
Private Sub AppStart
    Serial1.Initialize(115200)
    Log("AppStart")
    Pindir.Initialize(wemos.D7,Pindir.MODE_OUTPUT)
    Pinstep.Initialize(wemos.D5,Pinstep.MODE_OUTPUT)
    Delay(1000)
    PS=True
    DS=False   
    Pindir.DigitalWrite(True)
    Pinstep.DigitalWrite(True)
    RPM=200
    bekle=(60000000/RPM)/400
    xx=0
    Delay(1000)
    Log("sistem hazır :",bekle)
    Log("RPM :",RPM)
    DS=False
    syc=0
    d1=0
    d2=0
    AddLooper("Dongu")
    d1=Micros
    d2=d1
End Sub
Sub stepH
    Pinstep.DigitalWrite(True)
    'DelayMicroseconds(10)
    PS=True
End Sub
Sub stepL
    Pinstep.DigitalWrite(False)
    'DelayMicroseconds(10)
    PS=False
End Sub
Sub Dongu
    d1=Micros
    If (d1-d2) Mod bekle =0 Then
        
        d2=d1
        
        If PS Then
            stepL
        Else
            stepH
        End If
    End If
    
End Sub
			
				DelayMicroseconds method:
			
		
		
		Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'Public variables can be accessed from all modules.
    Public Serial1 As Serial
    Private wemos As D1Pins
    Private Pindir As Pin
    Private Pinstep As Pin
    Private PS As Boolean
    Private DS As Boolean
    Private bekle ,syc ,xx As UInt
    Public Serial1 As Serial
    Private Timer1 As Timer
    Private d1, d2 As ULong
    Private RPM As UInt
End Sub
Private Sub AppStart
    Serial1.Initialize(115200)
    Log("AppStart")
    Pindir.Initialize(wemos.D7,Pindir.MODE_OUTPUT)
    Pinstep.Initialize(wemos.D5,Pinstep.MODE_OUTPUT)
    Delay(1000)
    PS=True
    DS=False   
    Pindir.DigitalWrite(True)
    Pinstep.DigitalWrite(True)
    RPM=200
    bekle=(60000000/RPM)/400
    xx=0
    Delay(1000)
    Log("sistem hazır :",bekle)
    Log("RPM :",RPM)
    DS=False
    syc=0
    d1=0
    d2=0
    AddLooper("myLooper")
    d1=Micros
    d2=d1
End Sub
Sub myLooper
    
    Pinstep.DigitalWrite(False)
    DelayMicroseconds(bekle)
    Pinstep.DigitalWrite(True)
    DelayMicroseconds(bekle)
end sub 
				 
 
		 
 
		 
 
		
 
 
		 
 
		 
 
		