Friday, 1 May 2020

Computer Controlled Robots


Well I seemed to have a built another Commodore VIC20 controlled robot.  Some inspiration came from the classic 1980s Usborne How to Make Computer-Controlled Robots book.


You Will Need:

Initial Testing:

I started off by connecting the Maker Drive to the user port on my Commodore VIC20 to see if I could control it by using some simple BASIC POKE commands, this worked well so I purchased a CamJam Edukit 3 Robotics kit.

Maker Drive Features:
  • Dual channel, Bi-directional control motor driver
  • Support motor voltage from 2.5V to 9.5VDC
  • Maximum current up to 1.0A continuous and 1.5A peak (<5 seconds)
  • 5V Output (200mA) to power the controller.
  • Inputs compatible with 1.8V, 3.3V and 5V logic (Arduino, Raspberry Pi, etc).

Connection Diagram











Maker Drive:  Motor Driver




Maker Drive connected to a userport adapter and small DC motor

Taking the Maker Drive for a spin


























































Building the Robot:

Some time later the CamJam Edukit 3 arrived, in the kit are all the parts you need to build a robot.  I decided to use the box it came in as the chassis as suggested in the instructions which can be found here.

Kit contents

















I followed the instructions and soon had some motors stuck in the bottom if the box, I made a hole to pass the wires through. I also mounted the supplied line following sensor to the bottom of the box.










































Having successfully mounted motors etc, I needed some way of connecting the userport to the Maker Drive board so I made up a little board with an IDC connector and a pin header to plug the Maker Drive into.

















































I then connected the robot to the user port on my VIC20 via a interface board I made for the VIC20 controlled tank I built a while back.  With all the wiring in place, I tested the motors to make sure they worked correctly. 

Motor Test Coding:




















Memory location 37138, known as the data direction register (DDR), determines which of the eight user port data lines are inputs and which are outputs.

Memory location 37136 is the address of the user port.


Connector Pins
L
K
J
H
F
E
D
C
User port data lines
PB 7
PB 6
PB 5
PB 4
PB 3
PB 2
PB 1
PB 0
Maker Drive Inputs




M2B
M2A
M1B
M1A
Decimal value
128
64
32
16
8
4
2
1

Some example code:

By typing in different decimal numbers, this turns on the relevant user port data line which will make the motor go forwards or backwards. POKE 37136,0  turns off the motor.

POKE 37138, 255   # This sets the user port data lines as outputs

10 POKE 37136, 0
20 PRINT "TRY A NUMBER"
30 INPUT X:POKE 37136,X
40 GET A$:IF A$="" THEN GOTO 40
50 GOTO 10