Friday, 27 January 2012

FYP Week 1 - Introduction on microcontroller selection

Hi,
How are you doing? Hope everyone is fine… Today I am going to start on the introduction of the most important component in my Final Year Project (FYP), which is the microcontroller. I am using a PIC16F887A by Microchip.

So let’s learn more about PIC microcontrollers.

Introduction
A PIC microcontroller is a processor with built in memory and RAM, and you can use it to control your projects.  So it saves you building a circuit that has separate external RAM, ROM and peripheral chips. It is a very powerful device that has many useful built in modules. For example:
  •  EEPROM
  •  Timers
  • Analogue comparators
  • UART
The PIC is one of the most popular microcontrollers and in case you were wondering the difference between a microprocessor and a microcontroller is that a microcontroller has an internal bus with in built memory and peripherals. Click here for the PIC16F877A datasheet

Features
A PIC microcontroller is an amazingly powerful fully featured processor with internal RAM, EEROM FLASH memory and peripherals.  One of the smallest ones occupies the space of a 555 timer but has a 10bit ADC, 1k of memory, 2 timers, high current I/O ports a comparator, a watch dog timer and etc.

Programming
One of the most useful features of a PIC microcontroller is that you can re-program them as they use flash memory (if you choose a part with an F in the part number e.g. PIC12F675 not PIC12C509). You can also use the ICSP serial interface built into each PIC Microcontroller for programming and even do programming while it's still plugged into the circuit. That’s so cool right…hehe
You can either program a PIC microcontroller using assembler or a high level language. I recommend using a high level language such as C as it is much easier to use.

Input / Output (I/O)
A PIC Microcontroller can control outputs and react to inputs. For example, you could drive a relay at the output or read input buttons. Many now have a built in ADC so you can read analogue signal levels so you don't need to add an external device.

Peripherals
The best way to start is to learn about the main features of a chip and then begin to use each peripheral in a project.  I think learning by doing is the best way…..hehe <3

PIC microcontroller
Feature
PIC microcontroller
feature description
Flash memory
Re-programmable program storage.
Memory storage for variables.
Long term stable memory: Electrically Erasable Programmable Read Only Memory.
High current Input/Output ports (with pin direction change).
Typically 3.
Built in RS232 protocol (only needs level translator chip).
Capture/Compare/PWM module.
I2C and SPI Interfaces.
An analogue comparator and internal voltage reference.
Analogue to digital converter.
Parallel Slave Port (for 8 bit microprocessor systems).
LCD interface.
ICSP,WDT,BOR,POR,PWRT,OST,SLEEP
Simple programming using In Circuit Serial Programming.

Note: these are some of the main features (some chips have all of these and some don't).

Flash memory
This is the program storage area and gives you the most important benefit for using a PIC microcontroller. It allows you to program the device many times. It can be re-programmed up to 100,000 times (probably more) as they use Flash memory

ICSP
In Circuit Serial Programming (ICSP) is the next most important benefit. You can re-program the device while it's still in the circuit so once your programmer is setup you can leave it on the bench and test your programs without moving the chip around and it makes the whole process much easier. J

I/O Ports
Input / Output ports let you communicate with the outside world so you can control leds, LCDs or just about anything with the right interface.  You can also set them as inputs to gather information.

Pin direction
Most PIC microcontroller pins can be set as an input or an output. This allows you to use a pin for multiple operations. For example, the Real Time clock project uses RA0, the first pin of PORTA, to output data to a seven segment display and at a later point in the program read the analogue value as an input.

Current
The PIC I/O ports are high current ports capable of directly driving LEDs (up to 25ma output current) - the total current allowed usually ~200mA this is often for the whole chip.

Timer / Counters
Each PIC microcontroller has up to three timers that you can either use as a timer or a counter (Timer 1 & 2) or a baud clock (Timer 2).  

USART
The USART is a useful module and saves having to code up a software version so it saves valuable program memory. All you need to interface it to a PC serial port is a MAX232 chip (or equivalent).

Baud Rates
You have to be careful using the baud rates as they depend on the main clock in use and normal oscillator values in general do not fit very well with 'real' baud rates.  

CCP 
The Capture/Compare/PWM module has three modes of operation:
  • Capture - Capture the time of an event.
  • Compare - Generate an output when Timer 1 reaches a value.
  • PWM - Pulse Width Modulation.

Comparator and comparator voltage reference 
The comparator is module that has two analogue comparators which can be set up in one of 8 different ways. Either digital or analogue inputs can be compared to reference voltages.

In one mode an internally generated voltage reference is used as an input to both comparators and in the same mode multiplexing lets you monitor up to four different input pins.

ADC 
The single 10 bit Analogue to Digital Converter can have up to 8 inputs for a device multiplexed from input pins.
The ADC can be used during sleep but you have to use the RC clock mode. One benefit of this is that there will be no digital switching noise so you will get better conversion accuracy.

PSP
The Parallel Slave Port lets you to connect the PIC microcontroller directly into a microprocessor system. It provides an 8 bit read/write data bus and RD (read) WR (write) and CS (chip select) inputs - all active low.
This will let you add a PIC microcontroller to a system so that the PIC microcontroller can be treated as a memory mapped peripheral.  It will let the microcontroller behave just as though it was another microprocessor building block e.g. some memory or ram but in this case you have full control over exactly what the building block is i.e. you can re-program the PIC microcontroller to do just about anything..

Special Features
ICSP
In Circuit Serial Programming
Refer ICSP above
WDT
Watch dog timer
This is a software error protector. 
BOR
Brown Out reset
This detects if the power supply dips slightly and resets the device if so.
POR
Power on reset
This starts microcontroller initialization.
PWRT
PoWeR up Time
A time delay to let Vdd rise.
OST
Oscillator start up timer
Wait for 1024 cycles after PWRT.
SLEEP
PIC microcontroller sleep mode
Enter low power mode.

Differences between all three PIC microcontroller
All three devices are extremely powerful and the main difference is that they have different numbers of pins and memory size. 
PIC microcontroller Device
PIC microcontroller No. Pins
PIC microcontroller Flash memory WORDS
PIC12F675
8
1k
PIC16F88
18
4k
PIC16F877A
40
8k

(Note: that all of them have the letter F in - this means it is a Flash re-programmable part - don't go and buy a part with O in as its OTP - programmable only once!)

 So, that's it for now I guess... Next I will discuss on the PIC main board PCB designing and its etching procedures. Hope you enjoy this entry. Tata for now....!  :)




###################################################################

QUOTE of the day...!!!

Life is like riding a bicycle - in order to keep your balance, you must keep moving.  ~Albert Einstein

###################################################################




Regards,


Idriah Safriza :)

Tuesday, 24 January 2012

What is Home Patient Monitor

Hi people,

Currently I am doing my Final Year Project titled the "Home Patient Monitor". So far I am still in search of an suitable circuit design to build a patient monitor. Let me explain more on my project. This project is based on the patient monitor concept. What is Patient Monitor? 

I have came out with an idea to combine a few circuits that includes the Heart Rate circuit, Blood Pressure circuit, Temperature sensor circuit and the usage of a Microchip PIC16F877A microcontroller to form a new circuit. Here is a slight information on my project.
^..^    ^..^    ^..^    ^..^    ^..^    ^..^    ^..^    ^..^    ^..^    ^..^ 

Objectives
  • To design a single device that can measure multiple parameters
  • To make a prototype that is low in cost
  • To design a prototype that can interface, collect and store data in a computer for analysis
  • To build a simple device that is user friendly

Literature Review
  • “The Objective of Patient monitoring is to have a quantitative assessment of the important physiological variables of the patients”. 
  • “Patient monitoring system measures physiological characteristics either continuously or at regular intervals over time and thereby differs from diagnostic instruments that detect existing medical conditions through single testing procedures”.
  • “The choice of proper parameters, which have information content, is chosen and it is agreed that monitoring of following biological functions are often needed, the five vital signs monitoring are Electrocardiogram (ECG), Heart Rate (HR), Body Temperature, Non Invasive Blood pressure (NIBP), Spo2”.
     Sources:
  1. Suresigns VM Series Patient Monitor Philips manual guide (2007)
  2. http://www.rane.com/note148.html
  ^..^  ^..^  ^..^  ^..^  ^..^  ^..^  ^..^  
 
The 5 W’s + 1H Concept !

What is Home Patient Monitor?
  • The prototype consists of a LDR, NIBP cuff and a temperature sensor.
  • Signal from hardware will be interfaced to the computer using MAX232 circuit and a serial cable to the laptop to display the result at Visual Basic.

Why design Home Patient Monitor?
  • Capable of measuring multiple parameters e.g HR, BP & body temperature
  • Low cost compared to the readily available patient monitor in the market
  • VB can store data for analysis
  • Simple and user friendly

Who can use Home Patient Monitor?
  • Normal Person: Monitoring is useful not only for sick patient but also for normal person, including athletes (e.g. to observe their heart rate variations due to stress and exercise)
  • Abnormal (sick) Person: For persons with illness (e.g. heart rate will give indication of intensity)

When to use Home Patient Monitor?
  • Apply to all ages of people who want to monitor their health condition.
  • It will also provide readings just like the patient monitor without having to use the expensive device.

Where to use Home Patient Monitor?
  • Because of its portable size, the design can be used at home or in the office, school or any other desired place
  • Indoors
  • Outdoors
  • Clinics

How Home Patient Monitor works?
  • Signal will be amplified
  • Analogue signal will be send to ADC
  • Digital signal will be produce
  • Interface hardware with software using MAX 232 and a USB converter
  • Display output at computer/ laptop 
  • Using VB as a user interface
   ^..^  ^..^  ^..^  ^..^  ^..^  ^..^  ^..^  ^..^  ^..^  ^..^  ^..^  ^..^

Components/ Software Used
  • LDR (for HR)
  • NIBP Cuff
  • Honeywell SCC05DN (pressure sensor for BP)
  • LM35 (for temperature)
  • LM324N
  • TL082CP (x2)
  • LM358N
  • MAX 232
  • Tubings
  • DC Motor
  • Solenoid valve
  • Relay switch
  • Microchip PIC16F877A
  • USB converter
  • Computer/ Laptop
  • VB

Problem statement (Limitations)
  • Under the time constraints, I only manage to come out with a prototype of a patient monitor with HR, NIBP and temperature monitoring only.

Contribution
  • Able to collect and store data in a computer for analysis
  • Able to support self home monitoring by non technical user (user friendly)
  • Able to produce a lower cost patient monitor/ more affordable
 
Future Recommendation
  • Many features could be added such as wireless, SPO2, ECG technology, and alarm features.
  • To design a patient monitoring application that is capable to access a hospital database and presents clinical information easily and effectively.
  • To upgrade prototype so that it can overcome limitation of patient with physical disability, as they can also get updates and consultations on their health condition through email by sending their results to their clinicians (internet application).
^..^  ^..^  ^..^  ^..^  ^..^  ^..^  ^..^  ^..^  ^..^  ^..^  ^..^  ^..^  ^..^

 jARgONS used:
VB - Visual Basics
HR - Heart Rate
LDR - Light Dependent Resistor
NIBP - Non Invasive Blood Pressure
SPO2 - Oxygen Saturation level in blood
ECG - Electrocardiogram

^..^  ^..^  ^..^  ^..^  ^..^  ^..^  ^..^  ^..^  ^..^  ^..^  ^..^

QUOTE OF THE DAY...!!!

Don't look where you fall, but where you slipped.

^..^  ^..^  ^..^  ^..^  ^..^  ^..^  ^..^  ^..^  ^..^  ^..^  ^..^  ^..^  ^..^




Regards,


Idriah Safriza :p
/* CUTE CURSOR */ Waving Onion Kun /* ticker */