Author Topic: Serial Communication between PICs and Home-made Servos  (Read 2469 times)

0 Members and 1 Guest are viewing this topic.

Offline mack33Topic starter

  • Jr. Member
  • **
  • Posts: 8
  • Helpful? 0
Serial Communication between PICs and Home-made Servos
« on: March 30, 2009, 11:00:40 PM »
I'm trying to build a new robot. Some of the features that I want to incorporate is a communication bus between PICs (probably serial), and precision motor control.
I would like to build a communication bus for several reasons:
  • I/O expansion
  • multi-controllers multitasking
  • load(process) distrubtion

I've found plenty of threads and tutorials about serial connections from PIC to PC, but I haven't been able to find a tutorial about serial communication between PICs. I imagine it would be similar. Does anyone know any threads??? Since space is a major concern with my future projects, small PICs are preferred.

Regarding precision motor control:
I basically want to build my own servos. This will give me more freedom in the physical dimensions, degree of rotation, the torque, and the speed of the rotation. My main concern is not to create a huge load for controllers on the communication bus. Other things I would like to include in the design is the ability to output a signal when the operation is complete, and that a constant signal is not needed for the motor to maintain position. Does anyone have any suggestions on a design route???

I'm afraid of getting involved with controllers that don't have much support. Any help would be appreciated.

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Serial Communication between PICs and Home-made Servos
« Reply #1 on: March 31, 2009, 03:51:41 PM »

Using either I2C or (better) SPI (simple implementation, a few bits of discreet hardware and a few reuseable subroutines), you could build a system where the master commands eg.: "UID, turn steering 30° left".
The steering controller then starts turning and when the position is reached, sends a "UID, Acknowledge" and stays there until told differently.
(Where "UID" is the Unique ID for the steering, but each sub-module should have one of course, while sensors should do interrupts directly - polling would defy the entire principle of master/slaves processing).

I have been using that in a servosystem where the feedback was from a 1°/step Gray-coded disk (read via light fibers).

Now, I don't know what you view as precision, or the size of what you have in mind, so more precise advice is hard to give (the usual punishment for not giving the info needed  ;)).

Master/slaves processing is not needed in the average robot, but it sure helps modularizing as well as trouble shooting  ;D

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline mack33Topic starter

  • Jr. Member
  • **
  • Posts: 8
  • Helpful? 0
Re: Serial Communication between PICs and Home-made Servos
« Reply #2 on: March 31, 2009, 09:11:58 PM »
Thanks for the reply. Ya, I'll look into it. Unfortunately I don't have allot of time right now and I'm dead tired. As for precision, well that's all relative (depending if we're talking about analog or digital feedback). Since the range of the joints that I want to attach these motors to is limited, I was thinking of using analog. Here what exactly I was thinking;

Use a PIC (2 analog outputs, 1 digital input)
First analog output would represent the position the motor needs to be at. Say 0 volts for 0 degrees. Say 4.5 volts for 45%. (nothing set in stone) The output will go to one input pin of a voltage comparator. The other input will be connected to a voltage divider(a POT on the bot, and a normal resistor). Then I was hoping to connect the output to the base of of two transistors.

Second analog output would represent the speed the motor needs to move to the new position. The output would connect to a 555 timer circuit that generates PWM. The output of the circuit would connect to the collector of the transistors in the previous step. The output of the transistors would go to the corresponding transistors on the H-bridge to the motor.

The digital input can be handled a few ways. For instance, an opto-electrical device inline with the motor. Or, a nand gate if it's put in the right place.

After reviewing what comparators actual output, i don't think this is possible without introducing an inverter IC. Are the any comparators that have 2 different output pins?
There may also be a problem with the motor moving to fast and start gittering.
« Last Edit: March 31, 2009, 09:22:48 PM by mack33 »


Get Your Ad Here