Forum Rule: Always post complete source code & details to reproduce any issue!

Search:

Type: Posts; User: frankzappa

Page 1 of 2 1 2

Search: Search took 0.00 seconds.

  1. Yeah as I said I used the fastest settings for...

    Yeah as I said I used the fastest settings for conversion and sampling. I can use medium and see if it goes away. My guess is that the capacitor inside the A/D doesnít discharge in time for some...
  2. Well itís an AC signal, the first peak is a...

    Well itís an AC signal, the first peak is a negative half wave sinusoidal signal that lasts up to 2ms but it vibrates up/down for maybe 50milliseconds after the first peak before calming down...
  3. Thanks 😊 🙏

    Thanks 😊 🙏
  4. @defragster Iím measuring a half wave that is...

    @defragster
    Iím measuring a half wave that is about 0.5 - 2ms in lenght so not very fast signals. Signals above say 1000 Hz are just noise in this application.

    Averaging is good in this case.
    ...
  5. Yeah. I figure if you have say ten sensor...

    Yeah. I figure if you have say ten sensor readings. They have a value of 10 and 11 every other reading. If you average them out they will still probably show 10 and 11 but the real value is 10,5. If...
  6. Yeah I've thought about that too. I've thought...

    Yeah I've thought about that too. I've thought about using 10bit readings, multiply them by say 4 and then do the averages. That should get more resolution (I think) because sometimes a voltage is...
  7. Your idea for the unrolled loop is genius. Iím...

    Your idea for the unrolled loop is genius.

    Iím getting great results with 10 bits and 8 averages although itís possible 12 bits with 4 averages may be even better. There is also the possibility to...
  8. Actually itís a non issue. With defragsters...

    Actually itís a non issue. With defragsters unrolled loop and placing all code only while waiting for the ADCís I can use 8 averages and still get 30 reads per sensor per millisecond which is...
  9. So connect one ADC to a voltage reference and...

    So connect one ADC to a voltage reference and read the signal on the other?

    I have read a bit more about the circuit part of things, I have a few more things to try. I think the noise can be...
  10. Let me try again: It's simpler then I thought....

    Let me try again:

    It's simpler then I thought.

    You start reading both adc's. Then there is time to do some work on previous sensor readings.

    Then there is a while loop which serves the...
  11. Oh wait, the while loop is just to wait for the...

    Oh wait, the while loop is just to wait for the conversion to finish right?

    That must be it.
  12. Hey defragster, could you help me break down this...

    Hey defragster, could you help me break down this code. What exactly is happening in detail when it comes to the unrolled part? I'm going to explain what I think is happening and you can tell me if...
  13. In comparison, here is how a normal peak looks...

    In comparison, here is how a normal peak looks like:

    https://www.dropbox.com/s/cxdrivhhv88k5ez/max%20peak.heic?dl=0
  14. Here is with 10 analog pins read (only showing...

    Here is with 10 analog pins read (only showing one):

    https://www.dropbox.com/s/31s9ngnt7o...sors.heic?dl=0

    Again, this is the worst case scenario. Could probably get twice the resolution by...
  15. That was 10 bits average of 2. However this was...

    That was 10 bits average of 2. However this was only two sensors (one shown) so it will be 5 times less measurements.
  16. Here is the worst case scenario that I want to...

    Here is the worst case scenario that I want to track. This is a very weakly struck drum:

    https://www.dropbox.com/s/il5tuzlr0k2wvvc/peak.heic?dl=0

    The lower pic is the first peak zoomed in.

    I...
  17. I'm using a center point of value 500 for the...

    I'm using a center point of value 500 for the signal. I'm catching the negative part of the signal and inverting it. This is the way the best edrums are triggered and I assumed it would have some...
  18. 12 bit looked the same but maybe it would improve...

    12 bit looked the same but maybe it would improve when divided by 4. The 10 bit with two averages seems to be good enough. The problem is not when you have a strong signal, it is when you play very...
  19. That is just with everything connected and at...

    That is just with everything connected and at rest.

    Only way for it to not jump up and down 4-5 values is to use averaging of 2. Conversion speed/sampling speed doesn't seem to affect it for the...
  20. Nevermind, I was doing 1023 - sensorValue to give...

    Nevermind, I was doing 1023 - sensorValue to give me an inverted signal, didn't work with a 12 bit value because it's a bigger number.
  21. Oh I had the capacitor placed in the wrong spot....

    Oh I had the capacitor placed in the wrong spot. Averaging of 2 works pretty good.

    https://www.dropbox.com/s/o0ky6lxppnmqnsp/averaging%202.heic?dl=0
  22. Here is 10 bit with an averaging of 4, it's...

    Here is 10 bit with an averaging of 4, it's actually worse.

    https://www.dropbox.com/s/94j9ur2l0mjlngn/filter2.heic?dl=0
  23. Well I've tried some low pass RC filters and it's...

    Well I've tried some low pass RC filters and it's still not that great but slightly improved.

    Strange thing is when I use averaging of 2 I get worse results with the RC filters.

    Maybe my...
  24. I was thinking that as well. I will try all...

    I was thinking that as well. I will try all possibilities and keep what works best. I also want to keep it reasonably simple.
  25. Thanks will try :)

    Thanks will try :)
  26. Not sure what you mean. Are you talking about a...

    Not sure what you mean. Are you talking about a bypass capacitor like this:

    https://components101.com/sites/default/files/inline-images/Bypass-Capacitor.png

    I was thinking a decoupling...
  27. Ah, I understand. I'm not that familiar with...

    Ah, I understand.

    I'm not that familiar with the preprocessor directives, I'm going to have to read about them a bit. I've only seen them used to include header files and whatnot.

    I wish I had...
  28. Good to know, thanks. I'll calculate what exact...

    Good to know, thanks. I'll calculate what exact cutoff frequency I need depending on the signal. The sensors are catching peaks of about 500-1000Hz but three of them will have to be a bit higher,...
  29. BTW is it not better to only have the filtering...

    BTW is it not better to only have the filtering before the op amp to keep the signal as low impedance as possible?
  30. What is an array ref took cycle?

    What is an array ref took cycle?
  31. Yes that was also my plan (I will try before the...

    Yes that was also my plan (I will try before the op amp and after and see what works best) but I didn't have any capacitors laying around, I have a bunch of them now, will experiment a bit. Was...
  32. I really appreciate your efforts into this,...

    I really appreciate your efforts into this, thanks a lot. I'm going to need a day or so to go through it and understand everything. I have a hard time seeing exactly what is going on and also what is...
  33. Here is a picture of it in action. ...

    Here is a picture of it in action.

    https://www.dropbox.com/s/vavkp8vdib3so4r/test.heic?dl=0
  34. Here is the circuit:...

    Here is the circuit: https://www.dropbox.com/s/90zhth0m3q2k2hd/piezo%20circuit.jpg?dl=0

    I just used some resistors I had available, the op amp is a TI model that was made for this application.
    ...
  35. Thanks man, I will test this. I tried up to 4...

    Thanks man, I will test this.

    I tried up to 4 averages. 4 averages gave me an OK result but not as good as analogRead. However I only tested 10bits.

    BTW, the delay you are adding. Is that...
  36. Ok, so I've tried the suggested code and it works...

    Ok, so I've tried the suggested code and it works great. I get much faster readings. It went from 50 readings to hundreds.

    However I get too much noise. I haven't done any low pass filtering in...
  37. Thanks man. Really appreciate your help. Was...

    Thanks man. Really appreciate your help.

    Was this the final code you suggested? A bit hard to keep track because so many examples were posted.



    #include <ADC.h>
    #include <ADC_util.h>

    ADC...
  38. Iím not sure how long the stuff I do between the...

    Iím not sure how long the stuff I do between the 10 reads take. I do a few nested loops and Ēif elseĒ. Also some ellapsed micros to read the timings of peaks and I store the biggest value of peaks. I...
  39. So you are basically doing stuff on the previous...

    So you are basically doing stuff on the previous sensor readings while waiting for the next ones to complete.

    I don't think it's necessary. It's not that important to get many readings, the most...
  40. I think I will try this. What does it mean to...

    I think I will try this. What does it mean to unroll the loop?
  41. Thanks for the examples, I don't think I need...

    Thanks for the examples, I don't think I need that much time to evaluate stuff between reads. All I'm doing is a few conditional statements and store the time and value of peaks. I don't store them...
  42. I see now that there are way more possibilities...

    I see now that there are way more possibilities under the surface.

    I think I will start with the more basic stuff and see later if something more advanced is necessary.

    Thanks for the tip about...
  43. Is there a way to reduce noise with multiple...

    Is there a way to reduce noise with multiple sensors?
  44. Oh itís very much fun. Itís frustrating at times...

    Oh itís very much fun. Itís frustrating at times but once I accomplish something and it works great itís very rewarding 😃

    I understand, I was thinking to test how much speed I need and find a...
  45. Again I'm just starting out with coding and I...

    Again I'm just starting out with coding and I just don't know how most of this stuff is done. I know how to do an analog read and I've made the peak tracking stuff and it's working great with analog...
  46. Ah, since the pins will not change you made them...

    Ah, since the pins will not change you made them constant.

    The original example code from the ADC library didn't have them as constants but i guess it's a good idea to make them constant.
  47. Would this be a proper way to set up a sensor...

    Would this be a proper way to set up a sensor reading of 10 pins into an array using the ADC library?

    I posted in the ADC library thread but no reply.



    #include <ADC.h>
    #include <ADC_util.h>
  48. That's good to know. It seems I can do any stupid...

    That's good to know. It seems I can do any stupid stuff and the teensy will not care because it does it so fast.
  49. I already have working code with 2 sensors. This...

    I already have working code with 2 sensors. This is a single drum with 10 sensors. My code is capturing the peaks and time arrival of peaks so I can compare arrival times later to do some cool stuff...
  50. Understood, you have helped me enough to get me...

    Understood, you have helped me enough to get me started with the ADC example. I think I can begin experimenting with removing unnecessary code as you say.

    Thinking about what paul stoffegren said...
Results 1 to 50 of 77
Page 1 of 2 1 2