Solar Sense

The solar sense board monitors the solar panels, there are three main components:

MPPT

The MPPT is responsible for converting high current low voltage output from the solar panels into low current high voltage power compatible with our batteries and motors.

https://uwmidsun.atlassian.net/l/cp/5XKzcv26

 

the board uses SPI to communicate with 6 MPPTs, to read voltage, current, pwm, and status from the MPPTs.

PB 0, PB 1, PB 2 are chip selects to choose which MPPT the controller board is talking to.

PB 10, PB 11 I2C line of MPPT voltage readings after adc (MCP3427: MCP3426/7/8 Data Sheet (microchip.com))

 

MPPT TASK:

  • start up MPPTs

  • periodically read the current, voltage, pwm, status from MPPT.

  • send commands by SPI to all MPPT, sequentially using chip select

  • read data by SPI from MPPT, sequentially using chip select

  • send MPPT data to CAN (current, voltage, pwm, status)

CAN MESSAGES:

MPPT (1 per mppt) - current (uint16) - voltage (uint16) - pwm (uint16) - status (uint16)

the autogenerated can_tx structure should have all MPPT data in a block, so it can be indexed with the first data in the structure and an offset.

Current sense

The current to the batteries are measured and sent to solar sense board, the controller board monitors the current and enables/disables a relay switch.

PB 8, PB 9 are I2C of current sensor. maps the current from 0 to 40 A to a digital signal.

 

I2C talks to an ADC chip (MCP3427: MCP3426/7/8 Data Sheet (microchip.com))

Current sense TASK:

  • read current sense.

  • open relay on fault.

  • open/close relay on command.

  • send current sense data to CAN (current, voltage, relay status)

 

CAN messages:

CURRENT SENSE (adc reading) - current (uint16) - voltage (uint16) - relay status (uint8)

 

Thermal

The board monitors thermal readings from GPIO pins A0, A1, A2, A3, A4, A5, all of which are analog. Use ADC to convert each pin to digital reading at each cycle, and set the data on can.

A0 is temp_1, A2 is temp_2, … A5 is temp_6.

we simple monitor these temperatures.

 

PB5 Overtemp bit. (active low)

PB7 Fan Fail bit. (active low)

PB6 Full speed bit. (active low)

 

Create a Thermal TASK:

  • convert gpio pins A0 to A5 to digital with ADC,

  • set can messages for temperature sensor.

  • read overtemp pin, fan fail pin and set can message to true if the pins are set/active.

  • toggle fan fullspeed control on command (active low).

 

Initialization:

  • ADC, set up adc conversion for gpio pins A0 to A5

  • GPIO initialize gpio pins for reading (A0 to A5, B5, B7) and writing (B6)

 

CAN messages:

THERMAL - overtemp bit (uint8) - fullspeed bit (uint8) - fan fail bit (uint8) - temp_1 (uint16) - temp_2 (uint16) message2: - temp_3 (uint16) - temp_4 (uint16) - temp_5 (uint16) - temp_6 (uint16)