Here’s my dilemma, I’ve got a Raspberry Pi 3 and a PiCAN 2 CANBus shield, BUT the shield blocks/uses the entire header and I have a bunch of other things I need to do:
Monitor voltage of battery 1 (~12v)
Monitor voltage of battery 2 (~12v)
Monitor dual battery system status (~12v, high/low)
GPS
Accelerometer
Anyone have an idea on how I can cram all this stuff onto a single raspberry pi or do I need to just design a board to do everything?
USB connection to an Arduino (or other micro controller) to read that data and serially report back? Or an Adafruit pi protoboard with header pass (stacking headers) through if some of the pins are not being used, but just blocked.
The PiCAN appears to use SPI, so I would use I2C for the battery voltages. Depending on what you need, you might be able to share SPI for the accelerometer with the PiCAN… or just use a lower-speed I2C accel.
I want to say there are stackable breakout boards. I think you would be fine as long as don’t try to use the spi for other devices. I take you are making a carpi without the radio? I started working on mine but got side tracked as usual, but I’m not tying into my ODB.
SPI can be used for multiple devices. WIth SPI the key is that the chip select pin needs to be different for each of the devices, and that no two of the chip selects be active at the same time. Even if you can’t control the PiCAN access to the SPI pins you can use some external logic chips to ensure that you never activate your chip select if the other is active. A little cumbersome, but doable if you really need to.
Ok, good news. I got a response from SK Pang, apparently the header on the bottom of the PiCAN just slides in and can be replaced by one with longer pins, allowing full access to the 40pin GPIO header.
Now all I have to figure out is how to measure the 12v batteries without blowing things up
You might also consider a cap in parallel with Z2, which will both filter the input signal and provide a reservoir for overvoltage transients as well as a TVS diode and another smallish (~100 Ohm) resistor from Vout to the RPi.
Belt and suspenders when you might have ESD or a load dump to deal with.
Edit: On second look, the resistors in the divider can probably go up an order of magnitude without issue for lower current draw, or (not and) increasing the Vout resistor to 1k is also possible for increased protection.
I made a board to do exactly this. It has two voltage and two differential inputs for current shunts. Has 485 receiver for GPS and i2C/SPI brought out for a sparkfun/adafruit board could be wired to. Also has a 1 wire bus driver for remote temperature sensors.
Have tested all of the board, only bodged the high current output FET packages pretty simple fix. Can sell you at cost board and parts if interested. Can also give you KiCAD and CAD if interested. Was for a remote boat security system but I got stuck on the software side pulling everything into a nice web interface. have a case designed for it to.
yeah there is a lot of crap on the board, figured if I am going to make a board should put everything and the kitchen sink on it. Bulk of the parts are ESD/Surge protection since vehicles are so noisy and the Pi being engineered to a price is a bit delicate. I can share the KiCAD if that would be useful. Unfortunately I have lost all of my perl scripts for grabbing the voltage, current and temps off the I2C bus.