BlueFruit Project: Analog and Digital Detection (Code Name ADD)

From the post last week, you can see that I ran into a snag with the BlueFruit Feather board. It should be able to read the analog inputs separate from one another, but for some odd reason, taking a 3.3vdc reading on A0 would return 3.3vdc on A0 and ~1.4vdc on A3, and vice versa when reading the other way. This is problematic, as I have A3 as the battery indicator and A0 as the brake light indicator.

The A3 battery indicator tells the circuit if the truck has started, due to the alternator kicking in and the voltage climbing over 14vdc. The A0 brake light indicator tells the circuit to shut down, because the user pushed the brakes. Can’t have both. I jumped onto the Adafruit Forums, and found some really helpful people there. However, I wasn’t able to find a reason for my dilemma.

Thus, I created a work around.

auto

I really need to know what voltage the battery is, however, I don’t need to know the voltage of the brake lights, just that the brake lights were pressed. So the battery voltage needs to be a fine tuned analog signal. The brake lights just need to answer the question of on or off, true or false, 1 or 0. Wait! 1 or 0 is binary, which is digital! What if I just had a digital representative for the brakes?

I’m currently re-working my schematics, but here is the gist of what I want to do with the brakes (only the relevant part of the circuit is shown):

brakelights

This will indicate high on the digital circuit, which usually needs above 3 vdc to read high. Test runs were good on my desk, so I’m going to press forward with it. You can check out the full commit on my GitHub, but here is the relevant portion:

// read the input on digital pin 30:
int sensorValue = digitalRead(30);
// print out the value you read:
if (sensorValue == 1) {
Serial.println(“Pin 30 HIGH “);
// Brakes have been pushed, shut down all autostart circuits.
// This will not affect actual engine run circuits, just the autostart
// ones. So the engine will stay running if the key is in and on.
digitalWrite(16, LOW);
digitalWrite(15, LOW);
digitalWrite(7, HIGH);
digitalWrite(11, HIGH);
crankTimer = -1;
startTimer = -1;
runTimer = -1;
startAttempts = -1;
Serial.println(” Kill All – Brakes pressed. “);
}

Just about done with the BlueFruit programming! Now I need to work on the app programming and iron out and construct the electronics portion.

Linux – keep it simple.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s