Last week, when we looked at my code for the BlueFruit autostart, we came to realize that if it did not know that the truck was started, it would continue to crank, even if it was running. This is not good. Thinking about it, it seemed obvious that a simple solution would be voltage detection. While I still need to tailor the detected voltage, I think this will get the job done:

// read the input on analog pin 5:
int voltValue = analogRead(A5);
float voltVoltage = voltValue * (3.6 / 1023.0);
if (voltVoltage >= 0.8) {
// It has enough voltage, it is running.
Serial.print(“Pin A5: “);Serial.println(voltVoltage);
runBool = true;
} else {
// Not enough voltage, must not be running.
runBool = false;

if (runBool) {
// Since it is running, make sure we are not cranking!
crankTimer = -1;
startTimer = -1;
digitalWrite(15, LOW);
digitalWrite(11, HIGH);

While reading the voltage on A05, it will be able to discern if the engine is running or not, and state so as a boolean (true/false). I also added the option for it to retry to start after failing to do so. You can check out the whole project, and this commit on my GitHub.

It seems to flow through nicely, which is a plus.


One problem that I have, however, is that anything read on A5 also seems to read a smaller portion, but a portion none-the-less, on A0 (brake light detection). Anything read on A0 assumes that you are trying to push the brakes and turns off the autostart, which becomes problematic. Obviously, this is some sort of failure on my part to understand how or why this happens, and I’m going to need to look into it further.

Linux – keep it simple.

Leave a Reply

Your email address will not be published. Required fields are marked *