|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: Lowering the voltage on a spike
The drives been built. so I can't change the gears on the motors.
Just so I don't look like an absolute ignoramus, I do know how a spike and victor work, I just want to know if its possible. I know I'm not C savy, so things like #define DRIVE_SLOW_FWD 155 #define DRIVE_SLOW_REV 99 // other code... pwm01 = DRIVE_SLOW_FWD; always seems like an extra step that I don't have to do, especially when I can just say pwm01=155 and put in a comment on the side that reminds me what the line is actually doing. Okay.... the window turns a motor until it hits a switch. If I use a relay I can use relay1_fwd = p1_sw_trig & rc_dig_in01; /* FWD only if switch1 is not closed. */ relay1_rev = p1_sw_top & rc_dig_in02; /* REV only if switch2 is not closed. */ in the default code and it will do exactly what I need. (ex. turn right until the switch is hit--rc_dig_in01--, not be able to turn right anymore right, but will be able to turn left until it hits the other switch--rc_dig_in02--) but of course the motor turns too fast. If I wire the window to a victor then I have to write new code (thread--Programming a switch) to control the victor in the same fashion. I may have to do it this way, which was a little bit beyond my C skills. So I decided to go the other route and see if there was a way of just slowing down a victor, but apparently not. but I might be able to program a victor to work of a joystick button Last edited by Mr. E : 26-02-2007 at 19:18. |
|
#2
|
||||
|
||||
|
Re: Lowering the voltage on a spike
They rate a Spike at only 6 switches/minute with a load. I would seriously consider a Victor. It's your best option between a lot of high gauge wire or any other options posted here other than the victor idea.
Quote:
pwm1 = 127 'for off' pwm1 = 0 'for full reverse/forward' pwm1 = 254 'for full forward/reverse' Use the If then statements to set the limits for the motor. Once these limit switches are closed, set the pwm1 signal to 127 to stop the motor. You can use anything from 0-126 for one direction or 128-254 for the other direction, and of course the closer you get to 127, the slower the motor turns. I wish I had the code I made last week for our robot, it's an excellent example on what to do. In our application we had a motor controlling a shifter with 2 limit switches on the shifting rod. The robot would set the shifter to 1 or 0 by the use of the joystick and would keep it at 1 or 0 infinitely until the joystick button had been pressed to turn a different direction or if the robot had been turned off. Last edited by RyanN : 26-02-2007 at 22:32. |
|
#3
|
|||
|
|||
|
Re: Lowering the voltage on a spike
Thanks Ryan, could you post your sample code?
|
|
#4
|
||||
|
||||
|
Re: Lowering the voltage on a spike
Quote:
Code:
#define pwm01 txdata.rc_pwm01 There's no hard rule that says you have to use constants/macros, but they sure do make your life easier. Quote:
Code:
#define DRIVE_SLOW_FWD 155
#define DRIVE_SLOW_REV 99
....
if((p1_sw_trig == 1) && (rc_dig_in01 == 1))
{
pwm01 = DRIVE_SLOW_FWD;
}
else if((p1_sw_top == 1) && (rc_dig_in02 == 1))
{
pwm01 = DRIVE_SLOW_REV;
}
else
{
pwm01 = 127;
}
- The above code assumes that the digital ins report a 1 when the switch is not pressed - You'll notice that I made explicit comparisons to 1 to determine the switch states. This is for readability and ease of maintenance. I can quickly go in and change a 1 to a 0 and get different behavior. Yes, I could just add a ! before the variable, but then it changes the visual flow of the code. - You'll also notice that I'm doing a boolean and (&&) instead of a bitwise and (&). While the operation in this case is identical, it's a good habit to get into. - There is a small error case that is not handled. What happens if both buttons are pressed at the same time? The FWD case will dominate until the switch is pressed then the REV case will take over. As soon as switch 1 is released it will drive FWD again. Hope this helps |
|
#5
|
|||||
|
|||||
|
Re: Lowering the voltage on a spike
As it relates to an earlier question in this post. There is no limit on the length of wire you may use on your robot. As long as the wire size is protected by the specified breaker you may do what ever seems to make it work. However, at a window motor operating current of 2 amps you would need to add 100's of feet of wire to you robot to achieve a reduction in current.
Relays are not happy switching quickly (>2 or 3 Hz) and get really unhappy when the load is inductive, i.e. motors. The switching current causes some arcing as the contacts break open which eventually leads to pitting of the contact surface. Since this damage has a dominoe effect, the eventual failure can be either a permanent open or a permanent close. Neither are desirable. Your only alternative seems to be a change in gearing or a swtich to Victor. Sorry. |
|
#6
|
|||
|
|||
|
Re: Lowering the voltage on a spike
And of course, whether you choose to go with a victor or a gear ratio reduction depends on a few things:
If you could use the extra torque (who couldn't?), go with a gear reduction If your mechanism isn't designed to take changes in chain length like that, (this happened to us a few years back), go with a Victor. If you can afford the extra weight of a victor, but never need to go as fast as you can right now, and a gear reduction is simple, do both. The variable power output of a Victor is always nice, it allows for things such as PID. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| What is best for lowering the middle wheel? | Jeff K. | Technical Discussion | 9 | 28-01-2006 12:49 |
| Lowering the Bar? | Aignam | Regional Competitions | 4 | 07-03-2004 23:13 |
| Raising the bar...or lowering it? | Ben Mitchell | General Forum | 29 | 13-01-2004 03:30 |
| Problem with Lowering the Bar | Kevin Kolodziej | General Forum | 14 | 12-01-2004 21:58 |
| Voltage Byte -> True Voltage | Ulibrium | Technical Discussion | 11 | 01-03-2002 08:55 |