Skip to main content

Building A Solar Powered Heads-Up Cab Monitor With The MAX20361

In a previous article, we tested the MAX20361 evaluation kit from Maxim Integrated that effectively demonstrated the novel combination of miniaturised MPPT solar harvesting techniques with boost conversion and energy storage capabilities. Having thoroughly explored the limits of localised solar energy generation, I was keen to evaluate the kit further by monitoring its performance as a power supply in a standalone project.

As I am currently in the process of building an off-grid campervan I thought I could make good use of this renewable technology to develop the early stages of an advanced driver assistance system (ADAS) for my mobile makerspace. Driving a large vehicle over long distances can be very tiring so this project will focus on maintaining driver awareness by monitoring environmental conditions in the cab and creating actionable outputs for the driver to follow.

Part List

Building the Cab Monitor

As this project will be heavily reliant on solar energy, we will be using the MAX20361 evaluation kit to power our cab monitor from the dashboard of the vehicle. Placing it in front of the driver will provide an excellent source of light to charge the single-cell lithium-ion battery that will periodically supply our environmental sensing equipment while using the reflective windscreen to give feedback to the user as a makeshift heads-up display.

A range of vehicle metrics are often used to monitor driver awareness but while commercial systems can often get quite complex in this regard, we will be challenging the limits of what can be achieved with a limited range of sensors monitoring the changes in microclimate conditions. For this project, we will be using the Pycom WiPy development board as our microcontroller alongside the Pysense expansion board to provide basic air quality metrics like temperature and humidity.

Pycom WiPy development board with Pysense expansion board

Pycom WiPy development board with Pysense expansion board

To avoid drawing excessive charge from the lithium-ion cell, the Pycom software will implement a simple state machine to minimise consumption between periodic sensor readings. The program will be controlled by the MAX20361 wake output pin, which will be configured to enable the device when all the relevant charging conditions are met.

Maxim MAX20361 Graphical User Interface

Maxim MAX20361 Graphical User Interface

We can configure the MAX20361 wake output using the dedicated GUI provided by Maxim. This gives us quick and intuitive access to the parameters needed to control our external hardware. First and foremost is the wake threshold voltage that directly controls the MAX20361 wake pin by comparing the voltage of the lithium-ion cell against a programmed minimum value. We will set this parameter to its maximum value of 3.7v to prevent excessive discharge on the lithium-ion cell while keeping the level within the minimum supply voltage of the Pycom hardware.

Setting the MAX20361 wake threshold

Setting the MAX20361 wake threshold

Next, we need to set the regulation voltage, which determines the maximum voltage limit to impose on our chosen storage medium so as not to cause damage to itself or any connected hardware. As the Pycom board has a nominal supply voltage of up to 5.5v we can safely set the regulation slider to the nominal charge voltage for lithium-ion batteries.

Setting the MAX20361 regulation threshold 

Setting the MAX20361 regulation threshold 

Finally, we can set the sleep threshold to limit the operation of the system when the yield from the solar harvester falls below a specified level. This attempts to limit the discharge of the storage medium by disabling the wake output pin during periods of low light, thereby encouraging a net positive charge on our lithium-ion cell.

Setting the MAX20361 harvest count sleep threshold

Setting the MAX20361 harvest count sleep threshold

With our solar harvester successfully configured, we can now start designing a state machine using the Pycom hardware, that will interpret any wake signals from the MAX20361. However, as the logic levels are tied directly to the shifting output voltage of the storage medium, we first need to mitigate the risk of overvoltage damage by clamping the output to the regulated 3.3v pin on the Pycom board using a MOSFET and the internal pull-up resistor.

MAX20361 alongside logic level clamp, Pycom hardware and lithium cell

MAX20361 alongside logic level clamp, Pycom hardware and lithium cell

Once the hardware setup has been complete, we can focus on implementing our state machine in software by poling the buffered wake output from the MAX20361 and switching between different modes using a series of conditional statements.

Wake_Input = Pin('P10', mode=Pin.IN, pull=Pin.PULL_UP)

while True: 
    if not Wake_Input():

        Cab_T = dht.temperature()
        Cab_H = dht.humidity()
        Cab_L = li.light()[1]

        if (Cab_T > 25) or (Cab_H > 50) or (Cab_L < 500):
            if (Cab_T > 30) or (Cab_H > 60):
                pycom.rgbled(0xff0000)
            else:
                pycom.rgbled(0x0000ff)
        else:
            pycom.rgbled(0x00ff00)

        time.sleep(1)
        pycom.rgbled(0x00)
        time.sleep(2)

    else:
        pycom.rgbled(0x00)
        time.sleep(10)

Pycom state machine controlled by MAX20361 wake input and sensor values

When the MAX20361 wake output is active, the device will take a reading from three sensors including temperature, humidity and light. It can then use the embedded LED on the WiPy to rate the current air quality in the vehicle using a colour temperature scale. Then, by using a structure of conditional statements, the program can inform the driver of any values above a fixed threshold using an RGB traffic light system from which the driver can rectify any hazardous conditions.

The full MicroPython code for this project can be found on GitHub.

Testing and Results

With the hardware and software setup now complete, we can test the performance of the system by placing it inside the cab of a vehicle. The direct sunlight harvested from underneath the windscreen will maintain the charge of the lithium-ion cell while it is in use and trickle charge when not.

Red LED colour warns the driver of excessive temperature

Red LED colour warns the driver of excessive temperature

We can simulate the worst-case environmental conditions in the cab by letting the ambient sunlight raise the temperature in the cab to an uncomfortable level. The cab monitor circuit should then respond with a red colour temperature emitted from the LED, denoting a dangerous microclimate.

Blue LED colour informs the driver of lesser microclimate conditions

Blue LED colour informs the driver of lesser microclimate conditions

Opening the windows will establish airflow through the cab and help lower the temperature to a more reasonable level. We should then be able to observe the LED colour temperature turn from red to blue to reflect a positive change in microclimate.

Green LED colour informs the driver of optimal microclimate conditions

Green LED colour informs the driver of optimal microclimate conditions

Finally, we can raise the windows and turn on the air conditioning to rapidly lower the heat index in the cab of the vehicle which will allow the driver to remain more attentive over a longer period. The LED colour temperature should turn green to reflect the optimal conditions.

LED reflected on windscreen creates a rudimentary heads-up display effect

LED reflected on windscreen creates a rudimentary heads-up display effect

Placing the cab monitor behind the vehicle instrument cluster will allow the RGB LED to reflect off the windscreen and create a rudimentary heads-up display effect. Using augmented reality in our system allows the driver to remain focused on the road ahead without having to look away to monitor the cab status. The completed system helps create a super safe long-haul driving environment by not only keeping the driver alert but also maintaining their eye contact with the road at all times.

A keen maker and electronic engineer with a passion for the environment, renewables, alternative transport and anything off-grid. Man with a van and founder of the Kickstart Kamper sustainable campervan project. Grassroots Education Sustainability Ambassador. BrightSpark 2017. BEng. KickstartKamper.co.uk

Comments