Shop OBEX P1 Docs P2 Docs Learn Events
Mechanical Engineering Senior Design Project HUGE PROBLEM / URGENT — Parallax Forums

Mechanical Engineering Senior Design Project HUGE PROBLEM / URGENT

MedDispenserMedDispenser Posts: 8
edited 2006-04-22 23:07 in BASIC Stamp
Ok we made a medication dispensing system for our senior design project. We are not electrical engineers we are mechanical engineers. We are using a 7.5 degree stepper motor. When I rotate the motor using half steps 3 times then pausing it works fine. That would be the half step program I have attached. If I try to just take that program and do 3 half steps without looping it, it seems to not work at all or rarely.


Now for the even bigger problem. I need to make 3 half steps on command. I am doing this from the final program file I attached. It's not working. I have a makeshift clock to skip using a crystal. It's supposed to activate the motor after a button is pressed.

Problem 1) After the button is pressed the hours on the clock jumps to 3!! I don't see where the glitch is
Problem 2) I need to make 3 half steps of the motor

I really would appreciate any help I thought we had this figured out. I need to have this ready to present to a board of executives so soon its not even funny. If you could post here, e-mail Warren.Halbig@gmail.com or send me a message and you can call if your that willing to help. I really greatly appreciate any help. Thank you!

Warren

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2006-04-22 20:38
    It looks like your "stepdelay" has gone from 150 mSec down to 15 mSec. Is that going to work?

    Next -- it looks like you've lost the {$PBASIC 2.5} directive in the transition between the two programs.

    And what's with those "B0" through "B8" variables?· Isn't it more usual, (and safer) to declare variables?·

    As it is, it looks like B0 and B1 are being 'stepped on' by some of your other variables.

    Also -- how does your stepper motor get its position initially set?· You don't set your "stpIdx" or "stpIdx2" values initially -- so I'd assume they were zero, but what if that doesn't match where your stepper is in its movement?

    Post Edited (allanlane5) : 4/22/2006 9:16:51 PM GMT
  • MedDispenserMedDispenser Posts: 8
    edited 2006-04-22 20:44
    Nah.. I was just seeing if that would affect it
  • Russ MillerRuss Miller Posts: 25
    edited 2006-04-22 21:13
    Yeah, Allan is right about the variables - stepdelay and B1 are the same byte in RAM, which is set to zero with B1=0. Maybe something else is wrong too, but stepdelay of zero could cause the stepper to lose steps. Give the variables meaningful names (seconds, minutes, etc) with VAR and the code will be both easier to read and more likely to work. The variable names don't take up any extra room in the BS2.

    Good Luck
  • MedDispenserMedDispenser Posts: 8
    edited 2006-04-22 21:16
    Allan I am sorry I didn't read your post entirely, I am going to try both of your suggestions. Thank you guys. I'll be back in a lil bit
  • MedDispenserMedDispenser Posts: 8
    edited 2006-04-22 21:19
    "You don't set your "stpIdx" or "stpIdx2" values initially "

    How would I set this in the initial program? Just make them zero?
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-04-22 21:28
    Yup, "stpIdx = 0: stpIdx2 = 0" would do it.

    However, it would probably help if that's where the stepper motors are -- position zero.
    So you may want to insure you either leave the stepper motors AT position zero when you shutdown your program, or that you have some routine to synchronize the position of the steppers with your indexes -- like rocking the steppers forward and back, or something.
  • MedDispenserMedDispenser Posts: 8
    edited 2006-04-22 22:11
    Good news, the clock is working again! It must've been those overlapping variables.

    I am going to take a look at the stepping problem now. Thanks so far!
  • MedDispenserMedDispenser Posts: 8
    edited 2006-04-22 22:38
    Ok so basically the dispenser has a divider assembly in a main dish. It takes 3 half steps to increment it one dosage. It then falls through a hole. The intended user should not have to worry about what position the motor is at. It seems like this might cause a problem. Setting the motor initially to 0 doesn't really affect it all too much.

    The stepping doesn't seem right and some times it just twitches and doesn't really move and then others its fine

    Heres the new program
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-04-22 23:06
    "twitching" is sometimes a symptom of poor (or entirely missing) grounding. Otherwise, it looks much better than it was.
  • MedDispenserMedDispenser Posts: 8
    edited 2006-04-22 23:07
    Thank you.. I've never used stamp before. But I think your right about it needing to start on the same phase. I need to find a way to accomplish this.
Sign In or Register to comment.