Using switches on microcontrollers – obvious, but…

Switches and buttons are common way of user interaction to embedded system. Normally we are used to connect pull-up (or pull-down) resistor for a switch and then check for its value. There is nothing wrong with such circuit, but speaking of power efficiency, this design can cause some problems. Since resistor is constantly connected to VCC while switch is closed, it constantly draws significant current. What if there are tens of switches – circuit starts drawing lots of current. For battery circuits this is in-acceptable. One simple way would be to select higher pull-up resistor values. In many cases it might work well, but there is always a limit how much you can rise its value. First of all microcontroller input have its threshold current to work reliably. But most importantly due high resistor values and small currents noise signals can start triggering the inputs. Also keep in mind, that switches also require some minimal current ratings. So you should select pull-up resistor with common sense. Other option is to use smarter circuit. If microcontroller have enough pins, you can… Continue reading

Single I/O pin – double function

There are many situations when you simply run out of I/O pins on microcontroller. For new project you can always select different microcontroller with more pins or ad I/O expander. If you have project running on Raspberry Pi and almost all your pins are busy, then you should try to go smart way. Emilio faced this problem when he needed to add LED indicator and button to his existing project, but there were only single free pin available. So he thought that functionality could be achieved with single pin quite easy. He attached LED to power supply via current limiting resistor. Then using same pin he added push button to ground through another resistor. The rest depends on how program controls that pin. In this case Python script simply runs loop every second where 200ms is used to turn LED another portion of time-frame is used to detect button switch and some sort of debounce. Button is used to shut down Raspberry Pi after it is pressed for longer than 5 seconds. Same technique can be easily used on any… Continue reading

Measure Your Blood Pressure is as easy as ABC!

We’re living in the 21st century, where everything is moving in very fast pace. Hence, most of the people in nowadays are being threatened with lifestyle diseases, such as depression, obesity, diabetes, high blood pressure and so on… Talking about the high blood pressure, one out of three Americans is having the risk of getting high blood pressure, due to the imbalanced diet (High sodium, low potassium diet). Honestly, those people who got the high blood pressure didn’t seem to realize about it, until they’re getting stroke and paralyzed all the sudden! Hence, for checking whether you’re free from high blood pressure or not, you can simply do it by creating an automatic blood pressure meter! This automatic blood pressure meter is specially-designed, which is used for measuring the systolic (the highest blood pressure), diastolic (the lowest blood pressure) and pulse rate. According to the WHO, the healthy blood pressure for adult is 120/80 mmHg. If you’re having the blood pressure more than 130/85, then you’re probably in the high blood pressure range, which is known as “Prehypertension”. The automatic… Continue reading