News:



  • June 16, 2024, 03:26:44 AM

Login with username, password and session length

Author Topic: Who programs them?  (Read 1663 times)

Offline Larry Cunningham

  • Red Hot Lover
  • Trade Count: (0)
  • Captain
  • *****
  • Posts: 855
  • Klaatu barada nikto my ass
    • Stephanie Miller
Who programs them?
« on: April 12, 2009, 12:24:16 PM »
I'm curious.

Who, here is actually writing programs for PIC chips (or similar) for the CL timer controls? If so, can you share any general information about it (programming language, software, program size, etc.)?

Thanks in advance for comments and discussion.

L.

"I know what pleasure is, for I have done good work." -Robert Louis Stevenson
AMA 247439 - '09, '10, '11, '12 and '13 Supporter of this site..

Alan Hahn

  • Guest
  • Trade Count: (0)
Re: Who programs them?
« Reply #1 on: April 12, 2009, 01:38:32 PM »
Will Hubin is "local"  (USA). He'll pipe in soon I think.

Igor Burger may have written something here or at SSW about his programming in an earlier post.

Offline Igor Burger

  • Trade Count: (0)
  • Admiral
  • ******
  • Posts: 2166
Re: Who programs them?
« Reply #2 on: April 12, 2009, 07:48:30 PM »
Yes, I am here and alive :-)

My older timer (programmable by power switch) used PIC 12F675 (approx 1kb of code). Newer version simple timer with 32 steps or version simulating 4-2-4 break and both programmable by Jeti Box is done on 12F683 and it has 2kB thanx Jeti communication subroutines. I use C language for programming.

Anything else?

Offline Larry Cunningham

  • Red Hot Lover
  • Trade Count: (0)
  • Captain
  • *****
  • Posts: 855
  • Klaatu barada nikto my ass
    • Stephanie Miller
Re: Who programs them?
« Reply #3 on: April 14, 2009, 12:20:48 PM »
Igor, how does the timer simulate 2-4 break? Does the ESC get any commands other
than raw speed setting? Is there any feedback information to the timer?

Particulars on the C compiler you used for the PIC?

Thanx,

L.

"The characteristic of genuine heroism is persistency." -Ralph Waldo Emerson
AMA 247439 - '09, '10, '11, '12 and '13 Supporter of this site..

Offline Igor Burger

  • Trade Count: (0)
  • Admiral
  • ******
  • Posts: 2166
Re: Who programs them?
« Reply #4 on: April 14, 2009, 02:48:50 PM »
it is exactly like IC engine ... if it feels that I need more power, it just adds little bit :-)

yes I have positive feedback from power consumption and now I do tests with gyroscope :-)

I use PICANT C compiler, it looks very good and it has limited, but well useful version for playing. It is limited to 2 KB of code on PIC12FXXX and legal for self writing.

http://www.sourceboost.com/

Offline Larry Cunningham

  • Red Hot Lover
  • Trade Count: (0)
  • Captain
  • *****
  • Posts: 855
  • Klaatu barada nikto my ass
    • Stephanie Miller
Re: Who programs them?
« Reply #5 on: April 14, 2009, 06:53:15 PM »
Wow! how very cool - I guess I need to bone up on gyroscopes. Can you steer me to reference material or part numbers?

Thanks again for the info, I'll have other dumb questions soon.

Best,

L.

Edit:

PS - by any chance are you using a rotational rate sensor chip, e.g. I saw listed such as the LISY300AL (single axis)
or IDG-300 (dual axis) or similar, rather than a complete gyro unit with sensor and servo control electronics?
The two mentioned here seem to be inexpensive and available (maybe) and look easy to interface with a microcontroller
with A/D input capabilities. That seems easier than trying to monitor and decode PWM servo signals..

It seems clear that the axis of the sensor would need to be on the pitch rotational axis for the ship, right?

Thanks for the C compiler link.

I'm still blundering around in the woods at this point, but I expect only a single axis (pitch) rate sensor would be
adequate for a RPM dither control input for your "2-4 break".

My motives are slightly different from what you are working on, and I will send you a detailed PM about it soon.
Thanks again for your help in understanding this.

"You cannot teach a man anything.; you can only help him to find it for himself." -Galileo  Galilei
« Last Edit: April 15, 2009, 02:47:37 AM by Larry Cunningham »
AMA 247439 - '09, '10, '11, '12 and '13 Supporter of this site..

Offline Will Hubin

  • Trade Count: (0)
  • Commander
  • ****
  • Posts: 151
Re: Who programs them?
« Reply #6 on: April 15, 2009, 09:05:03 AM »
I started with the Pic 12F683, programming in assembly language (because I had been using it for some time; it is considered more difficult to program this way but it is the most efficient in terms of program storage required and response time). I use the Pic 16F913 for my LCD-displayed throttle emulator and pulse width catcher because it includes direct drive for a 2 1/2 digit LCD. I'm using the Pic 16F684 for the new FM-6a and 6R because it has extra pins for more functions (in particular the ability to switch between the governed RPM mode and the Set RPM mode, as well as retract capability and LED indication of the delay time before flight time begins). One can start with a breadboarded chip and a socket and go from there, with the help of an oscilloscope (or pulse width catcher) to verify the output. Microchip's Pic series of microcontrollers, as well as an inexpensive programmer, are available at reasonable prices from Jameco and DigiKey. As soon as I find the extra time, I'm hoping to link my flight managers/timers to accelerometers/gyros, too... (See also the comments in the discussion of BEC voltages.)

Why should I have all the fun? Try it -- you'll like it.

Will


Offline Larry Cunningham

  • Red Hot Lover
  • Trade Count: (0)
  • Captain
  • *****
  • Posts: 855
  • Klaatu barada nikto my ass
    • Stephanie Miller
Re: Who programs them?
« Reply #7 on: April 15, 2009, 11:12:32 AM »
It seems straightforward to me, I can program in C (actually a "meta" assembly language)
and the assembly for the PIC, which is probably what I would use, as you say for the
efficiency and performance.

A quick question, when you are referring to the Set RPM and Governed RPM modes, would
I be correct in the following assumptions? 1) these modes are selectable in the ESC by
a command or switch, 2) Set RPM is an "open loop" mode, where you command a specific
(relative) RPM, and the ESC simply drives the 3-phase synchronous motor at that fixed
speed with a fixed waveform and timing (i.e. the motor might slip or jump phases depending
on load), 3) Governed RPM mode is a "closed loop" mode, where the ESC actually senses
load (perhaps using the motor's back EMF?) and adjusts the 3-phase drive timing/waveforms
to attempt maintain the specified RPM, under conditions of heavy load or even negative load.

Are these assumptions close to reality, or just my thought experiment going awry?

Thanks,

L.

"When you're as great as I am, it's hard to be humble." -Muhammad Ali
AMA 247439 - '09, '10, '11, '12 and '13 Supporter of this site..

Alan Hahn

  • Guest
  • Trade Count: (0)
Re: Who programs them?
« Reply #8 on: April 15, 2009, 12:01:14 PM »
It seems straightforward to me, I can program in C (actually a "meta" assembly language)
and the assembly for the PIC, which is probably what I would use, as you say for the
efficiency and performance.

A quick question, when you are referring to the Set RPM and Governed RPM modes, would
I be correct in the following assumptions? 1) these modes are selectable in the ESC by
a command or switch, 2) Set RPM is an "open loop" mode, where you command a specific
(relative) RPM, and the ESC simply drives the 3-phase synchronous motor at that fixed
speed with a fixed waveform and timing (i.e. the motor might slip or jump phases depending
on load), 3) Governed RPM mode is a "closed loop" mode, where the ESC actually senses
load (perhaps using the motor's back EMF?) and adjusts the 3-phase drive timing/waveforms
to attempt maintain the specified RPM, under conditions of heavy load or even negative load.

Are these assumptions close to reality, or just my thought experiment going awry?

Thanks,

L.

"When you're as great as I am, it's hard to be humble." -Muhammad Ali

At least I can answer that.

The Castle Creation's Phoenix line of ESC's has these two modes. The normal Governor mode takes the throttle input value and derives a desired rpm. If that throttle value stays fixed, the ESC will attempt to keep that rpm, basically by increasing/decreasing the PWM motor drive length to effectively raise or lower the power into the motor. The ESC keeps track of the rpm by looking at the back emf from the inactive leg of the 3 motor supply lines. This also is how the ESC commutes the motor. If you raise the throttle input, the governed rpm willl rise too.

The Set RPM mode allows you to fix three actual rpm values into the ESC. If the throttle input is less than 50%, you get rpm #1. If >50% and <99% you get value #2, and if >99% you get, and I bet you guessed it, value # 3. I use this mode and set my timer up to give me a lower throttle for the takeoff and first 2 laps, then it increases to the 2nd value for the wingover, and I set rpm#3=rpm#2 so it stays there for the rest of the flight. The timer itself is programmed to increase the throttle after an initial preset and I set that up to cross the 50% point after the 2nd lap. Then the timer throttle keeps on ramping up (at least the one I use does) to 100% at the end of the flight. But I still only get the 2 rpm values.


Offline Larry Cunningham

  • Red Hot Lover
  • Trade Count: (0)
  • Captain
  • *****
  • Posts: 855
  • Klaatu barada nikto my ass
    • Stephanie Miller
Re: Who programs them?
« Reply #9 on: April 15, 2009, 01:54:29 PM »
(That's what I get for guessing rather than finding and reading a user's manual..)

It seems to me that different motors might be optimized for slightly different
drive waveforms? Or all they all pretty much the same?

L.

"I always wanted to be somebody, but I should have been more specific." -Lilly Tomlin
AMA 247439 - '09, '10, '11, '12 and '13 Supporter of this site..

Alan Hahn

  • Guest
  • Trade Count: (0)
Re: Who programs them?
« Reply #10 on: April 15, 2009, 02:14:34 PM »
I am not an expert on the ESC, but ... y1 (that won't stop me from opinionating!)

The Castle Creation manual claims that it "figures out" the best timing automatically. By this I think it means that it decides when and where exactly to commutate the 3 different legs). You can trim this setting somewhat by choosing an aggressive timing (in other words, current turns on early and stays late as the motor rotates) or a less aggressive timing which will conserve battery current. What this means is that if you think about a simple magnetic dipole in a uniform North-South magnetic field, your maximum torque for a fixed current is when the dipole is 90 degrees to the uniform field. When the dipole is exactly aligned (like a compass needle to the N pole) there is zero torque for that same current. So as the dipole rotates, if you keep the current on for almost to the aligned point, you can get more torque out of the motor, at the expense of using a lot of current, particularly for those angles near the alignment points.

You can also choose the PWM update frequency. The default value is 12kHz (as I recall). I think I can go as high as 50kHz or as low as 8kHZ. The higher the update rate, as compared to the L/R of the motor windings, the more the motor sees a smooth DC like current. As I posted in my thread on ESC efficiency, the 12 kHz rate is actually pretty far away from the L/R rise/fall time for my motor. The downside of upping the rate is that now the switching losses in the ESC MOSFETs become more significant. The MOSFETs are pretty low resistance when "on", and very high when "off", but as they switch between these two states they go through a finite resistance and that short period of time is enough to lose some of your battery power to heat. How much I am not sure, but I am guessing it may be comparable to the gain in efficiency in the motor by having the higher rate---but I haven't tested this. Igor actually has, and come to think about it, I seem to recall he does see a small net increase in efficiency at the higher rate. Sometime I will revisit it when I have time.

Offline Igor Burger

  • Trade Count: (0)
  • Admiral
  • ******
  • Posts: 2166
Re: Who programs them?
« Reply #11 on: April 15, 2009, 02:23:22 PM »
>>Igor actually has, and come to think about it, I seem to recall he does see a small net increase in efficiency at the higher rate.<<<

yes ... small ... but I did see also troubles to start rotating ... but my Spin has only 8khz and 32khz so I stopped further tests since I use F2B A123 dedicated motor from Axi ... it runs very close to full throttle with very good efficiency (thanx to better copper filling and kv=680) and so gaps between impulses are very short and so I can fly little more that only 5 minutes also with 3 years old battery :-)

Offline Igor Burger

  • Trade Count: (0)
  • Admiral
  • ******
  • Posts: 2166
Re: Who programs them?
« Reply #12 on: April 15, 2009, 02:30:35 PM »
>>>LISY300AL<<<

No Larry, it is ugly bug and I do not like soldering too much :-) ... so I use simplest single axis gyro for helis without heading lock function. It does the same, but communication is in standard impulses, so it is relatively easy to work with. It is mounted to have yaw axle identical with vertical axle of model, so the siglal from  gyro is proportional to speed of the model .. the rest is trivial ... simple negative feedback with adjustable boudaries, low pass filter and sensitivity :-)

Offline Igor Burger

  • Trade Count: (0)
  • Admiral
  • ******
  • Posts: 2166
Re: Who programs them?
« Reply #13 on: April 15, 2009, 02:42:09 PM »
>>>A quick question<<<

Larry I thin easiest to understand function od ESC is following:

it has 3 parts

1/ commutator - it does exactly the job of mechanical commutator in DC PM motors

2/ PWM driver - it feeds the motor via commutator with PWM ratio relative to servo impulse length. It means POWER going to the motor, is proportional to pulse length, while RPM depends on that power and power necessary to handle attached prop. Means bigger prop rotates slowly.

3/ Governor - it uses signal from commutator and controlls the PWM driver, thus knows the commutation speed and thus controlls rpm wit feedback. Means RPM of commutation is relative to pulse lenght. It's function can be switched on or off. The relation between pulse length and RPM is usually depending on ESC - for example CC in our mode can have fixed rpm, Jeti Spin is well programmable and allows to define start and end points als also slope of the relation, MGM ESCs can "learn"  from test run of the motor and store setting etc...

Offline Larry Cunningham

  • Red Hot Lover
  • Trade Count: (0)
  • Captain
  • *****
  • Posts: 855
  • Klaatu barada nikto my ass
    • Stephanie Miller
Re: Who programs them?
« Reply #14 on: April 16, 2009, 07:20:21 PM »
Igor - what you are working on is a Timer/Controller which sends speed commands to a
commercial ESC, and uses the information from a rate gyro on the pitch axis to further
dither the speed control to affect a simulated 2-4 break. Right? Or sort of?

And your PIC controller is looking at the PWM output of the gyro. I assume it looks at the gyro
(digital) output signal, and looks for transitions, which cause it to start/stop a counter whose value
is an indication of pulse width. You may also be feeding the gyro a simulation of a fixed width pulse
for a "zero" rudder position command. Or not?

I assume you are using one of the PIC controller's internal timer functions to acquire the gyro data.
Or not?

I know what you mean by the gyro sensor chip being tiny, it is 7mm square and 1.5 mm thick and has a
flat package which requires either a much larger adaptor socket or special soldering techniques. Also
its output is analog, which is likely less convenient for the PIC chips.. And I doubt that you really need
many bits of resolution for the gyro reading; I'm guessing 5 or 6 bits or no more than 8 would do.

It sounds to me like the ESC's are pretty sophisticated, and well worth their costs. In addition, the
combination of switching fairly large currents, dealing with back EMF and other noise would require
some careful design to avoid problems with noise clobbering its microcontroller and other digital
logic.

I have some more thinking and studying, as I said, I was interested in fooling with something slightly different
from what you are doing, but would like to suck as much information out of your brain (excuse the expression!)
as I can.. ;->

Best,

L.

"Middle age is the time when a man is always thinking in a week or two he will feel as
good as ever." -Don Marquis
AMA 247439 - '09, '10, '11, '12 and '13 Supporter of this site..

Offline Igor Burger

  • Trade Count: (0)
  • Admiral
  • ******
  • Posts: 2166
Re: Who programs them?
« Reply #15 on: April 16, 2009, 11:52:46 PM »
yes

yes

yes

 ;D



Advertise Here
Tags: PIC  timer  programming 
 


Advertise Here