Shop OBEX P1 Docs P2 Docs Learn Events
transistor to use with propeller - Page 2 — Parallax Forums

transistor to use with propeller

2»

Comments

  • cavelambcavelamb Posts: 720
    edited 2012-07-27 07:21
    mikea wrote: »
    Thanks cavelamb, the power supply is one of 2 12volt batteries. the 2 are in series for 24v motors. I just attatched to the +/- of one of them for control power. they are the size battery for a rider lawn tractor. My protoboard is connected to 2 parallel 9 volt batteries, but i just got a 9v regulator and gonna put that in per Duane j diagram in this thread. The problem turned back up again. since i used 2n2222 the relays don't chatter anymore, but when raising the plow up or down it will go a ways then pause, and continue. Also i've noticed sometimes even without my input, the plow will go either direction for a fraction of a second. If i electrically skip past the r/c receiver and propeller and apply 3.3v to the base of the 2n2222 the thing runs without problem. It looks like filter caps in Duane j regulator drawing a few posts back, are there additional places in a circuit these would be helpful? -mike

    No way to know without showing the whole circuit...

    If the thing is sometimes running without input - something is really wrong somewhere...

    How about draw out what you have (by hand - on paper) and scan it?
    Leave the pretty drawings for after it works right.
  • mikeamikea Posts: 283
    edited 2012-07-27 09:02
    snow plow circuit scanjpg.jpg
    If something isn't clear let me know, Thanks -mike
  • mikeamikea Posts: 283
    edited 2012-07-27 09:10
    just noticed a drawing error. The 12 volt circuit actually comes from the battery on the left.(if that matters)-mike
  • mikeamikea Posts: 283
    edited 2012-07-27 12:53
    cavelamb, thank you for looking it over.
    1)you are right the sabertooth runs the 2 drive wheels. it happens to have the +5 volt circuit for things like r/c receiver, or mcu.


    2)sorry for the confusion, the double pole relay(on the left in the drawing) rests (while coil is not energized) on the contacts to the right which is wired for forward. This would normally be "on" so i interrupted one of the wires and put both ends to a separate single pole relay. when the 2nd relay is energized i get fwd, or i shut that off and energize the first relay(double pole) to get reverse. your drawing is slightly different. one two pole relay and one single pole is what i have, what software did you do that on btw? would've taken me quite a while. let me know if my explantion of the circuit isn't clear, my girlfriend says good communication is not my forte.

    3)when this gets ironed out there will be a 9v regular so i can run off the bigger 12v supply. I had the parallel 9v laying around and figured it would last longer.

    4)not sure what data packet means? I will post the code below.

    5)there is no breadboard, i have a protoboard. i'm a little new to soldering so i did as much as i could on a cheap pcb which sits next to the prop, receiver and sabertooth.
  • mikeamikea Posts: 283
    edited 2012-07-27 13:02
     
    CON
            _clkmode = xtal1 + pll16x                                               'Standard clock mode * crystal frequency = 80 MHz
            _xinfreq = 5_000_000
    VAR
      long cyclev
      long endcyclev
      long startpulsev
      long endpulsev
      long pulsewidthv
      long stack[100]
      long stack1[100]
      
    OBJ
           pst: "parallax serial terminal"
      
    PUB   eye
    cognew(plow,@stack)
    cognew(display,@stack1)   '  cog for pst for troubleshooting
    dira[2]~
    ctra[30..26]:=%00100
    ctra[5..0]:=2        'radio plugged into pin 2                'read r/c receiver section
    frqa:=1
                                                  
       repeat
         waitpeq(%000, |< 2, 0) ' wait for Pin 2 to go low     
         waitpeq(%100, |< 2, 0) 'Wait for Pin 2 to go high      
         startpulsev:=cnt
         waitpeq(%000, |< 2, 0) ' wait for Pin 2 to go low
         endpulsev:=cnt
         waitpeq(%100, |< 2, 0) 'Wait for Pin 2 to go high
         endcyclev:=cnt
         pulsewidthv:=endpulsev-startpulsev
         cyclev:=endcyclev-startpulsev
                                                           
              
    pub display     
    pst.start(115200)
    waitcnt(clkfreq/4+cnt)     
      repeat                                    'serial terminal section
       pst.str(string("cyclev="))               'display cyclewidth, and pulsewidth from receiver
       pst.dec (cyclev)
       pst.str(string(13,"pulsewidthv="))
       pst.dec(pulsewidthv)
                                             
       waitcnt(clkfreq/1000+cnt)
       'pst.clear
    pub plow 
    dira[5..7]~~                                                 'notes stickup=154300
                                                                       'deadstick=122000
                                                                       'stickdown=89600
                                                                        
    repeat                                                                       
      if pulsewidthv>132_400 and pulsewidthv <160_000            'if stick is pushed up then turn on transistor to switch relay 1
        outa[5]~~
        waitcnt(clkfreq/10+cnt)
      else 
        outa[5]~
         
              
       if pulsewidthv<110_400 and pulsewidthv >83_000          'if stick is pushed up then turn on transistor to switch relay 2  
           outa[6]~~
           waitcnt(clkfreq/10+cnt)
       else     
        outa[6]~
          
     
    
  • cavelambcavelamb Posts: 720
    edited 2012-07-27 15:05
    mikea wrote: »
    cavelamb, thank you for looking it over.
    1)you are right the sabertooth runs the 2 drive wheels. it happens to have the +5 volt circuit for things like r/c receiver, or mcu.

    2)sorry for the confusion, my girlfriend says good communication is not my forte.
    :lol: But if she's still there it can be all that bad.
    Sometimes words fail. So we invented drawing!

    Updated schematic. I didn't add the main drive motors because of room. And it sounds like that
    part is working ok.

    Does this schematic looks more like what you have in mind?

    I have the motor power enable relay on the supply side of the direction relay. It could be anywhere
    in the drive circuit but this is a more conventional arrangement. Not too sure I have the pins labeled
    correctly though.

    Trace out all the wiring. One way to do that is to print the schematic on paper and use a highlighter
    to trace wires. Match colors even, if you'd like. But make sure what you have wired up makes sense.

    One thing I don't see from your sketch was any pull down or pull up resistors on the Prop pins.
    We'll ask the gurus if they might be helpful here.
    MOTOR-1.jpg

    I use DesignCAD 3D. Good stuff, Maynard.

    The original drawing took about 30 minutes because I had to look up the Snaggletooth and see
    what that was all about. This edit took 2, maybe 3.
    Actually takes a lot longer to write the post that do the drawing!

    Well, let's see if this helps....

    Richard
    1024 x 679 - 47K
  • kbashkbash Posts: 117
    edited 2012-07-27 16:31
    the TIP-120 series Darlington is great to use for driving coils, lights, DC motors, etc. In a pull-down mode, you can control voltages many times higher than the Props 3.3. ( 30v +)
    These transistors also have a built in reverse diode for absorbing kickback voltages. A 1K resistor is fine for full "ON" drive.

    They can drive up to 5 amps up to 100V. ( some versions go even higher I think ) they cost less than $1.00 each.
  • mikeamikea Posts: 283
    edited 2012-07-27 18:43
    cavelamb, thank you for the schematic it looks good, accurate. There are no pull up/down resistors on the prop pins. gonna try design cad 3-d.
    @kbash how do you use tip 120 darlington in pulldown mode?. thanks guys-mike
  • cavelambcavelamb Posts: 720
    edited 2012-07-27 19:16
    transistor4.gif

    NPN transistor with the base tied LOW does not conduct.
    So a pull down resistor (Output pin to ground) would help keep the transistor off.
    Since the Propeller output pins can also be defined as inputs, this would keep the
    transistor turned off when starting up (before set as OUT and LOW).

    transistor3.gif


    When the base goes HI on an NPN the transistor conducts.
    If the pin is left floating (as an input for example, the transistor might be able to
    turn on partially, which could explain the unexpected movement.

    Try tying a 10K ohm resistor to ground on the two motor drive control pins.
    (on the Propeller side of the base resistor)...
    378 x 378 - 3K
    364 x 367 - 2K
  • tonyp12tonyp12 Posts: 1,951
    edited 2012-07-27 20:36
    Maybe the 12v tap-off is giving you problems, as I think they call it floating ground.
    Though going from 24v to 5v would need a switching type v regulator.
  • cavelambcavelamb Posts: 720
    edited 2012-07-27 20:50
    tonyp12 wrote: »
    Maybe the 12v tap-off is giving you problems, as I think they call it floating ground.
    Though going from 24v to 5v would need a switching type v regulator.

    (Sorry - misspoke)

    No, not at all. the "ground" for the rest of the circuitry is from the bottom side (negavive terminal) of the 24 volt battery stack. (Ground is such a cumbersome mis-nomer)

    A "floating ground" would be an unconnected ground pin.

    The "Tap" provides +12 volts (reverenced from that negavive terminal) to feed his accessory motor.

    The top of the battery stack provides 24 volts for the main drive motors.

    And the 5V supply is provided by the Sawtooth module.
    It's pretty cool, if a bit pricy.
  • cavelambcavelamb Posts: 720
    edited 2012-07-27 20:53
    mikea wrote: »
    cavelamb, thank you for the schematic it looks good, accurate. There are no pull up/down resistors on the prop pins. gonna try design cad 3-d.
    @kbash how do you use tip 120 darlington in pulldown mode?. thanks guys-mike

    The TIP120 is a Darlington transistor, which is really not all that different from a regular transistor.
    It's just bigger and faster.
    The hook-up would be exactly the same as a 2n2222. (I'd have to hit the book again to work out and difference in biasing).
    And yes, it would be a good general purpose choice for a transistor switch.
  • mikeamikea Posts: 283
    edited 2012-07-27 21:56
    i double checked the ground reference to everything which looks ok. it's at the "bottom" of the 24 volt loop, not the other negative where they're series together. also noticed sometimes the pause in the raising and lowering the plow is affected by moving a drive wheel. the plow is up/down on the right stick and the right drive wheel is left/right there also. somewhere i think maybe a signal is bleeding over. gonna try to shorten the wires or keep them apart more,and maybe take the sabertooth out to see if it goes away. thanks for the darlington info-mike
  • cavelambcavelamb Posts: 720
    edited 2012-07-30 21:27
    1.8 amps at 12 volts - via an antique TIP-101, which has been waiting in the bottom of the junk box for years for a chance to do something.

    Schematic above was used. Base resistor is 3.3K ohms.
    Nothing fancy at all, but it works - quite well.
    I was a bit surprised how warm the solenoid was at the end of the run.

    But it comes to almost 25 watts, so it makes sense it would heat up.

    http://youtu.be/ewy0ag_V7IU

    A couple of things I noticed that struck my fancy...

    Note how the solenoid keeps grabbing the transistor - steel screw holding the heat sink.
    There is a serious magnetic field there!

    For a while I had an LED indicator installed instead of the solenoid (before hooking up the QS board I used a button for testing). Lots of wires pulled and added, and the LED (unintentionally) became the snubber diode for the solenoid. That's the first time I've actually SEEN the counter EMF voltage happen. AFTER the solenoid returned, the LED came on. (collapsing electro-magnetic field). Interesting (it was a pretty boring day otherwise, so cheap thrills)

    That was fun. (even if I did reply to the wrong thread!)
  • jmgjmg Posts: 15,179
    edited 2012-07-30 22:57
    Another interesting device, is the BTS3800SL.

    http://www.infineon-designlink.com/index.php?article_id=155&language_id=2

    This is a new class of 'smarter' mosfet, it includes a current sense/trip, a temperature sense, pull down current sink, and 2.7V ON threshold, and a output clamp, and slew limiting.

    Not the sub 10c of a generic device, but at 54c/100 (28c/3k) it is not bad for a 'oops' protected device.

    Lacks a read-back pin, which would make it an ideal I/O part, but a high value resistor / resistor divider to a Prop pin would give that.
  • cavelambcavelamb Posts: 720
    edited 2012-07-31 07:09
    Interesting, but it won't do the same job by itself.
    BTS3800SL is designed to drive relays up to 375mA load current.
    It would still need a power transistor for heavy loads.

    I thought I'd experiment with the Sparkfun optoisolator board
    with a Darlington transistor to get complete isolation.

    https://www.sparkfun.com/products/9118
  • mikeamikea Posts: 283
    edited 2012-08-01 07:07
    I finally got my project to work, however my protoboard is not working right. The project problem i was having for the longest time was the relays dropping out or "chattering". I think now it was the board. it was only outputting the high signal for short periods. I caught myself bench testing it without flyback diodes across the relays a couple times, but the transistors still worked after that. I built duane j's mosfet h bridge from post 13 and tried it with the same pulsing result so i replaced the motors with leds while i tried to fix it. i changed the code a bit and the leds worked smoothly so i put the motors back, and the motor ran smoothly while the usb was still plugged into the computer. when i powered everything down, unplugged the usb and powered up it would do the old pulse problem again. i plugged in the usb and it worked, but must have burned something out at the usb connection because the prop will not find it anymore and the red led stays on next to the plug when i try to program it. Also i tried the same program and duane h bridge on a different prop platform and it works like it should without remaining plugged into the usb. can anyone see a potential here for frying a usb by what i've been doing? it's basically reading in on pin 2 from r/c receiver and out putting pin 5, 6 to gate of npn mosfet like in the diagram post 13. i cant see how the usb plugged could be involved. also is there a remedy for no usb plug like program though i/o 30 and 31 (i think thats the pins used on these). i would hate to scrap this board, it has a problem somewhere because it still pulses the outputs i'm using but i would still like to communicate with it to figure something out.any ideas? Thanks -mike
Sign In or Register to comment.