Shop OBEX P1 Docs P2 Docs Learn Events
Bipolar stepper motor — Parallax Forums

Bipolar stepper motor

metron9metron9 Posts: 1,100
edited 2006-04-27 17:57 in BASIC Stamp
I have been away from programming for a few months and it seems I am just to foggy in the brain to get this proof of concept through my head.

I have a stepper motor from an automotive guage, it is a little white plastic one with 270 degrees of movement

The panel when operated turns on the stepper in a counter clockwise direction till it bangs against the pin so it knows it is at position 0.

The motor operates typically with I think is called an H bridge but I want to control it with 4 stamp pins.

270 ohms per coil

Pattern to rotate motor clockwise given pins

pin1---(coil1)---pin2
pin3---(coil2)---pin4

1=+---+---+---
2=--+---+---+-
3=-+---+---+--
4=---+---+---+

Time----.>>>

How do I flip flop say pins 12,13,14 and 15 from inputs on 3 pins and output on one pin and then rotate through the pattern.
I used 2 leds to see them blink for testing


Pin 15>+(LED1)-<pin14 when 15=high and 14 is input to sink current is lit
Pin15>-(lLED2)+<pin14 when 14 is high and 15 is input to sink current

Below is code that is not working using direction registers and code that works using the HIGH LOW commands




I guess I just need to understand the direction registers again but I have been putting in 15 hour days at work and I just cant seem to find enough time to work it out.


Anyway I misss interacting with folks on this board and the mind stimulation I get working with programming and chips.


' {$STAMP BS2}
' {$PBASIC 2.0}



notworking:
DIRD=%1000 'direction pin15 output and 14 input
OUTD=%1000 'make pin 15 high and pin 14 sinks the current

PAUSE 100

DIRD=%0100 'direction pin 15 =input and pin 14 =output
OUTD=%0100 'make pin 14 high and sink current with pin 15

PAUSE 100

goto notworking

'=======================================================


' The code below works but is this the way to do it?

Xloop:
HIGH 15
LOW 14
PAUSE 100

LOW 15
HIGH 14
PAUSE 100
GOTO xloop


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think outside the BOX!

Post Edited (metron9) : 4/27/2006 1:24:04 PM GMT

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-04-27 14:22
    It's not a good idea to connect any kind of inductive device to the BASIC Stamp I/O pins. I suggest you use an L293D driver; it can sink and source current, and the programming will be the same.

    For your programming; you pins always need to be outputs (DIRD = %1111) and you'll need to adjust the sink (low) / source (high) state in code. The L293D will provide a nice buffer between the Stamp and the motor.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • metron9metron9 Posts: 1,100
    edited 2006-04-27 17:57
    Thanks for clearing that up Jon.

    I like that L293D chip. I will use it in higher power projects. I wish they had a low power one as I actually plan to use a ATTINY11L at 2.7V (a .30 cent part in qty) or the ATTINY12V at 1.8V only if I have too its 4x the price, I have not looked into the PIC line but what I am really looking for is a under $1.00 chip with 4 output pins to drive the stepper and an onboard thermostat so I dont have to use an external one. ATMEL makes one but not in a 8pindip however for production it may be the one to use.
    I think they can source 40mA.

    The stepper motor simply moves a pointer on a gauge and using 2.7 V it only draws about 10mA, I plan to measure the kickback but since the voltages are reversed on each winding I cant use a diode to solve kickback and I want to keep this thing under a buck for the electronics.

    If you have any ideas on processors that could fit please post.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think outside the BOX!
Sign In or Register to comment.