Shop OBEX P1 Docs P2 Docs Learn Events
BS2 Lock up — Parallax Forums

BS2 Lock up

kelly@ncwcom.comkelly@ncwcom.com Posts: 3
edited 2011-03-20 23:03 in BASIC Stamp
Hi
I have made a simple glue machine that just spins the part and turns the glue on and applies it to the piece as it rotates. It works fine except it locks up randomly. The system is quite simple, you press the button and it sends a series of pulses to a stepper controller to spin the part while at the same time it sends a pulse to strat the glue head. The speed and glue time can be adjusted be 2 front mounted push button variable resistors. Below is the code I use.

Any help on the lock ups would be greatly appreciated.

Kelly.

' {$STAMP BS2e}
'stepper test beta 1

Reset:
factor CON 2 'Pot -> speed factor
steps VAR Word 'number of steps per revolution
relay VAR Word 'glue head relay
POT VAR Word 'Result of RCTIME
speed VAR Word 'Calculated speed value
btnwrk VAR Byte
relay1 VAR Word 'adjusted glue relay
OUTPUT 11 'set step direction
HIGH 11
INPUT 10 'switch input
HIGH 10
OUTPUT 5 'stepper speed
LOW 5
OUTPUT 4 'relay output
LOW 4

Main:
HIGH 9 'Charge cap
PAUSE 1 'Discharge cap for 1ms
RCTIME 9,1,relay 'Measure discharge on P9
relay1 = relay / 1 'Adjust relay range
HIGH 2 'Charge cap
PAUSE 1 'Discharge cap for 1ms
RCTIME 2,1,POT 'Measure discharge on P2
PAUSE 1
speed = POT / 5 'adjusted motor speed
BUTTON 10,0,50,20,btnwrk,0,SKIP1 'Check button state and jump acordingly
HIGH 4 'turn the relay on
FOR steps = 0 TO 210 'start stepping count
PULSOUT 5, 4 'send step pulse out
PAUSE speed 'pause for variable miliseconds
IF relay1 >= steps THEN GoOn 'check step and relay count and jump accordingly
LOW 4 'turn relay off
GoOn:
NEXT 'count
'LOW 4 'turn relay off
GOTO Reset 'attempt to reset unit and avoid lockups. (didn't work)
SKIP1: 'main loop
GOTO Main 'loop

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-03-20 13:55
    It probably has nothing to do with the program. You probably need better filtering in your power supply. Typically, noise spikes from the motor or relay gets into the rest of the circuitry and forces the Stamp to reset. You need to provide a schematic or a detailed description of what's connected to what.
  • kelly@ncwcom.comkelly@ncwcom.com Posts: 3
    edited 2011-03-20 18:37
    Thanks for the quick reply. I am using the super carrier board with a 24 volt to 12 volt regulator (7812a). The outputs drive a 5 volt relay directly (radio shack Part # 275-232). All of the work is done through the relays. The servo is driven by a geco drive stepper contoller using the pulseout command. The whole thing is powered by a comercial 120 volt to 24 volt power supply.

    Hope this helps.

    Kelly
  • LloydsLloyds Posts: 75
    edited 2011-03-20 19:46
    Hi Kelly,
    What Mike said about the filtering is the issue. The PS is probably fine, but driving the relays directly from the stamp is dangerous to the stamp because of the back emf from the field collapse of the relay coil(s).

    Take a look at this:
    http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/vol1/col/nv6.pdf
    (Stamp on Steroids)

    You really need a driver of some kind and a diode to protect the stamp. Personally, I would stop using it until you add the driver circuit. You could smoke the stamp, instead of just locking it up.

    Hope that helps,
    Lloyd
  • LloydsLloyds Posts: 75
    edited 2011-03-20 19:48
    Kelly,
    Sorry, I didn't look to see if the super carrier board has relay drivers built in. If it does, forget what I said.
    Lloyd
  • Mike GreenMike Green Posts: 23,101
    edited 2011-03-20 20:27
    The Super Carrier Board doesn't have any drivers built-in.

    If you're using the 24V supply and a 7812 regulator, there will be a lot of heat produced in the 7812. Make sure you have an adequate heatsink. The glue relay will draw about 30mA. The Stamp will draw maybe 10-20mA more. The regulator will need to dissipate somewhere between 1/2 and 1W of heat, not a huge amount unless there's no heatsink.
  • kelly@ncwcom.comkelly@ncwcom.com Posts: 3
    edited 2011-03-20 23:03
    Thanks for all of your replies. I just ordered the i/o board kit (27113) from Parallax. From what I have read and what has been posted here I think this will resolve my problems. I will update the thread when it is in place.

    Thanks

    Kelly
Sign In or Register to comment.