Code Help Not Available - Page 1
Forum section: electronics / general

author: Paul Price
author_rank: Super Contributor
timestamp: May 25, 2013, 02:55:13 pm
content: 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.

author: andyturk
author_rank: Frequent Contributor
timestamp: May 25, 2013, 06:42:30 pm
content: Quote from: Paul Price on May 25, 2013, 02:55:13 pmFixed-Point Arithmetic

author: IanB
author_rank: Super Contributor
timestamp: May 25, 2013, 07:37:53 pm
content: 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.

author: Skimask
author_rank: Super Contributor
timestamp: May 26, 2013, 05:01:23 am
content: Quote from: Paul Price on May 25, 2013, 02:55:13 pmEasily done, even using the lowest end PICQuoteOld, outdated, plenty of PID code out there for PIC16xxxxx types.QuoteTrue, but with some creativity, you can easily avoid all those nasty cycle consuming floating point calc's.QuoteThen you are wanting in one hand and shitting in the other.QuoteIf 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.QuoteWha?QuoteTry Google.

author: IanB
author_rank: Super Contributor
timestamp: May 26, 2013, 05:37:41 am
content: Quote from: Paul Price on May 26, 2013, 02:32:45 amIf 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.)

author: IanB
author_rank: Super Contributor
timestamp: May 26, 2013, 05:43:20 am
content: 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.

author: C
author_rank: Super Contributor
timestamp: May 26, 2013, 09:46:25 am
content: 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 resultBy your own responses, Items that I and other people used for years can not exist or work the way they do work.C

author: Rufus
author_rank: Super Contributor
timestamp: May 26, 2013, 01:40:13 pm
content: Quote from: Paul Price on May 25, 2013, 02:55:13 pmHave you run your phase control system open loop?

author: Rufus
author_rank: Super Contributor
timestamp: May 26, 2013, 02:22:09 pm
content: Quote from: Paul Price on May 26, 2013, 01:46:46 pmI 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.

author: glatocha
author_rank: Regular Contributor
timestamp: May 26, 2013, 02:33:46 pm
content: 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.

author: Rufus
author_rank: Super Contributor
timestamp: May 26, 2013, 03:10:00 pm
content: Quote from: Paul Price on May 26, 2013, 02:37:02 pmWow thanks, I didn't know that.Quote from: IanB on May 25, 2013, 07:37:53 pmAbout sums it up, at least this was a very short analysis.

author: BravoV
author_rank: Super Contributor
timestamp: May 26, 2013, 06:09:46 pm
content: Quote from: IanB on May 25, 2013, 07:37:53 pmI 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.

author: Unknown
author_rank: Unknown
timestamp: May 28, 2013, 02:26:59 pm
content: Did the OP post some code or something? was this about controlling a washing machine or am I going crazy? :-)

author: mrflibble
author_rank: Super Contributor
timestamp: May 28, 2013, 03:08:26 pm
content: 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.)

author: Unknown
author_rank: Unknown
timestamp: May 28, 2013, 04:43:28 pm
content: Quote from: mrflibble on May 28, 2013, 03:08:26 pmAh 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.QuoteBut 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

author: Jon Chandler
author_rank: Frequent Contributor
timestamp: May 28, 2013, 06:43:27 pm
content: Quote from: mrflibble on May 28, 2013, 03:08:26 pmIt 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.

author: IanB
author_rank: Super Contributor
timestamp: May 28, 2013, 08:06:21 pm
content: 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.