Archive for the ‘Robots’ category

CoasterBot Finished!

May 6, 2010

A while ago I entered the Make: Robot Build contest. The contest was to build a robot using CDs/DVDs as the primary building material. The robot needed to be able to navigate around obstacles. The design also had to be flexible enough to allow additional additional sensor-systems to be added on top of the obstacle avoidance system. The deadline was May 7th (Later moved to May 10th). I submitted my entry last night.

Finished CoasterBot

This is the final product that I submitted in the end. It's a very basic bot using only 'bump' sensors.

Gimpy the CoasterBot is made from 2 CDs connected via hex spacers with 2 modified servos driving 2 wheels. The front is held up by an old dice case that’s used sort of like a ski. There are two front ‘bump’ sensors that detect when the robot has run into something so that it can back up and change direction to get around the obstacle. The sensors are two switches that have strips of CDs connected to form larger antenna-like arms.

The motors are powered by 4 AA (eneloop) batteries. The robot is is controlled via an Arduino Duemilanove sporting a Proto Shield. The arudino controls the motors via an L293DNE motor controller. The microcontroller is powered by a 9V battery separate from the motor power source. It runs a fairly basic program that detects when an obstacle has been hit and causes the bot to back up, turn a little bit, and continue forward (only to bump into something else later or fall backwards and flail a bit). There are also a few pictures.

Electric Schematic

This was my rough attempt at creating a schematic for the electronics systems of the CoasterBot

This was a very interesting project for me. I had been interested in robotics since I played with a lego mindstorm kit in college as part of an advanced Java programming class. Having custom hardware to program for seemed like a very natural extension to software development. However, I never took any classes in electrical engineering so my electronics abilities were minimal at best. Learning how to wire up the physical components and construct a robot from parts and not a kit was the real challenge for me.

Part of my path to success was through reading the Make: Electronics book. It also helped that I stuck a large sticky note of Ohm’s law on the side of my desktop computer at work (at least I think it helped). I learned a lot of new things in an area that I did not have a very large knowledge base to begin with. I find this quite a different experience than learning a new programming language, framework, or other aspect of software development that I’m already fairly familiar with. In this robot building exercise, I was still able to relate with my field of software development since I had to program the thing, but I was also able to dive into a new realm of electronics and physical computing that I hadn’t experienced before. I think that the most rewarding aspect of any project like this is knowing that your expanse of knowledge is growing to cover a wider field than you held previously.

For entering the contest, assuming that the judges mark my entry as valid, I shall receive a Maker’s Notebook. I own one of these already and used it for part of this project, but it’s a nice little notebook and I’ll enjoy having a second one. I found that having a prize just for entering was a fairly important aspect to this contest. While I don’t really need another Maker’s Notebook (mine only has 6 of 150 pages filled), knowing that I would get one for completing the project gave me a motivation and drive to finish under a deadline and complete my work. Also the contest provided me with a direction, a goal, and a timeline to complete. Hopefully I’ll see some more contests by Make or maybe some other sites that will give me ideas or spur me on to create other relatively useless but ultimately interesting things.

So that’s my robot. It’s not very smart and if I had a lot more money to pour into it I could add a bunch of other sensors (and maybe a front wheel) and make it more aware of its surroundings so that it doesn’t have to run into things. Even still I’m pretty proud of my accomplishment, even if he does fall backwards when hitting the lip of a carpet.

L293DNE H-Bridge

April 19, 2010

Today I’m going to talk about the L293DNE Quadruple H-Driver used to control 2 bidirectional motors when hooked up to a motor. I had a lot of trouble recently attempting to get this thing working. All of the tutorials written involved hooking it up to a microcontroller (I’m going to use the arduino in all examples from now on), and sending singles with code to change the direction. While that is the ultimate use I’ll be using the L293DNE for, I wanted to make sure it worked without a microcontroller first.

Example use of an L293DNE

The L293DNE has 16 pins. If you’re just driving a single motor you can ignore 5 of those pins (9-11, 14-15). Pin 16 powers the logic of the controller and should always be set to +5V from what I’ve been able to gather. Pin 8 provides power for both motors. Often you’ll want a stronger and independent power source for your motors than from the rest of the logic. Your motor power source should have its positive node connected to pin 8, and ground connected to the grounds of pins 4, 5, 12, and 13. Grounds for your logic control source should also be connected to the same pins.

The motor will be connected to pins 3 and 6. The basic idea is that when power is supplied to pin 2, pin 3 will become positive and pin 6 will become ground for the motor. When power is supplied to pin 7, pin 6 will become positive and pin 3 will become ground. Depending on which control pin (2 or 7) you have powered, the polarity of the circuit that’s going through the motor will change. If neither 2 nor 7 is powered, there will be no circuit going through pin 3 and 6 and the motor will not be powered.

Motor 1 and 2 are turned on and off by pin 1 and 9 respectively. If either of these pins does not have +5V connected to them, the motor associated with that pin will also not receive power.

One thing that I did not understand from looking at the datasheet for the L293DNE was that while you can add a voltage to pin 2 or 7 to turn the motor on in either direction, the other pin must be connected to ground to work. This means that if pin 7 has a +5V but pin 2 is not connected into the circuit, the motor will not work. The circuit for pin 7 is completed by pin 2 (and visa versa), not the grounds coming from pins 4, 5, 12 or 13. I assume those grounds are associated with pins 1, 8, 9, and 16, but I haven’t experimented with that and I can’t find that information in the datasheet.

So, in order to test if your H-Bridge works, do the following:

Quick test for L293DNE without a controller

Pin 1, 2, and 8 should connect to the +5V positive line of your power source. Pins 4, 5, and 7 should connect to ground. Hook pin 3 and 6 up to a multimeter and check the voltage. It should read around +5V (probably a little less). Change the circuit so pin 2 is hooked to ground and pin 7 is hooked to +5V and check again. The voltage reading should be reversed (-5V or so). Unhook either pin 2 or 7 and you should see no voltage going through the circuit. You’ll notice the same thing if you leave the original setup and unhook pin 1 or 8 as well.

So what caught me off guard from this was that all tutorials mentioned plugging the H-Driver into an arduino and setting pin 2 to HIGH and 7 to LOW. What didn’t click for me was that LOW doesn’t mean no current is going through it, it means ground. By not making the association that LOW = Ground, I was attempting to just add voltage to 2 or 7 without connecting the other, assuming that pins 4, 5, 12, or 13 would provide the ground for the circuit. This is not the case, the other needs to be connected to ground.

I don’t know if this will help anyone else out there working on making simple bots, but I found it a frustrating adventure in learning how to use the L293DNE. If I had just hooked it up to the arduino to start with it would have worked fine, but by going the longer route of figuring out how to use the driver without an arduino I learned more about the chip and the arduino itself.

Coaster Bot

April 1, 2010

There is currently a contest by Make Magazine to create a coaster bot. I’m not looking to really win or anything, but it is a good excuse to create a robot of some sort.

Wall-E is a good example of a Robot. Also, pictures make posts more interesting I've been told.

I’ve ordered a few parts such as a pair of motors, some wheels, and a bunch of hexes of steel and aluminum for structure support. Unfortunately I don’t have much in the way of sensors so I’m not sure how I’m going to have it interact with the outside world. The only sensors I’ve ordered were a few ambient light sensors, but that doesn’t really help with navigation other than perhaps telling the robot to stop when it becomes dark (because you’re likely to be eaten by a grue).

Fortunately, sensors are really just devices that send some sort of electric signal when they “sense” something. Digital sensors will be basically an on-off sort of thing such as a sound impact sensor that detects loud sound changes like clapping. I’ll need some sort of sensor to detect other objects so the robot can perform some sort of navigation.

Luckily, there’s a simple sensor that I’m pretty sure I can build myself without buying an expensive sensor module. That is a touch sensor. The idea behind a touch sensor is to detect when the robot has basically run into something so that it can react to that in the future. I can do this by placing some pieces of material on the front of the robot that will bend slightly when the robot hits something, causing a piece of metal to complete a circuit and send a signal to the microcontroller.

If it looks like a hacked up ugly version of a large button, well it is. The idea is taken from the Lego Mindstorm kit that I played with in College. I should be able to find some scrap metal (maybe a washer or something) for the touch contact and another washer and some wire for the internals. I’m not sure what to make the touch arms out of yet, maybe some sort of wood or see if I have any plastic pieces laying around. Ideally I suppose I would use a part of a CD, but I don’t have any good tools for cutting and working with them. I’ll look into it though

Very rough diagram. The gold lines are just wires or plates that will connect to the Microcontroller.

The touch sensor design can be augmented for other uses as well. If you place a rod with a wheel attached to it on the underside of the front of the robot you can add an additional contact that will activate when that front wheel drops too low (such as when stairs or a ledge are encountered). It might not look pretty, but it won’t look pretty if the robot falls and smashes either.

So the robot itself will need to be able to navigate a space, around objects and such, in order to qualify. The touch sensor is a good start on that path, but it might be unfortunate that the robot will only be able to avoid something after having rammed into it. My cat might not like this much.

Another aspect of the contest is that the robot needs to be able to accept additional sensors to help it navigate. That seems easy enough, though it’s mostly on the programming side (the side I’m least worried about). Ideally I’ll be able to acquire some range finders, either ultrasonic sonar or maybe some sort of laser range finder.

Of which, lasers eventually need to be involved. I’m not sure how or in what capacity, but lasers are cool.

So this is the start of my CoasterBot build. I’ve ordered the motors and a few wheels along with a bunch of other construction parts. I probably should have ordered more wheels but I’ll manage I’m sure. I don’t know what’s going to come of it, but I’m sure it will be neat.

3D Printing and Electronics

March 10, 2010

I was recently approached by a friend of mine to join forces and create a DIY 3D printer. For those who don’t know, a 3D printer is a machine that can fabricate 3D objects that are rendered in a computer using a medium such as plastic, rubber, or sugar. Much of the design is similar to a regular desktop printer, except that instead of using ink it uses a building material, and instead of just printing in 2 directions, it has a moving platform that lowers to allow for the 3rd dimension. It really just prints the material in several 2D layers that build up to slowly create a physical object. Useful in prototyping and art.

My main desire for having a 3D printer is to build housing and components for an arduino. It would be much easier to custom create components from a 3D model for me than to hand make them out of wood or metal, especially since I lack in a decent work shop with power tools. Commercial 3D printers run from $15k up, but DIY kits can be had for under a grand. I’m not sure when my resources will allow me that indulgence, but it’s something to look forward to in the future.

However, my recent fascination in the Arduino, physical computing, and robotics in general have made me wonder if I shouldn’t have also gotten a degree in Electrical Engineering. The college I graduated from did not offer that degree, however the field has begun to interest me increasingly so. I might try to look up some electronics courses at a local community college to expand my horizons.

In the meantime, one of the best ways of learning is not through an institution but through research and experimentation. For experimentation I have to wait for my arduino to arrive (it should be here on friday), but as for research, there are more possibilities in that area. I’m looking at some books on the subject, but I’m not quite sure where is the best place to start. I could focus on some of the physics and basic text books on the subject, or focus more on the experimentation and practical usages. If anyone out there has a good learning road map to a non-colligate learning curriculum on hobbyest electrical engineering, let me know. 🙂

In a slightly different ramble, I’m discovering that my leanings seem to be towards the lower level and possibly abstract areas of programming and engineering. I’ve been focusing my code on creating libraries rather than single use programs. Code reuse has always been an interesting topic in computer science I feel. It’s greatly expounded upon as one of the benefits of object oriented and modular code, the ability for reuse. However I’ve noticed that many developers, and entire teams of developers, rarely write any code that is reused in another project. They will use code from existing libraries such as the Java Standard Library, but will not often create them. However, I feel drawn to making base items that can be reused in multiple projects and by other people.

I think this is why electronic engineering fascinates me so much right now. It’s one of those areas where lower level library code is very much in need. If I can design and create a device that can interface with a microcontroller to perform some interesting action, I would then need to write a driver or library to make that interaction more abstract and easier for a basic user. I haven’t done much C/C++/Assembly programming so I’ve never written a driver, and that’s where my knowledge of theory and experience deviate.

Gaining some practical experience for basic theory is that area of excitement that I feel I can achieve by wiring up components to a microcontroller and building devices that have not yet been built. An exciting prospect that, in the end, I feel will help to improve myself as a developer.

Building Things

March 1, 2010

Most of my posts on here have been about software development and work related issues and observances. I’m going to deviate slightly into the realm of hobby, which I think is important for people of any career in order to keep the personal passion alive and to keep your brain active without burning out.

Recently I’ve been reading a lot of Make Magazine which is primarily about building things of all sorts, though it does lean a bit towards electronics. Building technology is one of those basic features of humanity that separates us from other species. When I was younger I used to visit a friend’s house who’s father had an extremely well equipped workshop that we would use to make random things. For the longest time I stored all of my blank CDR’s on a wooden spindle that we created in that shop. Somewhere along the way with college and a career, building things fell to the wayside. Something that was so interesting and involved when I was a kid I no longer thought about or had time for. It is an unfortunate state to have gotten to, but luckily I’ve been able to rediscover the fun and excitement of making things from raw materials.

My first project was to build a small scale version of a trebuchet. My version is not even close to historically accurate, was created by lashing together pieces of wood with string, isn’t extremely sturdy, and the hook on the throwing arm is a bent nail taped with electrical tape. However, it works. It can toss a small ball around 50-60′ using a sack of change as a counterweight. Just by making the proof of concept small scale rickety version, I have built in myself ambition for creating a proper model.

I think that as we get older, for those of us who don’t stay in a making field or practice, we forget that we have the ability to create things ourselves. You do not have to be a master carpenter to build a table. You can build a trebuchet using hand tools and scraps of wood without any significant training. Making things, especially if they’re fun or useful (or both!), can be a very rewarding experience that I think many people forget that they have the ability to do, even in some spare time.

One of my original ambitions upon moving to California was to utilize the local Fry’s and build myself a robot. I’m not really sure what this robot will do, or its exact purpose. It probably won’t even look like any normal robot, but I wanted to create one. It’s been almost 2 years and I haven’t started even thinking about how I would create a robot. The dream just never seemed feasible to me with my limited knowledge. I’m not an electrical engineer, I’m a computer scientist. I can program a robot that’s already built, but making one is something outside of my expertise. Luckily today with the abundance of resources on the internet along with the open source movement, Robotics and creating electronics is not out of the realm of a passionate hobbyest who has no formal training.

My next goal along the path of building things will take me to the Arduino which is an open source microcontroller. There is a kit available that will get me started on the path of physical computing with the ability to control LEDs, servos, gears, read various sensors, and make noises. The eventual robot army is the natural conclusion. Everyone needs a hobby, even if it’s world domination. It keeps the mind busy.