|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Speed controlling a relay..?!?!?one/????
Okay. We want to slow down the speed with which a spike relay drives a motor. We have tried programming in delays in the proccessing, and creating loops that would only let the relay activate after they had cycled for a while. We are trying to make it pulse on and off instead of constantly open or closed.
The problem with that is that the method that tells the relay to active makes it so that there will be a delay after we press the button so it takes a minute for the motor to go, but doesn't pulse the relay. Has anyone successfully programed something that would pulse a relay in this fasion? ps. We don't want to reduce the voltage to the motor because we want to retain power. |
|
#2
|
||||
|
||||
|
Re: Speed controlling a relay..?!?!?one/????
Quote:
Your post is a little confusing, but it sounds like you want to turn on a relay output immediately, then control the amount of time that it is on, and then enforce a minimum 'off' time. How about something like this in your default_user() code... Code:
#define TIMER_ON_VALUE 10; // 26.3ms * 10 = 263ms
#define TIMER_OFF_VALUE 38; // 26.3ms * 38 = 1 second
unsigned int TimerOn = 0;
unsigned int TimerOff = 0;
if (TimerOn) { // if on timer is running
if (!(--TimerOn)) { // decrement it, and if it just hit zero then...
relay1_fwd = 0; // turn off the output
TimerOff = TIMER_OFF_VALUE; //... and start the off delay timer
}
}
if (TimerOff) { // if off delay timer is running
--TimerOff; // decrement it
}
// if user triggers motor on and neither timer is running
if (p1_sw_trig && (!(TimerOff)) && (!(TimerOn))) {
relay1_fwd = 1; // turn on the relay output
TimerOn = TIMER_ON_VALUE; // ... and start the 'on' timer
}
|
|
#3
|
||||
|
||||
|
Re: Speed controlling a relay..?!?!?one/????
If I read that correctly, it sounds like you're trying to make the Spike emulate a Victor with the pulsed power output. Why not just use a Victor? Pulsing the Spikes that rapidly is probably bad for them as well.
|
|
#4
|
|||||
|
|||||
|
Re: Speed controlling a relay..?!?!?one/????
Concur with Matt. All you're doing here is making a very poor imitation of a speed controller. The speed controllers do exactly what you're trying to do, only faster, better, and more reliably. If you're trying to slow the motor down without losing power, you might just try mechanically gearing it down more. With your method, the motor will just sag and be backdriven during the off periods so you'll still be losing "power" just the same as with the speed controllers.
|
|
#5
|
|||
|
|||
|
Re: Speed controlling a relay..?!?!?one/????
Spikes are mechanical - that is, the current is controlled by moving parts. (Victors also are, internally, but they're tuned for high speed switching) You can probably wear one out pretty quickly by clicking it on and off too fast.
|
|
#6
|
||||
|
||||
|
Re: Speed controlling a relay..?!?!?one/????
Quote:
Since no expectations as to duration and repetition rate were provided, I chose somewhat reasonable values to use in my example. If a small motor were connected, the relay would probably survive at least couple days of competition. If a large motor were connected, then it would probably be good to have a box of spare relays on hand. |
|
#7
|
||||
|
||||
|
Re: Speed controlling a relay..?!?!?one/????
Thanks. I know that a victor would be better (and yes, that is what I want the result to emulate) however, we can't really do that at this stage. Our board is very compact and we don't have as much time as we would like. We really desire a programming solution.
If anyone has a solution to make a spike emulate a victor, though, that would be extremely helpful. |
|
#8
|
||||
|
||||
|
Re: Speed controlling a relay..?!?!?one/????
Quote:
At best you can turn it on and off 6 times per minute if you plan on attaching a motor to it. The spikes really just can't do speed controlling. |
|
#9
|
|||
|
|||
|
Re: Speed controlling a relay..?!?!?one/????
Yeah, you are really much better off just using a Victor - they're not all that bigger than the spikes, you can probably squeeze them in somewhere.
|
|
#10
|
|||||
|
|||||
|
Re: Speed controlling a relay..?!?!?one/????
I have to disagree. 6 times per minute? 10 seconds between switches? That is patently untrue. I can walk over to the robot and toggle a switch a few times if you'd like proof.
|
|
#11
|
||||
|
||||
|
Re: Speed controlling a relay..?!?!?one/????
Spike relays are meant to give a on signal, reverse signal, and a neutral signal. As someone said earlier, you should use a speed controler if variation is what you want.
|
|
#12
|
|||
|
|||
|
I had this idea, but my team shot it down, I later learned that a relay is for full forward or full back or not at all, and speed controlers are used for motors. I hoped this helped.
Blaise |
|
#13
|
|||
|
|||
|
Re: Speed controlling a relay..?!?!?one/????
Quote:
Spikes do use mechanical parts. They do not like being switched quickly. However, nothing says you can't do so provided you are willing to live with the consequences. It is very possible that you will burn your Spike out. Modify this code to fit it into your program. spike_pwm_timer++; if(spike_pwm_timer>=spike_pwm_max_value) spike_pwm_timer=0; spike=spike_pwm_timer<spike_pwm_ontime; This will pulsewidth modulate your spike's output with a frequency of 40Hz/spike_pwm_max_value, with a duty cycle of spike_pwm_ontime/spike_pwm_max_value. I did this one year for the last 8 rounds of nationals. It worked, sort of. I think my values were spike_pwm_max_value 32 spike_pwm_ontime 10 but your mileage may vary. Again, you do run the risk of breaking things, so don't blame me for lighting your Spikes on fire. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Controlling motor speed | WGRAY | Programming | 9 | 16-02-2009 22:50 |
| Controlling | team 803 | Programming | 10 | 21-02-2006 13:56 |
| Edit- Can we connect more than one speed controller fan per breaker? | DemonYawgmoth | Rules/Strategy | 7 | 03-02-2006 21:37 |
| Controlling motors | railerobotics | Programming | 6 | 17-01-2006 17:17 |
| <R86> No more than one motor may be connected to each speed controller. | Michael Hill | Electrical | 2 | 08-01-2006 02:00 |