Using an arm to write

Hello,

My name is Jerald and I’m using the AL5C Robotic Arm Combo Kit to write messages on a board. The problem i have is that I’m not sure how to account for spaces in the text and placing all digits in order left to right. I can get the arm to write the programmed digits, but they are done on top of each other.

The project is actually a calculator, so the arm will be writing basic addition and subtraction formulas on a flat surface. I have already programmed sequences for most of the needed digits, but I’m hoping there’s some creative way to not have to litterally write a sequence for every possible combination of numbers and characters.

If anyone out there has some suggestions it would be much appreciated.

Thanks,
Jerald

it sounds like you are missing, to use an anology from a video screen, a cursor offset. the origin of each character should get added to the cursor position, both x and y, and then the cursor positions get updated as each character is written.

is this possible using the RIOS environment? I also have a Basic Stamp 2, but due to limited memory, I figured running RIOS on my PC would be better.

Without developing some involved formulas, you probably need to move the board or the arm for each letter, somewhat like typewriters used to do.

Yeah, kinda what I was thinking. Basically adding another servo or a track to slide the arm Left to Right and vice versa.

Might be kind of cute to have the arm slide the board to the left one letter space after each letter is printed. Lots of posibilitys for moving the board.

I suppose you could have one pair of servos to draw the letters, and one to "move you along the carriage, if that’s what you’re saying. Probably depends most upon the size of the letters. If you don’t have the additional servo for carriage duty, then incrementing an offset variable by the width of the character plus the char spacing for each character you draw is what’s required to put multiple characters on a “line”. Add this offset to each move for writing the character.

As far as writing the characters, what you need is a font table. Single stroke fonts are the easiest to use. Better then having to create them yourself!

Font work comes up from time to time. HPGL plotters draw characters. CNC CAD programs draw characters. Either of which can be captured for your use.

Any of this sound interesting?

Alan KM6VV

Thanks everyone who replied, I ended up using a track system from a printer and used it as a mounting base for the arm. Because the arm is so heavy (compared to an ink cartridge) I used a window lift motor from an automobile that used a cable-drive system. Now the track has all the torque in the world! I’m using two limit switches to control the end-of-trank locations with the BASIC Stamp module. works pretty well.

Jerald

I sure would get a kick out of seeing this. Images, video, anything…

BTW, ITT Tech is my alma mater! 8)

Once i get it up and rinning right, I will definitely send you pics. This is a final project for my Bachelor’s Degree in Electronics.

I am having technical difficulties in programming subroutines when using the RIOS code that has been converted to Basic. What I did was program two simple sequences using the RIOS program. I want to use each of these sequences as a seperate subroutine with the Stamp. This way, depending on what the input signal to the Stamp is, a different subroutine can be called and in any order.

What I think is happening is that the DATA variables are getting mixed from the different movements and it’s causing some spurious results. individually, the two different arm programs work great, but when combined, they conflict a bit.

Here’s the combined code:

' FuctionalTest2.bs2
' {$STAMP BS2}
' {$PBASIC 2.5}

'This program tests the functionality of using subroutines to control the arm
'----------- Main Program ------------
Main:
  GOSUB Num1
  PAUSE 500
  GOSUB Num2
  PAUSE 500
END

'----------- Subroutines --------------
Num1:
  DATA  155, 195, 210, 164, 142, 144, Word 1000, Word 0
  DATA  155, 195, 210, 164, 142, 144, Word 30, Word 0
  DATA  155, 171, 202, 164, 142, 144, Word 330, Word 0
  DATA  155, 171, 169, 148, 142, 144, Word 660, Word 0
  DATA  155, 188, 188, 148, 142, 144, Word 300, Word 0
  DATA  155, 195, 210, 162, 142, 144, Word 300, Word 0

  idxa    VAR   Word
  time1a  VAR   Word
  pause1a VAR   Word
  pos1a   VAR   Byte
  pos2a   VAR   Byte
  pos3a   VAR   Byte
  pos4a   VAR   Byte
  pos5a   VAR   Byte
  pos6a   VAR   Byte

  SSC32a  CON   15
  PAUSE 500

     FOR idxa = 0 TO 5
      READ idxa * 10, pos1a
      READ idxa * 10 + 1, pos2a
      READ idxa * 10 + 2, pos3a
      READ idxa * 10 + 3, pos4a
      READ idxa * 10 + 4, pos5a
      READ idxa * 10 + 5, Pos6a
      READ idxa * 10 + 6, Word time1a
      READ idxa * 10 + 8, Word pause1a
      SEROUT SSC32a, 6, "#0P", DEC pos1a * 10, " #1P", DEC pos2a * 10, " #2P", DEC pos3a * 10,
        " #3P", DEC pos4a * 10," #4P", DEC pos5a * 10, " #5P", DEC pos6a * 10," T", DEC time1a, 13]
      PAUSE time1a + pause1a
    NEXT
RETURN

Num2:
  DATA  156, 195, 209, 161, 142, 144, Word 1000, Word 0
  DATA  156, 170, 171, 149, 142, 144, Word 540, Word 0
  DATA  141, 170, 171, 149, 142, 144, Word 120, Word 0
  DATA  172, 170, 171, 149, 142, 144, Word 240, Word 0
  DATA  172, 165, 187, 154, 142, 144, Word 450, Word 0
  DATA  145, 165, 187, 154, 142, 144, Word 300, Word 0
  DATA  145, 173, 204, 163, 142, 144, Word 210, Word 0
  DATA  183, 173, 204, 163, 142, 144, Word 360, Word 0
  DATA  156, 173, 204, 163, 142, 144, Word 240, Word 0
  DATA  156, 195, 210, 163, 142, 144, Word 330, Word 0
  DATA  156, 195, 210, 157, 142, 144, Word 90, Word 0

    idx    VAR   Word
  time1  VAR   Word
  pause1 VAR   Word
  pos1   VAR   Byte
  pos2   VAR   Byte
  pos3   VAR   Byte
  pos4   VAR   Byte
  pos5   VAR   Byte
  pos6   VAR   Byte

  SSC32  CON   15
  PAUSE 500

    FOR idx = 0 TO 10
      READ idx * 10, pos1
      READ idx * 10 + 1, pos2
      READ idx * 10 + 2, pos3
      READ idx * 10 + 3, pos4
      READ idx * 10 + 4, pos5
      READ idx * 10 + 5, Pos6
      READ idx * 10 + 6, Word time1
      READ idx * 10 + 8, Word pause1
      SEROUT SSC32, 6, "#0P", DEC pos1 * 10, " #1P", DEC pos2 * 10, " #2P", DEC pos3 * 10,
        " #3P", DEC pos4 * 10," #4P", DEC pos5 * 10, " #5P", DEC pos6 * 10," T", DEC time1, 13]
      PAUSE time1 + pause1
    NEXT
RETURN

I have it set up to simply run one subroutine followed by the other in a loop. What it actually does is run the first subroutine twice, then it only does half of the second routine and locks up (or stops moving).

I added an “a” at the end of the variables for the first subroutine so that the program doesn’t get confused.

Any ideas you have will be greatly appreciated! Thanks,
Jerald

I’ll leave this for the programming gurus. I don’t have any experience with data tables. Sorry…

I am not much of a guru on the Basic Stamp but a few things come to mind.

  1. I don’t see a loop in the function. It calls 1 function, pauses, calls the second function pauses and then ends…

  2. Both functions appear to define data, which I think just gets stored sequentially in the EEPROM, but both function start reading at memory location 0. I wonder how well something like this would work.

[code]Num2:
N2 DATA 156, 195, 209, 161, 142, 144, Word 1000, Word 0
DATA 156, 170, 171, 149, 142, 144, Word 540, Word 0
DATA 141, 170, 171, 149, 142, 144, Word 120, Word 0
DATA 172, 170, 171, 149, 142, 144, Word 240, Word 0
DATA 172, 165, 187, 154, 142, 144, Word 450, Word 0
DATA 145, 165, 187, 154, 142, 144, Word 300, Word 0
DATA 145, 173, 204, 163, 142, 144, Word 210, Word 0
DATA 183, 173, 204, 163, 142, 144, Word 360, Word 0
DATA 156, 173, 204, 163, 142, 144, Word 240, Word 0
DATA 156, 195, 210, 163, 142, 144, Word 330, Word 0
DATA 156, 195, 210, 157, 142, 144, Word 90, Word 0

idx    VAR   Word 

time1 VAR Word
pause1 VAR Word
pos1 VAR Byte
pos2 VAR Byte
pos3 VAR Byte
pos4 VAR Byte
pos5 VAR Byte
pos6 VAR Byte

SSC32 CON 15
PAUSE 500

FOR idx = 0 TO 10 
  READ n2+idx * 10, pos1 
  READ n2+idx * 10 + 1, pos2 
  READ n2+idx * 10 + 2, pos3 
  READ n2+idx * 10 + 3, pos4 
  READ n2+idx * 10 + 4, pos5 
  READ n2+idx * 10 + 5, Pos6 
  READ n2+idx * 10 + 6, Word time1 
  READ n2+idx * 10 + 8, Word pause1 
  SEROUT SSC32, 6, "#0P", DEC pos1 * 10, " #1P", DEC pos2 * 10, " #2P", DEC pos3 * 10, 
    " #3P", DEC pos4 * 10," #4P", DEC pos5 * 10, " #5P", DEC pos6 * 10," T", DEC time1, 13] 
  PAUSE time1 + pause1 
NEXT 

RETURN
[/code]

Yeah, the code I attached is the non-loop version. i didn’t realize that until you mentioned it!

I’ll try out your idea for the code. I also have been doing a little research and I think that if I specify on the DATA line what memory location to start at ( like DATA @100, 150, 134, ect…) and then call that location in the FOR statement (FOR 100 to 105) or something along those lines it might work.

Basically I have to make each of the servo positions their own unique location and ID in memory, then i can call it whenever needed.

Thanks,
Jerald :wink: