Motor Control Problem

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am using a Gecko Motor Controller to drive my telescope with a Pittman 9000 series DC motor. I use Timer1 to produce a pulse stream for the RA axis (East-West motion) and timer0 does the same for Declination (North-South)

I am using a Tiny2313 for this project and it is working fine. My problem: When I want to move to another part of the sky I have to increase the pulse frequency to drive the scope faster. I have done this by shifting the value in the OCR1AH/L registers to the right, doubling the pulse rate each time until I reach the slewing speed I want. This is rather simple to code and works well with one big exception.

The new telescope is quite a bit heavier than the previous one and when the speed is increased from tracking speed up to about 128X it is quite smooth, however when the speed jumps from 128 to 256 to 512 the Gecko loses counts and errors and resets. The Pulse rate for tracking the sky is ~130 pulses per second.

So my thought was to do a little more complicated speed increase algorithim and do an mx+b type of slope calc. store the calculated values in EEPROM or SRAM and copy them to the registers as required.

However if I want an increase in "So Many Pulses per second per second" I think I need a timer and an interrupt. Problem is both Timer1 and Timer0 are used.

Any insights into what can be done?

Thanks

Bob Parry

Bob Parry

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Instead of doubling each time, maybe just add a fixed amount? Or add a fixed fraction such as 1/4 or 1/2?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think you would do much better with linear speed change instead of exponential (which is what you seem to be doing now). Just ramp (up or down) linearly from the current speed to the desired one. This is done by changing the pulse frequency (not the period) by a constant increment until the desired frequency is reached.

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can control the rate of accelleration using the same timers you're using to create the pulsetrains.

The interrupt handler can keep it's own count, and every 'N' calls, update the frequency, by incrementing or decrementing the timers top value. Even if you use fixed increments, you'll end up with a bit of a curve, as the time to do the 'N'interrupts will change with the frequency. This can be compensated for, but is likely not necessary in this case.

Writing code is like having sex.... make one little mistake, and you're supporting it for life.