Sub-par ad9833 sweep using arduino.  - Page 1
Forum section: electronics / general

author: eti
author_rank: Super Contributor
timestamp: January 16, 2022, 01:15:38 am
content: Link:https://www.instructables.com/Signal-Generator-AD9833/(thanks to ataradov for telling me I’d forgotten to include it 🤦🏻‍♂️)Okay. I know we have to USE software, it’s an occupational hazard, but the continual “evolution” of it, coupled with the egos and personal interpretations of software - ahem - “engineers” - makes it a time sink and one which drags me down a rabbit hole, the likes of software and bytes and utter piffle, the likes of which I’d rather not have to go down, were the entire internet not so overly enamoured with computers and an endless array of digital modules that take the long way round the houses, only to reinvent the wheel of what could be achieved with discrete components (were people not so lazy - me included).Rant over… almost… I digress. This link tells me how to create a sweep generator; I’ve done so, and it’s trivial - it’s built. What I can work out (this whole rant is likely my misunderstanding the utter bollocks that is arduino, and the inability of “makers” (ugh!!!) to document things in a thorough fashion)Why does this “sweep generator” not generate a continuously increasing or decreasing frequency output? Instead, it JUMPS to the next increment or decrement.I’ve no desire AT ALL to delve into the nonsense that is arduino, nor the bollocks that is the code that powers it all.Could someone, if possible, please tell me why this code jumps, and doesn’t generate a smooth linear sweep?Thanks. Ranting through misunderstanding, possibly, and the anticipation of people coming along here and telling me how stupid I am to not be able to mentally cope with taking all this in, merely to achieve a simple freq sweeper.Ps: this is what springs to my mind when I think of “makers” and arduino users in a general sense; this person's worded it spot on:https://forum.arduino.cc/t/are-arduino-users-inheriently-stupid-basic-electronics-knowledge/448914

author: ataradov
author_rank: Super Contributor
timestamp: January 16, 2022, 01:38:50 am
content: So, you took someone else work, because you are not capable of doing the same yourself, it did not do EXACTLY what you wanted, but again, you are not knowledgeable enough to fix it, yet you are shitting on the author that could make things work? Sure, Arduino is the problem here.And instead of linking to the project you failed to use, you have linked to some other misguided rant about Arduino.You are the problem here, not Ardiuno or its users.If you think all Arduino code is bad, then simply don't use it. Just forget it exists. You need to understand that nobody owes anything to you, not delivering working code, nor documenting it. You've got it for free, you have no standing to dictate what the author should or should not have done.

author: eti
author_rank: Super Contributor
timestamp: January 16, 2022, 01:40:32 am
content: Quote from: ataradov on January 16, 2022, 01:38:50 amOh there you are! You pop up like a mole 😁 don’t make me waste the mods valuable time by reporting you for provocation. You have a track record of jumping into my threads, adding nothing but antagonist smart guy replies. I’m not reporting this for respect for the mod’s time, but if you’d kindly go away, it would save me getting out the fly spray.Happy Old New year. Спокойной ночи

author: ataradov
author_rank: Super Contributor
timestamp: January 16, 2022, 01:42:07 am
content: You are an old bitter man. All you do is rant and complain.

author: eti
author_rank: Super Contributor
timestamp: January 16, 2022, 01:44:26 am
content: Quote from: ataradov on January 16, 2022, 01:42:07 amRise above it. Be the better person and walk away then, set a standard. Are you being held at gunpoint, against your will? Nope.

author: xrunner
author_rank: Super Contributor
timestamp: January 16, 2022, 01:45:16 am
content: Quote from: eti on January 16, 2022, 01:40:32 amSo do you.But - thank you for reaching out to us about this issue.

author: eti
author_rank: Super Contributor
timestamp: January 16, 2022, 01:50:33 am
content: Quote from: xrunner on January 16, 2022, 01:45:16 amI probably do. Then again, I’m human, and none of us is above anyone else, as much as we delude ourselves that this is the case, and we each falsely believe “there’s no flies on me” as they say.I’m going to point out VERY CLEARLY HERE that I’d made it very clear and openly admitted in the OP that I’m frustrated and confused by this code.No need to pour fuel on the fire, folks. I asked a question - a technical question. If you can’t help me that’s fine, but snotty replies only serve to boost egos, and belittling people is exceptionally childish.Again, I posted in frustration - I do not expect NOR feel “entitled” to help, I’m here asking, that’s all n

author: xrunner
author_rank: Super Contributor
timestamp: January 16, 2022, 01:56:05 am
content: It's Arduino - I wouldn't expect any of it to work right (although there are some very well-written libraries I've used for my projects). Most of the time I might look at someone's code to get an idea of how to do what I want, but I don't think I've ever used an Arduino program without modding it (unless it was a trivial example of lighting up LEDs).

author: eti
author_rank: Super Contributor
timestamp: January 16, 2022, 01:58:41 am
content: Quote from: xrunner on January 16, 2022, 01:56:05 amThank you. Appreciate the gracious reply. Feel free to lock it if you want to.

author: ataradov
author_rank: Super Contributor
timestamp: January 16, 2022, 02:01:01 am
content: But you have not actually posted a link to the code. What help do you expect? Do you think there is only one AD9833 project using Arduino and we are supposed to find it ourselves?Also, what is even continuous? AD9833 is not capable of producing truly continuous sweep. There will be steps as you reprogram it. So how big were the steps in your case? And how big you were expecting them to be?

author: eti
author_rank: Super Contributor
timestamp: January 16, 2022, 02:03:01 am
content: Quote from: ataradov on January 16, 2022, 02:01:01 amYes, thanks for pointing that out - I forgot 😁 lol. I’m not afraid to face my faults - thanks for telling me - see! You’ve done something constructive, now you can smile. 😉As much as I want to be kind to you and forgive you, and I do, I’d rather not interact with you. You have a history of jumping into my posts and being unkind. Your intellect is not enough to make me want help from you. Thanks for trying to help. Now, would you please refrain from future interactions, as I feel it’s detrimental for us both. I have no desire to defend this wish, you bring out the worst in people when you’re snotty.Note to mods: should ataradov CHOOSE to wilfully ignore this civil request, I shall report each and every single interaction he attempts to make, and since my concern is from respecting your time as mods and very busy ones, this is advanced notice - not to be unkind to him, but he’s only here to provoke.Thanks

author: ataradov
author_rank: Super Contributor
timestamp: January 16, 2022, 02:10:52 am
content: This code updates frequency every millisecond. Feel free to remove the delay and modify the formula for the next frequency accordingly. You steps will be limited by the SPI's ability to write a new value into the register. This is the best AD9833 can do. The phase of the signal will remain continuous, this is guaranteed by the AD9833, but the frequency would change in steps, you can't avoid it. You can pick a very small step, bu then you won't be in control of the sweep time. You need to pick one.This is a very reasonable code, BTW. The step selection is purely arbitrary, but you need to make one. Author made a choice of 1 ms. There is absolutely nothing wrong with that.Also, you should not make comments about other's ability to code if you can't figure out 200 lines of easy to read code.I will interact with whoever I want, thank you. Feel free to not post nonsense if you don't want to be called out.

author: SiliconWizard
author_rank: Super Contributor
timestamp: January 16, 2022, 02:41:03 am
content: Quote from: ataradov on January 16, 2022, 02:10:52 amI would agree with this point.And reading the AD9833 datasheet would tell the OP what can and cannot be done. =)

author: nali
author_rank: Frequent Contributor
timestamp: January 16, 2022, 09:49:02 am
content: Quote from: SiliconWizard on January 16, 2022, 02:41:03 amNot to mention the data sheet of the MCU used by whichever Arduino. Why for example don't you change the code from using delays to timer interrupts, add a potentiometer to load timer values and give yourself a sweep speed control? Then you can publish it for someone else to have a play with...What I can't fathom is why you evenhavean Arduino in the 1st instance, given your vitriolic hatred of the whole ecosystsm. There are plenty of ways to do the same thing in the analogue domain.

author: rstofer
author_rank: Super Contributor
timestamp: January 17, 2022, 03:24:14 pm
content: Worth noting (I think I got this right!):The step size is logarithmic - ideal for Bode' PlotsThe function SG_StepSweep() isn't referenced. That's good because:The variable SG_nSweep isn't initialized (so it is probably 0) and is used as a divisor (as well as a comparison value) in SG_StepSweep(). Division by 0 would be bad!They made a movie about legacy code hanging around...

author: rstofer
author_rank: Super Contributor
timestamp: January 17, 2022, 03:29:09 pm
content: Quote from: nali on January 16, 2022, 09:49:02 amWhat should happen is for the calculation to be one step ahead and the value transferred on an interrupt. As it is, there is some calculation in the loop with delay(1) so the update occurs at some period much greater than 1 ms. Depending on the actual values being computed, the computation time can probably vary somewhat.