davidbuckley.net
home  >  BBC-Buggy 19 September 2020

BBC-Buggy upgrade by David Buckley

In the mid 80s I aquired a second hand BBC-Buggy with a Research Machines (RM) interface. I made an adapter box which routed the wires from the RM 25D connector to two 16pin DIL sockets (to my Sinclair Projects standard) so I could connect it to a Spectrum I/O board and in 1988 I had it tunning under Beta-Basic. Beta-Basic was a very pwerfull implementation of Basic with Functions, Procedures, Local and Default variables and more and it was easy to get the Buggy to hunt for obstacles and map their location.

At the end of August 2020 during COVID-19 lockdown I was waiting for some conductive rubber paint to repair a Jupiter Ace keyboard for Modular-1 and looked at the BBC-Buggy which had sat in cupboards since 1988 and thought about how to connect to the RM interface. I realised though that I could make an Aduino interface directly to the Buggy just as I did for Zeaker2 and Zero2.

The shield just routes the Buggy 20way umbilical to the Arduino pins, the V+ supply, and the output from a 7805 5v regulator. Also it has a header for a FTDI USB/Serial adapter with the serial lines routed to Arduino pins 0 and 1.

Using the Buggy I found that the mounting for the BarCode/Line sensor left a lot to be desired. There seemed to be two options - one, keeping the unit separate from the Buggy until used or - two, removing the LDR from its pillar then removing it from the side of the LDR pillar and mounting it on the front of the pillar then replacing the LDR. So I made a mounting arm for the unit bolted to the RHS axle mount (see the Log page), now the unit can be swung into place and stored safely when not needed. It is a pity it is used in front of the bumpers so they can not be relied on at the same time.

The Arduino program receives high level commands from a terminal on a PC and can store them as 3 pages of 8 command strings and any command string can call any other string or chain to one.


Just as with a washing machine controller where you wouldn't expect to have to write more microcontroller code just to get it to do a different wash cycle so neither is it desirable to have to continually write Arduino code to change what the robot does.
The following commands can be entered from the Serial Monitor (or other Terminal) set to 9600 baud and sequences of commands can be recorded in the EEPROM so they are remembered even when power is off.
The sequences of commands can then be replayed.

If each sequence which we will call an Act takes less than 32 commands then 8 Acts will fit in the second 256 byte page of the EEPROM.
A second set of eight Acts will fit in the second 256 byte page of the EEPROM.
These are addressed as logical Page0 by prefixing with 0 the 1-8 Act number.
So sixteen Acts can be remembered. 01,02,03,04,05,06,07,08,1,2,3,4,5,6,7,8.
A further 8 Reacts can be held in page 3 of the EEPROM by prefixing with !.
Page 0 holds behaviour variables.

An Act can have up to 31 commands followed by '.' indicating end of the Act.
Any Act can chain to another Act, even itself.
Any of the Acts 1 - 8 can be set to autorun on poweron or reset, depending on selected behaviour.

Commands

COMMANDS
======== 
[Esc],[Q] - stop, quit operations, go to command mode
[.] - stop, end current operation - recording, playing, input  
["] - start/end of a comment, processed in GetCcmnd()      
[(] - start of a Do, will show its location in EEPROM when played, eg (=263
      If a jump to another Act is made from within a Do then the Do 
	  location will be shown eg (@267) and when returning the return 
	  location will be shown, eg (267)
      A jump to an Act from a Do will on . continue in the Do
      If a jump is made to an Act which contains another Do then that Do
      will become the current Do and the old Do will not be returned to
[)] - end of a Do, will show its location in EEPROM when played, eg )=285
[0] - use page0 for the next cmnd or Act, Acts [0][1] - [0][8]
[!] - use ReActs page
[1-8] Play act, or the Act to record, copy, load etc
[F]{digits}[,] - Forwards   - if no digits then 1 - units mm
[B]{digits}[,] - Backwards  - if no digits then 1 - units mm
[R]{digits}[,] - turn Right - if no digits then 1 - units degrees
[L]{digits}[,] - turn Left  - if no digits then 1 - units degrees
[T]{digits}[,] - turn to heading - if no digits then ignore
[H] - goto 'home'
[D] - Pen down
[U] - Pen up
[V] - beep   (interface beeper)
[w][0-9,0] - wait seconds, 0=10
[n][0-9,0] - nap tenths second, 0=10

SPEED
[s][1-9] - steptime/3
   [+] - speed-up,   steptime -=1  >=1
   [-] - speed-down, steptime +=1
   [u] - speed-up,   steptime -=1  >=stepmin
   [d] - speed-down, steptime *=2
   [m] - set speed-max for speed-up to current speed
   [s] - save speed
   
TURN   
[t][m] - Turn Memory - turn same way as last time
   [o] - Turn Other - turn other way from last time
   [l] - Turn to Light
   [d] - Turn to Dark
   [u] - Turn unwind   
   
SENSORS
[$][b] - test bumper status and ReAct
   [e] - test eyes staus and ReAct
   [l] - return LDR value
   [c] - return barcode value

SKILL
[t][l] - Turn to Light
   [d] - Turn to Dark
   [L] - Turn at Light
   [D] - Turn at Dark   
   [u] - Turn unwind
   [H] - Turn to 'home'  
[h] - set current location as new 'home'
[H] - goto 'home'
[g][H] - goto 'home'

MIND
[?][m] - print Mind
   
BEHAVIOUR
[b][0] - do default behaviour
   [S] - save current behaviour as default
   [a][1-8] - Act to autorun on power on
      [0] - no autorun
      [d] - if Playing ends, run autorun Act
   [m][digits][,] - default move mm or degrees
   [r][digits][,] - rotatescale, actual steps for 360 degrees
   [s][digits][,] - stepescale, actual steps for 100mm
   [e][digits][,] - eye thredhold
   [l][digits][,] - LDR thredhold
   [c][digits][,] - BarCode thredhold
   [$][0,1] - sensor react 0=off
   [!][0,1] - 0=turn off reacting flag to jump from a ReAct,
              automatically turns on again
                       
SYSTEM
[*][r][(0) 1-8] - record act,               optional 0 use page0
   [l][(0) 1-8] - load act,                 optional 0 use page0
   [c][(0) 1-8][(0) 1-8] - copy Act to Act, optional 0 use page0
   
PRINT   
[?][?] - print Acts
   [0] - prints Acts 0, and changes '??' to just print current page
       - (for QL zero2 program)
   [a] - change back to ?? prints all Acts    
   [1-8] - print Act
   [!} - print ReActs    
   [b] - print Behaviour - thisprog,autoAct,f_autoPower,steptime,stepmin,stepScale360
   [m] - print Mind
   [d] - dump all acts to PC without descriptions, suitable for loading
   [$] - show all sensor values
   [h] - print help
   [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 Mind 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 EEPROM bytes 0-255, Page 1 is EEPROM bytes 256-511 etc.