Search:

Motivation

I ran across a website several years ago about someone building a computer for their boat, based on a Raspberry Pi. Since I enjoy tinkering with electronics, I decided to do a similar project. I had recently got a Raspberry Pi 4, which is a pretty powerful single board computer. I decided to design a HAT that would provide power for the raspberry pi, and turn it on and off. Instead of just using a switch, I decided to have a microcontroller on the hat to monitor a pushbutton. When the button is pushed, then power is turned on for the raspberry pi, or it is told to turn itself off cleanly, once it turns itself off, the microcontroller can then shut off the 5V power. If you just cut the power by using a hardware switch, then the microsd card will soon get corrupted. I also wanted to turn the power on and off to the lcd panel I was using. In addition i wanted to have a few ADC channels since the raspberry pi didn't have that capability, and have a barometer device attached so I knew the atmospheric pressure.

The power for the Raspberry Pi is provided by the Adafruit MPM-3610 breakout board. There is a small power device to provide 3.3V power for the microcontroller, which is a ATmega328P device.

I routed all 8 of the microcontrollers adc channels to connectors. I connected the Raspberry Pi I2C bus to another connecter that the barometric pressure can use. I also included a solid state relay which provides 12V power to the video panel when the Raspberry Pi is powered on.

A connector that is wired to 5V power and the serial port of the Raspberry Pi is used for a GPS module. The GPS module that I'm using is the Adafruit Ultimate GPS breakout.

As required by the HAT spec, there is an eeprom chip on the board that is queried by the Raspberry Pi on bootup to set the state of the IO pins automatically.

Software

This project requires a large variety of software, that will be covered in a different post

Hardware Design

hardware github project

There is a related project, which is the display and pcb board housing for the Pixel Qi display that I am using with this boat computer.

Revision A

The first design of the board was complete in about December of 2020. I had the pcb manufactured by oshpark. I soldered on the components and tested out the board. It turned out that I had run one of the signals meant to communicate with the Raspberry Pi on the 3.3V line of the header. It took some time to figure out why it wasn't working right. Once I found the bad trace, I cut it on the board, and soldered a jumper to another pin to verify that it would work. Here is the Rev A board after the surface mount components were soldered on, before all the through pin components were soldered.

Chart Plotter Hat Rev A full size

Revision B

The next version of the hardware design was essentially the same, with the addition of an option to measure the voltage of the 12V input directly on one of the ADC inputs by completing a solder bridge and populating a voltage divider with resistors. This version was built in January of 2021. Also all connectors were changed to JST PH type connectors instead of the mix to fix existing components I had on hand for the original design. This board was used on my boat computer for about a year until I decided I needed a CAN controller as well.

Chart Plotter Hat Rev B

full size

Revision C

This version was extensively changed to add an isolated CAN controller. The controller is a MCP2515 with a MCP2551 transceiver. It is isolated both from the Hat and has a TVA on the CAN bus. The other changes are modifying the JST PH connector for the I2C bus to a Qwiic connector so that any I2C breakout board can be added, in fact they can be daisy chained together. Adafruit calls this style of connection system STEMMA 3 Pin or 4 Pin. They are just JST PH connectors with a specific pinout. This board was ordered and soldered together in June of 2022.

Here is the pcb ready for solder paste and placing of the SMD components.

Chart Plotter Hat ready for solder paste

full size

The board after the SMD components were soldered. There are a few solder bridges on the fine pitch parts that I had to fix.

Chart Plotter Hat Rev B

full size

After getting this board all together, flashing the firmware, and installing it on the Raspberry Pi. I discovered a few problems. I had not put a pullup resistor on the CAN controller reset pin, thinking that I could use the internal pin pullup on the Raspberry Pi pin. That turned out not to work. I could not figure out a way to get the pullup on, without the pin being pulled low at the same time. It is probably a bug in the device tree code in the linux kernel. So a modprobe of the kernel driver would always fail as the device was in reset. So I wired a pullup resistor to the CAN reset line, and cut the trace to the Pi header. I don't really need to manually reset the CAN controller, the device driver code does a software reset of the device already. The next problem I discovered is that I had the pinout backwards on the Qwiic connector. That was fixed by desoldering the connector and wiring directly to the Pi header pins. After that everything worked perfectly. The eeprom is flashed with the pin setup, and the pointer to the device tree overlay required to setup all the hardware on the Hat. I will do one more design cycle, to consolidate some connections, and fix the 2 problems I found.

The board installed in the boat computer

Chart Plotter Hat Rev C installed

full size