epromcore

EPROM CORE - A SERVO CONTROL STATE MACHINE

Wilf Rigter 06/2001

 
 
INTRODUCTION

The EPROM CORE was designed to control the ambulation of an 8 servo motor walker. It uses a sequential state machine to generate the pulse patterns for the walker motion. Although highly deterministic the design gives rise to complex behaviour when sensors react to the environment by selecting new behavior sequences.In addition, 16 different behavior  modes (or moods) can be selected with a DIP switch.  The EPROM contains 32K bytes of data of which only 3 bits are used to generate the servo signals. The other 5 bits in each byte are reserved for future control applications. The 3 bit PWM codes in each byte are used to synthesize a 1-2 ms servo control signal with a range of 8 position values. Eight 3 bit codes are multiplexed on the EPROM data bus selected by the channel address which is also decoded with a one of 8 decoder. The outputs of this decoder sequentially pulse with the PWM signals for the servos. The servos are the standard unmodified hobby type selected for appropriate torque and speed as required by the walker design. The servos are controlled with PWM signals which are used to simultaneously adjust the position of all 8 servos with 12 % resolution by continuously scanning the eight PWM codes on the low order 3 data bits of the EPROM data bus. A 16 step sequence counter is clocked at an adjustable rate of 1-10Hz. This sequence counter addresses the position information for 16 unique positions for each of the 8 servos. This is generally used to sequence the legs through one complete stride. When repeated, the walker takes the next stride and so on. 4 tactile/optical switches, alone or in combination, respond to environmental inputs by selecting the right sequence for the motion of the walker : forward/reverse, turn left/ right , raise high/low, rotate. In addition, a quad DIP switch be used can select 1 of 16 modes which may alter sensor response, the gait or otherwise change the behavior of the walker.

EPROM CORE CIRCUIT

The complete EPROM CORE design is shown  in Figure 1. It is a discrete digital design consisting of just 5 chips to generate 8 PWM signals with pulse widths determined by data stored in a 32K EPROM. The data is addressed by counters and switches to select unique combinations of PWM signals which adjust the position of 8 servos controlling the motion of the walker. The switches react to environmental conditions to make the walker respond to light level or obstacles in it's path by altering direction of motion. The walker may also extend it's legs higher to negotiate over rough terrain or the walker my curl up it's legs into a defensive position.

Figure 1- EPROM CORE

EPROM

The largest of the 5 chips, the 27C256 EPROM, contains blocks of preprogrammed servo positions which are selected by the counters, the sensors and a DIP switch. This chip contains 32K bytes of information which must programmed before the EPROM CORE can be used. A complete binary dump will be available shortly and users are encouraged to develop and share their own EPROM patterns for their specific applications. Each of the 32K data bytes in the EPROM is addressed with a 15 bit address. The address is generated form various sources as shown in table 1. The first 3 address bits use the channel counter to select the current channel number. The next 4 bits use the sequence generator to select one of 16 steps in a sequence. The next 4 bits are selected by conditioned external sensors. The last 4 bits are selected with the mode DIP switches to specify a type of behaviour. The three low order data bits (D0-2) contains the position code for a servo selected by the address bits. Eight bytes of EPROM data are continuously scanned by the channel counter to supply the position data for the PWM generator to program each of the 8 servo channels The last 5 data bits are reserved for future use..
 

BIT

00

01

02

03

04

05

06

07

08

09

10

11

12

13

14

ADDRESS

CHANNEL

SEQUENCE

 SENSORS

    MODE

DATA

     PWM

   NOT USED

Table 1

 

SERVO CHANNEL COUNTER

The 3 lower order address bits (A0-2) are used to scan the 8 sequential bytes and the 3 bit address is generated by the servo channel counter using ½ of a 74HC393 4 bit binary counter. The most significant bit of this counter is not used here but is reserved for future 16 channel servo controller applications.

SERVO CHANNEL DECODER

The servo channel counter outputs also are connected the binary selection inputs of a 74HC238 - 1 of 8 decoder. The outputs of the decoder provide the 8 channels of active high PWM servo signals. As the servo channel counter is incremented a new pulse is generated with a pulse width corresponding to one clock period of the channel counter chip. Since the servo PWM outputs have various durations controlled by the clock input of the channel counter, the clock signal of the servo channel counter is the serial pulse train of all PWM signals.

SERVO PWM GENERATOR

The clock input for the channel counter comes from the output of the 74HC163 PWM generator. This is a 4 bit synchronous presettable counter, which is loaded with the 3 (LSB) bit PWM code while the high order bit preset input is always low. The clock of this counter is connected to a 125us oscillator. This mean that with a preset code of 7 the PWM counter terminal count will occur after 8 clock pulses or 1 ms. This is the minimum PWM pulse width and corresponds to the extreme left servo position.. With the 3 bit data set to zero, the counter will reload after 16 clock pulses or 2 ms. This is the maximum PWM pulse width and corresponds to the extreme right servo position. As each data byte is read, the duration for that servo channel is loaded into the PWM counter which times one output pulse of the 74HC238 decoder until it steps the channel counter to the next channel and activates the next decoder PWM channel output pulse. Since the PWM signal durations will vary, the scan rate of servo channel counter is multiplexing the EPROM data bus at an average rate of about 80Hz . Only 3 bits of each data byte is used for the servo channel and that leaves 40 bits of multiplexed data available for other control applications. The PWM pulse width is synchronously updated and once loaded the pulse is  independent of any changes in the selected address by  sensors or the sequence generator. This feature is important to avoid jitter in the servo positions.

SERVO SEQUENCE GENERATOR

The walker moves in a sequence of 16 preprogrammed servo positions providing one or two complete forward, reverse, or turning strides. In addition, a sequence can cause the walker to raise itself to full height to make observations, or to lower itself into a protective crouch. Any other sequence can be programmed within the limit of a cycle of 16 positions for each of the 8 servos for each sensor and mode input combination. The data for these 16 positions is selected with the second half of the 74HC393 chip whose outputs are connected to A4-A7. This chip is clocked with an adjustable oscillator using a 74HC14 inverter, to execute each position in at a rate of 1-10 positions per second. That means that with the fastest setting, a whole sequence or stride will take on average 1.6 seconds to complete. Conversely the maximum walking speed of the robot would therefore be 0.6 strides per second.

SENSORS

The sensors for this design consist of a number of tactile and or optical devices which may include Sharp 40kHz IR modules for remote obstacle detection. The output of the 4 sensors shown are buffered with 4 Schmitt inverters and connected to A8-A11. In order to introduce a delayed reset of the active sensor condition, a capacitor may be added at the inverter inputs . This is used to generate, for example, a complete turn or reversal for a number of strides, or a period of inactivity or sleep.

MODE

The 4 position DIP switch is used to select one of 16 specific programs of walker behavior. Altenatively, the DIP switch can be replaced with conditioned sensors or a counter.

FUTURE EPROM CORE

A sensor priority encoder (74HC148) or replacing the 27C256 with a 1M-4M  EPROM would double the number of sensors and / or programs. By adding a second 74HC238, the number of servo channels is increased to 16 with only one extra part required.. The 40/80 unused data bits for each complete channel can be demultiplexed further (ie with 74HC259 or 74HC174 chips) to provide up to 40/80 discrete outputs for various control purposes. Alternatively, a 74HC4511 seven segment decoder can be used to generate a 5 digit numerical display. Any number of other applications are just waiting to use this flexible but simple and understandable design and will be documented as they are developed further.

wilf