duminică, 25 noiembrie 2018

Speedometers

Since initial attempts at getting the real-time speed for a locomotive as this decelerates and comes to a stop proved cumbersome (to say at least), I've looked around to see if anyone manufactures devices for reading the instant speed of a locomotive - and more importantly - sends this info to the PC. Sure enough, I found Bachrus, which were doing this for quite a while.
I've went ahead and ordered 2 such speedometers - which are really just regular elements of a classic roller stand with a mechanism to relay the wheel speed to a PC, along with some other "saddles" for placing the rest of the wheels. The first photo shows 2 regular saddles under the left bogie of the Brawa V100 and 2 speedometers on the right bogie - easily identified by a red wheel each - positioned in opposite directions so they can successfully fit on the same bogie. The purchase of all the kits was done in August 2017. 
   Unfortunately, while writing this post, and not understanding why their website isn't reachable any longer, it appears that the company owner - which was kind enough to provide technical details over email at the time - has since retired, and as such the website and Youtube channel no longer work as of today (Nov 2018). Nonetheless, the link above contains a pointer to an archive of the website as it was back when it was up.

  Back to the speedometer itself - the way it works is similar to the old ball mouse. The red wheel of the speedometer is connected by a shaft to the black wheel with "slits" - as seen in the 2nd photo. These "slits"either let - or prevent - light from a LED hit an optical detector located across. This can be seen very well in the 3rd photo, showing the same black wheel as before mounted in its place, where the enclosing "chair" - soldered to the green PCB - has a pair of LED emitter and detector that end up resting on each side of the wheel. The wire seen leading from the edge of the enclosing is connected to an interface (photo 4) by means of an audio jack. The other end of the interface is connected to a standard USB cable, which is then hooked to a computer.


  I've spent quite some time understanding how the device works internally. The technical data received from Bachrus - as mentioned above - pointed me in the right direction. I needed this in order to understand when are the speed values sent across the wire, and also to know the expected accuracy of the device. Keeping the nitty gritty details out for now, the speedometer counts the time it takes for a "slit" to pass in front of the optical detector. The "counting" is done using a timer clocked at 1.5 MHz, powered by a PIC18F13K50 microcontroller inside the interface (the black box saying "MTS-DCC"). Once the "slit" has passed, the timer is stopped and the value noted. The interface averages 4 such consecutive counter values, and sends the value across the USB cable to the PC.


  As for the accuracy of the device - there's nothing mechanical I had at hand that would come close to rotating with a constant speed. A locomotive - although on track seems to be cruising at the same exact speed - is shown by the speedometer to vary its instantaneous speed quite significantly. The next best thing was "simulating" a perfectly constant rotating black "slit" wheel. How ? By tricking the interface into believing it's receiving signals from the speedometer, when in fact an emulator circuit is generating specifically crafted electrical signals, timed very accurately. This was done using the AWG (Arbitrary Waveform Generator) module of a PC-based oscilloscope (Picoscope 2206B) - purchased specifically for this - and a couple of electronic components on a breadboard. The results were quite impressive - just take a look at the chart below. In this particular instance the hardware setup was configured to simulate a constant speed by generating pulses every 0.5 milliseconds. The horizontal axis shows the actual time values measured, while the vertical axis shows the number of instances encountered for each time value. Summing the number of values within +/-1 microsecond of the target 0.5 milliseconds, this represents 99.947% of all the values. Therefore at least the electrical part of the speedometer is pretty exact. Provided there's no wheel slippage from the locomotive while running across the red wheel of the speedometer, the values measured should be pretty exact.

  As for the formula for the instant speed, and the speed variance measured for the locomotives tested, this will be treated in a future post. Otherwise this introductory post would become quite extensive.

Update 1/5/2020: Bachrus has since closed down. The specification that was provided to me back when I wrote this post is here.


2 comentarii:

  1. I wondered if you still had his email for bachrus or the information on the dcc interface and the circuit involved. I have won the ruling road on ebay but I need to find the dcc interface or build the circuit thanks Andy willsher

    RăspundețiȘtergere
  2. Sorry for the late reply. I've updated the article with a link to the interface specs. The DCC interface was designed by an external company, and that PDF is pretty much all that's left, aside the hardware devices themselves.

    RăspundețiȘtergere