Forum Rule: Always post complete source code & details to reproduce any issue!
Page 2 of 2 FirstFirst 1 2
Results 26 to 45 of 45

Thread: Clean up power supply noise Teensy 4

  1. #26
    Senior Member
    Join Date
    Jan 2020
    Posts
    210
    Quote Originally Posted by BriComp View Post
    There is some information in this document illustrating different circuits, amongst other things, dealing with piezo sensors.
    Thanks I will read it. However I think Iím getting squeeky clean signals other than the idle voltage problem which is probably a limitation of the teensy reference voltage.

    I will test it when I get the voltage reference ICís in a few days.

    I will post a picture of the waveforms Iím getting when I get home.

  2. #27
    Senior Member
    Join Date
    Jan 2020
    Posts
    210
    Quote Originally Posted by BriComp View Post
    Did a google search and found this.
    Thanks. I realised that a log amp would lose the negative phase of the signal so wonít work.

  3. #28
    Senior Member
    Join Date
    May 2015
    Location
    USA
    Posts
    919
    Quote Originally Posted by frankzappa View Post
    ... a log amp would lose the negative phase of the signal so wonít work.
    But the one I posted does.

  4. #29
    Senior Member
    Join Date
    Jan 2020
    Posts
    210
    Quote Originally Posted by jonr View Post
    But the one I posted does.
    Iíll take a look at it when I get home. Iím on my phone now. Donít have a spice iphone app

  5. #30
    Senior Member
    Join Date
    Jan 2020
    Posts
    210
    Quote Originally Posted by jonr View Post
    Here is a LTSpice circuit to show what happens to 60Hz supply noise if you change from .1u to 500u on the virtual ground capacitor:
    Quote Originally Posted by jonr View Post
    But the one I posted does.
    Will this have a true logarithmic response from the virtual ground to the max value?

  6. #31
    Senior Member
    Join Date
    May 2015
    Location
    USA
    Posts
    919
    It takes the full range of + and - piezo outputs and compresses it down to the 0-2V range. Piezo outputs near zero cause large voltage output changes and piezo outputs near min and max cause little output voltage change - a logarithmic response. Piezo parameters change the values and output range, but I think it's about what you want.

  7. #32
    Senior Member
    Join Date
    Jan 2020
    Posts
    210
    Quote Originally Posted by jonr View Post
    It takes the full range of + and - piezo outputs and compresses it down to the 0-2V range. Piezo outputs near zero cause large voltage output changes and piezo outputs near min and max cause little output voltage change - a logarithmic response. Piezo parameters change the values and output range, but I think it's about what you want.
    Yep thats it. So it will not have a linear response up to 0.7v or something weird like that? Any way to control the amount of the curve? How compressed it gets?

  8. #33
    Senior Member
    Join Date
    Jan 2020
    Posts
    210
    I also found this circuit on the forum somewhere: https://forum.pjrc.com/attachment.ph...9&d=1540923756

    Does this do the same thing? It seems to compress the signal before going into the op amp.

  9. #34
    Senior Member
    Join Date
    May 2015
    Location
    USA
    Posts
    919
    You can tweak the circuit once you know the piezo parameters. A 100K resistor in parallel with the diodes will change the slope at zero piezo output. You
    might prefer the curves of BAT54 diodes.

    The circuit you linked is similar, but will produce more like 0-1V.
    Last edited by jonr; 06-01-2021 at 03:24 PM.

  10. #35
    Senior Member
    Join Date
    Jan 2020
    Posts
    210
    Quote Originally Posted by jonr View Post

    The circuit you linked is similar, but will produce more like 0-1V.
    Yes but the piezo voltage is more like -10 to +10v around vcc/2 so it might give me 0-3.3v i to the op amp.

    Also it seems you control the voltage swing with the resistor in series with the diodes.

    I will try both and see what works.
    Last edited by frankzappa; 06-01-2021 at 06:35 PM.

  11. #36
    Senior Member
    Join Date
    Jan 2020
    Posts
    210
    When designing a PCB that the teensy4 gets soldered onto, should I leave the unused pins unconnected? Iím only using the ADC pins and 3.3v/ground pins.

    I only use one ground pin and Iím not sure if the unused stuff should be connected to the ground plane or left away from it.

    Thanks.

  12. #37
    Senior Member
    Join Date
    May 2015
    Location
    USA
    Posts
    919
    I'm interested knowing if you detect any noise difference with all unused pins set with pinMode(xxx, INPUT_PULLUP) vs the default UNUSED.

  13. #38
    Senior Member
    Join Date
    Jan 2020
    Posts
    210
    Quote Originally Posted by jonr View Post
    I'm interested knowing if you detect any noise difference with all unused pins set with pinMode(xxx, INPUT_PULLUP) vs the default UNUSED.
    I will have to test. Iím designing a new pcb with only surface mount components and itís much smaller so all loops should be smaller. Will see if there is any difference. Star grounding seems pretty impossible though. Iíve paid much more attention to current return paths. However Iím not sure I know what Iím doing.

    The old pcb has a ground plane on the whole board including where the teensy pins are but they are not connected to it.

    Since this noise is low frequency, Iím thinking itís a ground loop problem but the weird thing is that it increases when the USB is used so it definitely has an effect.

    I should also add that the noise is maybe +/- 7 values. The maximum signal is +/- 35000 or so. This is after filtering and the values are doubles. Maybe Iím just asking for too much. There is plenty of resolution and signal to noise. Iím just thinking since I didnít use any noise decoupling I could get even better results. Itís certaintly good enough. Itís just a shame because if there was none of this low frequency noise the noise floor would be maybe +/-3 or so.

  14. #39
    Senior Member
    Join Date
    Jan 2020
    Posts
    210
    Nope, that made no noticeable difference. Neither did pulldown.

    I loaded up a fresh teensy4 without any circuit. Just sampling the empty analog pin has more noise than my circuit. Why is that.

    I think this is as good as it's going to get with a teensy4. I'll just make another PCB with the voltage reference and some bypass caps on the op amps and be done with it.

    Is there any way to power my circuit from the 5V coming from the USB?

  15. #40
    Quote Originally Posted by frankzappa View Post
    I loaded up a fresh teensy4 without any circuit. Just sampling the empty analog pin has more noise than my circuit. Why is that.
    Empty as in nothing driving the input at all? Of course that will be noisy.

  16. #41
    Senior Member
    Join Date
    Jan 2020
    Posts
    210
    Quote Originally Posted by UhClem View Post
    Empty as in nothing driving the input at all? Of course that will be noisy.
    How could I see what the noise floor of the teensy is and not interference from my circuit?

  17. #42
    Senior Member
    Join Date
    May 2015
    Location
    USA
    Posts
    919
    You could use two series 2K resistors from 3.3V to ground and connect the midpoint to an ADC input. This should be about as good as possible - reported to be about 10 bits (without using a trimmed mean).

    I expect that different inputs have slightly different noise levels.

  18. #43
    Senior Member
    Join Date
    Jan 2020
    Posts
    210
    Quote Originally Posted by jonr View Post
    You could use two series 2K resistors from 3.3V to ground and connect the midpoint to an ADC input. This should be about as good as possible - reported to be about 10 bits (without using a trimmed mean).

    I expect that different inputs have slightly different noise levels.
    Ok thanks. How exactly do you calculate how many bits? I'm guessing it should be dividing the max value with the noise value and then if it's about 1024 it's 10 bits.

  19. #44
    Senior Member
    Join Date
    Jan 2020
    Posts
    210
    Ok, so I got a voltage reference in the mail, the LM385Z https://www.ti.com/lit/ds/symlink/lm...ouser.com%252F

    I hooked it up to my breadboard circuit and this does not seem to work. I'm only getting positive values from the piezo. The reference is at 1.2V and I only get positive spikes from 1.2v up to 3.3V. I replaced the virtual ground in my circuit with this voltage reference. Am I missing something? I seem to be getting a stable 1.2v but the piezo signal is not behaving as it should.

  20. #45
    Senior Member
    Join Date
    Jan 2020
    Posts
    210
    Quote Originally Posted by frankzappa View Post
    Ok, so I got a voltage reference in the mail, the LM385Z https://www.ti.com/lit/ds/symlink/lm...ouser.com%252F

    I hooked it up to my breadboard circuit and this does not seem to work. I'm only getting positive values from the piezo. The reference is at 1.2V and I only get positive spikes from 1.2v up to 3.3V. I replaced the virtual ground in my circuit with this voltage reference. Am I missing something? I seem to be getting a stable 1.2v but the piezo signal is not behaving as it should.
    The Texas Instruments manual for some reason showed the pins from upside down view. Voltage reference is working now.

    However the problem was not the voltage reference or the circuit. Basically I was pushing the ADC too hard. I was reading at 12 bits with 4 averages with HIGH_SPEED in the ADC library. 10 sensors at 50kHz each.

    I'm using a bit more averaging and the noise is much less. Frequency is 28.5kHz and 10 bit but when using doubles and some filters the noise is non existant and resolution is very good anyway.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •