Log in

View Full Version : Oscilloscope help



Megahertz
- 6th August 2012, 20:04
Hi, I am trying to replicate a waveform. I can see it on my oscilloscope, but I can't get the exact data I need just by looking at it as it is changing very fast. These are pulses from a uC of different periods. I tried the datalogging function on my scope, but I am unable to understand the data. Can someone please help me understand the information which is logged by my scope. I have attached the PDF of the logged data.

The pulses are not continues and only appear for few seconds and then there is a period of no signal and then again the pulses start.

If you want to watch how the pulses appear, I have also uploaded the video.

http://www.youtube.com/watch?v=uOKs9Bx4dk0&feature=youtu.be

Thanks

dhouston
- 6th August 2012, 20:34
It's very difficult to judge given that you have not synced your scope but they appear to be RF or IR signals with a fairly wide start pulse followed by a series of shorter pulses which contain the data.

Perhaps you could get a better picture using your soundcard to record the signal. That gives you something you can playback in an editor (e.g. GoldWave). See http://davehouston.org/learn.htm

Megahertz
- 6th August 2012, 21:01
This is neither an IR nor an RF signal. I put the scope directly to the uC pin outputting this signal. This is the waveform which creates an alarm like noise when fed to the base of the npn transistor on which a coil and a piezo buzzer are connected on the collector side in parallel to each other. But since the pulses are changing so quick, visually I can only make out that the minimum pulse is 150uS and MAX is 250uS. These pulses are increasing from 150 to 250 in some number of steps. I tried replicating this in equal 10 increments of 10uS but it does not match as it does not produce the same sound effect. So I logged the data, but need someone to explain me what the two long rows mean. To me it seems some values (between 150uS - 250uS) are repeated more than once, I am hoping the correct interpretation of the logged data will make it more clear.

kellyseye
- 7th August 2012, 10:59
Looks like 'swept' signal.

The square wave frequency is being increased (swept) from x(Hz) to y(Hz) by a modulating waveform. It 'looks' like it's sweeping from around 2kHz to 3kHz by a low (250Hz???) signal.

Configure an output to a 2kHz square wave and arrange for it to increase by 4Hz every 4uS until it reaches 3kHz then repeat.

Megahertz
- 7th August 2012, 19:34
Hello kellyseye, I tried the following, but no sucess:

while 1
Pulsout PortC.0,25
@ NOP
@ NOP
@ NOP
@ NOP
Pulsout PortC.0,24
@ NOP
@ NOP
@ NOP
@ NOP
Pulsout PortC.0,23
@ NOP
@ NOP
@ NOP
@ NOP
Pulsout PortC.0,22
@ NOP
@ NOP
@ NOP
@ NOP
Pulsout PortC.0,20
@ NOP
@ NOP
@ NOP
@ NOP
Pulsout PortC.0,19
@ NOP
@ NOP
@ NOP
@ NOP
Pulsout PortC.0,18
@ NOP
@ NOP
@ NOP
@ NOP
Pulsout PortC.0,17
@ NOP
@ NOP
@ NOP
@ NOP
Pulsout PortC.0,16
@ NOP
@ NOP
@ NOP
@ NOP
Pulsout PortC.0,15
@ NOP
@ NOP
@ NOP
@ NOP

Wend

Megahertz
- 7th August 2012, 20:04
Here I have recorded the sound produced by the buzzer. Please rename the attachment to "Memo.m4a" from ".pdf" as I could not upload it in its original format.

Darrel Taylor
- 7th August 2012, 20:54
Try this ...
You'll need to put the piezo circuit on a CCP pin.


Freq VAR WORD

Main:
FOR Freq = 3000 TO 4000 STEP 10
HPWM 1, 127, Freq
PAUSE 1
NEXT Freq
GOTO Main

It should sound something like this ... http://support.melabs.com/DT/Piezo.wma

Megahertz
- 8th August 2012, 00:36
Thanks Darrel, I will try it tomorrow with 16f877A which I have. But I would like to ask if this task can be made possible using a smaller PIC without an HPWM, I would like to use 16F676 if possible as it is very easily available and where I am and if this takes off then it will be economical as well.

In the mean time I am attaching the datasheet of the Chinese uC which is controlling the base of the NPN transistor connected to the piezo & coil. The signal comes out from PIN 2, which to me seems just an I/O pin.

Thanks

Darrel Taylor
- 8th August 2012, 00:55
Yes, of course it can.
It's only 3-4 khz. You can generate that in software easily.

But see if it drives your piezo first.
I was assumming your piezo has a resonant frequency of ~3.5khz.

Megahertz
- 8th August 2012, 13:03
THANKS Darrel, it worked like a charm with HPWM. Any pointers as to how to do without it.

I tried FREQOUT
FOR Freq = 3000 TO 4000 STEP 10
FREQOUT PortC.2,1, Freq
NEXT Freqbut the results were not the same, not even near enough, the pulsing sound is not that prominent

Darrel Taylor
- 8th August 2012, 18:55
FREQOUT makes sine waves and must be filtered, which is not what you need.
Try this ...


PiezoPIN VAR PORTC.2
TMR0IF VAR INTCON.2
Width VAR BYTE
OPTION_REG = %11010011 ; TMR0 1:16

Alarm:
FOR Width = 161 TO 120 STEP -1
WHILE !TMR0IF
TOGGLE PiezoPIN
PAUSEUS Width
TOGGLE PiezoPIN
PAUSEUS Width
WEND
TMR0IF = 0
NEXT Width
GOTO Alarm

Megahertz
- 8th August 2012, 20:15
Thanks Darrel and everyone. It's done :)

Megahertz
- 10th August 2012, 12:41
Just out of curiosity, can this be achieved without using a microcontroller?

kellyseye
- 10th August 2012, 12:53
Commonly driven by a type 555 multi-function timer chip. Google '555 alarm schematic' and take your pick.
Also can be done using standard logic gates such as 2-NANDs in astable mode with another 2 providing the modulation therefore a single dual-input quad NAND package (4011 or 7400) will work. You can use NOR gates too.

falingtrea
- 10th August 2012, 19:11
You can also buy piezo devices that are already configured to output an alarm tone, aka piezo buzzers. Sonalert for one, comes to mind.