home  >  BBC-Buggy 28 July 2023

BBC-Buggy upgrade by David Buckley BBC-Buggy 1983

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 powerfull 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.


[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
[1-8] Play act, or the Act to record, copy, load etc
[!] - use ReActs page, ReActs [!][1] - [!][8]
[F]digits[,] - Forwards   - if no digits then default
[B]digits[,] - Backwards  - if no digits then default
[R]digits[,] - turn Right - if no digits then default
[L]digits[,] - turn Left  - if no digits then default
   digits should be terminated with [,] or [ ] or other non digit character except [Q] and [.]
   digits may be preceded by a minus sign to reverse direction so F-100, is B100,
[G]digitsX[,]digitsY[,] - goto X,Y
[H] - goto 'home'
[D] - Pen down
[U] - Pen up
[V] - beep
[w][1-9,0] - wait seconds, 0=10
[n][1-9,0] - nap tenths second, 0=10

[s][1-9] - speed, steptime =speed cmnd *8
   [+] - speed-up,   steptime -=1 >=1
   [-] - speed-down, steptime +=1
   [u] - speed-up,   steptime -=1 >=stepmin
   [d] - speed-down, steptime *=4
   [m] - set speed-max for speed-up to current speed
   [s] - save speed

[m][m] - move Memory - move same way as last time
   [o] - move Other - move other way from last time
   [+]+-DigitsX[,]+-DigitsY[,] - goto X,Y offset from current position
[t][h]digits[,] - Turn to heading
   [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
   [C]digits[,] - Turn to Compass heading

[$][b] - return bumper status
   [g] - return ground/barcodereader value
   [l] - return light value - Buggy LDR
   [e] - return eyes values - add-ons
   [~] - return change in barcodereader value

[t][l] - Turn to Light
   [d] - Turn to Dark
   [L] - Turn at Light
   [D] - Turn at Dark
   [u] - Turn Unwind
[H] - goto 'home'
[g][H] - goto 'home'
[g][0-9] - goto numbered place

[M][r][0-9][{][}] - if random(0,10)<=digit then do commands and end act 
       eg. M3{F199,B200,Cfr,}Vw1Vw1. if random <3 then {...} will be done else beep will sound, { optional    
[@][h] - set current location as new 'home'
   [0-9] - set place (0 - 9) to current location
[?][m] - print Mind
[?][p] - print places

[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
   [m][digits][,] - default move steps
   [t][digits][,] - default turn steps
   [s][digits][,] - stepescale, actual steps for 100mm
   [r][digits][,] - rotatescale, actual steps for 360 degrees
   [e][digits][,] - eye threshold - low dark
   [l][digits][,] - LDR threshold - low dark
   [c][digits][,] - BarCode threshold - high dark
   [$][0,1] - sensor react 0=off
   [!][0,1] - 0=turn off reacting flag to jump from a ReAct,
              automatically turns on again
   [v] - verbose printing
   [q] - quiet printing, verbose off

[*][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()

[?][?] - 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
   [$] - print sensors
   [p] - places
   [h] - print help
   [E] - print EEPROM use
   [f] - print free RAM

[(] - will show its location in EEPROM when played eg (=263
[)] - will show its location in EEPROM 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