Thursday, August 2, 2012

Servo Motor Control

This short video demonstrates the control of a servo motor using a PIC microntroller. This system consists of two microcontrollers, one serves as the main controller that transmits data to the other PIC microconyroller via RS232( a communication means between PIC's that uses the USART-synchronous asynchronous receive transmit).
The purpose of this system is to demonstrate how to use servo motors as actuators in robot applications.
The source code and circuit diagram still needs some fine-tuning, and would be posted later. I would be glad to entertain your comments.
AWOTULA, Stephen .A.



Friday, July 27, 2012

Digital Thermometer using a PIC Microcontroller

Temperature measurement entails knowing the degree of hotness or coldness of an object. it comes in handy to have an idea of the temperature of an object.
This simple mini-project is built around a PIC18F2550 microcontroller and a industrial type "K" thermocouple. The thermocouple has a range of -270degrees celsius to about 1330 degrees celsius( please, refer to the datasheet for specification). The voltage from the thermocouple is conditioned using AD595 (0 degrees Celsius to 500degrees Celsius). Please, note that this is for educational purposes ONLY.
METHODOLOGY:
1. Sample the voltage readings from the thermocouple by using the internal ADC( in 10 bit mode for higher accuracy )  feature of the PIC microcontroller.
2. Scale the sample voltage to 10mV/C (as specified in the AD595 datasheet).
3. Output the signal using a Liquid Crystal Display(LCD).
The LCD driver can be found at www.ccsinfo.com/forum just place a search string for it.
...hope you would find this helpful! I would be glad to entertain suggestions, corrections, contributions, and questions.
Best regards.




 BASIC CODE ( Language : CCS C):


#include <18F2550.h>
#DEVICE ADC = 10

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES NOUSBDIV                 //USB clock source comes from primary oscillator
#FUSES HS                       //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES PUT                      //Power Up Timer
#FUSES NOBROWNOUT               //No brownout reset
#FUSES MCLR                     //Master Clear pin enabled
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O

#use delay(clock=8000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,stream=PORT1)

// LCD PINS
#define LCD_DB4   PIN_B0
#define LCD_DB5   PIN_B1
#define LCD_DB6   PIN_B2
#define LCD_DB7   PIN_B3
#define LCD_E     PIN_C0
#define LCD_RS    PIN_C1

#include <flex_lcd.c>
#include <math.h>

float reading;
float temperature, fahrenheitTemp;


void main()
{
   setup_adc(ADC_CLOCK_INTERNAL); // ADC clock
   setup_adc_ports(AN0); // ADC channel combination
 
   lcd_init();                      // initializes the LCD
   lcd_putc("\f");                  // Clear the LCD
   delay_ms(500);
   while(true)
   {
                 
         set_adc_channel(0); // Select channel
         reading = read_adc(); // Get input
         delay_ms(1000); // Wait 1 sec
         temperature = (((reading*0.0048828125f))*100); // Scales input to Celsius, needs some calibration.
         fahrenheitTemp = (temperature*1.8) + 32;   // conversion to Fahrenheit
         printf(lcd_putc,"\n%3.2f%CC, %3.2fF",temperature,0xdf, fahrenheitTemp);
           
   }

}




Friday, July 6, 2012

WELCOME

...pertinent solutions are not built over night, they are the results of careful thinking and research, and good innovations don't always come by serendipity. If we must provide solutions to our problems, then we must stop looking at our problems as a black box.
It is with great joy that I welcome you to my blog, please be my guest as we journey through the basic blocks of innovations, learning from one another and applying technology to improve our lives and environment.

Best regards,
Stephen Awotula.