I've managed to get my hands on a bmw e36 instrument cluster, and the next step is to manage to make the speedometer, rev counter, fuel and coolant temp work. I do believe i have to use the PWM to keep the motor at a given position, although i have not managed yet. I found someone who has managed, and got the code, but it is way to complicated to read or even understand at least 20% of it. My humbly request is if someone is willing to take a look and erase the non essentials (i.e. comunication between other arduinos ) and explain a little what is going on there. all i want for the moment is to manage to move the damn rev counter.
no, i have not uploaded it on the arduino because i don't understand exactly what it does. what i want to do is use a pin for each motor ( gauge) and move it. the cluster is powered by a 12 v source, it has a common ground with the arduino, and the pins are connected to each responsible pin on the cluster. yes, i have identified the correct pins. the code is too complex, full of many things i do not need. for example, the nokia display code is not useful, but i have not worked with that sort of item, so i can't know what i need/can delete from it
The tacho seems to be controlled by a function called rpmTone.
The sketch you provided makes a couple of calls:
rpmTone.begin(pinTacho);
and
rpmTone.play(freq);
without having access to the rest of the code (SimHud is big) I would say that rpmTone.begin() sets up the pin mode.
rpmTone.play will both produce a sound on external hardware, and also produce a pulse (freq) on the pin assigned to pinTacho
If you are trying to use this cluster to build your own Hud using SimHud, I would recommend that you spend some time on the forums there.
If you're wanting something else, start by applying pulse frequencies to the pin and see what happens
I think you’ll find the gauges are driven by stepper motors, you could use some of the stepper library examples to drive them .
I’ve read somewhere on this forum that someone is developing some code specifically for this type of motor.
darrob:
Where did you manage to find that lot? None of that code is in the sketch provided!
Fantastic bit of help. Kudos
It was all in there, just poorly written and widely disbursed. I extracted the useful parts and cleaned up the code to make it readable. I don't know why Pin 5 is being used for two separate PWM outputs or why Pin 4 is being used with analogWrite().