Do I need a Microcontroller for Computer Control of Electrical Devices?

AI Thread Summary
Using a microcontroller is generally the most effective way to control devices like robots from a computer, as it allows for simpler command inputs and handles real-time processing. While it is possible to control devices directly from a computer using parallel ports or USB I/O cards, this approach requires the computer to manage all control details, which can be complex and less efficient. Microcontrollers often come with built-in communication peripherals, enabling easy programming and interaction via USB or serial connections. For beginners, starting with a popular microcontroller and a programmer, along with a C compiler, is recommended to facilitate learning and development. Overall, integrating a microcontroller simplifies the control process and enhances the functionality of robotic systems.
TheCoolBrian
Messages
8
Reaction score
0
Lets say I want to controle something like a robot but I want to controle it through the computer via a usb or printer plug. If the computer is plugged into the microcontroller do I still have to put the microcontroller In a PIC Programmer or can I program it wile its hooked up via the usb or printer plug ...

How does the computer "Talk" to the Microcontroller does it send singnals and the microcontroller will decode it and do the command you want it to do.

as you can see I,am new to electrical enegineering and I know even less about how a microcontroller works thanks guys

Edit: And do I Really need a microcontroller if it is connected to the computer can I controle the device directly from the computer
 
Last edited:
Engineering news on Phys.org
It might be possible to leave your chip plugged into the programmer (if you could fit your breadboard / PCB onto it, and it were hacked to communicate, instead of program), but the preferred method is to make use of the onboard communications peripheral. The majority of microcontrollers (ones meant for hobby use) have on-board serial (though you'll need a voltage level converter--something like a MAX232), allowing you to communicate with it via a serial port (without having to reprogram it).

There are also micros with USB serial built-in (it looks like a standard serial port with the right drivers), but FTDI makes a line of USB-TTL serial converters (from chips to modules) that have really good driver support under just about every OS (again, looks like a standard serial port). They even have prototype-suitable DIP (Dual Inline Package) evaluation boards (UM232R, and DLP-USB232M-G):
http://www.ftdichip.com/

Using a microcontroller is probably the easiest and most flexible way of controlling a device. If you were to avoid a micro, you'd still need (some) hardware to interpret commands from your computer (unless you were only looking for it to do a few things). That's why they're in practically everything. The easiest way to get started with this micro stuff is to:
1) Get a micro (e.g. PIC, or ATMEL, stick to the more popular models if you have 0 experience), and a programmer for it,
2) Get a C compiler for it (unless you already know assembly)--may also need to pick up a C programming book,
3) Built the "bare bones" reference design, and PERUSE THE DATASHEET!
4) Start programming--it'll take you a while to figure out the tool chain (how to get your simple "Hello world" or blinker program compiled, onto your micro, and then doing what you want it to do). You'll probably be forced to reread and actually comprehend sections of the datasheet during this process. Yes, this'll be the case even for your 3-line program.

Possibly in conjunction with that, you can get one of the aforementioned USB modules, or get a MAX232 from Radio Shack or wherever (this only works if you have a serial port on your computer--these are slowly being phased out).
 
before complicating with too much explanation,
please let us know why/how do you plan to implement USB into your system.
what kind of robot are we speaking about??
have any idea about computing requirements?
 
TheCoolBrian said:
Edit: And do I Really need a microcontroller if it is connected to the computer can I controle the device directly from the computer

You could control it directly form the computer.
Under dos/linux you can set individual bits on the parralel port or you can buy a USB I/O card and use that to control motors etc.

But this means that every detail of the robots control and response must be handled in real-time from the computer. The reason for using a micro controller (apart from being more portable than the PC) is that you can handle the detail of stepper motors and switches in it and just have a simple command from the PC like "forward 100" .
 
mgb_phys said:
You could control it directly form the computer.
Under dos/linux you can set individual bits on the parralel port or you can buy a USB I/O card and use that to control motors etc.

But this means that every detail of the robots control and response must be handled in real-time from the computer. The reason for using a micro controller (apart from being more portable than the PC) is that you can handle the detail of stepper motors and switches in it and just have a simple command from the PC like "forward 100" .
I've compiled BASIC code to control computer ports. You can write subroutines to do the DOS interrupt calls. Back when I got into it, I was amazed with all the built in DOS functions. Do intel processors still support these function calls and interrupts?
 
Yes under DOS. BUT it has to be DOS not a dos box inside windows ( at least> win95).

Under windows you are prevented from low level access to the computer - only device drivers are allowed to talk to the port. There are examples device drivers that will send commands to the port or you can use dos!

eg. http://electrosofts.com/parallel/parallelwin.html
 
So on these new machines I would have to boot up in DOS to run my executable?
 
If you want to use raw _inp() and _outp() to talk to the ports, yes.
 
Thanks. I didn't mean to hijack TheCoolBrian thread.
 
  • #11
Can you still get parallel ports these days? I suppose there's always USB to parallel converters.
 
  • #12
The USB-Parallel adaptors don't necessarily support all the I/O pins to use the port fully, you might be better off getting a USB-PIO card designed specifically for robotics.
 
  • #13
Thanks Guys you all helped a lot got any idea of what I should buy first to get started in electrical engineering should I buy a kit or just a bunch of stuff and make stuff from schematics I find online I,am tryin to keep it under about 100 dollars
 
  • #14
Last edited by a moderator:
Back
Top