Updated design of the WiFi IoT Electric Switch

After lots of design changes, we have been able to make a commercial prototype of a WiFi Electric Switch.
This WiFi Electrical Switch is used to control the home appliance, for example, light, fan, etc.

Below are some pictures of the updated version.

Prototype testing at my home.

This prototype has been running for a month. Installed it on 5th July 2018.

Inside the box.

Continue reading “Updated design of the WiFi IoT Electric Switch”

A small addition (foot length measuring tool) to the Pedograph Software

Pedograph is a medical device for measuring the variation of foot pressure at the various points  under the sole.
“Diabetic patients usually suffer from lack of nerve sensation, especially in the feet. Therefore, their gait on standing and during walking may deviate from that of a normal person and points of high pressure develop under the feet. However, due to neuropathy they do not feel any pain which would have been felt had the nerve functions were alright. Later, ulcers form at these high pressure points, leading to gangrene and eventual amputation of the leg. A Pedograph revealing the variation of foot pressure at various points under the sole easily delineates such high pressure regions at an early stage so that special shoe insoles can be prepared to spread the pressure away from the hot spots. This way the patient is saved from eventual amputation, from being crippled for the entire life. Again, pressure points and pattern may differ while standing and during walking, usually it is the latter which put the soles on greater burden, and a dynamic pressure measurement during walking has more importance from a clinical point of view.” (https://bibeat.com/product/dynamic-pedograph/)

The main sensor unit (Fig) uses an optical method to create an
image of light intensities proportional to the pressure impressed at
individual points. This sensor unit provides a video image and rest of the work is done by software.
In this software, I have added a tool for measuring foot length from the composite image.

Foot length measurement tool

 

Below is the fundamental portion of the code.

private void footDisplayPanelMouseClicked(java.awt.event.MouseEvent evt) {                                              
        // TODO add your handling code here:
    int FootLength = 0;
    int footLengthinInch = 0;
    float ResultofFootlenthInInch =0;
        MAclickCount++;
        Integer x = evt.getX(), y = evt.getY();
        Graphics g = footDisplayPanel.getGraphics();
        Graphics2D g2 = (Graphics2D) g;
        g2.setStroke(new BasicStroke(3));
        
        
        int alpha = 127; // 50% transparent
        Color myColour = new Color(255, 255, 255, alpha); // transparent white
        
        g.setColor(Color.WHITE);   // this is the code for pointer// the white '+' symbol 
        g.drawLine(x, y-15, x, y+15);
        g.drawLine(x-15, y, x+15, y);
        
        footLengthinInch = Constants.DEFAULT_PIXELS_PER_INCH;
        
     if (MAclickCount>1){
//        super.paint(g);
         g.setColor(Color.red);
         
        g2.drawLine(PreviousX, PreviousY, x, y); 
        
        FootLength = (int) Math.sqrt(((PreviousX-x)*(PreviousX-x))+((PreviousY-y)*(PreviousY-y)));
        ResultofFootlenthInInch = (float)FootLength/footLengthinInch; 
        
//        footDisplayPanel.setBackground(myColour);
//        DisplayLength.setBackground(myColour);
        DisplayLength.setText("Lenght of The Foot = "+(String.format("%.2f", ResultofFootlenthInInch))+" Inch or "+FootLength+" Pixels");
//        DisplayLength.setBackground(myColour);
       
     }
     if (MAclickCount>=2){ // for refreaching after two click. 
         PreviousX = 0;
         PreviousY = 0;
         MAclickCount =0;
         x =0;
         y=0;
     }
     PreviousX = x;
     PreviousY = y;

    }
Foot length measuring tool's code

 

Continue reading “A small addition (foot length measuring tool) to the Pedograph Software”

Electronic Stethoscope for Smartphone

At our lab (Biomedical Physics and Technology Department at University of Dhaka), we have developed a smartphone powered electronic stethoscope system. It’s a small low-cost device, requires no battery and can be attached to a smartphone. Details are coming…

Smartphone powered Electronic Stethoscope System
OTG powered electronic stethoscope amplifier
Internal Circuit of the Amplifier

Voluntary Coding #1

Problem: 3. A simple measure of how complex a sequence is would be the count of the most frequent character n-gram, divided by the count of all n-grams. For example, if n is 3, then the sequence ATATATATAG contains 4x ATA, 3x TAT and 1x TAG. The proportion is thus 4/8=0.5. The higher this number, the more repetitive the sequence.

Write a function simple(s,n) where s is a sequence and n is the length of the n-gram to consider. The function will return the proportion described above.

Continue reading “Voluntary Coding #1”

Smart WiFi Switch demo board presentation at Digital World 2017

Some pictures of the Smart WiFi Switch demo board that has been displayed at BMPT stall in the Digital World 2017 – an exposition organized to showcase the progress of Bangladesh’s IT industry. The event, held at the Bangabandhu International Conference Centre in Dhaka from 6th December to 9th December.

Continue reading “Smart WiFi Switch demo board presentation at Digital World 2017”

Full Circuit of Electronic Stethoscope

Complete Circuit diagram of our electronic stethoscope is shown below.

Full Circuit Diagram

I discussed every stage of the circuit in my previous posts. Here it just shows the integration of all of the parts and  a constant 5V DC supply circuit (top in the picture) is added.

The overall performance of the circuit:

Frequency Response:

Frequency Response of the Overall Circuit

Completed circuit:

Completed Prototype:

The prototype of the Electronic Stethoscope Device.

Recorded sound: with visualization

Schematic diagram and PCB layout:
1. Schematic Diagram
2. PCB Layout 

 

Power Amplifier for Electronic Stethoscope

The first stage of the electronic stethoscope circuit was Pre-amplifier and at the second stage filter circuits. In both the stages, op-amp LM358 was used to perform the amplification and filter task. We were supposed to connect an earphone socket at the end of the filter output so that we can insert an earphone to hear the stethoscope sound. But LM358 op-amp can’t provide enough power to drive the earphone. The reason we find is the impedance mismatch between op-amp output impedance and earphone impedance.According to maximum power transfer theorem, maximum power is achieved when the source impedance (here output impedance of the op-amp) is equal to the load impedance (earphone impedance). Since the output impedance of an op-amp is low so it can’t provide enough power to the high impedance earphone (typically, mobile earphone 16Ω to 32Ωand speaker 300 to 600Ω ). To solve this problem, We chose to use an IC name LM386 which is a low voltage audio power amplifier. And it is the 3rd stage of our electronic stethoscope circuit. For this stage, the circuit we designed was based on an example given in the datasheet.

Audio Power Amplifier

 

Some useful link:
1. Why is impedance matching important? https://www.quora.com/Why-is-impedance-matching-important
2. Understanding Earphone / Headphone Specifications http://www.shure.com/americas/support/find-an-answer/understanding-earphone-headphone-specifications
3. https://en.wikipedia.org/wiki/Maximum_power_transfer_theorem
4. What is the importance of impedance in earphones or speakers? https://www.quora.com/What-is-the-importance-of-impedance-in-earphones-or-speakers

Filter for Electronic Stethoscope

After amplifying the signal that is captured by electronic chest-piece, we get a noticeable amount of noise with the main signal. Most of these are high-frequency ambient noises. Therefore, it becomes a mandatory task for us to design a filter circuit to remove those noises. There I implemented a bandpass filter circuit with the help of ANALOG DEVICE FILTER WIZARD Tools.

As the body sounds those a physician needs to listen lies between 20Hz to 1000Hz [reference], we need to make a bandpass filter that ranges between 20Hz to 1000Hz. And to get a clear heart sound, we added another bandpass circuit (20Hz to 200Hz) in parallel with previous one. Since the heart sounds lie between 20Hz to 200Hz [reference].
However, an electret microphone can’t capture sounds below 10Hz and human’s hearing frequency is above 20Hz, so we don’t need to be concerned about filtering noise below 20Hz. Therefore, we optimized our circuit by implementing two lowpass filter. The first one which of cutoff frequency 1KHz and the second one cutoff frequency at 350Hz.

Two Low-pass filters. 1KHz cutoff at the top and 200Hz cutoff at the bottom.

Low-pass (1KHz cutoff) 4th order Butterworth  filter: 

Circuit:

1KHz Fc, Low-pass 4th order Butterworth

Characteristics and Frequency response:

Frequency response of 1KHz Fc 4th order Low-pass filter

 

Frequency Response of the Filter, Fc = 1KHz

Low-pass (200Hz cutoff) 4th order Butterworth  filter:

Circuit:

350Hz Fc Low-pass Filter

Characteristics and Frequency Response:

Frequency Response of the 350Hz Fc low-pass filter

Two filters get the same input signal simultaneously but we placed a switch at the output end to get the specific filtered signal.

A video will be uploaded there.
A simulation of the low-pass filter circuit on Proteus will be found there.