Main Controller

The main controller is responsible for all communications from the house to the dock system as well as the dockside protocol. It also performs the desired monitoring of the solar panel and battery systems.

Controller

The microcontroller on the main controller board is a PIC24FV32KA302 from Microchip. Some of the criteria that I used to choose this particular controller were

  • Inexpensive - while I am only building one of these, I still wanted to be cognizant of the cost.
  • 3.3v operation - by making the main controller natively 3.3v I didn't need to worry about level shifting inputs to the ESP8266 module (it's explicitly not 5v tolerant) nor did I need to specify multiple regulators.
  • UART and SPI - I need both protocols so getting them implemented on the chip saves bitbanging
  • No external crystal - saves components
  • C - I can write assembly (see the light controller) but I wanted to use C for the bigger tasks
  • Tooling - I need to be able to program the chip, my PICKit 3 does this quite nicely
  • I hadn't used one of this family before - I wanted the learning experience of doing something new!

With the chip selected it came time to design the circuit and layout the board. As I want to potentially build and sell this project in the future, I would have invalidated the hobby license so I used KiCAD for the first time instead. While there was a small learning curve coming from Eagle it was not that bad. I found that adding the parts and footprints I am using to KiCAD is much easier than Eagle and the KiCAD community appears larger than Eagle's. Really the only thing that has confounded me is the multistep process to transfer parts to the board. Instead of Eagle's single "Transfer to board" click, and from that point it being kept consistent, the process requires you to choose the footprint of each part, and export the netlist from the schematic editor. Then switch to the PCB editor and import the netlist the new footprints are created and the rats nest connected. However if you change a part type (ie shrink a resistor from 0805 to 0603) you must delete the old part before importing, as that replacement is not done on your behalf.

This proved to be a very beneficial decision with all of the acquisitions that Eagle has gone through over the last few years. By not using a commercial product, I am not limited to licensing terms that could easily change at a moments notice. This is particularly concerning with the most recent change requiring you to sign up with Autodesk, it's not entirely impossible they could hold your files for ransom with a change to the license (although this is entirely conjecture on my part).

Communications

As described in the high level design section, the main controller will be using 2 different types of wireless communications. From the house to the dock, I will use an ESP8266-01 module and 802.11g WiFi, within the dock, I will be using NRF24L01 modules.

Monitoring

Circuit