Author Topic: new ds1054z, noise square wave arduino  (Read 4752 times)

0 Members and 1 Guest are viewing this topic.

Offline freebilTopic starter

  • Regular Contributor
  • *
  • Posts: 50
  • Country: gr
new ds1054z, noise square wave arduino
« on: August 19, 2016, 04:13:46 pm »
Hello. I am new owner of ds1054z. I would like to ask if this is shown in the video is normal.

The square waveform was generated from arduino. Contrary to this, the square waveform from the inbuilt generator is perfectly fine.
 

Offline Aodhan145

  • Frequent Contributor
  • **
  • Posts: 403
  • Country: 00
Re: new ds1054z, noise square wave arduino
« Reply #1 on: August 19, 2016, 04:24:46 pm »
You might just not be triggered correctly. I don't own one so I'm not the best to guide you on how to do so.
 

Offline mcinque

  • Supporter
  • ****
  • Posts: 1129
  • Country: it
  • I know that I know nothing
Re: new ds1054z, noise square wave arduino
« Reply #2 on: August 19, 2016, 04:58:26 pm »
How did you probe the signal from the arduino? Show/describe your setup.
 

Offline freebilTopic starter

  • Regular Contributor
  • *
  • Posts: 50
  • Country: gr
Re: new ds1054z, noise square wave arduino
« Reply #3 on: August 19, 2016, 05:12:41 pm »
I connect the probe to the pin3 and the aligator to the gnd of the arduino. I saw that for 5kHz is way more stable and for 500Hz is absolutelly stable.
 

Online Fungus

  • Super Contributor
  • ***
  • Posts: 16664
  • Country: 00
Re: new ds1054z, noise square wave arduino
« Reply #4 on: August 19, 2016, 05:15:13 pm »
How are you generating that wave?

From the timebase (5uS) it looks like you're doing something like this:

void loop()
{
 digitalWrite(pin,HIGH);
 digitalWrite(pin,LOW);
}

If so then yes, it's normal. You're seeing software timing artifacts and/or processor interrupts.

Edit: Try putting "noInterrupts()" in the setup(), see what happens.

« Last Edit: August 19, 2016, 05:27:38 pm by Fungus »
 

Offline freebilTopic starter

  • Regular Contributor
  • *
  • Posts: 50
  • Country: gr
Re: new ds1054z, noise square wave arduino
« Reply #5 on: August 19, 2016, 05:49:55 pm »
Thank you very much! This was the problem. With the nointerupts(), the waveform is perfectly stable!
 

Online cncjerry

  • Supporter
  • ****
  • Posts: 1283
Re: new ds1054z, noise square wave arduino
« Reply #6 on: August 19, 2016, 06:25:10 pm »
Depends on how you are triggering because the loop causes an unbalanced square wave.  After the low write the code branches which means the low will be longer than the high.  You would have to look at the no op instruction length vs the branch to see if putting one after the write high would balance the square wave. Since your square wave isn't a perfect 50 percent duty cycle your trigger could be causing the artifacts.
 

Offline crazyguy

  • Regular Contributor
  • *
  • Posts: 101
  • Country: 00
Re: new ds1054z, noise square wave arduino
« Reply #7 on: August 19, 2016, 06:56:30 pm »
there are 3  hardware timers on the 328 chip, you may make use of them to generate square wave, rather than software looping the I/O pins high and low.
 

Offline mcinque

  • Supporter
  • ****
  • Posts: 1129
  • Country: it
  • I know that I know nothing
Re: new ds1054z, noise square wave arduino
« Reply #8 on: August 19, 2016, 07:01:07 pm »
jrmelectronics (trying to demonstrate another thing) showed an acceptable squarewave with no over/undershoot even with >25KHz and a simple digitalwrite HIGH/LOW
 

Offline 1design

  • Regular Contributor
  • *
  • Posts: 162
Re: new ds1054z, noise square wave arduino
« Reply #9 on: August 19, 2016, 07:27:16 pm »
Why don't you just use the built in timers and an interrupt to do this? Much faster and more deterministic. :wtf:

BR
 

Online Fungus

  • Super Contributor
  • ***
  • Posts: 16664
  • Country: 00
Re: new ds1054z, noise square wave arduino
« Reply #10 on: August 20, 2016, 02:34:18 am »
Why don't you just use the built in timers and an interrupt to do this? Much faster and more deterministic. :wtf:

Interrupts are deterministic?  :-DD
 

Offline heatbreak

  • Contributor
  • Posts: 37
  • Country: us
Re: new ds1054z, noise square wave arduino
« Reply #11 on: August 20, 2016, 02:51:55 am »
Depends on how you are triggering because the loop causes an unbalanced square wave.  After the low write the code branches which means the low will be longer than the high.  You would have to look at the no op instruction length vs the branch to see if putting one after the write high would balance the square wave. Since your square wave isn't a perfect 50 percent duty cycle your trigger could be causing the artifacts.

I understand how software latency causes the horizontal over/under shoots, but what caused the vertical over/undershoots?
 

Offline Muxr

  • Super Contributor
  • ***
  • Posts: 1369
  • Country: us
Re: new ds1054z, noise square wave arduino
« Reply #12 on: August 20, 2016, 03:08:34 am »
Depends on how you are triggering because the loop causes an unbalanced square wave.  After the low write the code branches which means the low will be longer than the high.  You would have to look at the no op instruction length vs the branch to see if putting one after the write high would balance the square wave. Since your square wave isn't a perfect 50 percent duty cycle your trigger could be causing the artifacts.

I understand how software latency causes the horizontal over/under shoots, but what caused the vertical over/undershoots?
Impedance mismatch is one of the possible reasons. Your source impedance is probably a lot different than the input impedance at your scope.
 

Offline heatbreak

  • Contributor
  • Posts: 37
  • Country: us
Re: new ds1054z, noise square wave arduino
« Reply #13 on: August 20, 2016, 03:32:41 am »
Why don't you just use the built in timers and an interrupt to do this? Much faster and more deterministic. :wtf:

Interrupts are deterministic?  :-DD

If designed and implemented correctly within the confines of the system, then yes, interrupts are 100% deterministic.  In this case, output compare can be used.
« Last Edit: August 20, 2016, 03:39:07 am by heatbreak »
 

Online Fungus

  • Super Contributor
  • ***
  • Posts: 16664
  • Country: 00
Re: new ds1054z, noise square wave arduino
« Reply #14 on: August 20, 2016, 10:03:32 am »
what caused the vertical over/undershoots?

Most likely: Connecting the probe to long breadboard wires poked into the Arduino edge connector.

(ie. Inductance)

« Last Edit: August 20, 2016, 11:57:09 am by Fungus »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf