I managed to wire for frequency modulated PWM signal for speedo on Out7. I first connected 10K pullup to 12V directly and applied tone() function at 25Hz. I couldnt get speedo to move so i remembered i had similar problems with Peugeot RPM dial.
So i added one 1uF film cap on the line in series. This made signal go down and cross 0V and i got speedo to run!
Now i simply had to program code to move needle with change with motor RPM.
I set it up so that code picks up motorRPM and calculate the speed of the wheels. Then i factor this with a frequency multiplier for speedo which is allways the same.
void Speedo()
{
if (timer100_4.check() == 1)
{
calcspeed = (motorRPM / ratio) * tireD * 3.14 * 60 / 1000; // speed = wheelsRPM * tireD * PI * 60 / 1000 Km/h
calcHz = calcspeed * 1.4;
if (calcHz >= 0) { //when rpm in positive direction
calcHzi = calcHz;
}
else { //when rpm is in reverse
calcHzi = calcHz * (-1);
}
tone(OUT7, calcHzi);
//analogWriteFrequency(OUT7, calcHzi);
}
}
Next item would be to change the code to show motor amp draw. I would apply the second PWM output which was programmed to signal motor temp and display motor amp draw on RPM dial.
Super MAGLEV živi dalje