Beruflich Dokumente
Kultur Dokumente
Chris Odom
www.basicxandrobotics.com chris_odom@georgeschool.org George School, Newtown, PA
Exciting Technology
The BX-24 can be used to: Autonomously control nearly any mechanical device such as robots, vehicles, airplanes, vacuum cleaners, etc. Output electrical signals to (thereby controlling) motors, speakers, LCD panels, lights, LEDs, etc. Read data such as temperature, light intensity, magnetic field strength, force, distance, flame (IR), conductivity, etc. Record data in space, underwater, your back yard
Why BX-24?
The BX24: Is smaller and therefore transportable Is cheaper Has no moving parts: data a programs are burned in to the chip. Can be removed from power Runs on a 9V battery Is better suited for remote and mobile applications Students love it!
Walking Robots
Kits
Just Toys?
Fun but not a toy Learn a real computer language Learn logic skills Learn electronics Research universities are now using the BX-24 to teach computer science Microcontrollers allow the average person to do what only NASA could do just a few years ago Springboards into other serious fields such as electronics, aerospace engineering, manufacturing, automotive and medical applications, etc.
Computers never do what you want them to do, only what you tell them to do.
Brian Patton Vice President, Robodyssey Systems
A Quick Tutorial
Rather than just a Show-and-Tell, let me explain some of the basics of computer and microcontroller programming Very abbreviated tour of the book Lets start by learning how the BX-24 outputs data
Creating a Program
The program is written on the PC in the BasicX language BasicX can be downloaded for free at www.basicx.com The code is saved as a simple text file. (New programs start with a blank page.) When the program is ready to run, simply press one button to compile the program into a language the BX-24 can understand The compiled program is sent to the BX-24 via a serial cable
Loops
Almost all computer problems use structures called loops to repeatedly perform a task or tasks. Do-Loops can run forever. For-to-Next loops run for a finite number of times.
Do-Loops
Do
For-To-Next Loops
Dim i as Integer Debug.Print "I can count fast!" For i = 1 to 5 Debug.Print CStr(i) Next
Delays
Sometimes, the computer performs its tasks too quickly. We can use a Delay command to slow it down: Dim i as Integer Debug.Print "Countdown...." For i = 5 to 1 Step -1 Debug.Print CStr(i) Call Delay(1.0) Next Debug.Print "Lift Off!"
Computer Logic
The computer can be programmed to think using the If-Then logic statement. Heres how we humans employ logic statements:
First, check to see if the door is open. If the door is open, then walk right through. Else (computerese for otherwise), if the door is unlocked, then turn the handle and walk through. Else, unlock the door with a key, turn the handle, and walk through.
The computer is only as smart as the person who programmed it!
Call PutPin(5, 1)
The device is connected to pin 5 1 = Turn it ON
Do
Call Call Call Call Loop PutPin(5,1) Delay(Rnd * 0.1) PutPin(5,0) Delay(Rnd * 0.1)
OUTPUT: Speakers
The BX-24 can also control speakers and audio transducers These devices cannot simply be connected to a battery. They must be turned on and off to make a sound. There are two more commands that can be used to turn the output voltage on and off: the PulseOut and FreqOut commands.
Dim i as Integer For i = 1 to 100 Call PulseOut(12, 0.500, 1) Call PulseOut(12, 0.001, 0) Next
1 = Turn it ON
0 = Turn it OFF
Duration = 0.001s
Robot Music
The BX-24 can be programmed to play familiar tunes.
Beats
When two notes of similar frequencies are added together, a beat is created.
Duration = 5s
OUTPUT: Servomotors
Electric motors spin when a voltage is applied to it. Servomotors (or servos) are special motors commonly used in R/C planes, cars, and boats. Roboticists also use them.
OUTPUT: Servomotors
Servos are controlled with the PulseOut command. A 1-ms pulse turns the servo clockwise A 2-ms rotates it counterclockwise The speed can be controlled with pulse width modulation (PWM)
OUTPUT: Grippers
Grippers use servo motors to open and close their jaws Loops and the PulseOut command is used to control its movement To hold an object, the jaws must continually be pulsed
INPUT: Voltmeter
Not only can the BX-24 output voltages, it can read them, too This is easy to do with the GetADC command The analog voltage from a battery, for example, must be converted into a digital signal before it can be read by the computer The BX-24 has eight built-in A-to-D converters! Digital signal 0 = 0V Digital Signal 1023 = 5V (10-bit value) Therefore, a signal of 512 is ~2.5V. What does a AA battery read?
SPIRIT II Results
High school students (at George School) in my physics and computer science classes designed an experiment that flew onboard that rocket. A BX-24 and RAMB motherboard were used to measure the forces of liftoff and any changes in temperature within the payload. The experiment cost less than $100 (the force sensors cost 4 each) and returned excellent data.
Robots in Action
Lets take a look at a few robots and how they utilize these basic microcontroller principles. Each robot is controlled by the BX-24. Can you picture how the commands are put together to obtain these results?
Follow Me
Not so smart
The Crawler
Another H-Bridge application Stays on tabletop
Clean Sweep
Smart and useful (sort-of)
RoboSapien Hack
Brain surgery
Future Work
This is only the beginning. In the field of robotics, we are (now) limited only by our imaginations. Here are some other applications that my students are interested in and/or working on:
Inner planetary exploration especially on the Moon and Mars More rocket launches Balloon research Salt run-off experiment A DIY science classroom laboratory DARPA Challenge
2015 (1/3 of all military vehicles must be autonomous)
www.basicxandrobotics.com chris_odom@georgeschool.org
www.basicxandrobotics.com chris_odom@georgeschool.org
Follow Me
[to be added at a later time] This simple robot application is a fairly unintelligent one. The Mouse, equipped with an infrared range-finding sensor, will continually spin around until something comes close to it. Then, the robot will move toward the object, stopping just prior to hitting it. If the object is removed, the process is repeated. Can you imagine which commands and logic structures are used for this application? What would the If-Then statement look like?