12V GPIO on the back of the interface card


I was looking at the schematics, and I noticed that it has 6 GPIO ports that are tied to 12V drivers, and are fused at 750 mA. I was curious to see if this would be enough to power a small dashcam (Street Guardian SG9665GC). I currently have it plugged into the accessory 12V port using the included adapter which steps the voltage down to 5V (USB power level). I doubt it’s even pulling 500 mA at 5V, so it should pull even less at 12V.

The safest thing I could do would be to connect a relay, but if the M2 can power it directly, that would be a lot simpler.


The included adapter should tell you what amperage it outputs as well as voltage; then as long as the M2 at least matches that, you’re good. I suspect it is going to be fine, 750mA is quite a lot, but I absolutely would not recommend using the board to power anything more than a pot or sensors.

1 Like

For those same GPIO ports what would the lower level trigger point be to be seen as a digital ON? Or is this flexible and setup somewhere?


Seems unwise. Relay is pretty straightforward. I haven’t got much of an idea how much heat these generate when doing interesting things, but I’d imagine that’s a concern.


Indeed, there are 6 general purpose 12V IO pins available on the 26 pin connector. However, one thing that is still on the TO-DO list is a nice library to make it easier to use these pins. I’d love to be able to do something like this in the main program:

12VIO_setpin(3, SOURCE) // sets output 3 to source 12 volts
12VIO_setpin(4, SINK) // sets output 4 to sink
12VIO_setpin(5, AIN)  // set pin 5 to Analog input
12VIO_setpin(6, DIN)  // set pin 5 to Digital input
12VIO_PWM(3, 75) // put 75% duty cycle on pin 3
12VIO_LOW(4) // drive pin 4 LOW

…or something like that… We should probably follow whatever convention Arduino has going.

In addition, it would be cool to take advantage of the following:

  • built in current sensing of the switched 12V I/O and an adjustable OVER_CURRENT flag.

  • 6 Channels of 12V I/O can be turned on/off via 12Vio_EN

  • Power monitoring possible when combined with voltage monitoring of Vin (AD3).

Anyone out there want to work together on this library?


The arduino way would be to have “pinMode” for setting whether you’re going to use a pin for output or input and then digitalWrite to set whether an output is high or low. But, technically the pins on the M2 are tristate so it should probably be HIGH, LOW, FLOATING. Floating doesn’t do the end user a lot of good but it’s a nice in between state that one could use to ensure that a pin doesn’t try to do anything funny if it is disconnected and dangling. For PWM Arduino uses analogWrite. Obviously the Arduino core already reserves those function names so they’d have to be changed. Since you actually can’t start function names with numbers 12VIO_xxx is out but maybe IO12V_pinMode, IO12V_digitalWrite, etc could be done. That way the functions could work just like the built-in Arduino functions and have basically the same names too.

I do plan to use the digital IO pins at some point but who knows if/when I’d ever get around to writing up a decent library for that.

One thing that appears to be a very important reason for a library is that it seems entirely possible to turn on both the upper and lower mosfet at the same time and short the bus together through both mosfets. That’s no bueno if you do that. That actually brings up an important distinction with PWM too. You can PWM two ways: either chop ground or 12V with floating as he rest state OR transition back and forth between 12V and GND on the same pin. The latter approach is how motor controllers work. Technically one could probably do such bi-polar PWM on the M2 but it doesn’t seem to really be constructed for that. It would be far easier to just do chopping of either GND or 12V with the transition state being “floating.” But, any way you go you don’t want accidents to create bus shorts. So, a proper library would be a good idea so that the library can internally enforce a sane state of affairs.


Hi Collin
I agree with all your your comments. I have been in contact with Josh & have started writing a library for the control of the 12Volt digital IO pins & abstracting away the Arduino pinMode & digitalWrite & AnalogWrite & AnalogRead. functions to simple calls to the library functions using a reference to the numbered output pins like Output_1, Output_2 or something similar along with either Source or Sink. internally in the function the function will check if the output was in Sink mode previously if we are now setting the output to Source & will disable the previously set Source mode & then enable the Sink mode & Vice a Versa & thus protect against the possibility of creating a short across the 12 Volt supply to Ground.
The Library will also monitor the current being supplied bye the M2 when any of the pins are in source mode & be able to return to the user the total current being drawn & if the total current drawn in Source mode exceed the maximum current allowed generate an error flag & turn off all Source configured outputs.
Bye having the library control the toggling between Source & Sink this will open up the possibility to have both option available to the end user to PWM the output by either means of chopping the output ON & OFF in Source or Sink or alternate the output to Source & then Sink. I have a few other thoughts for the use of the outputs & controlling same but will save these thoughts for a later discussion after i have proven the concepts.