Posts

Showing posts from March, 2014

Multivibrator as a state machine

Image
It's pretty hard to imagine, but a multivibrator is one of the most common terms used in the electronic world. How many times did you use a PWM signal to control the rotational speed of a DC motor? Did you ever think about a CPU clock generator? Well, a PWM signal as well as the CPU clock generator belongs to the class of a multivibrator. In this blog post, you will see that a multivibrator is a square wave generator modeled by a state machine.
Multivibrator classes
There are three types of multivibrators. Classification is related to a state stability. But, before I continue with the classification, I would like to say a few words about nature of a multivibrator. A multivibrator is a state machine with two discrete states and a two transitions in between. Generally speaking, with a two states and a two transitions we are able to construct a three different types of a multivibrators independent of an implementation:
monostable multivibratorbistable multivibrator andastable multivibra…

Monostable multivibrator as analog differential motion controller

Image
Thinking about robots is the same as thinking about microcontrollers or some other digital computing device able to control the motion. That is correct and pretty logic way of thinking. But, the motion could be also controlled with an analog device. What we need is a square wave generator able to control an H-Bridge circuits which drive a DC motor. This simple example demonstrates a monostable multivibrator as the analog device able to control one set of the differential motion kinematics.

Differential robot
Before we start with a monostable multivibrator, I would like to say something about a differential robot. The differential robot belongs to a class of simple robotic system. It has two standard DC motors (with two wires), each connected to an H-Bridge device controlled by a microprocessor or analog device, what we do have in this example.
Kinematics
When both DC motors rotates in the same direction, the robot goes forward or backward. When one DC motor rotates in one direction and se…

PWM Generator for Standard DC Motors

Image
This example is related to simple PWM generator for standard DC motor. Complete example is based on my previous example related to Injection System Behavior. PWM modulation signal is generated by transitions through state machine states. State machine has four states: Idle, PWM, Timer and Direction. Transition matrix has 17 bytes. x2Mode is used for state encoding.
Provided material for download contains two bin files related to different behavior of the system. DCSpeedController.bin - rotation in one direction with speed regulation. DCSpeedDirectionController.bin - rotation in both direction with speed regulation.
Electronics #1: beside priority encoder for external commands encoding, interface between 8051 MCU and DC motor is done over device driver BA12004 IC (replacement: ULN2XXX series - motor driver kit). To create H-Bridge for bidirectional rotation, two additional resistors are used.
Electronics #2: beside priority encoder for external commands encoding, interface between 8…

Stepper Motor Controller

Image
This stepper motor controller is base on my previous example related to Injection System Behavior. As You can see from related YouTube video, stepper motor behavior could be easily changed by injection into the generic state machine. Injection is done over RS232 and USART terminal.Version: 1.0.0.0
Provided material for download contains several bin files related to stepper motor behavior.
ContinuousRotateLeft.bin - transition matrix - stepper behavior #1 ContinuousRotateLeftAngle.bin - transition matrix - stepper behavior #2 ContinuousRotateRight.bin - transition matrix - stepper behavior #3 StepByStepRotateLeft.bin - transition matrix - stepper behavior #4 StepByStepRotateRight.bin - transition matrix - stepper behavior #5
For more details please look at Injection System Behavior example.
Electronics: beside priority encoder for external commands encoding, interface between 8051 MCU and stepper motor is done over device driver BA12004 IC (replacement: ULN2xxx series - motor driver…

Injection System Behavior

Image
This simple example present ability of the system modeled by state machine to execute different tasks by injecting behavior. It is based on 8 bit field transition matrix which stores information about system behavior. If we change transition matrix, system behavior will be changed also. Current example provides only 4 states (A, B, C and D) and 4 external commands (interrupts, events or signals). This example present generic solution for all systems modeled by state machine.Version 1.0.0.0Usage examples:

1) Embedded Robotics: external commands are signals from sensors: IR sensors, mechanical sensors, ultrasonic sensors and so on.
2) Human - Machine games.
3) Low level driver / firmware software etc.

Generally, this idea could be used for each system which includes component able to store information about states (like micro-controller unit).

This example is written in ANSI C programming language and supports all hardware platforms powered by MikroElektronika. Unit test are wri…