Microcontrollers for Medicine – Part I

25 Apr
The building of the musium of traditional medical equipments in Japan (wikimedia)

Healthcare is becoming more demanding by the hour…. probably by the minute. Natural calamities and resultant man-made disasters contribute heavily to those diseases which were unheard of in the past. Pollution, so called global warming, receding forest density…. you may add to the list and would not stop for the next few hours…. so long is the list of contributors to diseases and deformities.

As if this is not enough, hospitalisation expenses climb the Himalayas faster than petroleum prices.

Fine…… let us stop the negativities today and now.

It is imperative that we know what has been done by our engineers’ fraternity about all this.

You are right, it is a doctor’s job.

However, can you  imagine your physician without a thermometer and a stethoscope or a blood pressure apparatus?

It is we , the engineers who devise such medical equipment from a simple thermometer to a MRI scanner. Engineers put their heart and soul in these products which result in ultimate patient care and hence makes the job of the medical community easier.

Now, coming to the point,

How are microcontrollers used in medicine?

Sensing and detection

Patient vital signs such as ECG, Blood Pressure, Oxygen Saturation, Temperature, etc, are measured by analog-rich mixed signal microcontrollers. These microcontrollers have in-built ADCs which convert these vital sign analog information into digital data. Internal processing with digital filters designed through embedded firmware, filter out unwanted noise and remove those components which may give rise to false alarms. 

This clean data, then, is processed to find various vital values such as Heart Rate, Oxygen Saturation, Blood Pressure, etc.

Each of these measured and deduced data are stored in flash and eeprom memory for data logging. 

After doing all these, microcontrollers display these values in the right display formats. For long-term patients, the clinician can monitor these data as trending graph for periods of upto past 3 to 5 days. 

Clinical decision making is made simple by monitoring and reviewing the stored data. 

To be continued…

Next in Part II : Pain Management and Physiotherapy

(DesignSpark 16/03/11)


Metamorphosis – Project Engineer to Product Designer

9 Apr

“You need a very product-oriented culture… Lots of companies have great engineers and smart people. …..there needs to be some gravitational force that pulls it all together.” – Steve Jobs

titleAs an engineer, you are mostly required to work in product development teams. Your team often consists of system architects, programmers, hardware designers and so on. Being a team member, you are assigned a certain part or area of development with timelines. You complete your part and are satisfied on accomplishing your mission.

This kind of “I have done my job” performance will of course help you develop your career and climb up the ladder of success. You would get your increments and incentives, well, in the right time. However, when you look back after a certain number of years, most of these assignments would appear incomplete. Overall product understanding would have been almost non-existent.

Would you really love to use your phone as a simple talking instrument or a fully functional social networked communication engine, for example? The latter, isn’t it? Then, what stops you from becoming a complete product designer rather than just being a project engineer?

Product Designer, in spite of being capable of executing only a part of the design process, would be involved in the overall system design and interacts with other team members to achieve intended product functionality. What happens if every team member has this kind of attitude? You guessed it right; your product comes out well. You may find below some simple tips to upgrade yourself from where you are to a complete product designer.

Get global

Talk to your peers and the boss. Get an idea of what would be the end product, its functionality, performance criteria,etc. Try to acquire an overall knowledge about the system as a whole. Of course, you would encounter some grey areas marked ‘confidential’ or ‘proprietary’ which may be way above your pay grade level to have access to. Leave them as black boxes and learn everything else. You can always fill in the blanks, later.

Make an assessment

Make a list of concepts/technologies involved. Identify those about which you do not have enough understanding. Categorize these based on your level of understanding.

My categorization would go like

Poor Understanding – ‘I am zero’

Low Average – ‘Hey wait a minute’

Medium Average – ‘I heard about it somewhere’

Average – ’Oh, Yes. May be a little’

Good – ‘Wow. This, I am aware of’

and so on…

It’s time to learn

  • Google extensively and read related articles, blogs and papers. You may also want to read general product design related blogs on how to go about overall product design.
  • You must read Mike Shipulski’s blogs. They deal with various subjects which include product design and innovation.
  • If you would like to read some tips on robust product design, you would find my blog useful.
  • Attend webinars. Most of these are free and easily accessible. All you need to do is register and login to the sites that host them.

Even if these give you a limited understanding, it is worth a try.

It is a long journey of continuous learning. But rest assured you will be finding out more along the way.

As Steve Jobs said, the final product would be the binding force. Make your approach product-centric

Image ref: By Maria Sibylla Merian (1647-1717) [Public domain], via Wikimedia Commons

All – aware Engineer – Should Embedded Engineer be Multi-purpose?

1 Apr


Following on from my previous blog, another important question has arised....

A Swiss Army Knife's primary function is a Knife, but in fact its a multipurpose tool.... An Embedded Engineers primary function often just focuses on the heart of the system, but in order for the entire design to be successful, do they need to understand and appreciate other aspects of the products design?

All-aware Engineer

Should this person be aware of...

Software? Definitely, yes.

Hardware? Hmmm. My answer would be, yes.

Interfaces? Surely, as these days are ruled by inter-device and intra device interfaces.

Sensors? How else one would know how to scale his measurement ranges. Yes.

PCB Design? You bet. Our modern day chips heavily depend on proper layouting techniques to perform better.

Enclosures? Why not? It doesn't hurt to have an informative knowledge on how we package our products. So, the answer is , maybe.

Front panel design? User interface design can't be imagined without it.

EMC techniques?  Should this be the  first question? Basic precautions from decoupling capacitors, earthing, etc, are important pre-requisites for the design to work outside the lab. So, to a certain extent this knowledge is necessary.

Regulatory compliance? Basic knowledge on this has become mandatory as the regulations are becoming more stringent.

So, can the embedded engineer be called "All-aware engineer" meaning he/she needs to have knowledge on the above and more?

Would there be something left out in the above list?

Or do you think, some of them do not come under the purview of the embedded engineer?

It would be great to hear your views on this!.

DesignSpark - 22/03/12

ALL – WARE ENGINEER – Embedded Design -Software, Hardware or All Ware?

29 Mar



The blog “”Battle of the engineers” was quite interesting.  While I could notice diverse views in reader’s comments, I was also curious to know that most of them were united in saying – there are fundamentally two types of engineers – hardware and software.

Day by day, the density of components integrated into chips is increasing as the performance whereas power consumption levels are nose-diving. When large scale integration is yesterday’s buzz word, very large scale integration is today’s mantra.

Chips have become general purpose and it depends on the designer and the end application to decide how they want it to perform. The designer programs the chip to suit the application requirements.  Does this therefore mean that the designer is a software engineer?

If so, how do they know that the chip will function as required? Will things like the power levels and the necessary PCB layout techniques be taken into account? How is the hardware designed to comply to EMC/EMI standards?  Does this therefore mean that our designer is in fact a hardware engineer?

I think the answer could be that the designer could actually be both?  So this asks the question, “What do we call somebody who knows both?”  Like in cricket, where we have bowler, batsman and all-rounder, can we call the designer an “All-ware” engineer?

Where do we draw the line? Or is the line really necessary?

Sooner or later, every engineer, willingly or unwillingly needs to know a bit of software and hardware – the percentage of knowledge could vary.

So, as more and more intelligent devices are produced, it perhaps seems inevitable that Hardware and Software engineers will need to understand each others worlds.

Can we call this “All-ware engineer” an “Embedded Engineer”?

What are your thoughts?…

DesignSpark 22/03/12

Handy Apps for Product Design

26 Mar


The critical thing about the design process is to identify your scarcest resource. Despite what you may think, that very often is not money. For example, in a NASAmoon shot, money is abundant but lightness is scarce; every ounce of weight requires tons of material below. On the design of a beach vacation home, the limitation may be your ocean-front footage. You have to make sure your whole team understands what scarce resource you’re optimizing.

— Fred Brooks, author of The Design of Design.


Product requirements are growing complex by the day. Organising the design process pays rich dividends at a later stage.

There are quite a number of interesting applications which can help a designer , particularly an electronics engineer in organising the design process.


Openproj  is a project management software which can help one schedule the timelines of a project.  Task oriented scheduling with individual timelines is possible while marking important tasks as milestones. Schedules are simultaneously converted into Gantt Charts, where the tasks and their timelines are pictorially represented. All we need to do is break the design process into smaller tasks and enter them in an organised manner.

Open Project

Flow Chart/UML/Block Diagram:

yEd Graph Editor is a fantastic tool for flowcharts. Hardware block diagrams as well as software flowcharts can be drawn. The user interface is very easy.

y Editor

Diagram Designer is another nice app for flowcharts. Apart from flowcharts, we can load various palettes which contain templates and symbols as necessary. A special mention must be made about Electronic Display Devices palette which contains nicely laid out Seven Segment Displays and even a dot matrix LED display.

Diagram Designer

Enclosure Modelling:

Sketchup from Google is a 3D mechanical drawing software which could be used for designing enclosures and mechanical items.

Sketchup is already popular amongst Design Spark users and needs no further introduction.

With Cetina, the front panel  cut-outs can be designed to exact dimensions.  Designing slots for SD Cards, LCD Displays, etc can be done with ease.


Rack Designer is an interesting tool which provides a VB like interface where we could physically drag down various user interface components such as Buttons, LEDs and LCD Displays. You could even add a scope display.

Rack Designer

With the help of above and similar tools, the design process can become less cumbersome while reducing the time-to-market.

Designspark – 26/01/2012

A simple recipe for a successful PCB Design

23 Mar


An electronics or embedded engineer should not limit themselves to writing firmware. Having thorough knowledge on hardware empowers the designer to understand what is happening and take the right path.

For example, the firmware written could be world-class, yet it may not stop an ADC count from oscillating whereas a simple decoupling capacitor may.  Before starting the building, one needs to properly lay down the foundations. Hardware is the base on which firmware lies, so this needs to be fundamentally right and stable.

Proper circuit design, topology and PCB routing is essential for any subsequent process to take us through further.

Points mentioned below may enhance the performance of the design while cutting the testing time shorter by making the process more convenient.


Plan from day one

1. Make a list of components you use often in your design. This could be your standard molex connectors, 0805

package resistors, crystals, etc. This list must contain all the standard components that you may use and those you might have used at least once in your career so far. It would be also helpful, if you could get the datasheets containing footprints of these components, wherever necessary.

2. Search DesignSpark for schematic symbols and PCB footprints which exactly match these components. In case matching schematic symbol and PCB footprint are in different libraries, you may want to create your own component which has the selected schematic symbol and footprint. You may also want to rename the component, symbol and footprint with similar names so that future retrieval is easier. DesignSpark has a nice wizard for creating such component libraries.


3. It is also very important to see if each of the footprints have the right kind of pads by cross-verifying if the pad widths and holes are suitable to the physical component.


Component Wizard Tutorial Video

Let the Schematic have it all

1. Now, that, each of the components is ready, schematic can be drawn.  During schematic design, it is easy to relate to certain aspects of the design such as track width (depending on the current capacity needed),etc. Using “Settings” – “Design Technology” menu, we are able to select whether our net is a signal, power or ground. We may also create our own net classes with names like thick, thicker, thickest and so on. To specify the track width for the new net classes, we may have to select Settings – Design Technology, when we are inside the PCB file.


2. De-coupling capacitors, as we know, are a must in any digital design. Most of them are connected to the DC supply and ground. It would help in identifying them easily in a PCB file, if we name them as CU1, CU2, etc, meaning CU1 is to be positioned near U1 and so on. This will ensure that we have not left any IC without a decoupling capacitor.

3. Depending upon the application, we may need to practically arrive at the value of certain components. For example, we may need to adjust the value of a resistor to change the frequency of an RC oscillator or setting a gain value. In a SMD design, this particular component may be selected as a through hole type. A production PCB can have all SMD components once the value is determined practically.

PCB Design

1. In multi-layer boards we use vias to switch between layers while laying tracks. Having vias of a larger size helps us in two ways. Firstly, if we need an additional connection from a net we could always have it by connecting a wire. Secondly, a larger via can act as test point. Design Technology Menu has settings where we can alter the default size of the via. I have found that a via of 70 mil diameter and 40 mil drill size to be very useful.


2. In microcontroller designs, while it is important to position the crystal in close proximity to the microcontroller, it is equally important not to run any other track in between.

3. Copper pouring can be very useful in ensuring proper grounding. Copper pouring is basically filling areas where no nets are present while this filled copper would be connected to one of the selected nets. It would surround all areas around tracks with a standard spacing. We could do this by selecting “Add Area for Copper Pour” icon. Once the copper pour is drawn, connecting this copper pour area to a net is done by right clicking and selecting “Add to Net”.  Once we add the ground net, we get the ground filled.


From Schematic design to design delivery, every step is important. If one can take care from the start,  valuable time can be saved.

DesignSpark – 28/101/11

Schematic – Just drawing a circuit?

21 Mar

Is there more to it?

Having used a few CAD packages, including DesignSpark PCB, I was curious to look around to see how people work on drawing schematics. I was not interested in the way they draw or the design itself, but was only looking at the importance they attribute to drawing and configuring their schematics.  The general practice seemed to be – draw the circuit, translate to PCB and let’s work out things on the PCB side. I was wondering whether this approach was right.

The schematic is the closest in context to the design and layout provides the necessary connections physically. Whenever, we need to look into the design, our first action would be to refer to the schematic.

The most important aspect of a  PCB layout, perhaps, is the width of the track. Tracks are drawn based on the properties of the Nets specified in the schematic. For example, when we connect two component pins through a net, we can change the width of the track according to the current carrying capacity needed. We do this by clicking on the net and pressing ‘S’. We get to change the width in mils or the units we have chosen.


For VDD and VSS, we may draw tracks with 60 to 80 mils whereas for a I2C signal such as SDA and SCL, we may go below 15 mil too, depending upon the size of the board.

As the schematic gives us a better idea about the current and voltages involved in a particular part in relation to the end design, specifying track widths would help us  to pre-fix the track widths to the appropriate values.

DesignSpark – 18/08/2011



#define – Simple Embedded C Multitasking

19 Mar

An interesting video on multitasking

Multi-tasking as we know is all about doing several actions simultaneously or at least so fast so that it appears that all actions appear to happen simultaneously. When we switch an electric fan on, at the start we see a few blades rotating in a circular fashion. Once the fan picks up the speed, only a circular plate is visible. As we know, the blades are moving so fast, our eyes could not tell the difference.
Microcontrollers do several actions pretty fast and if we program them to do the actions sequentially yet in rapid succession, we could mimic the fan’s characteristics. For the user of the end product, it never appears that the particular gadget is doing things one by one.
However, this is not easy for several reasons. One primary reason is that most gadgets have displays, keypads, sensors,etc, which either work slowly or act suddenly to events. This means, if the microcontroller works on one peripheral after another, the concept of simultaneous action goes for a sixer.
In practical terms, the only way available for the designer using speed-starved microcontrollers is to split these tasks.
Splitting or breaking the tasks into small sub-tasks resulting in each sub-task getting done in a jiffy helps in minimising the time spent on each sub-task. Each time a sub-task is completed, the status is noted and whenever the status changes , the next sub-task is executed.
Thus, we get all the tasks executed almost simultaneously through what is called ‘Time-Slicing’ approach.
The code provided below attempts to provide an understanding on how this can be realised.
We need simple counters to keep track of each of these subtasks. To make it more convenient, let us package flags with these counters to inform that it is time for the next sub-task.
// Declare a Structure
struct MyStruct{
unsigned Flag : 1;
unsigned int Counter;
unsigned char KeyscanState,DisplayState;

// Timer Interrupt Routine
void TimerIsr(void)

void KeyScanTask(void)
case 0:
//Do First SubTask
case 1:
//Do Second SubTask
// and so on

void DisplayTask(void)
case 0:
//Display Units Digit
case 1:
//Display Tens Digit
// and so on
DesignSpark – 29/06/11

Connecting People and Products – The User Interface Part IV : Keys and Controls

19 Mar


Part IV (Final) : Keys and Controls

Crux of it…

Thoughts on keys, controls and related designs.


Displays and indicators provide vital information on a process or application. Most applications demand user intervention often. If the display screen real estate is limited, then several screen pages are required to display volume of data  and different parameters. There needs to be a way to intervene as and when needed or when required to view different screens and set process parameters.Keys and controls play vital role in user interaction.

Let us discuss the key points to be considered while designing keypads and providing for controls.





Normal human psychology would be to look toadjacent displays for any of their actions.

Keys and controls related to a display must be grouped and placed adjacent to the same. This also helps the user to access the right keys even during emergencies.




When we change TV channels through remote, we need instant response. While running on the treadmill, we require the speed to change as quickly as possible and comfortable , as soon as we press the key. A key press if not responded by the system within about 200 msecs, the user becomes aware of the same and experiences discomfort on continuous usage.

Immediate feedback such as a clicking beep would instantly make the user understand that his key action has been recognized by the system. For a rotary control, the clicking noise of engagement automatically informs the user that the control has moved to the next position.


Suitable Precision

                                                                                                                                  Low Precision

Low Precision

Precision of adjustment for a control must be suitable for the application. When we use a normal table fan, it may be sufficient to have a control which has only four positions – OFF, LOW, MEDIUM AND HIGH. Fan does not require a control which sets RPM from 0 to 1000.

                                  High Precision


High Precision


A hair dryer can have only three control settings – OFF, LOW, HIGH, whereas a refrigerating system used in a clinical laboratory may need settings in Centigrades starting from -50 Degrees.

Providing a high precision control for a lower application requirement can be inconvenient while vice-versa can be catastrophic.





Identification & Shapes



Clear labeling of the controls and keys will prevent improper operation. Keys used for incrementing and decrementing can be triangular in shape. Buttons used in emergency situations can be of larger sizes and of colors that easily stand out.

Embossing of key pads will provide the tactile satisfaction to the user and gives a nice operating experience.



User Interface has grown leaps and bounds with touch screens and high resolution graphic displays. New operating systems like Android facilitate easy and seamless interface making the user experience unforgettable.


I have chronicled my thoughts so far in these four parts in the sincere hope that it could prove useful to those who need it.


Connecting People and Products – The User Interface ( Part III )

15 Mar
Georg Wiora (Dr. Schorsch) made this SVG-drawing (wikimedia)



In the previous part, thoughts were on components that make a UI

Part III : Screen Real Estate – Information Display

Crux of it…

Displaying numbers and other information..

Now that we have so many types of displays, focused thinking on the way of putting information onto the displays is order of the day.

The screen real estate is very cramped most of the times and , as designers, we face hardships in judiciously utilizing the space.

Before going further, these questions lingered in my mind.


Who needs this display information?

What do they intend to do with it?

Do they have the necessary skills and necessary experience, or, if framed the other way around,  are we going to design to suit the skills of  the user?

Do we really know the user’s needs?

If we have the answers for the above, I guess we have succeeded in completing the design in question.

When we know the user’s needs, goals and aspirations, we get most of the work done. However, there are certain fundamental design attributes one may look at. Few thoughts about these fundamental requirements are necessary at this stage.

Mask Leading Zeros

The benefits are Power Saving and user comfort. I, personally never liked displays showing 123 as 00123. It may look good for bank account numbers and not in a display.


Always use one leading zero to show a decimal number which is less than 1.0. This means we should display .8 as 0.8

Incrementing/Decrementing Numbers

While changing set values in a product one must be able to set them easily and swiftly. For each key press the response must be swift which is normally less than 200 milliseconds. To change a value from 10 to 100, if the display takes a long time, the user gets uncomfortable. This can be avoided by measuring the time during which key is being pressed and incrementing the values in almost an exponential manner. This is best described as below.

Upto increment of first 5 seconds  : Increment value every half a second

Upto next 5 seconds                      : Increment value every 200 milliseconds

From there on                                 : Increment value every 50 milliseconds

Same applies for decrementing values.

Seven Segment Displays

These displays are used in multiplexed mode, meaning, each display will be on for a certain period and switched off while the next one switches on.

Units Display ON –> Units Display Off –> Tens Display On –> Tens Display Off and so on.

Since, the frequency of this switching is normally in milliseconds, human eye does not detect the changes and feels that the displays are on continuously. Multiplexing is used primarily used to reduce hardware and power consumption.

If sufficient time is not provided to switch off the previous display, then we will have ghost display of the next digit on the previous digit. This is quite annoying and looks cumbersome. It would pay to write the necessary code like this.

Units Display ON –> Delay  –> Units Display Off  –>  Delay  –> Tens Display On –>  Delay  –> Tens Display Off  –> and so on.

Note : We mean Units Digit by Units Display and so on.

Character LCD Modules

When using LCD Modules, in-built cursor can be disabled, as it does not provide a neat look in such a small screen.

Special Character space in LCD modules can be used to make big digits in Character LCD Modules.


Creating big digits with standard charater LCDs is easily done as provided in Bascom website – AN #07. (http://www.mcselec.com/index.php?option=com_content&task=view&id=40&Itemid=57).

The above requirements, if met, the User Interface makes a lot of difference to the user.

Coming Up…  

Part IV : Keys and Controls

Thoughts on keys, controls and related designs.

Designspark – 05/05/11

%d bloggers like this: