Umair

toc =Introduction= A //microcontroller// (MCU) is a computer implemented on a very large scale integration chip (VLSI). Microcontrollers are used as dedicated devices embedded within an application e.g. synchronizing servo controls and calculating torque/force from different sensors. In order to serve these applications, MCU contains microprocessor (main core) but in addition to that it integrates timer/counter, memory, analog-to-digital converter (ADC), digital-to-analog converter (DAC), compare/capture/pulse width modulation (CCP), memory controller, input/ouput (I/O) interface, and a clock oscillator (MC68HC11: An Introduction, Han-Way Huang, 2000, p. 4).

Microcontroller range from low-power, small architecture to high speed, powerful computational implementation. But, for optimized selection of MCU we need to take specific target of application into consideration. We look at the amount of memory required, number of I/O pins, communication interfaces, programming language, ADC and DAC pins, and input and output capture requirements among the considerations. Also, the MCU must be able to process data in real-time, thus it must be capable of multitasking.

=Selection Factor= The selection criteria discussed in introduction above is general, [|Microchip Technologies Inc.] suggested following factors while selecting the microcontroller:


 * Microcontroller speed (MIPS, clock speed for communications channels, etc.)
 * The memory sizes (program memory/ Flash, RAM, data EEPROM)
 * The number of I/O pins required
 * Peripherals needed (ADC, Input Capture, Output Compare, Motor Control PWM, SPI™, UART, etc.)
 * Physical size (form factor/package)
 * Analog Input Voltage levels

Among the factor, we can add:
 * MCU architecture
 * Software development choices
 * Providing power to peripherals
 * Cost.

- Our project will implement tele-presence using haptics. To smoothly feel the illusion of haptics interaction it has been shown that the refresh rate must be at least 1 [kHz] (El Saddik, "The Potential of Haptics Technologies," //Instrumentation & Measurement Magazine, IEEE//, vol.10, no.1, pp.10-17, Feb. 2007). Thus, we need MCU which runs at clock speed higher than 1 [kHz].

- Memory size will depend on the implementation of our project; though, it will not be a major issue as today's MCU integrate enough memory for program storage and stack management.

- Number of I/O pins is on the other hand is major issue. We require enough number of I/O pins to integrate all the actuators (servos in our case) and torque/force sensors. We will be using at least six servos and two torque/force sensors. We will also need to integrate collision sensors as well in each of robotic arms. Keeping that in mind we need more than 10 dedicated I/O pins. We need to further refine our model to conclude on exact I/O pins.

- In order to process data we need ADC, to communicate and to load developed program to flash memory we need UART (standard communication interface), to control speed of servos we need enough number of CCP pins, where duty cycle of the pulse regulates the speed of servo.

- Physical size is important once we need to commercialize our project, but we are in implementing and testing phase and it is not our primary concern.

- Analog input voltage level will depend on voltage level of servos and sensors. If the voltage levels are low or out of range we need an implement amplifier to operate in proper voltage range.

- MCU architecture come in 8, 16, 32, and now in 64 bit. But 8 bit MCU architecture is enough for out project since our project is implemented on a small scale and does not require extensive computation, as 16-bit and 32-bit architecture would be implemented in automobile and digital signal processing application.

- Software can be developed using numerous programming languages and different MCU manufacturers have their own choices as well. We as a team prefer C programming language or its derivative since we are most familiar with it and also it has wide debugging support.

- To provide power to peripherals we need dedicated power supply in order to allow clean, smooth, and regulated power. Single power from MCU is a bad choice since there is threshold on current supply. Therefore, we will use a dedicated power supply to provide necessary power to all peripherals.

- Finally the cost of the MCU will be bottleneck since we need to keep with in our budget or better stay below. Obviously we can buy MCU which adheres to our requirement but it may cost a lot more. Sacrificing on our needs for cost and coming up with engineering solution with limited resources is one of implicit purpose of this project.

**Summary of Selection Factors**

 * Architecture || 8 bit ||
 * Operating Frequency || >1 KHz ||
 * Memory || >15 KB ||
 * Digital Communication Peripherals || Serial Communication (RS232, USB), Wireless Protocols (optional) ||
 * Capture/Compare/PWM Peripherals || Ideally 10 PWM (Ouput Compare or DEMUX can be used as well) ||
 * Analog Input || Ideally 10 (otherwise we need MUX) ||
 * Physical Size || Small to Medium ||
 * Cost || <$100 ||
 * Programming Language || C programming language ||

=List of MCU Considered=
 * Microchip PIC18 MCU - PIC18F8628
 * Arduino - Arduino Duemilanove
 * Actel - Core8051
 * Atmel (Already evaluated under Arduino)
 * [|Cypress Semiconductor - CY3687 MoBL-USB FX2LP18 Development Kit]
 * Infineon XC800 Series - XC878 MCU

=Final Verdict=

As stated before, for a given price we can buy the best MCU and evaluation board but we are constraint by our budget. The engineering solution is to employ as much ingenuity possible while remaining with in limited resources. Therefore, we selected **Arduino Duemilanove** MCU evaluation board because it is the least expansive of ones we researched and more or less fulfills our requirement with additional addons, i.e., we need a MUX and DEMUX in order to accommodate all servos and sensors.

=Additional Addons=

Arduino Duemilanove incorporates ATmega328 MCU. ATmega328 MCU has 20 I/O pins, of which 14 are digital I/O pins, of which further 6 are can be used as dedicated PWM pins, and 6 are analog input pins. It was discussed in the introduction that our initial design only implements 6 servos, 3 for each robotic arm, but we need to approach this number of I/O pins problem as though we are using 10 servos. As such, to accommodate all servos it is not feasible in ATmega328 MCU. Therefore, we need to employ MUX and DEMUX to fulfill our requirement. The proposed functional design is given below. At the input end, there are only 6 analog input pins. In the design below, the input 2 servos are connected directly to Analog IN 1 (A1) and Analog Input 2 (A2). While all other servos are connected through 8-Channel MUX to Analog IN 3 (A3) where through logic table it is decided which of the servos in active. The read action must be very quick in order to counter transition lag. The decision logic is implemented through 3 Digital IN pins (D12, D13, and D14) as an example. This approach leaves us with 3 free Analog IN pins. Similarly we will use DEMUX at the output end. Though we have much more leeway since there are 14 digital I/O pins, we want to conserve as much pins possible for the of use sensors. Therefore, 2 PWM pins are connected to 2 servos and other PWM pulses are transferred through 8-Channel DEMUX. All remaining 8 servos can be accommodated this way through logic decision from 3 Digital IN pins (D9, D10, and D11) in this example. This way we conserve 5 Digital I/O pins for other uses.



MUX/DEMUX
There is a large variety of MUX/DEMUX available in the market. They are relatively cheap as well. Therefore, our budget can be well managed due to this addon. As such, we found Philips HEF4051B meet our requirement.

General Description
The HEF4051B is an 8-channel analog and digital multiplexer/demultiplexer with three address inputs (A0 to A2), an active LOW enable input (E), eight independent inputs/outputs (Y0 to Y7) and a common input/output (Z).

The device contains eight bidirectional analog switches, each with one side connected to an independent input/output (Y0 to Y7) and the other side connected to a common input/output (Z).

With E LOW, one of the eight switches is selected (low-impedance ON-state) by A0 to A2.

With E HIGH, all switches are in the high-impedance OFF-state, independent of A0 to A2. If break before make is needed, then it is necessary to use the enable input.

If break before make is needed, then it is necessary to use the enable input.

VDD and VSS are the supply voltage connections for the digital control inputs (A0 to A2, and E). The VDD to VSS range is 3 V to 15 V. The analog inputs/outputs (Y0 to Y7, and Z) can swing between VDD as a positive limit and VEE as a negative limit. VDD − VEE may not exceed 15 V.

For operation as a digital multiplexer/demultiplexer, VEE is connected to VSS (typically ground).



Features

 * Analog multiplexing and demultiplexing
 * Digital multiplexing and demultiplexing
 * Signal gating
 * Multiple package option
 * Speciﬁed from −40 °C to +85 °C