Help to novice...

spippolone

New member
Hi, I have made some simple ones scatch to PIXAXE.. Now I have two question:

I would like the decision command to be "read" for 1 second and then ignored, until the end of the loop and, the second,
I would like to count 200 pulses from a magnetic sensor and therefore deactivate the output .
I use flowchart because I'm no expert... someone can help me ?

Thank you
 

The bear

Senior Member
Welcome to the forum.
These words are just to prepare you. When asking for help, YOU need to give the forum members as much information as possible, (They are busy people).
Post your program code, explain what you are trying to do, what is the project you are working on?
Good luck, Bear..
 

spippolone

New member
Thanks for the reply, I'm working on a project to apply a motor to a lock
My project:
currently, there is a limit switch that turns on a led when the lock is closed.
I would like to put a motor with a button that starts the motor clockwise if the lock is open, or counterclockwise if the lock is closed.
The lock status would be read from the position of the limit-switch.
I would also like if the start button is held down, only one loop is generated.
Therefore to repeat the operation it is necessary to release the button and press it again

Now my actually simple sketch, when I press start button, read the lock status (by limit-switch) and stars the engine in the correct direction to two second, which is the approximate time to turn the key.

I would like to try to read the encoder pulses in order to determine a precise number of pulses and not an approximate time.

My motor is a JGY-37, my Pic Axe 08M2

Thanks for your help
 

Attachments

premelec

Senior Member
You need to get some symbols or REM statements for where motor is connected and limit switches.
You can probably sense end stops by motor current rise on stall. You will need motor driver power
supply and a method of reversing the motor [could be a DPDT relay]. What is your experience with electronic circuits?

From post above:
Code:
'BASIC converted from flowchart:
'C:\Users\Main\Documents\PICAXE Editor\Documents\Serratura.plf
'Converted  2020-09-06 at 19:31:19

{ ;Symbols
symbol varA = b0
symbol varB = b1
symbol varC = b2
symbol varD = b3
symbol varE = b4
symbol varF = b5
symbol varG = b6
symbol varH = b7
symbol varI = b8
symbol varJ = b9
symbol varK = b10
symbol varL = b11
symbol varM = b12
symbol varN = b13
symbol varO = b14
symbol varP = b15
symbol varQ = b16
symbol varR = b17
symbol varS = b18
symbol varT = b19
symbol varU = b20
symbol varV = b21
symbol varTEMPBYTE1 = b22
symbol varTEMPBYTE2 = b23
symbol varTEMPBYTE3 = b24
symbol varTEMPBYTE4 = b25
symbol varTEMPBYTE5 = b26
symbol varTEMPBYTE6 = b27
symbol varTEMPWORD1 = w11
symbol varTEMPWORD2 = w12
symbol varTEMPWORD3 = w13
}


main:

Cell_7_6:
    low C.0, C.1, C.2

    if pinC.3=1 then

        goto Cell_7_8
    end if
    goto Cell_7_6

Cell_7_8:
    if pinC.4=1 then

        goto Cell_7_9
    end if
    low C.2
    high C.1

    pause 2000
    goto Cell_7_6

Cell_7_9:
    low C.1
    high C.2

    pause 2000
    goto Cell_7_6


#no_data    'reduce download time
 

spippolone

New member
Hi with electronics, I am more used to programming which for me is a new thing. I have only one limit switch, which activates a signaling LED when the lock is closed. I have a power supply with current limit, so if the pic cuts power after a slight delay nothing happens. For this I thought of counting the number of revolutions of the sensor that is on the motor shaft, and the error of the count is divided by the reduction ratio.
Trying to remember it should be 11 impulses per revolution, of the crankshaft, and 210 revolutions of the power per 1 revolution of the final shaft.

I hope google has done a good translation ... and there aren't too many misunderstandings

In the image the pulses feeding the motor

Thanks
 

Attachments

The bear

Senior Member
Very nice 'scope.
What is your language?
Looks like Google did a good job.
I'm still a beginner, unable to help you.
Bear..
 
Top