Need ideas for cramming a bunch of things onto a RPi

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.

1 Like

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.

Use UART for the GPS, and I think that’s got it?

This is the only way i can think of doing it

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 :slight_smile:

Z1 = 4.7k ohm
Z2 = 1k ohm

Vout = Vin * 1000/(4700+1000) ~= 14.4 * 0.175 ~= 2.53V Max reading

You can tweak the resistors a little bit if you want to maximize resolution, but don’t get too close to your max 3.3V since 3.3V can be less then 3.3…

3 Likes

The divider is good for this.

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.

2 Likes

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.

https://dl.dropboxusercontent.com/u/8122313/SecurePi_Sch_R1-01.pdf

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.

3 Likes

Here’s the board although if you want to make your own you’ll want to fix the FET packages
Order from OSH Park

Also here is the enclosure:

Thanks for the info, your board has a lot more stuff then I need for this project though.

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.

Yeah, the KiCAD file would be great. Thanks!

Let me know if this zip works. Not sure if it has everything KiCAD needs
https://www.dropbox.com/s/pmqdnq3e9cdqvy4/motion_pi_board.zip?dl=1