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

Search:

Type: Posts; User: frankzappa

Page 1 of 3 1 2 3

Search: Search took 0.00 seconds.

  1. Thanks 🙏 Just needed to be sure

    Thanks 🙏 Just needed to be sure
  2. Thanks, the pins are valid on the teensy 4 which...

    Thanks, the pins are valid on the teensy 4 which Iím using and he did specify that.

    Iím getting some strange values ocassionally and itís because of my code but wanted to make sure it wasnít...
  3. Hello! I'm trying to do calculations while...

    Hello!

    I'm trying to do calculations while waiting for conversions to finish.
    Is it guaranteed that ADC0 will read sensor A0 and sensor A2? And
    ADC1 will always read A1 and A3 in this code? If...
  4. Thanks, I think this is very clear now. So if...

    Thanks, I think this is very clear now.

    So if we have 4 bits and want to convert an unsigned value of 1111 which is 15 to a signed 4 bit value, then that would convert into -7. However as long as...
  5. That is true, maybe not that great for the forum....

    That is true, maybe not that great for the forum.

    I don't seem to have problems but maybe it only shows in a certain situation that I'm not anticipating.

    Is there any situation where a 0 will...
  6. In stead of making more noob threads I'll just...

    In stead of making more noob threads I'll just ask here:

    I've run into a little trouble with unsigned integers. As I understand you can't mix unsigned and signed together.

    For example: If I...
  7. That is very convenient indeed, I haven't read...

    That is very convenient indeed, I haven't read about classes yet. I've mostly read about C so far because it was a bit simpler to learn but i will get there eventually because I've noticed they are...
  8. Ah, much appreciated. Thanks :)

    Ah, much appreciated. Thanks :)
  9. How would I actually read it? uint32_t...

    How would I actually read it?



    uint32_t g_cycleCounter = ARM_DWT_CYCCNT;

    void setup() {
    }
    void loop(){
    uint32_ t start = g_cycleCounter;
  10. I will check. I usually use elapsed micros to...

    I will check. I usually use elapsed micros to check these things. I assumed it was pretty instantaneous until you said it above.

    I didn't get around to using the cycle counter. I will check the...
  11. That's great. How much CPU time are we talking? ...

    That's great. How much CPU time are we talking?

    I would only need to set a timer to 0 when a rising value passes zero and then check the elapsed time when it goes back down below zero. So the...
  12. How many elapsedMicros can you use on the teensy 4?

    I'm new at programming, I'm still half way through a book on C programming and I'm learning so bare with me.

    Is there a limit on how many timers you can run simultaneously with the teensy 4?
    ...
  13. 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...
  14. 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...
  15. Thanks 😊 🙏

    Thanks 😊 🙏
  16. @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.
    ...
  17. 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...
  18. 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...
  19. 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...
  20. 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...
  21. 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...
  22. 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...
  23. 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.
  24. 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...
  25. 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
  26. 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...
  27. 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.
  28. 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...
  29. 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...
  30. 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...
  31. 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...
  32. 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.
  33. 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
  34. 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
  35. 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...
  36. 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.
  37. Thanks will try :)

    Thanks will try :)
  38. 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...
  39. 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...
  40. 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,...
  41. 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?
  42. What is an array ref took cycle?

    What is an array ref took cycle?
  43. 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...
  44. 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...
  45. 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
  46. 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.
    ...
  47. 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...
  48. 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...
  49. 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...
  50. 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...
Results 1 to 50 of 107
Page 1 of 3 1 2 3