Go to Post A bunch of kids in prom dresses staring through telescopes must have been quite a sight! - BlondeNerd [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 26-02-2007, 15:49
Mr. E Mr. E is offline
Its physics or stamp collecting
FRC #1883
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Las Vegas
Posts: 38
Mr. E is an unknown quantity at this point
Lowering the voltage on a spike

Is there a way to lower the voltage on a spike.
The spike drives a window motor but the motor is turning too fast. I want the spikes on/off function, but slower.
thanks
  #2   Spotlight this post!  
Unread 26-02-2007, 15:52
TubaMorg TubaMorg is offline
Programmermechanicalelect ricalcoach
AKA: Dan
FRC #1480 (Robatos Locos)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Houston
Posts: 450
TubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond repute
Re: Lowering the voltage on a spike

you need to use a Victor. You can turn it "on" and "off" plus control the speed of your motor by plugging it into a PWM port. Sending a 127 signal is "off". 128-254 is variable speed in one direction while 0-126 is variable speed in the other direction.
  #3   Spotlight this post!  
Unread 26-02-2007, 16:00
bjimster1's Avatar
bjimster1 bjimster1 is offline
Registered User
AKA: Jimmy Bourne
FRC #1029 (Wolvcats)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2004
Location: Miami, FL
Posts: 117
bjimster1 is just really nicebjimster1 is just really nicebjimster1 is just really nicebjimster1 is just really nice
Send a message via AIM to bjimster1
Re: Lowering the voltage on a spike

yea, you're not gonna be able to do it with out using a PWM.
basically it goes like this:
spike = on/off switch
pwm = dimmer

you're only other option is to play with the gear ratios (smaller gear, sprocket, pulley, w.e. on the window motor and/or larger gear, sprocket, pulley, w.e. on whatever is being driven.

probably, the easiest thing to do is to swap the spike for a pwm
__________________
-2006 UCF Quarterfinalists w/ 1345 & 21
-2005 Peachtree Quarterfinalists w/ 1180 & 462
-2005 UCF Quarterfinalists w/ 1694 & 348

CMU '11
  #4   Spotlight this post!  
Unread 26-02-2007, 16:06
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,187
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: Lowering the voltage on a spike

Quote:
Originally Posted by Mr. E View Post
Is there a way to lower the voltage on a spike.
The spike drives a window motor but the motor is turning too fast. I want the spikes on/off function, but slower.
thanks
You could use a bunch of the highest gauge wire available.

Actually, I believe that would be illegal.. Electrical gurus?

You're gonna have to switch over to a Victor.
  #5   Spotlight this post!  
Unread 26-02-2007, 16:20
Fred Sayre's Avatar
Fred Sayre Fred Sayre is offline
Registered User
AKA: Fred Sayre
FRC #0488 (xbot)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2003
Location: Seattle
Posts: 141
Fred Sayre has a brilliant futureFred Sayre has a brilliant futureFred Sayre has a brilliant futureFred Sayre has a brilliant futureFred Sayre has a brilliant futureFred Sayre has a brilliant futureFred Sayre has a brilliant futureFred Sayre has a brilliant futureFred Sayre has a brilliant futureFred Sayre has a brilliant futureFred Sayre has a brilliant future
Send a message via AIM to Fred Sayre
Re: Lowering the voltage on a spike

Can you not send a series of on/off pulses through the spike? I am sure its probably a bit harsh on the motor.

Both this idea and the victor technically wouldn't limit the actual voltage, just the duty cycle of the signal.
  #6   Spotlight this post!  
Unread 26-02-2007, 17:54
Mr. E Mr. E is offline
Its physics or stamp collecting
FRC #1883
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Las Vegas
Posts: 38
Mr. E is an unknown quantity at this point
Re: Lowering the voltage on a spike

how about something like this...

if button is pushed (p1_sw_trig)
( pwm01 = 155; //turn slow)
if button is pushed (p1_sw_top)
( pwm01 = 110; //turn slow backward)


What would this code actually look like?

The problem is that using a spike makes writing my code alot easier. Wiring the motor through a victor, (which we have already done) is possible but not now

Last edited by Mr. E : 26-02-2007 at 18:46.
  #7   Spotlight this post!  
Unread 26-02-2007, 18:03
Andrew Blair's Avatar
Andrew Blair Andrew Blair is offline
SAE Formula is FIRST with Gasoline.
FRC #0306 (CRT)
Team Role: Alumni
 
Join Date: Feb 2005
Rookie Year: 2004
Location: Corry
Posts: 1,193
Andrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond repute
Send a message via AIM to Andrew Blair Send a message via Yahoo to Andrew Blair
Re: Lowering the voltage on a spike

Quote:
Originally Posted by fsayre View Post
Can you not send a series of on/off pulses through the spike? I am sure its probably a bit harsh on the motor.

Both this idea and the victor technically wouldn't limit the actual voltage, just the duty cycle of the signal.
I'm pretty sure that the Spike cannot operate at high frequencies like a Victor. If I remember right, the max cycling is like 20hz for just a few seconds. The Victors are solid state, but the spikes are actually a mechanical relay- thats the clicking noise. This limits the frequency as well as the life cycles that the unit can handle. Otherwise, I think your idea is right, just not with our hardware.
__________________
Reading makes a full man, conference a ready man, and writing an exact man.
-Sir Francis Bacon

"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction."
-Albert Einstein
  #8   Spotlight this post!  
Unread 26-02-2007, 18:09
meatmanek meatmanek is offline
Programmer/physicist/mathematician
FRC #0868 (TechHounds)
Team Role: Programmer
 
Join Date: Mar 2004
Rookie Year: 2004
Location: Carmel, Indiana
Posts: 142
meatmanek is a splendid one to beholdmeatmanek is a splendid one to beholdmeatmanek is a splendid one to beholdmeatmanek is a splendid one to beholdmeatmanek is a splendid one to beholdmeatmanek is a splendid one to beholdmeatmanek is a splendid one to behold
Re: Lowering the voltage on a spike

For your own sanity, please don't just say 'pwm01 = 155; // slow forward.'
do this instead:

Code:
#define DRIVE_SLOW_FWD 155
#define DRIVE_SLOW_REV 99

// other code...

pwm01 = DRIVE_SLOW_FWD;
For one, it saves you a comment every time you use that value
for two, if you ever want to change the value, you don't have to find'n'replace 155

But, to allow you to save face, I'm going to assume that you replaced your #define or equivalent with 155 when you pasted for clarity.
This comment was directed toward new programmers.
__________________
Real programmers use vim.
  #9   Spotlight this post!  
Unread 26-02-2007, 18:33
Dave Scheck's Avatar
Dave Scheck Dave Scheck is offline
Registered User
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Feb 2003
Rookie Year: 2002
Location: Arlington Heights, IL
Posts: 574
Dave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond repute
Re: Lowering the voltage on a spike

Quote:
Originally Posted by Mr. E View Post
how about something like this...

if button is pushed( relay 1 fwd)
( pwm01 = 155 //turn slow)


What would this code actually look like?

The problem is that using a spike makes writing my code alot easier. Wiring the motor through a victor, (which we have already done) is possible but not now
As was mentioned above, the Spikes are relays and only exhibit forward/off/reverse functionality. There is no slow speed. It's all or nothing. If you want a slower speed, you either need to change your gearing (probably not an option) or use a Victor to variably control your speed.

I don't understand your comment about the code being harder. It is essentially the same code, just on a different port (pwm vs relay).

For a relay, you probably have
Code:
relay1_fwd = 1;
whereas for a speed controller you would have what meatmanek suggested.
Code:
pwm01 = DRIVE_SLOW_FWD;
If you could clarify what you think would be harder, we may be able to offer up some better suggestions.
  #10   Spotlight this post!  
Unread 26-02-2007, 18:37
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Back to humble
FRC #0832
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Atlanta GA
Posts: 7,011
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
Re: Lowering the voltage on a spike

Quote:
Originally Posted by fsayre View Post
Can you not send a series of on/off pulses through the spike? I am sure its probably a bit harsh on the motor.
And even harder on the Spike. Solid state or not, switching an inductive load isn't pretty.

But you definitely have the theory right!

Plus what Andrew said ^^

Don
__________________

I am N2IRZ - What's your callsign?
  #11   Spotlight this post!  
Unread 26-02-2007, 18:41
meatmanek meatmanek is offline
Programmer/physicist/mathematician
FRC #0868 (TechHounds)
Team Role: Programmer
 
Join Date: Mar 2004
Rookie Year: 2004
Location: Carmel, Indiana
Posts: 142
meatmanek is a splendid one to beholdmeatmanek is a splendid one to beholdmeatmanek is a splendid one to beholdmeatmanek is a splendid one to beholdmeatmanek is a splendid one to beholdmeatmanek is a splendid one to beholdmeatmanek is a splendid one to behold
Re: Lowering the voltage on a spike

If you're looking for code on how to pulse-width modulate the spikes so that you can decrease the speed, it can be done. However, realize that the spikes are mechanical devices, and switching them on and off wears them down. Normally, this isn't a problem, but it will be if you're switching them on and off once every second. The solution for the problem is to go to a solid state system - the Victor.

Now, if you're trying to run it slowly sometimes and quickly other times, you'll want to go with a Victor.

If you're trying to run it more slowly all of the time, the best solution might just be to change the gear ratio so you have more torque.
__________________
Real programmers use vim.
  #12   Spotlight this post!  
Unread 26-02-2007, 18:54
Mr. E Mr. E is offline
Its physics or stamp collecting
FRC #1883
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Las Vegas
Posts: 38
Mr. E is an unknown quantity at this point
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.
  #13   Spotlight this post!  
Unread 26-02-2007, 22:22
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
FRC #4901 (Garnet Squadron)
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Columbia, SC
Posts: 1,126
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
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:
Originally Posted by Mr. E View Post
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
Okay, I'm not sure if this will help you a lot, but I recently reprogrammed our 2003 robot. This robot uses PBASIC and not C, but this will give you a general idea if you know anything about If Then statements, which I assume you do. All you need to do is set:
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.
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian

Previous mentor and student from Team Fusion, FRC 364

Last edited by RyanN : 26-02-2007 at 22:32.
  #14   Spotlight this post!  
Unread 27-02-2007, 13:59
Mr. E Mr. E is offline
Its physics or stamp collecting
FRC #1883
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Las Vegas
Posts: 38
Mr. E is an unknown quantity at this point
Re: Lowering the voltage on a spike

Thanks Ryan, could you post your sample code?
  #15   Spotlight this post!  
Unread 27-02-2007, 14:32
Dave Scheck's Avatar
Dave Scheck Dave Scheck is offline
Registered User
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Feb 2003
Rookie Year: 2002
Location: Arlington Heights, IL
Posts: 574
Dave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond repute
Re: Lowering the voltage on a spike

Quote:
Originally Posted by Mr. E View Post
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.
That may be true in small simple cases, but as soon as you start getting more complicated and using the same value all over the place it will make your life easier. For example, if you look in ifi_aliases.h, you'll find
Code:
#define pwm01           txdata.rc_pwm01
Now imagine if you didn't have that alias in place and had to type txdata.rc_pwm01 all over the place. The same goes for constants. Lets say you had a program that was doing a bunch of operations on circles and you needed to use PI all over the place. You could hardcode each line of code to have 3.14, but what happens if you want more precision? You have to search and replace all the 3.14's with 3.1415. If you had a constant, you would only have to change it in one place.

There's no hard rule that says you have to use constants/macros, but they sure do make your life easier.

Quote:
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. */
How about something like this?
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;
}
A couple of notes:
- 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
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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


All times are GMT -5. The time now is 00:22.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi