3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.


Autonomous/RC Human Bot

Step 3Electronics

Electronics

The electronics I chose to use are all from Parallax. I am using 2 basic stamp usb board of education microcontrollers. One is a Basic Stamp bs2 and other is a high performance Stamp bs2PX. I am also using a propeller microcontroller which is inside the body. There is a Propeller servo controller, 24 LED lights and many different sensor including a temp sensor, accelerometer, and bluetooth sensor etc.

A BASIC Stamp is a single-board computer that runs the Parallax PBASIC language interpreter in its microcontroller. The developer's code is stored in an EEPROM, which can also be used for data storage. The PBASIC language has easy-to-use commands for basic I/O, like turning devices on or off, interfacing with sensors, etc. More advanced commands let the BASIC Stamp module interface with other integrated circuits, communicate with each other, and operate in networks.  

 

  • Controlling the servos is a Parallax Propeller USB servo controller which operates the arms. You can connect up to 15 servos on one board. The basic stamp microcontroller controls the servo controller making all the functions possible.
  • The motors are controlled from 2 Parallax HB-25 motor controllers which are also controlled from another Bs2 microcontroller.
  • I have many different sensors I use to take temperature readings, operate automatic headlights with darkness% and many other applications.
  • The microcontrollers are the brains of this machine and the possibilities are endless when it comes to the things you are able to do with some knowledge and experiments.

RC MODE:
As far as using a RC remote control to drive my robot, this is done with a 2.4GHzSpektrum DX5e system. The reciever is mounted onto the robot and the two drive motor wires are connected to the reciever. The HB-25 motor controller is ran on servo pulses so most RC systems will work with some modifications. With this technology and my wireless camera I can sit inside my home and drive my robot around the block and view everything from my PC. Very cool!!

 

This is a code I wrote to load into the processor in order to make this robot roam around autonomously. It roams around and when it encounters an object with its ping sensor that used to be mounted where the camera is it stops and scans the surrounding area for a clear path then resumes its mission. Learning how to program takes time but once you try it you will enjoy it and want to learn more. This is all done with the stamp editor software from parallax.
 

Run wires from ping to top 3 pin port 13
Run wires from servo to top 3 pin port 14
Run wires from HB-25 to top 3 pin port 15
HB-25 has its own power source with a switch.
jumper wires are ran from one HB-25 to the other connecting them together to be ran on one servo pulse.
' {$STAMP BS2}
' {$PBASIC 2.5}
' -----[Object Detection and Avoidance ]---------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

PingServo PIN 14 ' PING))) Servo
Ping PIN 13 ' PING))) Sensor
HB25 PIN 15 ' I/O Pin For HB-25

' -----[ Variables ]-------------------------------------------------------

pulseCount VAR Byte ' Used For Measuring Turns
distance VAR Word ' Current Distance Of Object
oldDistance VAR Word ' Old Distance Value
counter VAR Word ' PING))) Cycle Counter
task VAR Nib ' Current Task
index VAR Word ' Counter For Ramping

' -----[ Initialization ]--------------------------------------------------

DO : LOOP UNTIL HB25 = 1 ' Wait For HB-25 Power Up
LOW HB25 ' Make I/O Pin Output/Low
PAUSE 5 ' Wait For HB-25 To Initialize
PULSOUT HB25, 750 ' Stop Motor 1
PAUSE 1 ' 1 mS Delay
PULSOUT HB25, 750 ' Stop Motor 2


' -----[Main Code ]----------------------------------------------------

Main:
DO

counter = counter + 1 ' Increment Passive Counter

IF counter > 10 THEN
GOSUB Ping_Out
ENDIF

IF (distance > 40) THEN ' is distace greater than 40 cm??
GOSUB Forward_Pulse
ELSE
GOSUB Back_Up
GOSUB Ping_Around
ENDIF


LOOP



' -----[ Subroutines ]-----------------------------------------------------

Forward_Pulse:

FOR index = 250 TO 250 ' Ramp Up To Full Speed
PULSOUT HB25, 750 + index ' Motor 1 Forward
PAUSE 1 ' 1 mS Delay For Motor 2 Pulse
PULSOUT HB25, 750 - index ' Motor 2 Reverse
PULSOUT PingServo, 750 ' Ping Servo Forward Pulse Value
PAUSE 20
NEXT
RETURN

' *************************************************************************

Turn_Left:
FOR pulseCount = 1 TO 35 ' Left Turn, About 45 Degrees
PULSOUT HB25, 750 + index ' Motor 1 Forward
PAUSE 1 ' 1 mS Delay For Motor 2 Pulse
PULSOUT HB25, 750 + index ' Motor 2 Reverse
PULSOUT PingServo, 750 ' Ping Servo Forward Pulse Value
PAUSE 20
NEXT
RETURN

' *************************************************************************

Turn_Right: ' Right Turn, About 45 Degrees
FOR pulseCount = 1 TO 35 ' Number Of Pulses To Turn
PULSOUT HB25, 750 - index ' Motor 1 Forward
PAUSE 1 ' 1 mS Delay For Motor 2 Pulse
PULSOUT HB25, 750 - index ' Motor 2 Reverse
PULSOUT PingServo, 750 ' Ping Servo Forward Pulse Value
PAUSE 20
NEXT
RETURN

' *************************************************************************

Back_Up: ' Back Up
FOR pulseCount = 0 TO 5 ' Number Of Pulses To Backup
PULSOUT HB25, 750 ' Motor 1 stopped Fwd
PAUSE 1 ' 1 mS Delay For Motor 2 Pulse
PULSOUT HB25, 750 ' Motor 2 stopped Rev
PULSOUT PingServo, 750 ' Ping Servo Forward Pulse Value
PAUSE 20
NEXT
RETURN


Ping_Out: ' PING)))
counter = 0 ' Reset Passive Delay Counter
LOW Ping ' Force PING))) Line Low
PULSOUT Ping, 5 ' Activate PING))) Pulse
PULSIN Ping, 1, distance ' Receive Return Pulse
distance = distance ** 2257 ' Calculate Distance
RETURN

Ping_Around: ' Start 180 Degree Pan-Scan
counter = 0 ' Reset Passive Delay Counter
oldDistance = 30 ' Current Old Distance Values
task = 0 ' Current Task Priority

' *************************************************************************

FOR pulseCount = 0 TO 20 ' Number Of Pulses To Spin
LOW Ping ' Force PING))) Line Low
PULSOUT PingServo, 1085 ' Ping Servo 90 Left Pulse Value
PULSOUT Ping, 5 ' Activate PING)))
PULSIN Ping, 1, distance ' Receive Distance Value
PAUSE 20 ' Refresh Delay
NEXT

distance = distance ** 2257 ' Calculate Distance In cm
IF distance > oldDistance THEN ' Is distance > Last Clear Path
oldDistance = distance ' Update oldDistance Value
task = 1
ENDIF

' *************************************************************************

FOR pulseCount = 0 TO 20 ' Number Of Pulses To Spin
LOW Ping ' Force PING))) Line Low
PULSOUT PingServo, 850 ' Ping Servo 45 Left Pulse Value
PULSOUT Ping, 5 ' Activate PING)))
PULSIN Ping, 1, distance ' Receive Distance Value
PAUSE 20 ' Refresh Delay
NEXT

distance = distance ** 2257 ' Calculate Distance In cm
IF distance > oldDistance THEN ' Is distance > Last Clear Path
oldDistance = distance ' Update oldDistance Value
task = 2
ENDIF

' *************************************************************************

FOR pulseCount = 0 TO 20 ' Number Of Pulses To Spin
LOW Ping ' Force PING))) Line Low
PULSOUT PingServo, 400 ' Ping Servo 45 Right Pulse Value
PULSOUT Ping, 5 ' Activate PING)))
PULSIN Ping, 1, distance ' Receive Distance Value
PAUSE 20 ' Refresh Delay
NEXT

distance = distance ** 2257 ' Calculate Distance In cm
IF distance > oldDistance THEN ' Is distance > Last Clear Path
oldDistance = distance ' Update oldDistance Value
task = 3
ENDIF

' *************************************************************************

FOR pulseCount = 0 TO 20 ' Number Of Pulses To Spin
LOW Ping ' Force PING))) Line Low
PULSOUT PingServo, 225 ' Ping Servo 90 Right Pulse Value
PULSOUT Ping, 5 ' Activate PING)))
PULSIN Ping, 1, distance ' Receive Distance Value
PAUSE 20 ' Refresh Delay
NEXT

distance = distance ** 2257 ' Calculate Distance In cm
IF distance > oldDistance THEN ' Is distance > Last Clear Path
oldDistance = distance ' Update oldDistance Value
task = 4
ENDIF

ON task GOSUB Task0, Task1, Task2, Task3, Task4

distance = 50 ' Prevent Scan From Looping

RETURN

Task0: ' Forward Was Clearest Path
GOSUB Turn_Right ' This Could Mean Narrow Path
GOSUB Turn_Right ' So We'll Turn Around
GOSUB Turn_Right ' You Can Change The Behavior
GOSUB Turn_Right ' Of Any Of The Tasks
RETURN

Task1: ' 90 Degrees Left Was Clearest
GOSUB Turn_Left
GOSUB Turn_Left
RETURN

Task2: ' 45 Degrees Left Was Clearest
GOSUB Turn_Left
RETURN

Task3: ' 45 Degrees Right Was Clearest
GOSUB Turn_Right
RETURN

Task4: ' 90 Degrees Right Was Clearest
GOSUB Turn_Right
GOSUB Turn_Right
RETURN

« Previous StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
5
Followers
1
Author:IAMTHEBOT