This is the third in a series of designs for an Auto S/S Kill switch. A principal deficiency with my two former designs, is that they both based on an "open-loop" system. That is, the devices are unable to ascertain whether the SS disabling pulse has been successful: they send out one pulse only and they assume that the pulse has worked the first time.
Whilst this assumption has not been a problem with the device that I have fitted to my car, a better approach is to design the S/S Kill switch based on what system-control folk call a "closed loop" system; that is, a device that is able to monitor whether the kill pulse has been successful and if not, a design that is able to send-out more pulses until SS is actually disabled.
In this design, the S/S Kill switch looks-at the status of the VW SS LED that is mounted inside the SS disabling switch on the centre console. If this LED is illuminated, the SS Kill switch concludes that it has successfully performed its allocated function and it stops sending kill pulses. To cater for the possibility that the LED may be faulty, the new design also limits the total number of kill pulses to a maximum of 9. If it has not successfully disabled SS within these 9 pulses, the device stops operating. I've selected an odd-number for the maximum kill pulses because it leaves the SS facility disabled (an even-number would leave SS enabled)
The design of the "closed-loop" device is based on a "baby" Arduino, called the ATTiny which is not as powerful as it's better known sibling - but it is perfectly suited to this application. Because the ATTiny requires a 5Volt supply, I've opted to use the Digispark (see picture below) which is a kind-of "shield" that allows the ATTiny to operate in the 12 volt environment of a motor vehicle (the Digispark also has a couple of on-board LEDs which were handy in developing the program for the Auto S/S Kill switch).
ATTiny Program
The "smarts" for the closed-loop device is the (simple) program listed below. To help in understanding the code, I have included the flow diagram.
Code:
//*Automatic Start Stop Kill Switch - Digispark Code by DV52*//
int Digi_LED = 1; //Set P1 as LED on Digispark PCB.
int Relay = 2; //Set P2 as the SS Relay driver
int SS_LED = 3; //Set P3 as monitor for the SS LED on centre console
int counter = 0; //Initialise SS_Kill_pulse counter
int Kill_Max = 9; //Set Maximum number of SS_Kill_pulses
void setup() { //Initialize P1 and P2 as an output and P3 as input.
pinMode(Digi_LED, OUTPUT); //Set P1 - Digispark LED
pinMode(Relay, OUTPUT); //Set P2 - SS Relay driver
pinMode(SS_LED, INPUT); //Set P3 - SS console LED monitor
}
void loop() {
while (counter < Kill_Max) //Test for maximum number of SS_Kill_pulses
{
if (digitalRead(SS_LED) == HIGH) //Send SS_Kill_pulse if SS LED is NOT energised
{
digitalWrite(Digi_LED, HIGH); //Turn-on Digispark LED
digitalWrite(Relay, HIGH); //Turn-on Relay - SS_Kill_pulse inititated
delay(1000); //Wait one second
digitalWrite(Digi_LED, LOW); //Turn-off Digispark LED
digitalWrite(Relay, LOW); //Turn-off Relay
delay(500); //Wait half second before next SS_Kill_pulse
}
else
{
while (1) { } //SS disabled -send Digispark into endless loop
}
counter++; //Increment SS_Kil_pulse counter
}
while (2) { } //Max SS_Kill_pulses exceeded - send Digispark into endless loop
} //End
Circuit Diagram
The circuit diagram for the closed-loop device is shown below. I've included protection diodes on the opto-couplers for safety and I've shown two driver options (I've built both and they both work perfectly)
Construction
Construction of the device is straight forward - in my case, I mounted all the components for the input and output interfaces onto the track-side of a piece of "Vero board" (tip: solder-in the opto-couplers 1st). I then affixed the Digispark (once programmed) with double sided tape to the board-side of the Vero board and ran wires between the two as shown in the circuit diagram.
EDIT: A note on wire size - as mattaus observed when he installed the first test unit (see 4th video in post#79), large gauge wire will be problematic when splicing the device into the existing wiring loom in the car. The required electrical current in any of the new device's wires is infinitesimal and therefore only small diameter wire is needed. Small gauge wire will make the splicing process easier - without affecting operation.
The picture below shows details of the component layout for my vero-board construction.
The pictures below show the completed device. The device was slipped into a piece of heat shrink tubing (not shown) after testing.Testing after construction
I have programmed the LED on the Digispark as a visual test tool to verify the build, post-construction (see picture above). The Digispark LED is programmed to mimic the output stage. Once the device is built, its operation can be checked (before installation in the car) by connecting the +12V and Earth wires to a test-supply (like the ciggy-lighter, or a battery). The native bootloader in the Digispark enforces a mandatory 5 second delay before the program starts (which is perfect in this application). After applying power and waiting for this delay time, the LED should emit 9 pulses ( 1 sec on - 1/2 sec off). If the wire that is to be connected to PIN #7 of the centre console switch (see circuit diagram) is connected to the +12V test supply (before the 9 pulses are sent), the LED should extinguish - indicating that no more pulses will be sent. If both these tests are performed successfully, the device should be good-to-go!
Not sure if there are many here that are familiar with Arduino protocols. If you are not familiar with how to program the ATTiny, I can do this for you. PM and we can discuss the logistics - perhaps you send me an un-programmed Digispark and in exchange, I send you a programmed Digispark)
Don
Bookmarks