1 / 48

Robotics Demo

Robotics Demo. Chris Odom www.basicxandrobotics.com chris_odom@georgeschool.org George School, Newtown, PA. The BX-24 microcontroller. The BX-24 is a 24-pin microcontroller made by NetMedia Small and Fast Floating-point math 16 I/O pins (8 built-in A-to-D converters) EEPROM storage.

Download Presentation

Robotics Demo

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Robotics Demo Chris Odom www.basicxandrobotics.com chris_odom@georgeschool.org George School, Newtown, PA

  2. The BX-24 microcontroller • The BX-24 is a 24-pin microcontroller made by NetMedia • Small and Fast • Floating-point math • 16 I/O pins (8 built-in A-to-D converters) • EEPROM storage • About $45 • Programmed with BasicX, a high-level language compatible with Visual Basic. BasicX is free.

  3. 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

  4. Personal Computer vs BX-24 The PC: • Is faster • Has more computing power • Is larger, heavier and therefore more stationary • Is more expensive • Is dependent on AC power • Is better suited for gaming and desktop programming

  5. 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!

  6. The Robodyssey Motherboard • Robodyssey Systems in Trenton, NJ designed and sells the RAMB • Makes programming the BX-24 easy • About $45 • Could do it yourself:

  7. Walking Robots Wheeled Robots (My students use the Mouse) Expressive Robots (ESRA) Kits

  8. 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.

  9. “Computers never do what you want them to do, only what you tell them to do.” Brian Patton Vice President, Robodyssey Systems

  10. BasicX and Robotics • Textbook written for novices and beginners ages 12 and up (especially for high school and college) • Only one of its kind • A teacher by your side to walk you through material • Over 300 problems and 400 full color images. 365 pages. • A complete curriculum • $44.95 textbook • Who has it?

  11. 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 • Let’s start by learning how the BX-24 outputs data…

  12. 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

  13. OUTPUT:Printing data to the PC Let’s write a short program that will display a simple message to the computer screen. The text message will be sent back to the PC via the serial cable. Here’s the code: Debug.Print "Hello, my name is Chris."

  14. OUTPUT:Printing data to the PC Here’s what the program’s output looks like on the PC’s monitor:

  15. OUTPUT:Printing data to the LCD With a small LCD screen, we can print messages and data without the need of a computer monitor. This allows us to be mobile! The code to do this is easy, too: Call InitLCD Call Display2Line("Hello", "My name is Chris")

  16. OUTPUT:Printing data to the LCD Here’s what the program’s output looks like on the LCD screen:

  17. Loops • Almost all computer problems use structures called “loops” to repeatedly perform a task or tasks. • Do-Loops can run forever. • For-to-Nextloops run for a finite number of times.

  18. Do-Loops Do Debug.Print "I can't stop!!!" Loop

  19. For-To-Next Loops Dim i as Integer Debug.Print "I can count fast!" For i = 1 to 5 Debug.Print CStr(i) Next

  20. 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!"

  21. Computer Logic The computer can be programmed to think using the “If-Then” logic statement. Here’s how we humans employ logic statements: The computer is only as smart as the person who programmed it! • 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.

  22. An If-Then Logic Statement For i = 1 to 5 If (i <= 3) Then Debug.Print "I am happy to be here!" ElseIf (i = 4) Then Debug.Print "BasicX rocks!" Else Debug.Print "Let's get started!" End If Next

  23. OUTPUT Using PutPin • BasicX has a command named PutPin that can be used to turn on and off external devices such as lights, LEDs, motors, buzzers, etc. • All you have to do is tell the BX-24 which pin the device is connected to and whether to turn it on or off: Call PutPin(5, 1) The device is connected to pin 5 1 = Turn it ON

  24. OUTPUT: Onboard LEDs • The BX-24 has two built-in LEDs. One red (pin 25), one green (pin 26). • Think about how to make a light blink. What we take for granted must be painstakingly programmed into the computer line by line: Do Call PutPin(26,1) Call Delay(0.3) Call PutPin(26,0) Call Delay(0.3) Loop • Turn on the light • Leave it on for some time • Turn off the light • Leave it off for some time • Repeat

  25. OUTPUT: External LEDs • External LED’s can also be easily controlled with the BX-24 using the PutPin command. (Here, the LED is connected to pin 5.) • This code simulates a flickering candle by using random delay times between 0.0s and 0.1s: Do Call PutPin(5,1) Call Delay(Rnd * 0.1) Call PutPin(5,0) Call Delay(Rnd * 0.1) Loop

  26. OUTPUT: Piezo Buzzers • Loud, obnoxious buzzers can also be controlled with the BX-24 • A class of buzzers can be driven by simply connecting them to a battery • Connect and disconnect the battery (loops!) and you can turn the buzzer into a siren • Use the PutPin command to turn the buzzer on and off

  27. 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.

  28. OUTPUT Using PulseOut Duration = 0.5s 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 The speaker is connected to pin 12 Duration = 0.001s

  29. OUTPUT Using FreqOut Musical notes have a particular frequency. Using the FreqOut command, the BX-24 can output these frequencies to a speaker. The speaker is connected to pin 12 Duration = 2s Call FreqOut(12, 512, 0, 2.0) Frequency #1 = 512 Hz Frequency #2 = 0 Hz

  30. Robot Music The BX-24 can be programmed to play familiar tunes. Or build your own piano and make the music yourself.

  31. Beats When two notes of similar frequencies are added together, a beat is created. From Section 9.3 in BasicX and Robotics The speaker is connected to pin 12 Duration = 5s Call FreqOut(12, 512, 514, 5.0) Frequency #1 = 512 Hz Frequency #2 = 514 Hz Here, the beat frequency is 2Hz. (514Hz – 512Hz = 2Hz)

  32. 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.

  33. 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)

  34. 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

  35. 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?

  36. INPUT: Light meter • Ambient light can be read using GetADC and an inexpensive photoresistor • As the light intensity increases, its resistance drops and the voltage to the BX-24 increases • This signal can be put to music with the FreqOut command • Some “light” music anyone?

  37. Light Meter Data A night watchman was “observed” checking the classroom. From Section 17.4 in BasicX and Robotics

  38. INPUT: Infrared Range Finder • The range (or distance) to any object can be determined using GetADC and an IR sensor • A transmitter sends out an invisible (to the human eye) beam of infrared light • The amount of light picked up by the receiver is an indication of the distance to the object • Section 16.9 in my book shows how to convert the digital signal to an actual range • Have you seen these? Yes!

  39. INPUT: Temperature Sensor • The ambient temperature be determined using GetADC and an inexpensive thermistor • As the temperature increases, the thermistor’s resistance increases and the voltage to the BX-24 decreases • The temperature can be calibrated and displayed in Fahrenheit, Celsius, and Kelvin scales. (See Section 17.7 of my book.)

  40. INPUT: Flame Sensor • Raw infrared light (heat) can be measured and displayed using an infrared transistor and the GetADC command • This sensor is also used in line- following robots and soccer-playing robots • What light/heat sources are detected?

  41. It can be rocket science! • In 2003, NASA, Penn State, and Clemson University launched a Terrier-Orion rocket from Wallops Island, Virginia. The rocket, part of the SPIRT II campaign, was in space for about 10 minutes and experienced nearly 20-G’s during liftoff.

  42. 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.

  43. Follow Me Not so smart Line Following Mouse A bit smarter, but still constrained Battle Bot Hack H-bridge technology The Crawler Another H-Bridge application Stays on tabletop ESRA Expressive robot Used in psychological research labs across the country including Yale Autistic research in high school? Robot Soccer Junior 2050 Challenge Clean Sweep Smart and useful (sort-of) RoboSapien Hack Brain surgery Robots in Action Let’s 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?

  44. 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) Understanding robotics to make intelligent, ethical decisions 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:

  45. If you would like to receive updates on what is happening with my students and our robots, please enter your name and email address in my notebook. Thank you for coming! Also, if you would like to purchase my book, the cost is $44.95. Please make the check out to Robodyssey. I would be delighted to sign it for you. www.basicxandrobotics.com chris_odom@georgeschool.org

  46. If you would like to receive updates on what is happening with my students and our robots, please enter your name and email address in my notebook. Thank you for coming! Also, if you would like to purchase my book, the cost is $44.95. Please make the check out to Robodyssey. I would be delighted to sign it for you. www.basicxandrobotics.com chris_odom@georgeschool.org

  47. 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?

More Related