Discussion in "Project Doubts" started by    Peter_Parker    Dec 11, 2013.
Mon Apr 07 2014, 10:54 am
#21
If you have a oscilloscope with you then first test your IR sensor, you should see pulse on scope before you can feed it to controller.
Mon Apr 07 2014, 10:41 pm
#22


If you have a oscilloscope with you then first test your IR sensor, you should see pulse on scope before you can feed it to controller.

Ajay Bhargav


I don't,I'm just doing this at home in my spare time and a oscilloscope is a bit expensive to buy,I know not having one puts me at a big disadvantage.
Although isn't there some pulse coming from my sensor since every time I put my finger over the LDR the counter increments by 1?
Tue Apr 08 2014, 06:33 am
#23


I don't,I'm just doing this at home in my spare time and a oscilloscope is a bit expensive to buy,I know not having one puts me at a big disadvantage.

Peter_Parker



Download "Visual Analyser" from
http://www.sillanumsoft.org
It uses the sound card as a simple oscilloscope and works well for audio frequencies.


Although isn't there some pulse coming from my sensor since every time I put my finger over the LDR the counter increments by 1?

Peter_Parker


It sounds as if the circuit can only tell the difference between no obstruction and
as big obstruction.

Try adjusting the sensor circuit to see if you can get more sensitivity.
"Visual Analyser" should help.
Tue Apr 08 2014, 03:18 pm
#24
Here is another good circuit which I found online... They have kept sensor and LED side by side instead of keeping them front and back.





Ref: http://makezine.com/projects/ir-pulse-sensor/


[ Edited Tue Apr 08 2014, 03:19 pm ]
Sat Apr 26 2014, 05:05 am
#25
Been a while since I posted.
Never seen/used a digital oscilloscope before,looks interesting.
I'm presuming I'll have to build some some sort of circuit to protect the sound card and also to probe my own circuit along the line of something like this
http://www.ledametrix.com/oscope

Thanks Ajay,I built that circuit so now I have 2 circuits to take readings from but more on that in a bit.
Back to the orginal circuit first,browsing around I came across some different programs for taking readings from the sensor,the one below uses an interupt
#include<reg51.h>
 //  add the reg51 . h file
#include<string.h>
 //  add the string . h file
//heart beat monitor 8051 based
#define lcdport P1 // change  for for hardware
sbit rw = P2^1; // LCD connection may be different
sbit rs=P2^0; // LCD interface with microcontroller
sbit en=P2^2; // Enable pin of LCD
unsigned char sec,sec100;
unsigned int bt,tick,r,bpm;
void lcdinit();
void lcdcmd(unsigned char);
void lcddata(unsigned char);
void send_string(unsigned char *s);
void msdelay(unsigned int);
 
void extrint (void) interrupt 0 // external Interrupt to detect the heart pulse
{
bt=tick; // number of ticks are picked
tick=0; // reset for next counting
}
void timer0 (void) interrupt 1 using 1 // Timer 0 for one second time
{
TH0 = 0xdc; //The value is taken for Ssc/100 at crystal 11.0592MHz
sec100++; // It is incremented every Ssc/100 at crystal 11.0592MHz
tick++; // This variable counts the time period of incoming pulse in Sec/100
if(tick>
=3500){tick=0;} // tick are limited to less trhan 255 for valid calculation
if(sec100 >
=100) // 1 sec = sec100 * 100
{
sec++;
sec100=0;
}
}
 
void main()
{
P0=0xff;
P1=0xff;
P2=0xff;
P3=0xff;
rw=0;
EA = 1;
TMOD = 0x21;
IT0 = 1;
EX0 = 1;
ET0 = 1;
TR0 = 1;
 
msdelay(1000);
lcdinit();
msdelay(1000);
send_string("Heart beat ");
msdelay(1500);
 
msdelay(500);
 
//delay(15000);
bpm=0;bt=0;
 
while(1)
{
 
if(sec >
=1)
{
sec=0;
/*
 
The sampling time is fixed 1 sec.
A variable "tick" is incremented with one tick per 100mSc in the timer 0 interrupt routine.
Each on occurring of external interrupt the value in the "tick" is picked up
and it is set to zero for recounting.
The process continues till next external interrupt.
Formula for calculating beats per minutes (microcontroller based heartbeat monitor ) is
 
as tick is the time period in Sec/100. so extract the frequency of pulses at external interrupt
Frequency = (1/tick)* 100 i.e pulses /sec
Then
bpm = frequency * 60 for one minutes i.e pulses per minute
in short we can do it as
bpm = 6000/ bt
 
*/
lcdcmd(0x02);
if(bt >
=7){
bpm = 6000/bt; // for valid output bt is limited so that it should be greater than 6
msdelay(500);
send_string("Pulse. ");
lcddata((bpm/100)+0x30);
r=bpm%100;
lcddata((r/10)+0x30);
lcddata((r%10)+0x30);
send_string(" bpm ");
}
else {
send_string("out of range");} // otherwise bpm will be shown zero, if limit does not fit for your project you can change it.
}
}
}
void lcdinit()
{
msdelay(100);
lcdcmd(0x01);
msdelay(500);
lcdcmd(0x38);
msdelay(500);
lcdcmd(0x38);
msdelay(500);
lcdcmd(0x38);
msdelay(500);
lcdcmd(0x06);
msdelay(500);
lcdcmd(0x0c);
msdelay(500);
lcdcmd(0x03);
msdelay(500);
msdelay(500);
}
void lcdcmd(unsigned char value)
{
rs=0;
lcdport=value;
msdelay(100);
en=1;
msdelay(100);
en=0;
msdelay(100);
rs=1;
}
void lcddata(unsigned char value)
//heart beat monitoring system using microcontroller
{
rs=1;
lcdport=value;
msdelay(10);
en=1;
msdelay(100);
en=0;
rs=0;
}
void msdelay(unsigned int i)
{
//unsigned int i;
while(i --);
}
void send_string(unsigned char *s)
{
unsigned char l,i;
l = strlen(s); // get the length of string
for(i=1;i <=l;i++)
{
lcddata(*s); // write every char one by one
s++;
}
}

The only changes I made to it were the LCD pins.
Although having tested with my circuit I seem to get random numbers generated,like 10 readings in a row would read something like this
240,10,222,127,93,19,139,7,101,200bpm
Using an oscilloscope would probably rule out a few things but I'm starting to think I've built the circuit wrong even though its seems easy enough to build.
Should I post up a pic or something of the sensor side on the breadboard,maybe I'm missing something really obvious

The second circuit from makezine,well I'm pretty positive i've build that wrong,when I connect that to my micro and lcd, the lcd reads "out of range" so its not getting any input from that circuit(obviously with a oscilloscope I could probe it to check for a pulse be sure)


[ Edited Sat Apr 26 2014, 05:08 am ]
Mon Apr 28 2014, 10:29 am
#26
At this point I am clueless unless I know your sensor is giving the correct signal. Looking at the logic of this code. It seems fine. Now only problem left is the sensor circuit which needs to be verified.
Mon Apr 28 2014, 08:59 pm
#27


Never seen/used a digital oscilloscope before,looks interesting.
I'm presuming I'll have to build some some sort of circuit to protect the sound card and also to probe my own circuit along the line of something like this
http://www.ledametrix.com/oscope

Peter_Parker


Well there is no need to use screened cable for what you're doing.
You only need one channel ,so two core will do.
I think the resistors (18k and 82k) are the wrong way round.
Apart from that it's perfect

For extra protection fit back to back LEDs/diodes between sound card input and
ground to limit the voltage swing.

For debug ,write a simple program to monitor (poll) the input pin.
Turn a LED on when high and off when low.

Sat May 10 2014, 03:17 am
#28



Never seen/used a digital oscilloscope before,looks interesting.
I'm presuming I'll have to build some some sort of circuit to protect the sound card and also to probe my own circuit along the line of something like this
http://www.ledametrix.com/oscope

Peter_Parker


Well there is no need to use screened cable for what you're doing.
You only need one channel ,so two core will do.
I think the resistors (18k and 82k) are the wrong way round.
Apart from that it's perfect

For extra protection fit back to back LEDs/diodes between sound card input and
ground to limit the voltage swing.

For debug ,write a simple program to monitor (poll) the input pin.
Turn a LED on when high and off when low.

ExperimenterUK


Will do


At this point I am clueless unless I know your sensor is giving the correct signal. Looking at the logic of this code. It seems fine. Now only problem left is the sensor circuit which needs to be verified.

ajay_bhargav



Ya the code seems fine,I might try and rebuild the circuit again,maybe I have something in the wrong place or something.

Although I might mess around with the bluetooth first,I'll add it to the circuit like in the picture in the previous page,then I'll pair it with my PC.
Just following whats wrote here http://mcuoneclipse.com/2013/06/19/using-the-hc-06-bluetooth-module/
Then I'm in unfamiliar territory,viewing the heartbeat data coming from the mirco on the pc,probably should check first there's a connection between the two using the hyperterminal.
I think I seen some stuff on the web when they're both connected you can send some commands via the hyerterminal to the bluetooth module.
Commands like check communication,change bluetooth name,stuff like this http://m2.img.dxcdn.com/CDDriver/sku.121326.pdf

After that,it'll probably have to be some visual basic program,one that reads in the values from the virtual serial port.



[ Edited Mon May 12 2014, 05:16 am ]
Mon May 12 2014, 10:41 am
#29
HC-xx series is good in doing what it is meant to do. i.e. you dont have to program anything or send any command to module unless you want to do something different other than primary job of module. Once powered on, you can pair the device with phone and within minutes your phone will be able to send/receive data via serial port over bluetooth. The limited set of AT commands are mentioned in the pdf link you posted. You can change baudrate, device name and pin for pairing etc.
Tue May 13 2014, 01:28 am
#30


HC-xx series is good in doing what it is meant to do. i.e. you dont have to program anything or send any command to module unless you want to do something different other than primary job of module. Once powered on, you can pair the device with phone and within minutes your phone will be able to send/receive data via serial port over bluetooth. The limited set of AT commands are mentioned in the pdf link you posted. You can change baudrate, device name and pin for pairing etc.

ajay_bhargav


Ok so I dont really need to bother with the AT commands but if I were pairing it with my pc/laptop wouldn't I need a program to view the information currently being displayed on my LCD on my computer/laptop?
As in a visual basic program to display the info coming in the serial port from the sensor/micro

*edit
Something along the lines of this,just 1 of the first random vids I clicked on youtube
C# program in microsoft visual studio and just uses emulator for the serial port
https://www.youtube.com/watch?v=palkjinISBs


[ Edited Tue May 13 2014, 01:42 am ]

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Bobbyerilar
Thu Mar 28 2024, 08:08 am
pb58
Thu Mar 28 2024, 05:54 am
Clarazkafup
Thu Mar 28 2024, 02:24 am
Walterkic
Thu Mar 28 2024, 01:19 am
Davidusawn
Wed Mar 27 2024, 08:30 pm
Richardsop
Tue Mar 26 2024, 10:33 pm
Stevencog
Tue Mar 26 2024, 04:26 pm
Bernardwarge
Tue Mar 26 2024, 11:15 am