Welcome to Our 6th Dispatch!
Getting a sense of things.
This week, we look at sensors, a robot's answer to eyes, ears, nose, tongue, touch, etc., the components that allow a robot to interact with its world and allow it to make some decisions about where it wants to go and what it wants to do. For more discussion on this topic, check out the Sensors & Input Devices section in the MAKE Forums.
And, as always, if you have any questions, you can ask us in the Forums or email us.
Let's Make: Robots!
Gareth and Matt
back to top
Ready for Entry!
The CoasterBot Entry Form is up! The official entry date, and the two week final build period, begins April 23rd. You'll have until May 7th to submit your entry. We can't wait to see what you came up with!
back to top
Introduction to Sensors
By Matt Mets
The Parallax Ping))) ultrasonic sensor, from MakerShed.
Sensors are the devices that allow us to detect things happening, not only in the world around us, but inside of us as well. Everything that wants to know what's going on around it needs them, including animals, plants, and robots.
The Memsic 2125 Dual-axis Accelerometer (measures tilt, vibration, rotation, and acceleration) from MakerShed.
As humans, most of us have some combination of eyes (sight), ears (sound), nose (smell), tongue (taste), and skin (touch) that we use as external sensors to measure the world around us. Equally important are our internal sensors that allow for our ability to sense temperature, balance, pain, and provide a sense of where our limbs are at any given moment. Using all of that information, we are able to figure out what's around us, to orient ourselves, and allow us to (usually) successfully navigate our environment.
The PIR motion sensor from MakerShed.
Robots are no different, except that the number and kinds of sensor that they have are much more varied. A fully equipped robot might sport external sensors such as bump, sonar, camera, distance, microphones, and chemical detectors, and internal sensors such as temperature, balance (gyroscope), and motor encoders. Most, however, don't need quite so many sensors. Rugged industrial robots
might rely extensively on motor position encoders to play back pre-recorded movement patterns, with only a few external sensors, such as a camera, to correct for small alignment errors. Research robots designed to explore new environments, such as Honda's ASIMO and Stanford's Stanley
, use a wide array of sensors to measure and react to their enviroment in as flexible a way as possible. Hobby robots usually fall somewhere in between, with the simplest versions using only a few touch sensors to navigate their world by brute force, and the most complex ones approching the capabilities of research robots.
Some robots are designed using unique sensing apparati. For example, the SCRATCHbot, developed by a group of researchers from the University of Sheffield and the Bristol Robotics Lab, takes inspiration from a rodent. Rather than relying on light sensors or cameras (which don't work well in dark tunnels), it uses a whole array of sensitive whiskers to sense and navigate its environment.
back to top
Making a Bump Switch Sensor
By Matt Mets
One of the simplest kinds of sensors you can make is a bump switch, which detects when it bumps into something. Normally, these are placed on the front of a robot, which is then programmed to back up and change direction when the switches hit something. You can purchase a tactile switch with a lever arm mounted on it that is designed to do this, or build your own using a variety of materials. The switch must consist of two metal contacts that are mounted to levers in such a way that they are normally not connected, but do come in contact when the lever hits something. The microcontroller is then able to sense the collision, by monitoring whether the two contacts are shorted to each other. Here are some examples of homemade bump switches:
The spring bump sensor by Instructables user leevonk uses the stiff spring from a mechanical pencil and a piece of wire to make a durable bump sensor.
Let's Make Robots user isotope built this combination bump switch/cavity detector using some scavenged bits of plastic and metal springs.
Oomlout built a bump sensor using some pieces of twisted wire to make a large bump sensor for the front of their SERB robot.
Harold Ilano's tiny Mercury robot uses the barrel jacks from power supply connectors, along with some stiff wire, to make some robust looking bump switches.
Have a favorite material or technique you use to build bump sensors? Join in the Forum discussions and share your ideas!
back to top
Basic Sensor Programming
By Matt Mets
OK, now that we know how to build devices to sense things, how can we use them in our robots? To do this, we'll need to connect them to the microcontroller, and then add some logic to our program to respond to their inputs.
To connect a sensor up to a microcontroller, we'll need to figure out what kind of pin to hook it to. There are three basic kinds of connection that a sensor will use to connect to the MCU: digital, analog, and serial.
Sensors with a digital output emit a voltage equal to high (5V) or low (ground), which represents a single condition being true or false. They can be as simple as a switch, which is open or closed, or as complicated as a PIR motion detector
, which detects if there is motion or not. Sensors with digital outputs can be connected to general purpose I/O lines on the microcontroller. For an example of how to use a digital input on the Arduino platform, see the button tutorial.
Sensors with analog output emit a signal with a voltage that can vary from 0V to 5V, which represents the measurement of some value. This could include things such as temperature, force, or heat. Sensors with an analog output need to be connected to an ADC (analog-to-digital converter) pin on the microcontroller, which are connected to a special device that can measure the voltage and store it as a variable. For an example of how to configure the Arduino to use an analog input, see the potentiometer tutorial.
Sensors with a serial interface can represent digital or analog signals, but have an extra circuit built into them that measures the signal and reports it in a digital fashion over a serial line. This is a bit more complicated than a simple digital or analog sensor, but allows the sensor to have more intelligence built into it. There are a number of different standards for serial communication (I2C, SPI and UART), and should be connected to the microcontroller pins that support them.
Once you have your sensors wired up, the final step is to extend your program to make use of them. For an obstacle-avoidance robot, this could be as simple as turning your motors in a forward direction, then continuously checking to see if the sensors have detected an obstacle. If they detect an obstacle, the microcontroller should then reverse the direction of the motors to back the robot up, then put the motors in opposite directions so that the robot turns. Once it is safely pointing in a new direction, the program can start over at the beginning, and put the robot back in forward mode. This basic pattern (called an algorithm) will work for some situations, but you will probably find that your robot will eventually get stuck. To avoid this, you can experiment with adding more complex behavior to your bot to try and help it from getting stuck.
Stay tuned for a tutorial on how to to convert the One Hour CoasterBot into a formidable obstacle avoidance machine!
back to top
Maker Profile: Brian Smith
This week we meet another of our robot builders.
My name is Brian Smith and I'm from Novi, Michigan. My interest in robotics is a natural progression from my profession (software development) and my off-hours DIYing (cars, bikes, home improvement). I got involved with robotics when I bought a Lego RCX 1.0 for my kids around 1999 or 2000. Currently, I mentor robotics teams for Lawrence Tech's Robofest and FIRST
(Frog Force 503). The kids on the Robofest team picked the name "Black Dog Robotics" for our new (at the time) puppy and the name has stuck.
I discovering the Arduino in an early issue of MAKE. After doing software for years, it opened up the door to hardware development for me. Currently I have several Arduino/AVR-based projects in the works.
My goal in entering the CoasterBot contest is to give myself a goal for implementing some ideas I've been wanting to try out for a while. I intend to keep developing the CoasterBot after the challenge is over to improve its navigational and mapping abilities, adding things like accelerometers, gyros, rotation encoders, and wireless communication. To allow for expanding the CoasterBot's capabilities in the future, I'm using two Arduino Pro Minis for control — one dedicated to motor control, one for sensor interface and overall robot control. The two Arduinos will communicate using the I2C protocol (Arduino Wire library).
I'm using Lego RCX motors and wheels, both for ease of use and because there are quite a few Lego pieces around the house! Putting two Arduinos, two Lego motors, and sensors in a small CoasterBot platform will be an interesting challenge.
Follow my progress on my blog.
back to top