my friend and I want to make and program our own computer hardware, such as a very simple robot ( a thing with wheels that can avoid objects and stuff like that). I have expiraince with C++ and i have heard that it is posible to program such things using c++.

however, I have no idea how to program such a thing, or how stuf like that works.

Can you tell me making such a "robot" works?

No, this is a help board -- not a teaching system. You'll have to do a lot of research on robot and firmware programming.

A simple robot like this (two wheels, differential steering, with some proximity sensors and possibly something else like a camera) is usually controlled with a microcontroller. Microcontrollers range from very simple to a smart-phone level of capabilities.

For very simple microcontrollers (uCs), they can be bought for as little as 20-30 dollars, but you'll need some electronics skills to integrate them into a robot (they are usually DIP-mounted, and require quite a bit of external circuitry like voltage regulators, pull-up/down resistors, and so on). If that is not something you are prepared or interested in doing, you'll have to go a step higher (in cost and capabilities). These simple uCs are typically programmed in C, and are rarely able to accomodate an operating system (or only a very simple OS, like FreeRTOS). Sometimes they allow C++ programming, but often with only limited capabilities (limited language support and reduced C++ standard library (or none at all)).

Then, you have mid-range uCs, like Arduino series. These are basically the same as the very simple uCs (Atmel AVR family), but they have more of the outside layer of electronics to allow for standard input-output protocol capabilities such as UART, TTL, PWM (and RC PWM), I2C, analog IOs, and maybe even encoder quadrature chips. And, with those you don't need to do much electronics besides soldering connectors, and mounting the chip with screws. As for programming, it's the same deal as for bare uCs, except that you will typically have more built-in functions for IOs and a better development environments available. Arduino style microcontroller packages usually range from 30$ up to 150-200$, depending on the uC chip it has and the amount and sophistication of their input-output ports.

These uCs are usually programmable via a USB connection, and using a development environment such as Atmel Studio. This is very nice because it gives you debugging capabilities (JTAG), and also simulation capabilities (e.g., run your program on a virtual machine emulating the uC chip in question).

Moving up one notch, you get into the world of ARM microcontroller architectures. This is the mobile-phone / smart-phone type of microcontrollers. These are highly capable 32bit uCs which can run an operating system (usually a Linux or micro-Linux distribution, or even Android), as well as running Ethernet (or even WiFi or bluetooth) connections. Some are as cheap as 60$, but most decent ones (not some obscure-brand uC chip) will range in the 200$ and above, again, depending on capabilities and the IOs it provides. With these uCs, you can also use Atmel Studio to develop code for it (C or C++), but there are also more options in this case. There are some hobby-roboticist (like Google ADK) tools out there, that I am not too familiar with. As a "professional" robotics engineer, I don't necessarily do too much work with uCs (my robots have one or more full-blown PCs running them), but when I do, it is usually through having a Linux distro on the uC, or a QNX operating system, which I then write code for in C++ in a cross-compilation environment and download the programs into the uC manually. The very nice thing with these uCs is that you can access and use them almost the same as an ordinary Linux PC (remote login through the network connection, and run programs that way), and they are capable enough that C++ support is pretty much fully implemented (with GCC).

Finally, you can move up to micro-PCs (or what robot-shop calls "Single Board Computers"), which are basically full-blown PCs inside a small box or package (of course, with limited capabilities compared to a real PC). In that category, I also include Atom processors which are basically the typical tablet processors. At this point, this is basically like developing on a normal computer. However, IOs on these chips (or the chips they come mounted on) are rather more "general" purpose than microcontrollers, meaning that you'll get interfaces like USB, RS-232, WLAN, LAN, and some GPIOs (General Purpose Digital Input-Outputs), but you won't generally find IOs that are more typical of "robots" or sensors, like PWM, RC-PWM, TTL, I2C, and so on. So, these are often used as highly capable "core" CPU systems, and usually communicates high-level instructions to other uCs via USB or RS-232, or even CAN (or OpenCAN). However, there are some low-range micro-PCs that are tailored for robotics applications, such as those listed on robot-shop, for example this one which is very rich in IOs and doesn't contain useless things like a micro graphics card (that many have). With these kinds of chips, you can also run much more feature-rich robotics software, such as ROS, which is quite good as a plug-and-play C++ library for running robot (complete with drivers for all sorts of typical peripherals you use in robotics, as well as many basic algorithm implementations for all sorts of things, this is kind of the go to solution for many professional roboticists when looking for off-the-shelf drivers or algorithms).

Basically, the important thing is to identify your needs. From the kind of application you describe, the minimum you require is essentially an entry-level uC with enough PWM outputs to control your motors and a healthy amount of GPIOs (and possibly one or two UARTs and some analog inputs). But you might want to go a notch higher just because it's going to be easier to develop code for it if you have an ethernet / wlan connection to it and enough resources to run an operating system. So, an entry-level ARM 32bit micro-controller might be just what you need, making sure you have the IOs you need on the chip. If you want to integrate more complex things like cameras or other systems like that, you might want to go with a micro-PC or a higher-end ARM uC.

That brings me to the next important topic, which is the hardware. Selecting and programming a micro-controller for your robot is a rather simple task compared to building the mechanical hardware and power-electronics. If you don't want to do this, you can shop around robot-shop and other robotics hobby sites for all-in-one solutions, which often include the uC or micro-PC all plugged in and all. If you want to build it from scratch (more or less), then you'll have a pretty long shopping list, and you have to be very careful about interfaces and interactions between components. For example, selecting good Amp-ratings on electronic speed controllers, isolating power circuits of motors, logic and sensor systems, making sure IR proximity sensors are equipped with Schmidt triggers if you are going to use them as digital "collision / no-collision" sensors, and so on. There are a lot of little details like this that you need to worry about, and some will require that you design your own electronics circuitry (PCB / proto-board circuits). This can all be very interesting and fun to do, if that is something you are interested in, but it can also be frustrating if you just want it to work, in this case, you should just buy an all-in-one robot. For about 800-1000$, you can get a pretty decent 2 wheels (or even 3 omni-wheels) robot with a number of IR sensors and a few other things, including a ARM uC and accessories. You can also play around with toy robots for only a couple hundred dollars (but then, the uC will be low-end and the robot very small, but still fun to play with). There are also many other options besides buying the whole thing, you can buy only the chassis-wheels-motors assembly, and do the rest yourself. Then, there are also other options besides wheeled-robots, like small humanoid robots or robotic arms controlled with servo-motors (which are super easy to use, from an electronics point-of-view, compared to DC motors).

So, I hope this gives you a good amount of resources. If you have more question, I'll be happy to answer (as best as I can, as I said, I'm not the most knowledgable with hobby-level hardware).

how it works depends on the hardware. If you buy a small robot then you will have to read their programmer's documentation to find out how to interface a computer with it. If you build your own then I suppose you can design the commands yourself. You might want to start out by googling for "robotics"

As mike_2000_17's comprehensive reply said, anything in the Arduino family of things is pretty easy. I've used freeduino in the past.

You get the board for about $30. There's some soldering to do, but not too much and all of the surface-mounted componented are done for you, so you don't need an expensive soldering iron and a magnifier or anything. It connects to your computer via USB (if you get the right one) and you can load programs onto it and run autonomously or leave it connected to your computer and read in data continuously. These guys are programmed in a C-like language called wiring which is easy to understand if you already know some C/C++. The board has a cool set of features, digital and analogue inputs/outputs and some PWM outputs for controlling servos. There's LOADS of forums and such for Arduino as well, so you should have no problem to find help and example programs and such. They're pretty cheap, just order one and get going!

commented: yep +14
Member Avatar for iamthwee

+1 for the arduino.

It's simply the best way to go, for beginners and professionals alike... Especially the task you are asking about. You probably just need to connect a few sensors so it turns around when it detects an object.

You can use and build robots from your lego kits...

thank you all for that information, this will help my friend and I to do it.

Member Avatar for iamthwee

Go for the arduino uno

-1 prototype breadboard
-few sensors, you can get these online or from your local electronics store, in the UK we have a place called maplins that usually is good enough.
-two motors, one for forward, one for turning
-If you have lego technic raid your box for motors and gears and wheels

Any issues you can post here...

That's the easiest option IMO.

Find the nearest FRC/FTC team and ask them, they'll be very happy to show and teach you. www.usfirst.org

-1 prototype breadboard
-few sensors, you can get these online or from your local electronics store, in the UK we have a place called maplins that usually is good enough.
-two motors, one for forward, one for turning
-If you have lego technic raid your box for motors and gears and wheels

Let me expand a bit. Assuming you want to make a wheeled robot to go around like the rumba robot (robot vaccuum cleaner), by bumping into walls and turning in a random direction. The basic hardware would be:

  • Prototyping: A solderless breadboard, with a kit of jumper wires for it.

    • Later, get a proto-board (also called "stripboard"), for the "permanent" circuits.
    • You also should get a starter kit of resistors and capacitors.
  • Soldering kit (basically what you find in this kit):

    • Soldering iron, get two tips: a fat one and a thin one.
    • Solder: a roll of thin solder wires, and a roll of fatter solder wires is also nice.
    • A "helping hands" thing (stand with little clamps, very useful to hold things together).
    • Some wires and some wire cutters and clamps.
  • A few useful proximity / touch sensors:

    • 2-3 IR proximity sensors (about 10$-15$ each).
    • 2-3 light-touch switches (for a physical bumper).
  • Schmitt-trigger integrated circuits for all "digital" sensors (touch switches and if IR sensors are used as ON/OFF instead of analog distance read-outs).
  • Two motors: differentially-driven (i.e., two wheels with a motor each, the speed difference determines the rotation). Do not use a forward motor + steering motor setup because it is hard to control and to construct, and performs horribly.

    • Get either brushed or brushless DC motors, depending on your budget.
    • Get proper Electronic Speed Controllers. Do not connect motors directly to the PWM outputs of your micro-controller (if either the motor breaks (or its terminal capacitor) or it draws too much current (stalls), it will melt your micro-controller). You need a speed controller between the motor and the micro-controller, with a current and voltage rating that matches your motors. Super-sonic frequency is pretty nice, don't underestimate that feature that some ESCs advertise, if you ever use one with sub-sonic frequency, you'll see (or hear) why I say that.
    • Setup an independent power-supply for your motors (and ESC), independent from what the sensors and micro-controller use. The easiest is to just get two battery-packs.
  • For mechanical hardware, a lego techno kit is pretty good, at least, for the gears and stuff. You can also get simple plastic gearboxes and wheels from hobby-shops (or hobby web-stores). For a bigger frame construction, just use wood (which is somewhat annoying to work with compared to metal, but working metal requires access to a complete workshop, while wood can be worked with with a (hand / jigg / round) saw, a drill, a hammer and a chisel). Plexi-glass is another decent material.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.