Macchina 2.0 has 6 General Purpose 12 volt Input/Output Driver circuits.

[TO DO: Add diagram and photos]

[TO DO: Add description of connector, wire harness, where to buy parts, etc]

Each pin is capable of:
Sourcing (pulling high to 12 volt rail) [current capability TBD]
Sinking (pulling low to GND) [current capability TBD]
Act as a analog input with a 0-12 volt range [resolution TBD]

When sourcing power, the 12V rail is monitored by an internal current monitor. The goal here is to be able to be able to dynamically measure how much power an external device is using AND ensure the the total power pulled from the OBD2 port does not exceed X amps and blow the car's OBD2 fuse.

12VIO library creation is in progress. The goal is to have an easy to use, simple library called "12VIO.h" (or something like that) to make it easy to set what each pin should be used for:

Calls would look something like this (feedback appreciated)

12VIO_setpin(3, SOURCE) // sets output 3 to source 12 volts
12VIO_setpin(4, SINK) // sets output 4 to sink
12VIO_setpin(2, AIN) // sets output 2 to be analog input

12VIO_PWM(3, 75) // put 75% duty cycle on pin 3
12VIO_LOW(4) // drive pin 4 LOW
12VIO_READ(2) // read analog value of pin 2

Note that this library is especially important since it abstracts the lower-level drivers and ensures that circuit is controlled correctly. It is possible to create a direct short by not controlling correctly. [more information to follow]

Below is example sketch showing how to PWM a pin.

[TO DO: Add example of syncing and analog input]