Speedometer Setup

Which product is right for your exact requirements
Post Reply
mihai.albert
User
User
Posts: 3
Joined: Sun Feb 25, 2018 9:17 pm

Speedometer Setup

Post by mihai.albert »

Hi,

I’m trying to determine the precision of a model railroad speedometer – the one here – in effect a device that measures revolution speed of the locomotive wheel and sends this across as a number to the PC constantly. By doing some analysis, this speedometer is composed of a rotary encoder that sends a series of +5V or 0V corresponding to the 2 possible positions it’s in and an interface board that computes an average based on the time duration of the last 4 pulses (each pulse is a sequence of +5V followed by 0V), constructs a packet containing this time average, and sends it down to the PC. Let’s call this interface board the “counter” for simplicity. Since it’s rather difficult to find a locomotive that turns with the same constant speed, I’ve resorted to actually “trick” the interface board by presenting it with a specially designed series of pulses, by swapping the rotary encoder with another PC-controlled interface that toggles a digital output. Let’s call this interface the “generator”. As such, a Phidget 1018is used to precisely generate a series of pulses and then forward these to the interface board that computes the average of the time duration of the pulses. However, the results I’m seeing out of this setup aren’t as precise as I’d expect them to be. I know my computer code is sending the packets accurately (error of a few us for pulses that range in the ms, since the frequency of these pulses is around 1kHz) since I can see the packets going through the USB stack on the PC ok (on their way out to the Phidget 1018). However what happens next – on the USB cable to the Phidget 1018, inside the Phidget 1018, then to the interface board that does the averaging and the trip of this packet back to the PC – is a mystery. I can only see the time measurements for the pulses that don’t look quite right (eg generating pulses of 4 ms results in packets coming back almost exclusively showing either 3.9 ms or 4.2 ms).

Now a Picoscope – even an entry level – will probably shed a lot of light on what’s happening here. But what model would be best, considering the items below:
- The model would need to have an AWG, since I’d like to have a series of exact pulses (in terms of duration, accurate down to 1 us at least) applied to the “counter” interface board, so I can test it in isolation. The problem is that the output of the AWG module – and to my understanding this applies to all models that have it – is between -2V and +2V. Even using an offset and a custom function won’t get the square wave between 0 and +5V I’m after. Thus an amplifier is most likely needed; I already have this one – would I be able to use one channel to take the Picoscope’s AWG output and generate the square wave I need ? If not, what off-the-shelf solution would be recommended as amplifier ?
- The model should be able to pinpoint how accurate the pulses generated by the “generator” interface board really are – down to 1 us
- What model is best, considering I’d like to see what’s happening inside the USB bus as well ? I’m seeing Picoscope 6 has parsers for the USB protocol, but probably the entry levels (as some of the Picoscope 2000) would have issues analyzing this, particulary at high USB speeds
- In the future I’ll be analyzing what happens on the model railroading DCC bus, and perhaps poke inside locomotive DCC decoders as well in the future, so I’d like to keep my options (as opposed to selecting a Picoscope model that would solve the “generator”+”counter” problem above now, but then realize in the future that I’d need more options which the model I’ve selected doesn’t have). I’ve noticed that Picoscope 6 already has DCC parsers, so the software won’t be a limitation
- My budget for the Picoscope is around 500-600 EUR



Regards,
Mihai

Gerry
PICO STAFF
PICO STAFF
Posts: 1145
Joined: Mon Aug 11, 2014 11:14 am

Re: Speedometer Setup

Post by Gerry »

Hi mihai.albert,

First of all, what is responsible for the pulse timing? Do you define the pulse width and send that as a value, or do you send the voltage values only, and therefore send a change in voltage when you want to create a pulse edge (in which case the pulse width is determined coarsely by you, with the precise timing being determined by the availability of resources, e.g. availability of the PC core/cores to process the threads of your application, availability of the USB bus to both send and receive the data, etc. which collectively add uncertainty to the pulse width and can account for the differences that you are seeing).

Using a pulse generator, or Signal Generator/AWG that can generate pulses, is a better way of sending pulses to the interface board because it is only dependent upon the start time and effectively removes any uncertainty of the pulse width caused by the computer and USB scheduling.

You would need to amplify the single ended pulse train, and the audio amp that you're considering can amplify single ended pulses but not as well as audio. It can reasonably reproduce a pulse, as long as the width doesn't become too small (for an audio bandwidth of 20kHz you would get a maximum pulse rise time of 17.5us for a 4ms pulse width), and provides enough gain for a 0-to-1V signal (can amplify a line level signal of 300mV RMS to the required 5V output). However it can have some issues in terms of impedance matching. The Sig Gen output impedance is 600, while the amp input impedance is 10k, so the output will contribute 6% error to the input voltage. There would also be other considerations, such as dc offsets, and other errors that would degrade precision and or accuracy.

So, you may get away with using the audio amp to get a good understanding of (qualify) how the pulse generation mechanism in the Phidget, or the pulse measurement system in the interface work. But to get a better appreciation of the scale of the errors that you are seeing (quantify) for pulse width/height etc, an Instrumentation amplifier would give you better precision and accuracy (and allow you to perform more precision interfacing in future applications).

Regarding equipment to use, the best way of fine tuning the duty cycle of a pulse or pulses in our PicoScope 6 software would be to use the AWG (which also gives you the highest frequency resolution). As an example, in the Signal Generator you can create a frequency of 125 Hz (which represents a 8ms period) and then use the AWG to create a single cycle square-wave waveform. The positive going pulse part of the waveform occupies half of the AWG graph (half of the AWG waveform buffer) so it has the 4ms duration you were looking for. The AWG waveform buffer has a number of sample points and, for example, in the PicoScope 2204A this number is 4096 (which means that the pulse occupies 2048 samples). So, if you want to change the duty cycle of the poitive going pulse, you can load in a new waveform as a CSV file (created in Excel) that moves the pulse width wider or narrower by one sample point. This means that the smallest movement that you can make, in the AWG of the PicoScope 2204A will be 1/2048 of 4ms which is 2us. So if you want to be able to change the pulse width by 1us you will need a PicoScope with a slightly bigger Waveform buffer for the AWG. The PicoScope 2405A and 2205A MSO have waveform buffers of 8KS (8192 samples) so one of these would give you the frequency resolution that you would need.

Regarding USB decoding we are only able to decode up to Full-Speed USB. However, for USB, the data you would have got from the decoder at High-Speed would only enable you to verify the integrity of the USB transmission medium, in terms of correct transmission and reception of individual packets. For protocol decoding you really need more sophisticated tools such as protocol analyzers. As you mentioned we can decode DCC.

So, unfortunately, there is nothing that we have discussed so far that will significantly narrow down your choice of PicoScope (even the DCC example we post here: https://www.picotech.com/library/oscill ... l-decoding uses our entry level 2000 Series of PicoScopes). What I would recommend is consider the potential uses that you may have in mind for the equipment (bearing in mind that serial decoding will be more dependent upon the buffer size of the PicoScope for protocols that require more data to be captured at once). Once you have your application wish-list visit our guide here: https://www.picotech.com/library/applic ... e-tutorial, to clarify your selection criteria, then go to our interactive Oscilloscope Comparison Chart here: https://www.picotech.com/products/oscil ... ifications to narrow down your choices. You can then use the individual specifications for the remaining PicoScopes to find the best fit, or contact us at the help desk (which you can also do at any point in the process), to discuss specifics.

I hope this is helpful,

Regards,

Gerry
Gerry
Technical Specialist

mihai.albert
User
User
Posts: 3
Joined: Sun Feb 25, 2018 9:17 pm

Re: Speedometer Setup

Post by mihai.albert »

Thank you for the detailed reply, Gerry.

To begin with - one of the “generator”’s (Phidget 1018) digital output is controlled by my code running on the PC. At specific time intervals the code either sets the output level to off (0V) or to on (5V). So as you said the pulse width is determined coarsely by me – even I can see through USB monitoring software that the packets generated by my code reach the USB driver stack as intended (time difference of only a few us) - the remaining part until the actual USB cable and what goes on in the generator itself I have no control over. Like you specified - it will make more sense to apply the AWG signal directly to the "counter" board to bypass all those things I don't have control over.

Regarding the memory available for the AWG – I’m seeing that the 2204A has a memory of 8kS available in the specs. You mentioned the AWG waveform buffer for this model only has 4096 bytes – that is half of the number listed in the specs. This is the same as for 2205A (as regards to half of the total memory). However the 2405A has a memory of 48kS. Thus the 8kS waveform buffer would only represent a fraction of the scope’s memory available. I’ve looked at the detailed specifications pages but couldn’t find the value for the waveform buffer memory. Did I miss something ?

Regarding the amplifier – the Picoscope's AWG output connector type is BNC. The easiest thing - at least in my view - for using the supplied Picoscope AWG cable connector would be to get an instrumentation amplifier that has BNC both as input and as output. Could you recommend one such an instrumentation amplifier that you’ve previously used (perhaps in tests) that was connected to a Picoscope and had the right characteristics (in terms of impedance (600), settling time, etc) or at least a pointer in the right direction ? I realize that there are lots of options to choose from (eg Analog Devices has a list here, however all look to be IC components) but a starting point would help me.

Thank you also for the comparison and the scope choosing article links !


Regards,
Mihai

Gerry
PICO STAFF
PICO STAFF
Posts: 1145
Joined: Mon Aug 11, 2014 11:14 am

Re: Speedometer Setup

Post by Gerry »

Hi Mihai,

The waveform buffer is a separate entity to the sample buffer, and the sizes are under the Arbitrary Waveform Generator section of the specifications for the PicoScopes. You need to scroll down quite far to get to them.

Regarding Instrumentation amplifiers, we don't have a specific one that we use, and it's not normally our policy to recommend anything that we haven't thoroughly vetted. However, information on selecting an Instrumentation Amplifier is very scarce, and finding a flexible enough module (so that you don't have to build one yourself) is difficult or time consuming. So, in the interest of at least providing a starting point for customers, I will give you my thoughts on it and give you options to make your own selection.

In general Instr. Amps should all have the right characteristics in terms of input impedance (which will be high enough, as the typical construction is 2 op-amps buffering the input, and then driving a third as a differential) you would just need to make sure that the bandwidth is high enough to preserve your pulse shape, the gain is low enough and the output level low enough to not exceed 5V and the gain adjustment is fine enough to give you the accuracy needed by the interface board.

Regarding which one to go for, you could look at a module like this:
https://www.amazon.co.uk/SODIAL-Microvo ... ier+module, which is a common board layout for a basic Instr. Amp. It's advantages are as follows:
  • As it is built by different manufacturers, you have a reasonably well tested design, and potentially have a number of different places to go for documentation and help.
    The board is simple to set up giving you clearly adjustable gain and offset.
    The board only needs one power supply
    The board is low cost
The disadvantages are:
  • You have no idea of the quality of the board construction, and the manufacturers are less likely to support you.
    There are no connectors (you would have to use terminal connectors, or solder directly on to the board, the BNC cable for the scope, along with the cable for the connectors on your interface board).
    The board would work for your current application but, because it's not configurable, may not be as useful for future application requirements.
Alternatively, you can go for proven Instrumentation Amplifier Evaluation Modules from amplifier chip manufacturers (such as TI, Analog Devices, etc), e.g. this one: http://www.ti.com/lit/ug/slou037/slou037.pdf, which is available from reputable distributors such as Farnell here: http://uk.farnell.com/texas-instruments ... dp/2379305. The advantages are that:
  • The design is proven, as the manufacturer of the board is also the manufacturer of the silicon, and therefore the documentation is more comprehensive than you will need, and there is likely to be manufacturer support.
    You can typically configure the boards in different ways, e.g. 2 separate amps, one differential amp, pre-amp outputs, amp inputs for filtering, etc.
    The board has BNC connectors
The disadvantages are that:
  • The board needs a more than just one power supply.
    The board is quite complex (it's an evaluation board intended for as many different applications as possible) and can be a little difficult to setup, for someone with a limited background in electronics.
    The board is more expensive.
Note that these are, by no means, the only 2 choices that you have, and there may be other forum users with experience of a more suitable option (you used to be able to find good quality, flexible, simple to use, enclosed modules, rather than just boards, but I guess times change).

Regards,

Gerry
Gerry
Technical Specialist

mihai.albert
User
User
Posts: 3
Joined: Sun Feb 25, 2018 9:17 pm

Re: Speedometer Setup

Post by mihai.albert »

Thank you again for the details, Gerry. I've went ahead and ordered the THS7002EVM. One thing I've noticed however is that its input impedance is 50 ohms (regardless of the 2 channels being used, there's a 50 ohm resistor connected to the ground for each), while the function generator modules of the PicoScope 2000 and 3000 series both have an output impedance of 600 ohms. The function generator of the 5000 series does have an output impedance of 50 ohms, however the first entry model here is way above my budget. Therefore, for the 2000 and 3000 series, should impedance matching be done in order to successfully connect to the THS7002EVM ? Would something like this be appropriate to insert between the BNC AWG connector and one the THS7002EVM's inputs ?


Regards,
Mihai

Gerry
PICO STAFF
PICO STAFF
Posts: 1145
Joined: Mon Aug 11, 2014 11:14 am

Re: Speedometer Setup

Post by Gerry »

Hi Mihai,

It would be a risk using the impedance matcher because it would actually attenuate the signal voltage by too much. The Impedance matcher has an insertion loss of 16.6dB, which means that, as the maximum gain of the board is 20dB you would only have a gain of 3.4dB. A gain of 3.4dB in power terms would give you a voltage amplification from 2V to about 4.4V which may or may not be enough.

I have contacted T.I. and they have recommended a very simple modification to the board, so I would recommend going the route of contacting them (https://myportal.ti.com/portal/dt?lt=my ... nId%3D2093) and establishing a channel of communication with them so that they can help you with any further issues, e.g. setting the board up.

If you have any problems with this then contact me at support@picotech.com and we will help you further.

Regards,

Gerry
Gerry
Technical Specialist

Post Reply