go_away

Author Topic: Electric unicycle .  (Read 1008 times)

0 Members and 1 Guest are viewing this topic.

Offline fish_manTopic starter

  • Jr. Member
  • **
  • Posts: 21
  • Helpful? 0
Electric unicycle .
« on: March 12, 2012, 03:46:34 PM »
He guys .. Im working on a electric unicycle using a arduino and IMU ... It's going pretty well so far ... except for the ages It was shuddering and jerking while balancing and nothing I tried seem to help.

Video
Franken-Wheelie Shuddering Demo


Then today while I was playing around I had a breakthrough ... suddenly it started working perfectly after some more playing around I discovered the battery was running low ... once the battery dropped below 21v ish the unicycle would work absolutely perfectly. Smooth, no jerking, shuddering or noise.

Obviously I can't be running a nearly dead battery all the time.

But I cant figure out how to replicate this digitally .. Ive tried reducing the gains WAAAAAY down and it had no effect except making the board feel mushy.

So what effect exactly would having a low battery on a PWM controlled DC motor have?
Would multiplying the motor percentage by say 0.75(reducing it by a quarter) before it is sent to the motor controller have the same effect?

Or is it impossible to replicate digitally and I need to search out another solution? any suggestions?

Offline georgeecollins

  • Full Member
  • ***
  • Posts: 58
  • Helpful? 3
Re: Electric unicycle .
« Reply #1 on: March 12, 2012, 09:44:09 PM »
I am no expert, but I could think of one thing that may already be taken care of.  Did you connect a capacitor across the motor leads and to the motor's body?  This can help prevent current surges from a motor.  Example:
http://electronics.stackexchange.com/questions/19517/why-connect-capacitors-to-motor-body

If you didn't, you would have more problems at a high voltage then a low one. 


Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Electric unicycle .
« Reply #2 on: March 12, 2012, 10:00:02 PM »
Hi,

Without knowing your schematic or software I can't be sure, but perhaps your control algos are a bit too "hysterical" and the slower acceleration caused by the flat(ish) battery dampens the response.

Assuming that you're using a PID, lower your P and D and perhaps increase the I a bit - all in very small steps and do one at a time to see what helps. When done with both P and D, go back and readjust, as they all influence each other.
Taking notes along the way will help you keep a tap on what you tried.
Make sure to test at more than one voltage (including freshly charged).


You might get away with adjusting the PWM, but you may need to adjust the factor as the voltage falls and it really is a sloppy way of handling it - your PID is quite capable of doing it, as it have more than the power needed, you just need to beat the control terms into submission ;D
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline fish_manTopic starter

  • Jr. Member
  • **
  • Posts: 21
  • Helpful? 0
Re: Electric unicycle .
« Reply #3 on: March 13, 2012, 04:54:25 AM »
I have tried adjusting all the P,I,D ... and it doesn't seem to have ANY effect at all until you adjust them right down to the point where the unicycle feel's slow to respond and "mushy" but it still shudder's like mad.

I've spent ages in the past trying to tune the PID and like I say noting seemed to change the shuddering. The shuddering just doesn't seem to get better or worse no matter what I do.

The schematic is based heavily on this instructable  http://www.instructables.com/id/Easy-build-self-balancing-skateboardrobotsegway-/ . Butbasicaly I have the IMU connected to the analogue input's of the arduino and the motor controller to the digital output's . The motor controller I'm using is a Syren 25a and it's being controlled in simplified serial mode.

I cant post the code as it exceed's the 22000 characters limit. but the balancing section is pretty much identical to the one posted in the instructable http://www.instructables.com/files/orig/FQG/KST3/GZ0MM8D9/FQGKST3GZ0MM8D9.txt

Ives not heard about connecting a capacitor across the motor but I imagine it would have to be a pretty beefy capacitor it's a 24v 500w motor. Anyone else know anything else about this ?

Offline fish_manTopic starter

  • Jr. Member
  • **
  • Posts: 21
  • Helpful? 0
Re: Electric unicycle .
« Reply #4 on: March 13, 2012, 06:55:13 AM »
It still jerk's and shudder's (to a lesser extent) when ran with fully charged 12V.

So it's not simply the voltage.

But I don't know enough about batteries and DC motor's to know what other effect's having a depleted battery has.

Offline fish_manTopic starter

  • Jr. Member
  • **
  • Posts: 21
  • Helpful? 0
Re: Electric unicycle .
« Reply #5 on: March 13, 2012, 07:09:47 AM »
Also I've checked the voltage while running and the voltage never dropped below 12v (when ran with charged 12v batteries)

and multiplying the motor percentage by 0.75 didn't help either.

All of these test's done with 12v supply because it's easier.

Offline fish_manTopic starter

  • Jr. Member
  • **
  • Posts: 21
  • Helpful? 0
Re: Electric unicycle .
« Reply #6 on: March 13, 2012, 07:16:24 AM »
I think Ive found a way to share the code as well.

Try http://codepad.org/PNwnnvRe

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Electric unicycle .
« Reply #7 on: March 13, 2012, 08:10:38 AM »
Hi,

I have tried adjusting all the P,I,D ... and it doesn't seem to have ANY effect at all until you adjust them right down to the point where the unicycle feel's slow to respond and "mushy" but it still shudder's like mad.

I've spent ages in the past trying to tune the PID and like I say noting seemed to change the shuddering. The shuddering just doesn't seem to get better or worse no matter what I do.
PID tuning may seem hard and like I said, you need to work in very small steps, especially if you really don't know what each does.
Best way is to either 'scope the input-output relation, to see what really happens - does it overshoot, is it too slow etc.
But check the serial first, as described below.


The schematic is based heavily on this instructable [...]
Did you try asking the guy who made it?


The motor controller I'm using is a Syren 25a and it's being controlled in simplified serial mode.
That may have something to do with the problem.

Try changing the serial speed ("baud rate") to see if this changes the response in any way - if it do, you might need to use another mode.


I cant post the code as it exceed's the 22000 characters limit. [...]
Never mind, I have no intention of debugging an entire program (which from a quick look seems a bit messy) and the PID parameters can only be found with the exact combo of motor etc. that you have. Change the motor (or the ESC) and you'll have to change parameters all over.


Ives not heard about connecting a capacitor across the motor but I imagine it would have to be a pretty beefy capacitor it's a 24v 500w motor. Anyone else know anything else about this ?
Any DC motor should have a cap over its terminals. it's for quenching some of the noise it generates and it should have a cap from each terminal to the (grounded) motor housing.
10nf..100nF ceramic caps is a good start.
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline fish_manTopic starter

  • Jr. Member
  • **
  • Posts: 21
  • Helpful? 0
Re: Electric unicycle .
« Reply #8 on: March 13, 2012, 10:37:03 AM »
Quote
PID tuning may seem hard and like I said, you need to work in very small steps, especially if you really don't know what each does.
Best way is to either 'scope the input-output relation, to see what really happens - does it overshoot, is it too slow etc.
But check the serial first, as described below.


Any advice on how ? .. I tried following the guide from wikipedia

http://en.wikipedia.org/wiki/PID_controller
about a quarter way down the page under "manual tuning" ... it wont copy and paste properly.

But it jerk's no matter how low I set the Kp ......  Lowering the Kp further just seems to change the angle at which it jerks to correct itself . is that right?

How small adjustments? and where do I start/stop?

I set D to zero and commented I out completely .. I then increased P until I was getting definite oscillations I then backed that off to approx half and set about adjusting the D ...... until I ended up back where I started.

Quote
Did you try asking the guy who made it?


Yes .. Ive been in touch with him the whole time and he seem's as confused as I am.

Quote
That may have something to do with the problem.

Try changing the serial speed ("baud rate") to see if this changes the response in any way - if it do, you might need to use another mode.


that didnt make any difference


Quote
Never mind, I have no intention of debugging an entire program (which from a quick look seems a bit messy) and the PID parameters can only be found with the exact combo of motor etc. that you have. Change the motor (or the ESC) and you'll have to change parameters all over.


Quote
Any DC motor should have a cap over its terminals. it's for quenching some of the noise it generates and it should have a cap from each terminal to the (grounded) motor housing.
10nf..100nF ceramic caps is a good start.


Is it likely that this will have them built in?

if not just one cap from the + to the motor housing? what sort of size?

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Electric unicycle .
« Reply #9 on: March 15, 2012, 07:14:28 PM »
Hi,

Any advice on how ? .. I tried following the guide from wikipedia

http://en.wikipedia.org/wiki/PID_controller
about a quarter way down the page under "manual tuning" ... it wont copy and paste properly.

If you look under the heading "Overview of methods", you'll see
Method/Advantages/Disadvantages
Manual Tuning/No math required. Online method./Requires experienced personnel.
Ziegler–Nichols/Proven Method. Online method./Process upset, some trial-and-error, very aggressive tuning.
Etc.
Why do you attempt to use a method that clearly states that it takes experienced personnel?


But it jerk's no matter how low I set the Kp ......  Lowering the Kp further just seems to change the angle at which it jerks to correct itself . is that right?

It appears that you didn't read the manual tuning chapter all that well. You're granted a free re-read :)


How small adjustments? and where do I start/stop?

As small as needed!
Nobody can tell what's needed, but the guy holding the motor.


I set D to zero and commented I out completely .. I then increased P until I was getting definite oscillations I then backed that off to approx half and set about adjusting the D ...... until I ended up back where I started.

You should have adjusted the "I" in step 2.


Quote
Any DC motor should have a cap over its terminals. it's for quenching some of the noise it generates and it should have a cap from each terminal to the (grounded) motor housing.
10nf..100nF ceramic caps is a good start.


Is it likely that this will have them built in?

Not very.


if not just one cap from the + to the motor housing? what sort of size?

I told you in my previous post, you quoted it, but did you actually read it?  ::)
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline fish_manTopic starter

  • Jr. Member
  • **
  • Posts: 21
  • Helpful? 0
Re: Electric unicycle .
« Reply #10 on: March 16, 2012, 12:05:42 PM »
First off I want to thank you for taking the time to help me as you can probably tell I'm struggling to get my head round all the term's so I must be testing you patience a bit.

I attempted to use the method suggested to me by the person who wrote the instructable . Which was manual tuning.

The only thing I don't understand about the Ziegler–Nichols method is the Pu (oscillation period) how would I find this out ? I don't have a scope.

So if I have read this right the jerking is caused by having a derivative term which is too low?

Quote
The derivative term slows the rate of change of the controller output
.

The reason I adjusted the Kd next was indeed because I didn't read the article properly. The person who wrote the instructable suggest's leaving the I value out completely while getting it to balance and I clearly didn't read the wikipedia article correctly and got in a muddle.
Can the I value be left out at least while getting it to balance in the first place ... or is the guy confused?

I think I'm starting to understand PID loops a whole heap better now.

And I don't know how I missed your suggestion on the size of the cap's ... I can only apologise .. it was obvious when I re-read it .
Can they by located at the ends of the motor wire (about 7" long) for the time being or do they need to be actually physically connected to the motor case and not just at the end of the wires? (which is the closest convenient mounting point).

Offline newInRobotics

  • Supreme Robot
  • *****
  • Posts: 1,015
  • Helpful? 48
  • N.I.R.
Re: Electric unicycle .
« Reply #11 on: March 16, 2012, 03:11:34 PM »
And I don't know how I missed your suggestion on the size of the cap's ... I can only apologise .. it was obvious when I re-read it .
Can they by located at the ends of the motor wire (about 7" long) for the time being or do they need to be actually physically connected to the motor case and not just at the end of the wires? (which is the closest convenient mounting point).
They have to be connected to each terminal and motor housing, literally, and third one goes, literally, between terminals.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian W

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Electric unicycle .
« Reply #12 on: March 16, 2012, 10:21:38 PM »
Hi,

A few quick links that may help you along:
http://ww.w.powertransmission.com/issues/0411/pid.pdf
Page 8 may be helpful, but read it all, it's only 13 very light pages.

http://www.jashaw.com/pid/tutorial/
Chapters 3 and 6 in particular, but again, it doesn't hurt to grab as much info as you can handle without going into meltdown :)
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline fish_manTopic starter

  • Jr. Member
  • **
  • Posts: 21
  • Helpful? 0
Re: Electric unicycle .
« Reply #13 on: March 17, 2012, 06:20:16 AM »
Thanks for those I've had a quick scan though that PDF and I can see I'm going to need my wit's about me when I'm reading it.

And my laptop battery is dying .. but I will certainly have a read through (probably at least twice by the look of it) and try to get my head around PID tuning a bit more.

So that cap itself has to be physically connected to the motor body? I couldn't connect it to the frame? ( which is obviously connected (electrically) to the motor body?) I'm just trying to avoid cutting into the wires if possible ... If not I will have to cut into the wires .. but If I can just connect the caps to the end's of the wires and frame that's much easier and neater.

 


Get Your Ad Here

data_list