Author Topic: Code Help Not Available  (Read 5601 times)

0 Members and 1 Guest are viewing this topic.

Offline Paul PriceTopic starter

  • Super Contributor
  • ***
  • Posts: 1419
Code Help Not Available
« on: May 25, 2013, 02:55:13 pm »
I was looking from some working c-code to control an AC Universal Motor. but  I now realize this board may not be the best venue to seek help.

Thanks to everyone, TOPIC is CLOSED.
« Last Edit: May 26, 2013, 07:24:50 pm by Paul Price »
 

Offline andyturk

  • Frequent Contributor
  • **
  • Posts: 895
  • Country: us
 

Online IanB

  • Super Contributor
  • ***
  • Posts: 11851
  • Country: us
I am not sure I have any more energy to help you. You seem to find ways to reject advice you are given by coming up with a long analysis trying to prove you are right and that other people are wrong. You will not easily be helped unless you are willing to listen more and talk less.
 

Offline Skimask

  • Super Contributor
  • ***
  • Posts: 1433
  • Country: us
The problem I am having is trying to create a PID controller that will be able to smoothly control the operation of a washing machine's varying load
Easily done, even using the lowest end PIC

Quote
and I am using a PIC16F876A 8-bit micro to try to do the job.
Old, outdated, plenty of PID code out there for PIC16xxxxx types.

Quote
Floating point calculations, like those needed to multiply the tiny valued PID coefficients to get PID to work takes much too much of the MCU time and code to be practical with an 8-bit MCU like this.
True, but with some creativity, you can easily avoid all those nasty cycle consuming floating point calc's.

Quote
I am not ready to graduate to a powerful DSP to get this PID idea to work, because the original controller board used an 8-bit PICC (Could not hack it, the mfg used code protection), but that controller worked very well.
Then you are wanting in one hand and shitting in the other.

Quote
I wish I knew how to do this. My efforts so far, using binary division to apply coefficients have resulted in getting the motor to jerk and surge and at slow speeds, sometimes just die out and stall.
If binary division is the only roadblock, then you need to bone up on your assembly.
Binary division, while difficult, is almost a building block of coding.

Quote
Binary division creates coeff.'s that can only be changed by a factor of two, but this is the only very fast way I know to multiply the coeff's. to do PID calculations.
Wha??????????

Quote
Any help or links to c-coding help in regard to AC Universal Motor control using PID would be appreciated. I haven't found anything with my searches yet.
Try Google.
I didn't take it apart.
I turned it on.

The only stupid question is, well, most of them...

Save a fuse...Blow an electrician.
 

Online IanB

  • Super Contributor
  • ***
  • Posts: 11851
  • Country: us
That's ok, IanB, I know you are very busy. Perhaps someone else can help me. Perhaps PID and C-coding is not your best hand of cards. Thanks anyway for trying and for the help you've so far given.

I agree that I am verbose, but I try to be entertaining and I write so much so as to make very complicated ideas clear.

Sometimes I can't resist to remark about someone's comments that are so confused or false, or so very far off from fact. And I can't help commenting  if someone gives advice(that  might be read not just by me but possibly many others)  that is so patently false that it, to not say something, will only serve to further the cause of misinformation, ignorance, myth and confusion.

If someone fails to comment on false information, then that person does not help me or others to correctly understand how things actually work in this very complicated field of electronics.  And what is this board about, if it is not to help others by sharing knowledge, not false information?

If I had the system and the code on my work bench I could make it work very easily, but that isn't the case so I'm limited to trying to offer suggestions.

I have advised you that you are unlikely to need derivative action in your controller, but you refused this advice. Derivative action works as a look ahead function to compensate for overshoots when systems have a delayed action to control inputs. Your motor speed control system does not have this property. The motor will accelerate as long as the energy supplied by the motor is greater than the energy dissipated by the system. If you reduce power to the motor the system will stop accelerating instantly, there is no delayed action at all.

You have an inherently jerky system as you recognize. There is sloshing and movement of the load in the tub, and there is a certain amount of  free play in the motor drive belt. The key to smooth control of a jerky system is constant application of torque and slow, smooth control variations. Your control system should be slow acting, should have filters to suppress noise and jitter, and should not try derivative action as this will amplify noise and produce instability. Your control responses should have a settling time of one or two seconds, not fractions of a second.

Since you have a low limit below which you cannot get a reliable speed measure you should not try closed loop speed control in this low speed range. You cannot control what you cannot measure. As I mentioned you need to use open loop control in this region where you apply low power to the motor from standstill in a measured fashion and wait until you detect a good speed signal before you close the loop. (For an analogy consider cruise control in a car. It doesn't work below some minimum speed like 30 mph. You have to manually speed the car up from a standstill before cruise control can take over.)
 

Online IanB

  • Super Contributor
  • ***
  • Posts: 11851
  • Country: us
As far as the code arithmetic is concerned there is no need at all to consider floating point arithmetic. You can work in the space consistent with your ADC input and DAC output resolutions, perhaps with a few extra precision bits internally. Within this (8 bit, 12 bit, 16 bit) space you can do fixed point arithmetic. All your calculations are essentially based on fractions of the measurement or control range.
 

Offline C

  • Super Contributor
  • ***
  • Posts: 1346
  • Country: us
An as I tried to point out, Speed control has been done for a long time.
I have worked on speed control that existed before even the SCR existed and you had to use a tube version of a SCR.

There is a saying I heard long ago for control systems, "Garbage In equals Garbage Out"
You can run Open Loop when Input sensors are garbage like IanB and others have suggested.
You can use your Input sensors in a different way such that the garbage does not have as bad result

By your own responses, Items that I and other people used for years can not exist or work the way they do work.

C   
 

Offline Rufus

  • Super Contributor
  • ***
  • Posts: 2095
The problem I am having is trying to create a PID controller that will be able to smoothly control the operation of a washing machine's varying load and I am using a PIC16F876A 8-bit micro to try to do the job.

Have you run your phase control system open loop?
 

Offline Rufus

  • Super Contributor
  • ***
  • Posts: 2095
If what you mean, by "Phase-control open loop", you mean triggering the TRIAC without any zero-cross timing reference

I mean driving the motor with each of your possible 82 (or whatever) phase positions and seeing what speed you get and that it is stable.
 

Offline glatocha

  • Regular Contributor
  • *
  • Posts: 114
There was an APP note with PID on PIC. Find it out. I look on it few years back. Generally nice explanation of digital PID control implementation.
 

Offline Rufus

  • Super Contributor
  • ***
  • Posts: 2095
Rufus: varying load demands widely varying duty cycles to stabilize speed.

Wow thanks, I didn't know that.

You seem to find ways to reject advice you are given by coming up with a long analysis trying to prove you are right and that other people are wrong.

About sums it up, at least this was a very short analysis.
 

Offline BravoV

  • Super Contributor
  • ***
  • Posts: 7547
  • Country: 00
  • +++ ATH1
I am not sure I have any more energy to help you. You seem to find ways to reject advice you are given by coming up with a long analysis trying to prove you are right and that other people are wrong. You will not easily be helped unless you are willing to listen more and talk less.

I do follow the OP's quest for quite sometime now, and aware he even made several threads just for this topic, and looks like he will create another new one just in case he stumbled again with responses that he doesn't want or like to hear.

Its easy actually, just reply with affirmation and confirmation on what he loves to hear, that will settle him nicely.  :-DD

jucole

  • Guest
Re: Code Help Not Available
« Reply #12 on: May 28, 2013, 02:26:59 pm »
Did the OP post some code or something? was this about controlling a washing machine or am I going crazy? :-)
 

Offline mrflibble

  • Super Contributor
  • ***
  • Posts: 2051
  • Country: nl
Re: Code Help Not Available
« Reply #13 on: May 28, 2013, 03:08:26 pm »
I think the OP got some answers that didn't coincide with his preconceived notions of what a "proper answer" should be. Then some people pointed out this behaviour, and the OP got all pouty. Said poutiness is of course a totally reasonable reaction. I mean, an internet forum where people just give answers however they see fit? What is this world coming to?

(And yeah I think it was about doing motor control with a PID loop. Where 1 of those three letters may or may not make sense at slow speeds.)
 

jucole

  • Guest
Re: Code Help Not Available
« Reply #14 on: May 28, 2013, 04:43:28 pm »
I think the OP got some answers that didn't coincide with his preconceived notions of what a "proper answer" should be. Then some people pointed out this behaviour, and the OP got all pouty. Said poutiness is of course a totally reasonable reaction. I mean, an internet forum where people just give answers however they see fit? What is this world coming to?

(And yeah I think it was about doing motor control with a PID loop. Where 1 of those three letters may or may not make sense at slow speeds.)

Ah mystery solved, many thanks!     After I read the post a few days ago I thought it was an interesting problem. 

I think IanB's comment sums it up nicely.
Quote
The key to smooth control of a jerky system is constant application of torque


But realistically if he's struggling with a 16F876A - it won't get any easier with any other micro controller chip unless it's one from Zanussi   :-DD







 

Offline Jon Chandler

  • Frequent Contributor
  • **
  • Posts: 539
    • Throw Away PIC
Re: Code Help Not Available
« Reply #15 on: May 28, 2013, 06:43:27 pm »
I think the OP got some answers that didn't coincide with his preconceived notions of what a "proper answer" should be. Then some people pointed out this behaviour, and the OP got all pouty. Said poutiness is of course a totally reasonable reaction. I mean, an internet forum where people just give answers however they see fit? What is this world coming to?


It truly sucks that the original poster was so childish to delete the original message - now it's impossible to follow the topic at all and everyone's contributions are meaningless.  What a jerk.
 

Online IanB

  • Super Contributor
  • ***
  • Posts: 11851
  • Country: us
Re: Code Help Not Available
« Reply #16 on: May 28, 2013, 08:06:21 pm »
Well, he's burned his bridges now. Nobody will be inclined to respond to any questions he asks in the future.

Short summary of the question: the OP removed the control board from an automatic washing machine and tried to replace it with firmware of his own design. However, he had trouble programming the microcontroller to obtain satisfactory speed control of the drum motor. Some of his issues were an incomplete understanding of the physics of mechanical systems, a lack of familiarity with designing and programming control algorithms, and limited low level programming experience. The OP didn't just need a few pointers, he needed a complete education in all of the above--something he apparently was unwilling to accept.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf