Friday, April 30, 2010

I'm just back from the embedded lab after a whole day of work. The last lab in advanced embedded sounded really simple but is definitely not when it comes to putting it all together.

The challenge: Interface a DC motor to the Renesas M16C micro-controller. The motor speed must be controlled by commands from a computer. So basically I had to write down a code for serial communication between the PC and the microcontroller to use the uC UART. The motor speed was controller by varying the duty cycle of the PWM pulse from 100% to 0. (Status -> Done. This was pretty easy and took me just under 2 hours to do this)

Next we had to design a tachometer to count the speed in rpm of the motor. Initially, we used the very basic VT43N1 LDR (Light dependent resistor) to design the tachometer. The LDR was supposed to detect and send a pulse to the I/O port of the M16C every time a shadow of the rotor wing attached to the motor would fall on it. This method was however not accurate as the micro-controller missed a whole lot of wing rotations. We then shifted focus on the TSOP1156 IR demodulator which would detect IR pulses from an IR LED. Though this approach seemed to work well, it was not feasible as the demodulator would be sensitive only to a pulsed input from the LED and would be sensitive enough to give acceptable results at 56KHz frequency. Generating 56Khz at an amplitude of 1.5v (for the IR LED) did not seem to be a good idea for an embedded system.

Finally, we decided to work back to the basics and used the much simpler IR Transmitter and receiver pair which is basically a LED made from gallium arsenide which emits infrared light at 880nm to be used as a transmitter. I used 3V Vcc with a current limiting resistor to power the IR LED. Just to make sure the LED is emitting IR light, you can check that by observing the LED with you cell phone camera and you can see the IR LED glow!! The IR receiver is an IR photo-transistor operating at 3.5 - 6V with its base powered by the IR light from the transmitter. The anode gives 0v output when IR light is reflected directly on its base. The pair just needs to be close enough to have a good output. (Status --> Done)

The main challenge was programming the MSP430F1122 micro-controller by Texas Instruments. We had to program a custom made platform with the MSP430 using a JTAG port on the board connected to the parallel port of a computer using the IAR embedded workbench. We are working on it now!!! Will post as soon as its done.

Until then, happy debugging.....

No comments:

Post a Comment