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

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
13 replies · 4K views
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?
 
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
 
Last edited by a moderator: