Hi GPForverer2024 and all!
Almost there! I have attached pics of the circuit I built, and a quick video (Its a pretty low quality video, I'll probably do a better one at some point).
All that remains is for me to tidy the code that enables this to run and write some instructions. I've made a new utility called "scoreboard_to_revcounter.exe". This runs on your PC, it reads the Rev values from a running MGPr game, and translates these to RPM values that get sent to the Arduino. I've also wrote a program that runs on the Arduino (Called arduino_rev_sim.ino) which receives these RPM values, and generates corresponding pulses to drive the physical revcounter. I'll provide the source code to both in a new MGPr package. It should be quite easy for anyone to modify scoreboard_to_revcounter & arduino_rev_sim to work with any game, not just MGPr. Hopefully I'll have this all ready and documented in a day or two.
The video shows scoreboard_to_revcounter.exe running in 'demo' mode, followed by it runnning in 'game' mode. In demo mode, MGPr doesn't need to be running, it just cycles though various RPMs so you can check you've specified the RPM range accurately. For example, I run scoreboard_to_revcounter.exe specifying an RPM range of 8000. Part 1 of the demo tests RPMs that increase at 25% steps of the range (0 RPM, 2000RPM, 4000RPM, 6000RPM and 8000RPM and back down). Part 2 of the demo tests RPMs that increase at 2.5% steps of the range (0 RPM, 200 RPM, 400 RPM etc...). If, say, I ran the demo and noticed the needle didn't quite reach the top of the range, I could specify a scoreboard_to_revcounter.exe RPM range to be something like 8100RPM until the needle hits the spot. When MGPr is running, scoreboard_to_revcounter.exe will convert MGPr's Rev value to an RPM proportional to your specified range. Hope that makes sense?
Regarding the circuit:There are probably better ways to build this circuit (From what I read online, the TIP120 transistor and the 1N5400 diode are quite 'old' components these days, they can also handle lots more voltage/current that I'm going to put through them, so they're arguably a bit over-the-top). However, browsing for revcounter circuits, everyone seems to be using the TIP120/1N5400 arrangement and as these components are cheap and available, I thought I'd do the same.
I need to say a big thanks to 'tylerpeppy' who is a member of the Arduino forum. He's uploaded some very detailed Arduino projects to the site, including this revcounter one which I copied
https://projecthub.arduino.cc/tylerpeppy/arduino-car-tachometer-simulator-no-simhub-f9fd0f. I actually used bits of his circuit diagram to make mine. My circuit is just a slightly rearranged version of his. You should be able to match my circuit diagram with what I built on the breadboard.
If you are buying a revcounter, be sure to get one that is compatible with a 2, 3, 4, 5, 6 or 8-cylinder Petrol engine, and runs off a 12v source.
I'm using a really old Arduino UNO board, but I think my arduino_rev_sim.ino program would run just fine on an Arduino Nano, Teensy board etc. (Anything compatible with the Arduino IDE, that you can upload *.ino files to should just work).
The Arduino sends the pulses to the revcounter out on Pin13. I picked Pin13 because it has an onboard LED connected to it. Thus without any circuit connected to Arduino, you can see the onboard LED flicker at a speed dependent on the pulses its trying to generate (So you can have confidence things are working before connecting it to any circuit). The pulses that output from the Arduino have 5v peaks. The revcounter needs a tacho source signal that has 12v peaks. The small Arduino signal pulses go into the base (B) of the TIP120 Transistor switching it on and off like a tap, As a result, the Transistor emits (E) larger 12v pulses.
There is no switch for the revcounter backlight light in the actual circuit I made (the yellow wire), its just permanently connected to 12v (I.e. Permanently on). But you could put a relay in there, switch the backlight on everytime you start a game perhaps?
You'll notice I'm using a 220 ohm resistor. Some people say use a 2.2K ohm resistor but it really doesn't matter. I've tried both and everything works fine. The resistor isn't there to protect the transistor, it is there to reduce current drawn from the Arduino. If you've got loads of other stuff connected to the other Arduino output pins then saving current might be important. As I've only got 1 output pin in use, this isn't a concern.
The legs of the transistor and diode were so thick I couldn't push them into my bread board. That's why you'll see I soldered thin wires to their legs.
The Diode (Which, at first, looks like its been placed the wrong way round) is there to protect the transistor when the +12v PSU is unexpectedly powered off. In normal operation (Where the +12v source is either greater than or equal to the Tacho source signal) the Diode acts as if it were open circuit. Should, however, the +12v supply be switched off when the revcounter is in full swing, then the Diode will conduct. Apparently, some revcounters act like inductors and build up charge. When the +12v PSU is unexpectedly powered off, the diode ensures any built up charge is routed away from the transistor and thus protecting it.
Regarding my KET105 Revcounter/Tachometer:I do think it looks good and its needle movement is just about fast enough. The cylinder switch at the back (Allowing you to choose between 2,3,4,5,6 or 8 cylinders) works well.
Something worth mentioning (That I believe is quite common with most off-the-shelf revcounters), is that they have trouble reading very low RPMs. My revcounter needle moves oddly (bounces around) when you send it less than, 600 RPM at 2-cylinder. This is probably OK as most engines would stall if you tried to run them this slow. I did notice increasing to 8 cylinder vastly improved things (Where you'd only see the oddness starting at less that 150RPM. I worked around this in my software, you can set a 'Stall RPM' where anything below a particular RPM will just send no pulses to the revcounter (and its needle will just drop to zero).
Wow, probably too much information here! Well done if you made it to the end!
