Test equipment guidance needed... - Page 1
Forum section: electronics / beginners

author: a67429
author_rank: Newbie
timestamp: November 01, 2023, 05:50:31 am
content: Hi everyone,Like many beginners, I know enough to get myself into a lot of trouble and find myself needing some help before making even more costly mistakes in my learning process.My current situation is that I'm working on my own product development project that is controlled by an Arduino H7, (Portenta Machine Control) and I need a way to make sure it's doing what it's supposed to when it's supposed to.The process at hand is this. A sensor is triggered, the micro controller counts x number of encoder pulses, and then sends an output high.I need to verify this chain of events happens reliably. Namely that the x number of pulses between those two events is accurate. The pulse train I'm looking at measureing, if my math is correct is up to around 144khz. (3600ppr encoder with a 6" circumference wheel measuring a surface speed of 1200ft/min.) (600ppi * 12 * 1200 = 8,640,000ppm / 60seconds = 144,000khz)From what I've been reading there are a number of tools that are able to do this, and some that may but aren't so clear if they do or don't...or perhaps I just don't know what to call it or where to look for it. I believe this would be a 'totalizer' function on a universal counter or the like. The options I've been coming back to repeatedly are the following:Analog discovery- From what I understand, these things are just fantastic for a lot of uses. I like that they can do just about anything that a beginner could wish for, but I don't care for the fact they can do just about anything. The large feature set feels a bit like buying photoshop just to crop photos if that makes sense, plus maybe it's me being old fashioned, but I much prefer real equipment over USB stuff like this, even if I end up with several devices on my bench to do what I need to. That said, I'm not totally against one of these things.A universal counter- It seems the HP5315 is commonly recommended to others looking to do similar stuff. I like that the process seems pretty simple, and once the slope and trigger level are set, the measurement can be taken almost automatically by simply resetting the counter. (If I'm understanding the process properly)Function generator / counter- I see some cheap 15mhz ones on Amazon from companies like koolertron or seesii which look like they might count in the way I need to, but I'm hesitant to fork over the roughly $100 for one if I'm not sure.Oscilloscope- Would an entry scope like a DHO804 or similar do something like this?

author: MathWizard
author_rank: Super Contributor
timestamp: November 01, 2023, 07:50:08 am
content: With an oscilloscope you'd probably have to count it yourself, and then there's time span issues, so that's no fun. A proper benchtop counter would be great, but yeah they probably aren't cheap, for brand-names anyways.There should be lot's of micro-controller type things that should work great for 100's of kHz. I bet some of the ebay counters would do fine. I should get 1 myself.Then if you have time, you could buy some counter chip and/or MCU, and make your own. You must know some programming, so something like that would probably be the cheapest way. Just a little bit of soldering, and maybe a bit of programming. But guaranteed there's all-in-1 chips, that output a count to 7-segment displays. And there's ones that output serial protocols, and require no programming, just wiring.

author: tggzzz
author_rank: Super Contributor
timestamp: November 01, 2023, 09:26:40 am
content: Quote from: a67429 on November 01, 2023, 05:50:31 amWelcome to the forum, especially since that is a well thought out questionThat would be an ideal use for a fully-fledged logic analyser with comprehensive triggering and filtering capabilities. It would enable you to setup the test and expected results, and to do nothing until the result arenotas expected. At that point you may have been able to capture whatever lead up to the incorrect result.A cheap grab-everything-and-post-process logic analyser would not be suitable, partly because of the limited number of samples and partly because you would probably have to do the post processing yourself. Caution: fully-fledged LAs have a learning curve, and logic analyser inputs may not be protected against high input voltages as a scope; RTFMA scope would have the same sample depth and lack of appropriate post processing issues. While the Analog Discovery is a very useful device, it has a limited sample depth.It may indeed be possible to use some form of off-the-shelf gated counter. You would have to read and understand the operation manual to verify that it can do the specific job you want. If a counter is available, just try itIf neither an LA or gated counter is available, I would probably get results soonest by creating my own test jig. At those frequencies it should be possible to use just about any MCU (e.g. an arduino) to sit in a tight loop observing the inputs, counting, and displaying the results on whatever is available, including over USB to a PC.

author: rstofer
author_rank: Super Contributor
timestamp: November 01, 2023, 03:36:59 pm
content: What value of 'x'? If you are going to count the pulses on a scope, 'x' needs to be fairly small.I would try to count the pulses with an Arduino and send the result over the serial port. The simplest approach would be to watch for the trigger and start counting then stop counting and send a message while holding off on counting subsequent events until the serial transmission is complete. You may need to take the input pulses as interrupts because you don't have very many cycles to get the count incremented. A Teensy 4.1 would be a better choice and it is pretty easy to add the toolchain to the Arduino IDE. It's a 600 MHz ARM Cortex M7 - a very capable chip. And it programs like an Arduino - same function calls, etc.https://www.pjrc.com/store/teensy41.html

author: a67429
author_rank: Newbie
timestamp: November 02, 2023, 08:13:48 pm
content: Quote from: rstofer on November 01, 2023, 03:36:59 pmAt the moment, the count is rather small of 600 or less. In the near future, that number will increase to up to around 20,000.I think that given the cost of commercial options, and the relative simplicity of the task at hand, I will do just as you suggest and build by own counter. This is to simply verify that my control firmware doesn't end up growing too inefficient that my critical timing operation is compromised. Thinking about this a little more has me realizing that I'm really only monitoring one edge of that 600ppi encoder signal, so my overall frequency actually tops out at around 72khz, which means at the 480mz clock speed of the H7 processor I can probably implement anything I want in firmware without issue so long as I'm mindful not to use blocking routines in my code.

author: Infraviolet
author_rank: Super Contributor
timestamp: November 03, 2023, 06:52:53 pm
content: A Pi Pico or other RP2040 based microcontrolelr board might be a good option here. They are clocked pretty fast compared to other microcontrollers, so you wouldn't need to work on optimising your code on it, you'd be able to keep up with the signal you want to measure almost trivially.EDIT: Just noticed it is an Arduino Portenta you are using, that has a pretty high clock speed too (faster than the RP2040). If you have a second one about that would work to build your monitoring tool around too.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: November 05, 2023, 04:03:47 am
content: It is quite common to have quadrature counters in hardware in microcontrollers. I don't know that processor is in an arduino H7, but (nearly?) all the STM32 (Those discovery things) have timer/counter hardware that can do this. But other uC's have it too. It is very common for motor control.Also, if accurate counting is important, then you have to give a bit of thought to the hardware too, especially when reversing directions narrow glitches can occur. It is quite common for encoders to have a "zero" output, which gives a pulse once each revolution, and this can be used to both check whether the count was correct, and add a correction if needed.You can also add a mechanical stop or extra switch, or even a pencil mark can give you a zero position that can be used to verify the count value because for a number of full turns the count is known.