Page 1 of 1

dc motor speed controller

Posted: Thu Aug 01, 2013 9:14 am
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. :?:

Re: dc motor speed controller

Posted: Thu Aug 01, 2013 11:07 am
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

Re: dc motor speed controller

Posted: Thu Aug 01, 2013 11:25 am
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.
:(

Re: dc motor speed controller

Posted: Thu Aug 01, 2013 3:01 pm
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

Re: dc motor speed controller

Posted: Fri Aug 02, 2013 7:26 am
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. :?:

Re: dc motor speed controller

Posted: Fri Aug 02, 2013 8:28 am
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

Re: dc motor speed controller

Posted: Fri Aug 02, 2013 9:22 am
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
:(

Re: dc motor speed controller

Posted: Fri Aug 02, 2013 10:29 am
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

Re: dc motor speed controller

Posted: Fri Aug 02, 2013 10:35 am
by nuwan5213
Dear Uli,

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

regards,
nuwan.

Re: dc motor speed controller

Posted: Fri Aug 02, 2013 12:04 pm
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 12265 times
RB0_ Controlled PWM_2 Macro - Timer.JPG
RB0_ Controlled PWM_2 Macro - Timer.JPG (12.32 KiB) Viewed 12265 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

Re: dc motor speed controller

Posted: Fri Aug 02, 2013 12:10 pm
by nuwan5213
im flowcode 4 user.can you please convert to flowcode v4 type.
thaks
regards,
nuwan.

Re: dc motor speed controller

Posted: Fri Aug 02, 2013 12:47 pm
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