dc motor speed controller

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
nuwan5213
Posts: 82
Joined: Thu Jul 29, 2010 10:03 am
Location: sri lanka
Has thanked: 24 times
Been thanked: 4 times
Contact:

dc motor speed controller

Post by nuwan5213 »

dear all,
this time i need to feed fabric to sewing machine and it should be doing by 12 v dcmotor coupled
wheel set.i can get one signal from by needle positioner and it is 5volts output for every stich .
according to that signal's frquency, dc motor must modulate it's speed.
to synchronization of digital signal and dc motor speed ,the operator must enter the(factor) value via keypad.
the problem is using FLOWCODE its pwm does not vary the speed in my range.its very fast.i need 15rpm and some times much more slow than that.
the signals i have
1)needle up signal 5v for every stich
(its frequency is varying 10 Hz to 100 Hz)
i need to control the motor according to the frequency.

I have no clear idea to doing this.PLEASE HELP. :?:
Attachments
cct_layout.pdf
(92.87 KiB) Downloaded 464 times
Electronics for better world.

Creative25
Posts: 323
Joined: Tue Sep 06, 2011 2:54 am
Has thanked: 166 times
Been thanked: 26 times
Contact:

Re: dc motor speed controller

Post by Creative25 »

Hi.
I think this is more a question of hardware.
What kind of DC motor are you using?
Normally the speed of a DC motor with brushes Is dependant on two things PWM duty cycle and how much torque it has to produce.
To run dc motor at only 15 RPM is possible but depending on the load it will vary a lot.
You could ether use a Gearbox and a Decoder wheel.
Or I think the easier way would be to use a Stepper motor. They are designed to run at such low RPM. And you can program it to make an exact amount of steps each time the needle is up.
Best Regards:
Uli

nuwan5213
Posts: 82
Joined: Thu Jul 29, 2010 10:03 am
Location: sri lanka
Has thanked: 24 times
Been thanked: 4 times
Contact:

Re: dc motor speed controller

Post by nuwan5213 »

Dear UlI

yes im using motor with gearbox
its 12V 370 rpm max.
torque is very little i want. you have any idea please pass to me.i really stuck on this.
:(
Electronics for better world.

Creative25
Posts: 323
Joined: Tue Sep 06, 2011 2:54 am
Has thanked: 166 times
Been thanked: 26 times
Contact:

Re: dc motor speed controller

Post by Creative25 »

Hi
What duty cycle did you use?
If you can post your code it will be much easier to answer your question.
Best Regards:
Uli

nuwan5213
Posts: 82
Joined: Thu Jul 29, 2010 10:03 am
Location: sri lanka
Has thanked: 24 times
Been thanked: 4 times
Contact:

Re: dc motor speed controller

Post by nuwan5213 »

dear,
this is my flowcode .
please check.
please note that I dont have ossillescope.

is my idea going to work?????????
Rb_0 signal frequency is vary from 1Hz to 100Hz and im trying to limit it 90 because of other concern.
i dont need very accuratly runing motor also.

best regards,
nuwan. :?:
Attachments
RB0_ Controlled PWM.fcf
(6 KiB) Downloaded 472 times
Electronics for better world.

Creative25
Posts: 323
Joined: Tue Sep 06, 2011 2:54 am
Has thanked: 166 times
Been thanked: 26 times
Contact:

Re: dc motor speed controller

Post by Creative25 »

Hi Nuwan.

I don't think this code will work.

I can not see where your count gets reset so it will simply count on till 255 and then reset itselve.
You culd make anoter interrupt that counts to a certain number and say after one second transfer cont to count2 and then set cont to 0.
Then use count 2 for setting the duty cycle of the pwm.

Also check if your configuration for your pic is right osccon etc.

You could find something when you look at some programs that have been written for your specific pic.

Hope this is helpful.
Uli

nuwan5213
Posts: 82
Joined: Thu Jul 29, 2010 10:03 am
Location: sri lanka
Has thanked: 24 times
Been thanked: 4 times
Contact:

Re: dc motor speed controller

Post by nuwan5213 »

Dear Uli,
please check this out.
is it going to work this time.and the concept im going to do this is correct?????????

thaks,
best regards.
nuwan
:(
Attachments
RB0_ Controlled PWM_1.fcf
(6.5 KiB) Downloaded 433 times
Electronics for better world.

Creative25
Posts: 323
Joined: Tue Sep 06, 2011 2:54 am
Has thanked: 166 times
Been thanked: 26 times
Contact:

Re: dc motor speed controller

Post by Creative25 »

Hi Nuwan.
I made a program for you that works.
To change the speed in relation to the speed of the counter you can simply change the variable called Gate_value in the main program.
At gate_value=100 The progran should give you a 90% duty cycle when you your sewing machine is running at 100 Herz.

In simulation with flowcode you can change the gate value to something like 20 so that you can see how the program works.

Best Regards:
Uli
Attachments
RB0_ Controlled PWM_2.fcf
(15.5 KiB) Downloaded 492 times

nuwan5213
Posts: 82
Joined: Thu Jul 29, 2010 10:03 am
Location: sri lanka
Has thanked: 24 times
Been thanked: 4 times
Contact:

Re: dc motor speed controller

Post by nuwan5213 »

Dear Uli,

cannot open the file.
coz im FC4 User. can you convert it to FC4 compatibility mode.

regards,
nuwan.
Electronics for better world.

Creative25
Posts: 323
Joined: Tue Sep 06, 2011 2:54 am
Has thanked: 166 times
Been thanked: 26 times
Contact:

Re: dc motor speed controller

Post by Creative25 »

Hi
How do you change to Flowcode 4 Compatibility mode?

Here are some pictures.
Of the changes.
The Int macro is unchanged.
RB0_ Controlled PWM_2 - Main.JPG
RB0_ Controlled PWM_2 - Main.JPG (27.58 KiB) Viewed 11386 times
RB0_ Controlled PWM_2 Macro - Timer.JPG
RB0_ Controlled PWM_2 Macro - Timer.JPG (12.32 KiB) Viewed 11386 times
Tiemer0 interrupt is set to Prescaler 1:16 (244Hz)


I also attached the hex file if you want to have a quck try.

Best Regards:
Uli
Attachments
RB0_ Controlled PWM_2.hex
(1.04 KiB) Downloaded 403 times
Last edited by Creative25 on Fri Aug 02, 2013 12:10 pm, edited 1 time in total.

nuwan5213
Posts: 82
Joined: Thu Jul 29, 2010 10:03 am
Location: sri lanka
Has thanked: 24 times
Been thanked: 4 times
Contact:

Re: dc motor speed controller

Post by nuwan5213 »

im flowcode 4 user.can you please convert to flowcode v4 type.
thaks
regards,
nuwan.
Electronics for better world.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: dc motor speed controller

Post by medelec35 »

Hi nuwan,
Since there is no way of producing a V4 Flowchart if using V5 (But you can load V4 into a V5 Flowchart).
You have two choices.
1) Edit Flowchart by copying images Uli has kindly posted or

2) Download V5 free version from here:
http://www.matrixmultimedia.com/lc_index.php?p=25
Then load Flowchart and either use the Free version for testing and compiling
Or Just create/edit you V4 version so it the same as V5.
Note if you load V4 with V5 version of Flowcode, then it's best to save as a different name first.
Reason for this is Flowcharts saved with V5 will no longer open with V4.

Martin
Martin

Post Reply