Shop OBEX P1 Docs P2 Docs Learn Events
Propeller versus Basic Stamp with a stepper motor. — Parallax Forums

Propeller versus Basic Stamp with a stepper motor.

WolfbrotherWolfbrother Posts: 129
edited 2010-01-11 05:41 in Propeller 1
Hi all, I'm really lost on converting this working basic stamp program to a propeller. I need the propeller because I want to have multiple things running at the same time. My Stamp program outputs a pulse to a unipolar stepper driver model K179. In theory it's a pulse about 40uS wide and repeats every 1mS or so. The Parallax USB scope makes me think it's more like a 40uS pulse every 2.2mS. But that's ok because hooking it up to the stepper motor driver spins it just fine. The propeller translation actually behaves like the theory mostly, but I emprically changed the values to match the scope outputs. Looking at the scope output, it looks like the two outputs are close enough to make the motor work. Hooking it up the same way to the driver board however, the motor just sort makes a little move, but not a rotation at all. I'm using the Propeller Robot Control board and using a 5.6K Resistor to input to the board, because the documentation says the 5V·translators require 4.7K impedance on the output. I have tried shortening the propeller pulse and/or varying the frequency. The K179 controller is just CMOS chips feeding a gang of FETs. I have attached·my scope output and my two programs. Any ideas what I am missing/doing wrong?

On the scope output the blue trace is the Basic Stamp and the red trace is the Propeller.

Thanks,

Dave

Comments

  • photomankcphotomankc Posts: 943
    edited 2010-01-05 05:59
    Just to rule out the obvious.... you don't have your dir/step crossed going to the driver?· Is it twitching rapidly or just every now and again?· Looking at the signals I can't see why one would work and another wouldn't.
  • WolfbrotherWolfbrother Posts: 129
    edited 2010-01-05 08:49
    I haven't crossed them. I'm still playing with it, I can modify the time it's low to make the motor spin, I didn't think Stepper motors had that narrow of a range they worked in, I thought frequency related to speed of the movement. Even with the spinning I can get, it's fairly inconsistent. The basic stamp is smooth and returns the stepper to the same zero everytime. The prop vibrates a bit and then goes, it sort of can get smooth turning, but it's not returning to the zero. On the direction pin, a zero allows it to turn but a one stops from turning. Again on the stamp it works just fine. Could this be a result of the 3.3 to 5V translators on the board? Should I use a pull up for these outputs?
  • Graham StablerGraham Stabler Posts: 2,510
    edited 2010-01-05 10:05
    I think it is very likely to be the voltage level translators causing the problems, your code looks fine and so does the trace. I'm surprised the series resistor does not work however, you may want to experiment with higher and lower values.

    One other option is to not use them and instead just use a series resistor straight from the propeller output pin. I think a couple of hundred ohm is enough to protect the prop but more should work fine too.

    Graham
  • WolfbrotherWolfbrother Posts: 129
    edited 2010-01-05 16:43
    Hi,

    I tried various resistor values until wee hours of the night. I also tried a voltage divider with the lower leg definitely having almost 5 volts. Without the translators the propeller output is only 3.3V and this K179 board doesn't respond well to 3.3. But I did try my Propeller starter kit board and it didn't even make things buzz. I guess I am really wondering why the signals look the same and the response from the actual device is so different. Anybody who is familiar with the Prop Robot control board have any similar experiences with the steppers or the translators?

    Thanks,

    Dave
  • photomankcphotomankc Posts: 943
    edited 2010-01-05 16:45
    Looking at the 4093 I'm not sure a direct connection would reliably trigger it? It's typical threshold is listed at 3.3v so I would think that would be iffy at best unless I'm missing something. That one has me a little stumped? I just can't see what would be the issue there. The 4093 doesn't need any input current to speak of. The grounds of the two devices are solidly connected right?

    You might try setting up a transistor switch with the 3.3V output on the prop to trigger the pulses on the 5v board since it's all output only. I guess a pull-up might be worth a shot too as long as you don't exceed what the 5V translator can sink.
  • WolfbrotherWolfbrother Posts: 129
    edited 2010-01-05 23:45
    I talked with Parallax this morning and they also suggested I bypass the level translators, so I soldered a header on the board and the jumper connection. Now I get the same period pulse train, but it's capped at 3.38V. I tried putting that into the K179 and once again, I'm not getting rotation with the propeller. I talked to another person, who suggested I post a couple photos of my setup. Basically, both setups are the same, I have the pins directly coming out through a 1K resistor and into the scope or into the unipolar driver board. The signal traces on the scope say that the signals are pretty much the same, except for the amplitude.· Help?
    4000 x 3000 - 811K
    4000 x 3000 - 1M
  • CannibalRoboticsCannibalRobotics Posts: 535
    edited 2010-01-06 00:05
    Increase your sample rate on the scope and look at the shape of the top of the pulses. It's probably just aliasing but the wave forms do look different. THe blue trace is more narrow. Also, if possible, try to hook up a scope probe to the output of the Prop only. Then connect both to the motor driver and look for a change in the signal.
    Make sure everything has the same ground before you do this.
    cool problem!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Signature space for rent!
    Send $1 to CannibalRobotics.com.
  • WolfbrotherWolfbrother Posts: 129
    edited 2010-01-06 00:11
    Hi CannibalRobotics,

    I put it on a DSO where I work. The pulses on that actually look pretty good. The propeller pulse was a bit wider than the stamp, but within 10uS. So I adjusted the wait to narrow it a touch. Since that pulse goes into the 4093 trigger, I don't think there's much issue there. I also don't see much of a change with the scope loaded or unloaded. I am carrying the common grounds all the way. Thanks for the thoughts.
  • CannibalRoboticsCannibalRobotics Posts: 535
    edited 2010-01-06 00:43
    Well, it must be a personality conflict. Hide the prop and tell the controller it's a stamp!
    But seriously when interfacing TTL to CMOS, one uses a pull-up. BUT! The TXB0108 is an NMOS/PMOS construct, not TTL.

    And, the Ti documentation of the TXB0108 sez:
    "Pull up or Pull down Resistors on I/O Lines-
    The TXB0108 is designed to drive capacitive loads of up to 70pF. The output drivers of the TXB0108 have low
    dc drive strength. If pull up or pull down resistors are connected externally to the data I/Os, their values must be
    kept higher than 50kΩ to ensure that they do not contend with the output drivers of the TXB0108.
    For the same reason, the TXB0108 should not be used in applications such as I2Cor 1-Wire where an
    open-drain driver is connected on the bidirectional dataI/O."

    So I'd be tempted to try a pull-up connected to the CMOS power supply on the motor controller side.

    Also, National Semiconductor has this to say about TTL to CMOS.
    http://digital.ni.com/public.nsf/allkb/826C981B3D0D3A9786256DD300188620

    Fairchild has this to say about NMOS to CMOS, page 5 shows a pull up.
    http://www.fairchildsemi.com/an/AN/AN-314.pdf

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Signature space for rent!
    Send $1 to CannibalRobotics.com.
  • WolfbrotherWolfbrother Posts: 129
    edited 2010-01-06 01:18
    I bypassed the TXB0108 because it has a whisper of drive current, since the prop outputs 3.3V on it's I/O, I figured I would just drive this into the CMOS chips. Looking on the TI site, the CD4093 triggers positive with 2.2 to 2.9V on the input. My scope is telling me I am consistently outputting about 3.38V from the propeller, so I would think that's enough to drive the motor controller CMOS. I do have my grounds tied together, so I don't think there's any issue there. Of course it's still not working...
  • CannibalRoboticsCannibalRobotics Posts: 535
    edited 2010-01-06 01:55
    Have you tried a cap straight out of the prop and into the motor controller?
    Maybe there is some sneak current somewhere causing a build-up of charge.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Signature space for rent!
    Send $1 to CannibalRobotics.com.
  • WolfbrotherWolfbrother Posts: 129
    edited 2010-01-06 15:54
    For added enjoyment, I used my propeller starter kit with the same setup. It creates the same waveform as the Prop Robot board and oddly spins the motor pretty much like the stamp BOE board does, not quite as precise but certainly a smooth spin. But... it won't change direction at all. It only will spin in one direction.
  • photomankcphotomankc Posts: 943
    edited 2010-01-06 16:54
    It spins when direction is low or high?
  • WolfbrotherWolfbrother Posts: 129
    edited 2010-01-06 17:02
    Spins when direction is low, but and this is so odd, it does pull the line high. I have something very odd happening.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2010-01-06 21:11
    Wolfbrother,

    I did some quick checking and here is what I see...using your original posted code on the BS2 I see a 40uS pulse at 2.24mS intervals. The extra time is from loading and execution of the instructions in your loop.

    When I run the Propeller code I get a 52uS pulse every 2.26mS.

    Looking at the documentation for your controller it seems that it requires at least 8V for the supply voltage for the controller. Are you supplying that? Also, it requires a separate supply for the steppers...where are your supply sources coming from? The controller should have a common ground with the Propeller or BS2 board of course. The power supplies should already connect to the proper ground where you connect them to the controller.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    Check out the new Savage Circuits TV!
    ·
  • WolfbrotherWolfbrother Posts: 129
    edited 2010-01-06 22:22
    Hi Chris,

    I agree on the times and intervals you said. The biggest question for me is why does the stamp circuit run so well and the propeller one doesn't? On the controller I am running a separate bench supply, supplying 8V for the CMOS and the separate side is supplying the voltage for the motor, the grounds are tied together on the supply and carried though on the stepper driver to either the stamp or the propeller board. I'm just stuck.

    Thanks,

    Dave
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2010-01-06 22:27
    Dave,

    So your BASIC Stamp and Propeller boards are getting power from somewhere other than where the controller and Steppers come from?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    Check out the new Savage Circuits TV!
    ·
  • WolfbrotherWolfbrother Posts: 129
    edited 2010-01-06 22:38
    Hi,

    Yes the both the propeller and the stamp are getting sourced from wall warts. I have tied all DC grounds together though.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2010-01-06 23:07
    Dave,

    I must admit to being at a loss. Since I don't have your Stepper Motor controller I am unable to duplicate any more of your system. One last thing I did think about though was where did you pick off your scope trace? Were you watching the trace at the output of the Robot Control Board or at the input of the stepper board? Check it at the input to the stepper board since that is after the resistor.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    Check out the new Savage Circuits TV!
    ·
  • WolfbrotherWolfbrother Posts: 129
    edited 2010-01-06 23:16
    Hi. They say misery loves company, but I'm thinking I'd rather not be miserable... The scope traces that I posted were direct from the board with no stepper driver connected. I figured I would match those first and if they matched, I'd be ok. Those traces were with the 5V level translators. Which is why they were both close to 5V. When I talked to Josh at Parallax, he told me that the translators would be ok to control a servo, but really couldn't drive much, I thought that the input current of the CMOS chip would be small enough that it might work. It wasn't. So I put the recommended header and jumper to disable the TI translators. I also put it back on the scope to make sure they weren't causing some bizarre loading even if disabled. They weren't.

    Since the stamp is working, I may be figuring out some way to use the stamp to drive the stepper and the prop board to interrogate where the stepper is and have it drive all the other motors. I really wouldn't have guessed what a puzzle this one is.

    Thanks,

    Dave
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2010-01-07 00:03
    Dave,

    So did you check the scope signal at the stepper controller with everything connected and running? That is the signal I would be interested in seeing. Also, while this problem can be discouraging, it probably is something simple we're all missing. Usually when I try to recreate a problem I try to simulate everything involved. But I can't really simulate your stepper controller from here. I am tempted to look in my parts bins at home and see if I have the CMOS chip so I can get right to the heart of this.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    Check out the new Savage Circuits TV!
    ·
  • CannibalRoboticsCannibalRobotics Posts: 535
    edited 2010-01-07 00:42
    Are the CMOS input chips powered at the 8 volt level?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Signature space for rent!
    Send $1 to CannibalRobotics.com.
  • WolfbrotherWolfbrother Posts: 129
    edited 2010-01-07 01:19
    Hi all,

    First, thanks for all the support, it really does help me. It certainly makes me think before I post something because I would hate to figure out that I had a super simple thing that I kept ignoring.

    I ordered a couple of the chips that are on this K179 board. The board uses sockets for all of them so that's a quick test. Maybe one of the chips is weak, my best guess is it would have to be the Schmitt Trigger if any.

    There's a 7805 on the K179 board which I checked and it's pretty good at 4.95V, I have the input to that 7805·at 7.2V to simulate a battery pack, because my original idea was to use a battery on this project. I never lowered it from that level. What I am going to try next is to level shift the 5V out of the Stamp to the 3.3 V level like the propeller outputs and see how that goes. Pretty much that's about all I can think of.

    My plan B is to use the stamp to run autonomically and set an interface to tell the prop when it's at either end of it's extension. So the propeller would drive the servos and the outer 7.2VDC motor that spins the whole arm.

    Lastly, I have checked the signal on the scope with the whole setup. I can't post it because it's an old analog scope. My computer is on another table separate from the assembly bench I have so I can't use the USB scope either.·But, it looks really about the same as the setup without the K179/motor on it, which is what I would expect since the logic chips should be pretty high input impedance.
  • Graham StablerGraham Stabler Posts: 2,510
    edited 2010-01-07 01:43
    your stepper control circuit seems fairly straightfoward so it would seem a good idea to start by driving it with constant inputs rather than a pulse train, then trace the voltages through, then change the level of the input and repeat. then do it for a pulse train with your scope
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2010-01-08 00:34
    Wolf,

    There's not a single reason the Propeller can't do this. So, whatever is going on we're certainly interested in getting it fixed. Please post your results once you've done the tests you mentioned.

    Best Regards,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    Check out the new Savage Circuits TV!
    ·
  • WolfbrotherWolfbrother Posts: 129
    edited 2010-01-11 04:38
    Hi all,

    It's working now. I took it all apart and put it back together and it still didn't work. I replaced the robot control board with the spare one I had as well. Still nothing. I had spares of the CMOS chips on the K179 board. I started by just replacing the CD4093 schmitt trigger and it that was the one that seems to be bad. I can't say that it's really bad since it worked for the higher voltage signal of the Basic Stamp, but it certainly couldn't work with the 3.3 V out of the propeller. Even with pull-ups on the output it wouldn't trigger. I'm not quite sure what to think about that, but I do guess it explains why the two signals would look the same and not perform the same. Thanks to everyone who helped with this, the community sure is helpful. I'll be doing the mechanical portion this week and then merging all the code towards the end of the week. I'm really happy about that.
  • photomankcphotomankc Posts: 943
    edited 2010-01-11 05:41
    Glad to hear you got it working.· Very strange to know it worked with the BS 5V signal but not the propellers level shifted 5V signal.· I think 3.3V is close enough to the edge on those devices that you could find some that would and some that wouldn't work with 3.3V logic.· Anyway, glad you got past the issue and can get on with the fun stuff.
Sign In or Register to comment.