Creating uart or ICSP device for multiple sensor input

I have a full kit 3 from freematics to hook up an arduino mega to the OBD2 plug in the vehicle. It uses the UTFT multi LCD linked here:

I'm more of a software developer so the hardware side is confusing. The screen shield already has the OBD2 plug into the I2C port and a GPS module on the UART2 plug. That leaves UART1 on the LCD or the ICSP connector on the mega itself open for input. Is that correct so far?

I'm not entirely sure what pins aren't used up by the screen as I'm still reading through the documentation and I don't specifically see that just yet.

My goal is to create a unit/device/whatever that just plugs in and can be poled for a variable number of input sensors manually placed around the car that the OBD2 system doesn't already log. For example: clutch switch, accelerometer, temperature sensor, steering wheel sensor, or anything else that can be plugged in.

The simple solution is likely to find unused analog pins or digital (for the clutch switch right?) and use those but that doesn't leave things open for easy expansion later on. I'd ideally like to just wire in new sensors, write some code, and be done.

I feel like this isn't rocket surgery and has probably already been done but my google searches have come up pretty dry. I will continue to search but any information or pokes in the right direction would be greatly appreciated.

Right, the "data sheet" is a joke :frowning:

I'd guess that all pins on the headers of the shield can be used, including I2C, Serial1 and Serial2 (for your GPS module).

SPI should be usable from the SD card pins (SD_), dunno what the T_ pins are good for (touch pad?).

Eventually you should insert a prototype shield, for access to the analog inputs, which most probably are not used by the shield. The ports F and K should be usable for either analog input or digital I/O.

Thanks for the reply! I'm not sure what yo umean by "all the pins on the headers of the shield can be used".

I'm currently using the SD card pins to log data to the mini SD card. The T_ pins are for the touch screen outputs (which are pretty cool).

I do suppose 16 analog inputs should be good enough for all of my external IO, so just a protoshield should be good enough. (EG Mega protoshield for Arduino : ID 192 : $14.95 : Adafruit Industries, Unique & fun DIY electronics and kits)

What are ports F and K?

I was thinking about making something external to just plug into the spare UART plug. But that seems difficult? Maybe I could get another arduino to gather all the analog/digital inputs and output it to a UART plug?

I meant that all signals on the shield headers can be used for other purposes, are not exclusively used by the shield.

A Mega controller (ATmega2561) has several 8 bit ports (A-K), whose pins can be used for digital I/O or special purposes (UART, PWM, SPI, analog inputs...).

Another (detached) controller makes sense in detail with long transmission lines, but is not a must. Details depend on your sensors and their interfaces. RS-232 is for point-to-point connections, while ODB, I2C or SPI are bus systems, which allow to connect multiple (slave) devices at the same time.

Ah so the UART plug can't do more than 1 io. That would explain why the kit has an I2C OBD2 plug with a MEMS accelerometer but the UART version is just the OBD2 reader.

So inherently, UART is not the answer to my problems. The ICSP plug in the middle of the board might be better then maybe? I'm planning to run wiring throughout the vehicle so an external unit makes tons more sense. I know for a fact that one currently connects to nothing.

The two ICSP headers connect to the USB and to the Mega Controller. Take care to use the right header, else you risk to program the USB controller.

Pretty sure this is the good one I can use. I'll do some googling. Thank you for the input!

That header has
Reset Gnd

MISO, SCK, MOSI are also 50-51-52 (check the Mega schematic on the Products page to get them correct), with Slave Select on 53.

MISO, SCK, MOSI are also 50-51-52 (check the Mega schematic on the Products page to get them correct), with Slave Select on 53.

Right, these are the exact pins which also are exposed on the SD card header of the shield.

I do see that pin 53 is being used as slave select in the code. So I'm guessing either that means it's already used by the SD card (and thus I can't use it) or that I'll be on the same bus and potentially slowing everything down?

It's the same pins, same bus. Each device on that bus needs its own select signal, from a different output pin.

So I can attach to the ones in my picture, find a different digital pin to use as my SS pin and basically add to that SPI bus. I think I got the concept. Now I just need to figure out how to make something that would fit that lol. Perhaps another arduino set as the slave.

This is both tons of fun and infuriating lol.

After tons more reading, adding to the I2C bus on the side of the LCD seems to be the simplest option. I picked up an Arduino Uno but the MCP23017 expander would have made more (cheaper) sense. Oh well. At least this way I don't have to put on an expander shield and the unit will stay relatively clean.

Edit: The MCP23017 is only digital IO though. Oh well.