Menu English Ukrainian russian Home

Free technical library for hobbyists and professionals Free technical library


ENCYCLOPEDIA OF RADIO ELECTRONICS AND ELECTRICAL ENGINEERING
Free library / Schemes of radio-electronic and electrical devices

Simple robot. Encyclopedia of radio electronics and electrical engineering

Free technical library

Encyclopedia of radio electronics and electrical engineering / Radio control equipment

Comments on the article Comments on the article

This article presents a diagram of a simple "robot". He goes to the light, and if there is no light source, then the "Free search" mode is activated, i.e. the robot will drive, and in the event of a collision, drive off and turn around.

Simple robot. Schematic diagram of the robot
(click to enlarge)

The heart of the robot is an ATMEL microcontroller: AT90S2313, but you can use any other of this company, this microcontroller has 2kb of memory for the program, 15 input / output ports, available power - 4-6V. The engines will be controlled by an "engine driver" - an L293D microcircuit (the domestic analogue is KR1128KT4A). As a sensor, it was decided to take photoresistors SF3-1.

The robot consists of two motors. Here is how they will work for certain actions:

Team Travel motor Swing motor
forward (F) forward stop
forward-right (FR) forward forward
forward-left (FL) forward ago
back (B) ago stop
back-right (BR) ago forward
back-left (BL) ago ago
back-left (BL) stop stop

Used radio elements in the circuit:

Microcontroller AT90S2313

Microcircuit L293D (domestic analogue - KR1128KT4A)

2 photoresistor SF3-1

Quartz at 4MHz

Capacitors 22-24pF

Stabilizer 7805 (or KREN5A)

100 ohm resistor (Optional)

Two motors

Power Vbat - 4 AA batteries, or 1 crown (9V)

Power supply Vm - 1 crown (9V)

After assembling the circuit, you need to download the program to the microcontroller and the robot is ready:

/**************************************************** ***

Chip type: AT90S2313

Clock frequency : 4,000000 MHz

Memory model: Tiny

External SRAM size: 0

Data Stack size: 32

******************************************************* **/

#include <90s2313.h>

#include

#include

// assignment of definitions for the convenience of working with peripherals

#define OUT PORTB

#define MOTOR_F 7

#define MOTOR_B 6

#define TURN_R 5

#define TURN_L 4

#define IN PIND

#define LIGHT_R 0

#define LIGHT_L 1

#define BUMPER_F 2

#define BUMPER_B 3

// Possible driving modes

enum {STOP, F, FR, FL, B, BR, BL};

//------------------------------------------------ ------------------------------

// Delay t x 10ms

//------------------------------------------------ ------------------------------

void Delay_10ms(unsigned char t)

{char i;

for(i=0;i

// probability table for choosing the direction of movement

// based on the current direction of movement

unsigned char p[7][7] =

{14, 43, 57, 71, 86, 93, 100,

7, 43, 71, 100, 100, 100, 100,

7, 50, 93, 100, 100, 100, 100,

7, 50, 57, 100, 100, 100, 100,

29, 29, 29, 29, 57, 79, 100,

36, 36, 36, 36, 71, 93, 100,

36, 36, 36, 36, 71, 79, 100};

// current direction of movement

unsigned char this_move;

//------------------------------------------------ ------------------------------

// Turn on the combination of motors to move in a given direction

//------------------------------------------------ ------------------------------

void go(unsigned char direction){

switch (direction) {

case STOP:

OUT.MOTOR_F=0;

OUT.MOTOR_B=0;

OUT.TURN_R=0;

OUT.TURN_L=0;

break;

case F:

OUT.MOTOR_F=1;

OUT.MOTOR_B=0;

OUT.TURN_R=0;

OUT.TURN_L=0;

break;

case FR:

OUT.MOTOR_F=1;

OUT.MOTOR_B=0;

OUT.TURN_R=1;

OUT.TURN_L=0;

break;

case FL:

OUT.MOTOR_F=1;

OUT.MOTOR_B=0;

OUT.TURN_R=0;

OUT.TURN_L=1;

break;

case B:

OUT.MOTOR_F=0;

OUT.MOTOR_B=1;

OUT.TURN_R=0;

OUT.TURN_L=0;

break;

case BR:

OUT.MOTOR_F=0;

OUT.MOTOR_B=1;

OUT.TURN_R=1;

OUT.TURN_L=0;

break;

case BL:

OUT.MOTOR_F=0;

OUT.MOTOR_B=1;

OUT.TURN_R=0;

OUT.TURN_L=1;

break;

}

}

//------------------------------------------------ ------------------------------

// Selecting the direction of movement in the next step according to the probability table

//------------------------------------------------ ------------------------------

unsigned char next_move(void){

unsigned charpp, i;

pp = rand()/327; // get a random number 0..99

for (i=0;i<7;i++){ // looking for a match in the probability table

if (p[this_move][i] > pp) break;

}

this_move = i; // write the new received direction as the current one

return(i);

}

//------------------------------------------------ ------------------------------

// Handling Front Bumper Interrupt (INT0 = PD2)

//------------------------------------------------ ------------------------------

interrupt [EXT_INT0] void ext_int0_isr(void)

{

if(this_move==FR) go(BL);

if(this_move==FL) go(BR);

else go(B);

Delay_10ms(250); // departure within 2.5 x 2 sec

Delay_10ms(250);

this_move=B;

}

//------------------------------------------------ ------------------------------

// Handling rear bumper interrupt (INT1 = PD3)

//------------------------------------------------ ------------------------------

interrupt [EXT_INT1] void ext_int1_isr(void)

{

if(this_move==BR) go(FL);

if(this_move==BL) go(FR);

else go(F);

Delay_10ms(250); // departure within 2.5 x 2 sec

Delay_10ms(250);

this_move=F;

}

//------------------------------------------------ ------------------------------

// "Random walk"

//------------------------------------------------ ------------------------------

unsigned char walk(void){

// this loop organizes "free roam" while

// no signal from any of the light sensors

while((IN.LIGHT_R) && (IN.LIGHT_L)){

go(next_move()); // get the next direction of movement and

Delay_10ms(250); // moving in this direction 2.5 sec

}

// this loop organizes the movement to the light while

// there is a signal from at least one of the light sensors

while((IN.LIGHT_R==0) || (IN.LIGHT_L==0)){

if((IN.LIGHT_R==0) && (IN.LIGHT_L==0)) go(F);

else if(IN.LIGHT_R==0) go(FR);

else if(IN.LIGHT_L==0) go(FL);

}

return (0);

}

//------------------------------------------------ ------------------------------

// Main program

//------------------------------------------------ ------------------------------

void main (void)

{

DDRB=0xff; // assign all lines of port B to output

PORTB = 0x00; // and set them low

DDRD=0x00; // assign all lines of port D to the input

PORTD=0xff; // connect internal load resistors

// External Interrupt(s) initialization

// INT0: On

// INT0 Mode: Falling Edge

// INT1: On

// INT1 Mode: Falling Edge

GIMSK=0xC0;

MCUCR=0x0A;

GIFR=0xC0;

// enable interrupts

#asm("sei")

// start the main loop

while(1) walk();

}

Download the program, firmware file and robot diagram in sPlan format

Publication: cxem.net

See other articles Section Radio control equipment.

Read and write useful comments on this article.

<< Back

Latest news of science and technology, new electronics:

A New Way to Control and Manipulate Optical Signals 05.05.2024

The modern world of science and technology is developing rapidly, and every day new methods and technologies appear that open up new prospects for us in various fields. One such innovation is the development by German scientists of a new way to control optical signals, which could lead to significant progress in the field of photonics. Recent research has allowed German scientists to create a tunable waveplate inside a fused silica waveguide. This method, based on the use of a liquid crystal layer, allows one to effectively change the polarization of light passing through a waveguide. This technological breakthrough opens up new prospects for the development of compact and efficient photonic devices capable of processing large volumes of data. The electro-optical control of polarization provided by the new method could provide the basis for a new class of integrated photonic devices. This opens up great opportunities for ... >>

Primium Seneca keyboard 05.05.2024

Keyboards are an integral part of our daily computer work. However, one of the main problems that users face is noise, especially in the case of premium models. But with the new Seneca keyboard from Norbauer & Co, that may change. Seneca is not just a keyboard, it is the result of five years of development work to create the ideal device. Every aspect of this keyboard, from acoustic properties to mechanical characteristics, has been carefully considered and balanced. One of the key features of Seneca is its silent stabilizers, which solve the noise problem common to many keyboards. In addition, the keyboard supports various key widths, making it convenient for any user. Although Seneca is not yet available for purchase, it is scheduled for release in late summer. Norbauer & Co's Seneca represents new standards in keyboard design. Her ... >>

The world's tallest astronomical observatory opened 04.05.2024

Exploring space and its mysteries is a task that attracts the attention of astronomers from all over the world. In the fresh air of the high mountains, far from city light pollution, the stars and planets reveal their secrets with greater clarity. A new page is opening in the history of astronomy with the opening of the world's highest astronomical observatory - the Atacama Observatory of the University of Tokyo. The Atacama Observatory, located at an altitude of 5640 meters above sea level, opens up new opportunities for astronomers in the study of space. This site has become the highest location for a ground-based telescope, providing researchers with a unique tool for studying infrared waves in the Universe. Although the high altitude location provides clearer skies and less interference from the atmosphere, building an observatory on a high mountain poses enormous difficulties and challenges. However, despite the difficulties, the new observatory opens up broad research prospects for astronomers. ... >>

Random news from the Archive

Acoustic waves for the treatment of muscle injuries 15.07.2016

Specialists from the University of Salzburg (Austria) found that exposure to acoustic shock waves has a positive effect on the recovery of damaged muscles and can be used as a promising therapy for athletes in the future.

The work of specialists is devoted to extracorporeal shock wave therapy (Extracorporeal Shock Wave Therapy or ESWT) - a method of treating diseases of the musculoskeletal system using acoustic shock waves of low power. This therapy has proven itself in the treatment of ligaments and tendons, but the Austrian scientists decided to go beyond the usual scope and tested what effect ESWT would have on muscles.

"As far as we know, no one has conducted experiments that would show how beneficial ESWT affects muscle damage - one of the most common causes of injuries in playing sports. ESWT can accelerate the healing process of muscles, allowing athletes to return to sports in the shortest possible time ", says Angela Zissler, PhD at the University of Salzburg and lead author of the study.

Shock wave therapy stimulates tissues mechanically, accumulates and triggers the division of stem cells that replace dead cells in the body. According to the study, shock waves stimulate signaling factors in muscle tissue. These factors, in turn, trigger the work of progenitor cells, which up to a certain point are at a low level of differentiation, but at the right moment begin to develop into an adult cell, and then into muscle fibers.

Zissler believes that ESWT has great promise in the field of sports injury treatment. The low frequency (about 1 beat per second) and low power (less than 0,2 mJ/mm2) of acoustic shock waves make it possible to use therapy without resorting to painkillers. The therapy is non-invasive, takes no more than 15 minutes and has no side effects, which means it can compete with traditional physiotherapy.

Other interesting news:

▪ Light dosimeter

▪ artificial wood

▪ Heavy duty wood

▪ A new planet has been discovered in the solar system

▪ Surface defrosting in a second

News feed of science and technology, new electronics

 

Interesting materials of the Free Technical Library:

▪ section of the site for those who like to travel - tips for tourists. Article selection

▪ article From the great to the ridiculous one step. Popular expression

▪ article What is the best time of day to study? Detailed answer

▪ article Liquorice. Legends, cultivation, methods of application

▪ article Prefix - Howler. Encyclopedia of radio electronics and electrical engineering

▪ article Graphic equalizer on LA3607. Encyclopedia of radio electronics and electrical engineering

Leave your comment on this article:

Name:


Email (optional):


A comment:





All languages ​​of this page

Home page | Library | Articles | Website map | Site Reviews

www.diagram.com.ua

www.diagram.com.ua
2000-2024