After three years of robot building and still having to learn
more and learning day by day I can say that I gathered enough experience
to build a robot out of a toy. All I needed was some basic tools (screw
driver, driller, e.t.c.) a toy, to be used as a base some electronics
(Two OEM Basic Stamp chips, photoresistors, IR leds and decoders e.t.c.)
some plastic sheets and some metal stand offs... The basic idea
was building a almost totally autonomous robot capable of recharging
itself by a top-level solar panel but not having enough money is a
serious problem (I have already gone over-budget but it was worth
trying). The solar panel needed for recharging the NiMH battery in a
reasonable time (4 hour charge aprox.) costed 60Euro ( 12V @ 5W). Also
by the end of the month a change in prices is expected in my country
(Hellas - Greece). But even without having a solar panel the proccess
can by analysed (program code - video cover - algorithm) and it will be
(but don't expect to recharge itself?!?!?!). That being the
situation, by building and displaying my robot I will also try to give
to you the basics of advanced sonar scan and object avoidance, photovere
function with object avoidance, how to check the battery voltage with
BS2 (RC circuit, 555 as ADC and maybe by an external ADC(I try to
explore the BS2 and not ADCs but it will also be a way to show serial
communiation with BS2!!!. If the samples from Analog Devices arrive soon
enought using the ADXL 202AE+ as a dangerous incline finder will be
displayed. Generally the lack of money leaded to a lack of sensors
but hoping to be able to cope up with school (I'm a 3rd grade senior
High school student and I have to study long hours in order to give
exams by the end of May and be accepted to a University!!!) I'll enrich
the tutorial. The contest was only a motivation being or not able
for me to take a place doesn't really matter!!! I only hope to be able
to finish before the voting ends....
STEP 1: Building The Robot Making a choise: Having
build two tank robots out of toys before I had to make something more
advanced and better!!! The first robot was made out of a caterpillar, it
was very short with the batteries in the back making it difficult to
climb anything. Also the maching was very bad (connection of the servos
to the wheels). The second bot was also very short but these problems
were fixxed!!! NOW I will be building a taller robot displaying various
analog sensor (heat seaker, light seaker) and digital ones (sonar, IR)
able to climb almost anything and in a very high speed!!! Also ways to
improve the toy's machining is shown (how the gear system is held
together tighter!!!). The past problems are overcame and everything is
kept simple!!! So this is what i came up to!!!
 So I have also to mod it so I can mount the electronics and use the motors and the case!!! And this video shows how: After that the robot looked like this:
  And after removing some unwanted plastic parts:
  Then some extra screws had to be placed to ensure the smooth and successfull fuction of the motors gearset!!! :
 The red boxes show where screws were added in order to re-enforce the gearset and hold tight the wheel axes!!! Note: Some hot glue is placed to protect the wires!!!
 And from above!!! Now
where we'll be mounting the BS2 OEM (a special version) Board... For
this purpose I drilled some holes in the center of the case so the
weight of the vehicle is balanced both in the front and the middle!!!
 And should really look like this for instance:
 So here I'm having the robot finished finally!!! The
first thing we had to attach was the battery. For a battery I chose a
NiCad @ approx. 600mA to power both electronics and mechanics!!! To
reduce the noise level I used some 0.1?F and 0.01?F caps near the noise
production units such as IC's and motors!!! The bad thing is that the
battery is wasted in less than an half hour of roaming!!! The good thing
is that in this half hour it's nearly unstopable!!! The battey can
deliver huge amounts of energy at any time!!! Now where to place the battery??? Tank
vehicles are usually able to overcome many object in their way!!! My
robot is no exeption!!! But having the center of weight high placed
reduces the height of the objects that the robot can pass!!! So the
battery was placed in the lowest position that was able!!! And here we come!!! Note that the battery is mounted on a soldering breadboard!!!
  And the battery board!!!
 
And this is what the robot should look like!!!
 
Now in
the next level what should be placed is the Stamp Board... Why because
we need the top level for the sensor board (we'll talk about this in a
minute!!!) And vualla!!!
 And
here is the Power LED mounted on the front of the
vehicle: (It can turn the
night to day!!!)
 
But what is a robot without sensors and a powerfull H-bridge... A human without senses and legs!!! For
these reasons I builded a board to host all these items. I could have
used the board's breadboard (ruster) but I needed the sensors to be as
high as possible!!! The sensors included is a pair of photoresistors, a
pair of NTCs and two pairs of IR receiver - transmitter (TSOP1730 and
some single IR LEDs!!!). So these are the schematics of the sensors
1)Note than the IRF9540 is for driving the LED circuit as it drow up to
350mA!!! 2)Note that the 555 circuit isn't used yet... The H-bridge
consume too many ports of the Stamp and will be connected to any
co-microcontroller (probably AVR) later!!!
 The board is a simple soldering breadboard as shown below:
  STEP 2: Programming the Robot
The
first action a robot must make is to avoid odjects!!! That could be
quit easy to quit sophisticated!!! Why? If you need a robot to find an
object and then find where should it go the thing get mud up!!! At least
two kinds of sensor with a linear output!!! Think about it later!!! The
BS2 is too slow for this!!! It can handle these task but the speed is a
main factor!!! So we are about to find an object and just avoiding it
by turning to another direction!!!
But first let's make a board of values for the H-Bridge ports!!! (when the motors move forward or backward!!!)
Right Tread of the Tank | Action | P6 | P2 | Forward | 1 | 0 | Backward | 0 | 1 | STOP | 0 | 0 | Not Allow | 1 | 1 |
Left Tread of the Tank | Action | P14 | P15 | Forward | 1 | 0 | Backward | 0 | 1 | STOP | 0 | 0 | Not Allow | 1 | 1 |
Now its far better!!! So let's see the program!!! The
progra, is based on the ability of the Stamp to produce various
freqences!!! IR demodulators usually have an IR filter around 38500
Hz!!! From my experience these demodulators will work with an up to
45000 Hz signal!!! But the higher the frequency is the shorter the wave
lenght will be!!! Cause TSOP1730 are quit sensitive and also the IR Leds
quite powerfull I used a frequence round 42000 Hz!!! With this settings
It can detect objects up to 25cm away!!! if the frequency is turned to
38500 Hz it will detect object up to 1m!!! And here is a chart with the frequences and the distances
 And here is the code:
' {$STAMP BS2} ' identify the chip ' {$PBASIC 2.5} ' and the compiler
' Set the variables and their ' place in the RAM IR_det_Left VAR Bit IR_det_Right VAR Bit
' Initialize the program FREQOUT 11, 200, 359 LOW 1 'Turn off the LOW 7 'IR LEDs DO ' The main program foe detecting the objects ' a short burst and emendiately after the detection FREQOUT 1,1, 42000 IR_det_Left = IN0 FREQOUT 7,1, 42000 IR_det_Right = IN8
' Conditions of turning... IF (IR_det_Left = 0) AND (IR_det_Right = 0) THEN GOSUB go_back ELSEIF (IR_det_Left = 0) THEN GOSUB turn_right ELSEIF (IR_det_Right = 0) THEN GOSUB turn_left ELSE GOSUB straight ENDIF LOOP
' The main subroutines table ' this program has only subroutines ' about the motion!!! Straight: HIGH 6 LOW 2 HIGH 14 LOW 15 RETURN Turn_Left: HIGH 6 LOW 2 LOW 14 HIGH 15 RETURN Turn_Right: LOW 6 HIGH 2 HIGH 14 LOW 15 RETURN Go_Back: LOW 6 HIGH 2 LOW 14 HIGH 15 RETURN
|