davidbuckley.net
home  >  Zeaker  >  29 July 2023

Zeaker Arduino interface 20 July 2023

Originally Zeaker worked from a UK101 then a Sinclair ZX-81, then a Sinclair Spectrum.
Unfortunately the software is long gone even though the ZX-81 and Spectrum still work.
Following on from making Arduino interfaces for Zero2, Zeaker2, BBBC-Buggy and MM3 I made one for Zeaker and so now after over thirty years Zeaker is again under computer control.

At first I only put LEDs on the bump sensor and eye sensors data lines but I had a lot of trouble getting the shield pins to make good contact with the Arduino board though I have not had that trouble before, so I added eight more on the effector data lines. The only trouble was 3mm LEDs don't stack on 0.1" perf-board so I had to file flats on each side of the LEDs.
The two centre red LEDs are the front bumpers, the yellow the side bumpers and the green the rear bumpers. Blue is the downward facing eye and white the forward facing eye.
The sensor LEDs all have 1kohm to 5v and the effector LEDs 1kohm to 0v. Vin goes to the efector socket 9v and 5v to both sockets.

What does the Aduino software enable
The software is built on that written for Bambino then Bamduino. Using a terminal on a PC, commands (see below) can be typed and Zeaker controlled. Sixteen Acts can be recorded or loaded into EEPROM and replayed. Any Act can chain to or call any other Act including itself. Eight other ReActs can be recorded or loaded which will be acted upon depending on the state of the bump sensors when the command '$b' is executed.
Zeaker knows where it is on an XY grid and can be commanded to go to any position. Navigation is by dead-reckoning so where Zeaker thinks it is may not be where it actually is. The downward and front facing eyes in the Black Prototype could be used to see markers so drift could be corrected. As yet the Curve reaction movements are not calculated for!
A small subset of the commands can be sent from a Sony Remote Control Handset.

To compensate for differences in the two drive motors, and battery cells there are Forward and Backward scale factors for moving and Right and Left scale factors for turning. It helps if the motors are braked at the end of each move but that is not possible so the motors are put in reverse for a few millisecs set by a brake time [b][B]digits, also coast can be set for a small coasting time between moves which gives a more gently movement but with less accuracy.


Arduino software

  • ZeakerArduino.ino
  • Doc_Commands.h
  • Doc_Sections
  • core.ino
  • IRin.ino
  • movement.ino
  • sense.ino
  • show.ino
  • test.ino
  • utilities.ino
  • Acts
    ??
    Act1 $bF1,1. - 6 bytes          Explore with bump tests, F1 smallest distance between bump test 
    Act2 F2B2. - 4 bytes
    Act3 B2. - 2 bytes
    Act4 $Gw14. - 5 bytes
    Act5 $b5. - 3 bytes
    Act6 F15R45F10L90F20Htu. - 18 bytes
    Act7 . - 0 bytes
    Act8 bc0bB0bt20,bm3,1. - 13 bytes  sets coast off, brake off, default turn to 20, default move to 3, then jumps to Act 1
    
    Act01 . - 0 bytes
    Act02 . - 0 bytes
    Act03 . - 0 bytes
    Act04 . - 0 bytes
    Act05 . - 0 bytes
    Act06 . - 0 bytes
    Act07 . - 0 bytes
    Act08 . - 0 bytes
    
    Reactions
    ?!
    f & s indicates bump front or side, code is Left Right bump status, 1=bump  
    ReAct1 f_01  B,B,Mr3{B,Cfr,Cfr,Cfr}Cfl,,. - 27 bytes    {...} is only done if random10 <3
    ReAct2 f_10  B,B,Mr3{B,Cfl,Cfl,Cfl}Cfr,,. - 27 bytes    {...} is only done if random10 <3
    ReAct3 f_11  B,B,Mr5{Cfl,Cfl,}Cfr,Cfr,. - 25 bytes      {...} is only done if random10 <5
    ReAct4 s_01  Cfl,. - 4 bytes
    ReAct5 s_10  Cfr,. - 4 bytes
    ReAct6 s_11  B,B,Mr5{Cfl,}Cfr,. - 17 bytes
    ReAct7 eye   . - 0 bytes
    ReAct8 gnd   . - 0 bytes
    
    Current Behaviour
    ?b
    **behaviour*****
    Zeaker 2023-07-26
    0 autoAct
    0 autorun
    3 default move 
    20 default turn
    1 coast time 1/10sec after each move
    1 1=brake after each move
    50 braketime after each move millisec
    c steptype
    1200 millisecs for 10cm F
    1200 millisecs for 10cm B
    3600 millisecs for 360deg R
    3300 millisecs for 360deg L
    0 1=last turn was R
    90.00 map Heading
    0.00 Compass Heading
    
    Saved Behaviour
    ?B
    **EEPROM BEHAVIOUR***** 
    0 autoAct
    4 stepScale10chiF
    176 stepScale10cloF
    4 stepScale10chiB
    176 stepScale10cloB
    14 rotateScale360hiR
    16 rotateScale360loR
    12 rotateScale360hiL
    228 rotateScale360loL
    3 defaultMove
    20 defaultTurn
    1 coast
    50 braketime
    
    Mind
    ?m
    **MIND********** 
    0.00 moveX steps
    0.00 moveY steps
    90.00 compass N offset from map 0 degrees =X-axis
    90.00 mapHeading degrees
    0.00 AtX cm 0.00in
    0.00 AtY cm 0.00in
    
    Help
    ?h
    COMMANDS
       digits should be terminated with [,] or [ ] or other non digit character except [Q] and [.]
       if no digits are entered then the default value will be used
       default value is last used value with default of last saved (bS) value
    [Q],[Esc] - stop all
    [.] - stop, quit current operation - recording, playing, input
    ["] - start/end of a comment, processed in GetCcmnd()
    [(] - start of Do, Acts within a Do will be treated as subroutines
    [)] - end of Do
    [0] - use page0 for the next cmnd or Act, Acts [0][1] - [0][8]
          page 1 is the default
    [0] - Acts [!][1] - [!][8]
    [1-8] Play act, or the Act to record, copy, load etc
    [!] - use ReActs page, ReActs [!][1] - [!][8]
       digits may be preceded by a minus sign to reverse direction so F-100, is B100,
       if digits are followed by c then distances will be set to centimetre - default
       if digits are followed by i then distances will be set to inches
    [F]+-digits[,] - Forwards   - if no digits then default move
    [B]+-digits[,] - Backwards  - if no digits then default move
    [R]+-digits[,] - turn Right - if no digits then default turn
    [L]+-digits[,] - turn Left  - if no digits then default turn
    [G}+-digitsX[,]+-digitsY[,] - goto X,Y
    [H] - goto Home
    [D] - Pen down
    [U] - Pen up
    [C][f][l]digits[,] - Curve forwards left   - if no digits then default move
       [f][r]digits[,] - Curve forwards right  - if no digits then default move
       [b][l]digits[,] - Curve backwards left  - if no digits then default move
       [b][r]digits[,] - Curve backwards right - if no digits then default move
       [R][F]digits[,] - Curve Right Forwards  - if no digits then default move
       [R][B]digits[,] - Curve Right Back      - if no digits then default move
       [L][F]digits[,] - Curve Left Forwards   - if no digits then default move
       [L][B]digits[,] - Curve Left Back       - if no digits then default move
    [h][0] - horns off
       [1] - horn low on
       [2] - horn high on
       [3] - horns on
    [i][0] - indicators off
       [1] - indicators on
    [w][1-9,0] - wait seconds, 0=10
    [n][1-9,0] - nap tenths second, 0=10
    
    [$][b] - sense Bumpers
       [e] - sense Eyefront
       [g] - sense eyedown   'Ground'
       [t] - test whether Uno shield pins make contact for bump sense
    
    [m][m] - Move Memory - move same way as last time, same amount
       [o] - Move Other  - move other way from last time, same amount
       [+]+-digitsX[,]+-digitsY[,] - goto X,Y offset from current position
    
    [t][h]digits[,] = Turn to heading
       [m] - Turn Memory - turn same way as last time, same amount
       [o] - Turn Other  - turn other way from last time, same amount
       [u] - Turn Unwind
       [C]digits[,] = Turn to Compass heading
    
    [H] - goto 'home'
    [g][H] - goto 'home'
    [g][0-9] - goto numbered place
    
    Mind
    [M][r][digit][{]commands[}] - if random<=digit then do commands and end act
    [@][h] - set current location as new 'home'
       [0-9] - set place (0 - 9) to current location
    [?][m] - print Mind
    [?][p] - print places
    
    Behaviour
    [b][0] - Restore default behaviour
       [S] - Save behaviour as default
       [a][1-8] - Act to autorun on power on
          [0] - no autorun
          [d] - if Playing ends, run autorun Act
       [C]digits[,] - compass offset from map 0 degrees
       [m]digits[,] - default move cm
       [t]digits[,] - default turn deg.
       [c][0]-[9]   - coast for 1/10secs after each move
       [B]digits[,] - 0 no braking, 1-100 set braking time ms
       [r][R]digits[,] - rotatescale Right, millisecs for 360 degrees
       [r][L]digits[,] - rotatescale Left, millisecs for 360 degrees
       [s][F]digits[,] - stepescale Forward, millisecs for 100mm
       [s][B]digits[,] - stepescale Backwards, millisecs for 100mm
       [v] - verbose printing
       [q] - quiet printing, verbose off
    
    System
    [*][r][0 1-8] - record act, 0 use page0
       [l][0 1-8] - load act, 0 use page0
       [c][0 1-8][0 1-8] - copy act to act, 0 use page0
    ["] - start/end of a comment, processed in GetCcmnd()
    
    Print
    [?][?] - prints all acts
       [a] - prints all acts
       [0] - prints acts 0, and changes [?][?] to just print current page
       [1-8] - print Act in current page
       [!] - print ReActs
       [b] - print behaviour
       [m] - print Mind
       [d] - dump all acts to PC without descriptions, for reloading
       [p] - places
       [h] - print help
       [e] - print EEPROM use
       [f] - print free RAM
    
    Notes
    [(] - will show its location in EEPRO< when played eg (=263
    [)] - will show its location in EEPRO< when played eg )=285
    If a call to another Act is made from within a Do then the location to return to will be shown, eg (267)
    Acts by default are stored in page 1, 0 changes to page 0 for the next command only.
    Page 0 ia the first 256 bytes of EEPROM, Page 1 is EEPROM bytes 256-511, ReActs is the next 256 bytes, 
    negative numbers allowed for F,B,R,L - so F-20 does B20
    
    IR COMMANDS
    ===========
    [^] Forward default
    [v] Backward default
    [>] Right default
    [<] Left default
    [power] Stop
    [1]-[8] the Act to record or replay
    [0] page0
    [9]
    [-] do Ground sensor
    [+] do Whisker sensor
    [f|] record
    [f^]
    [f+]
    [fx]