November 23, 2024, 07:50:51 AM

News:

Got VSA?  Want to use your Prop-SX?  Now you can!  See the VSA section of the Library forum for Prop-SX code that works with VSA.


prop1 with Pololu motor controller... need test code

Started by electricbob, March 18, 2009, 07:11:33 PM

Previous topic - Next topic

electricbob

Hello... NEWBIE HERE!!   I've got a Prop1 controller and I have connected a Pololu Micro motor controller (and motor) identical to the drawing on page 5 of this PDF...

http://www.pololu.com/file/download/smc02b_guide.pdf?file_id=0J36

Can anyone provide me a simple test code to properly reset, test the motor at different speeds, then send motor going in the other direction???

Thanks. EB

JonnyMac

March 19, 2009, 12:25:49 AM #1 Last Edit: March 20, 2009, 12:47:56 PM by JonnyMac
First things first: we torture "newbies" so unless you want to undergo "enhanced" interrogation techniques, stop using the moniker.  ;D

Here's a very quick port of the demo program in the documentation:

' =========================================================================
'
'   File...... Pololu_Test.BS1
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'              Copyright (c) 2009 EFX-TEK
'              Some Rights Reserved
'              -- see http://creativecommons.org/licenses/by/3.0/
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

SYMBOL  TX              = 7                     ' SETUP = UP; no ULN
SYMBOL  MReset          = 6                     ' SETUP = UP; no ULN


' -----[ Constants ]-------------------------------------------------------

SYMBOL  IsOn            = 1                     ' for active-high in/out
SYMBOL  IsOff           = 0

SYMBOL  Yes             = 1
SYMBOL  No              = 0


SYMBOL  Baud            = T2400


' -----[ Variables ]-------------------------------------------------------

SYMBOL  speed           = B2


' -----[ Initialization ]--------------------------------------------------

Reset:
  PINS = %11000000                              ' clear all
  DIRS = %11000000                              ' set outputs

  PULSOUT MReset, 1
  PAUSE 100


' -----[ Program Code ]----------------------------------------------------

Main:
  FOR speed = 0 TO 127
    SEROUT TX, Baud, ($80, $00, $00, speed)
    PAUSE 20
  NEXT

  FOR speed = 127 TO 0 STEP - 1
    SEROUT TX, Baud, ($80, $00, $00, speed)
    PAUSE 20
  NEXT

  FOR speed = 0 TO 127
    SEROUT TX, Baud, ($80, $00, $01, speed)
    PAUSE 20
  NEXT

  FOR speed = 127 TO 0 STEP - 1
    SEROUT TX, Baud, ($80, $00, $01, speed)
    PAUSE 20
  NEXT

  GOTO Main


' -----[ Subroutines ]-----------------------------------------------------


' -------------------------------------------------------------------------


' -----[ User Data ]-------------------------------------------------------


Jon McPhalen
EFX-TEK Hollywood Office

electricbob

Hey there. I tried the configuration and code with no luck. I assume I'm using OUT6 for reset and OUT7 for serial data? I put the jumpers appropriate.  Does no ULN mean the chip is to be removed? Sorry, I'm a learn-by-example and expand from there. I'm not sure what you can suggest but anything would be helpful. Bob

livinlowe

March 20, 2009, 10:32:25 AM #3 Last Edit: March 20, 2009, 01:21:52 PM by livinlowe
You can cut the pins on the uln on pin 7, or use a 2003.

Edit: Remove the pins on the uln on pins 6 & 7, as per program and jon's advice!  ;)
Shawn
Scaring someone with a prop you built -- priceless!

JonnyMac

Sorry, made a small mistake -- but was just going from docs as I don't have the product.  You need to have the P6 and P7 SETUP jumpers to the UP position and the ULN pins removed (pins 1 and 2 of the ULN2803).
Jon McPhalen
EFX-TEK Hollywood Office

electricbob

March 21, 2009, 02:15:43 PM #5 Last Edit: March 21, 2009, 02:18:52 PM by electricbob
Hello... Couldn't get it to work. Here's how I had it set up. See pic...
http://www.bumperbuzz.com/forumPics/Prop1_MtrCntrlr

I put a DEBUG message in the program and the Prop 1 seems to be running the code normally.
I noticed 12V across Vcc to PIN3 (logic supply) of the motor controller. I put in a resistor to drop it to 5.5V. Could the motor controller be damaged because of that?

Is the motor controller not properly configured for 1 motor?

Also not clear on the use (or non-use) of the ULNs. I've got a 2803 and a 2003. Are they even necessary for what I'm trying to do... with no other inputs or outputs? Thanks.

JonnyMac

"There's your problem..." (re: Jamie from MythBusters)

You have to use the TTL (WRB) headers to send TTL data to the device; the green terminals only swithc ground for valves and relays.  This is covered in the Prop-1 documentation.
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

March 22, 2009, 09:30:22 AM #7 Last Edit: March 23, 2009, 09:16:54 AM by JonnyMac
In the Prop-1 docs you'll find the part #s required for building connectors that attach to the TTL headers -- but there is an easier way: buy a handful of our 14" extension cables and cut them in half.  The W (white) connection provides TTL IO, R (red) is +5v, and B (black) is ground.

For your motor controller you could do something like this:


If you need 12v for the motor(s) take that from the V+ and GND terminals.
Jon McPhalen
EFX-TEK Hollywood Office

electricbob

March 23, 2009, 04:00:54 PM #8 Last Edit: March 23, 2009, 04:11:47 PM by electricbob
Hello there... Please see diagram to see if I'm on the right track along with the previous Motor Control program:

http://www.bumperbuzz.com/forumPics/Prop1_MtrCntrlr2

I've got ULN 2003 and jumpers UP on P6 and P7.

Does the Motor Controller logic supply come from the same place as the DC motor power supply?

In 1-motor-mode, pins 6 and 9 are for positive supply.
Pins 7 and 8 are the ground wires.
Does the Motor Controller need to be configured for 1 motor or is the code already doing that?
In other words, does this code need to go in during Initilization:
SEROUT TX, BAUD, [$80,$2,$00]

Also, I don't know where P7 "R" and "B" go. Thanks

JonnyMac

P7.R is the +5v you need for the logic side of the motor controller.  You can get ground from P7.B or the GND terminal.  The motor power comes from V+ (you need to have the position switch in P2 for this to be active).
Jon McPhalen
EFX-TEK Hollywood Office