This code example demonstrates system power supply control for the Raspberry Pi based application using PIC16F15245 Control board. For more details refer section 6 “Appendix: System Power Supply Control for the Raspberry Pi Application” of application note “Using PIC16F15244 Microcontrollers for System Power Supply Control”, which provides implementation and demonstration details based on Raspberry pi board.
For PIC16F15244 Curiosity Nano kit based implementation, refer System Power Supply Control Module Emulation using PIC16F15244 Microcontroller and Process Computer Module Emulation using PIC16F15244 Microcontroller GitHub code examples.
- Application note : Using PIC16F15244 Microcontrollers for System Power Supply Control
- GitHub Microchip PIC Examples : System Power Supply Control Module Emulation using PIC16F15244 Microcontroller
- GitHub Microchip PIC Examples : Process Computer Module Emulation using PIC16F15244 Microcontroller
- PIC16F152xx Product Family Page
- PIC16F152xx Family Code Examples on GitHub
- PIC16F15244 MCU Family Video
- PIC16F15244 MCU Product Page
In this demonstration, PIC16F15245 control board is referred as supply control module which controls the power consumption of the Raspberry Pi board when it needs to be put in Power-Down mode. A dedicated hardware board with a PIC16F15245 microcontroller and a MIC4684 switching regulator with enable control is used for power control of the Raspberry Pi board. The hardware also contains one MCP1702T low-dropout regulator to power the PIC16F15245 microcontroller. Below figure shows the block diagram of the hardware connections for the demonstration.
- MPLAB® X IDE 6.0.0 or newer
- MPLAB® XC8 2.36.0 or newer
- MPLAB® Code Configurator (MCC) 5.1.1 or newer
- Microchip PIC16F1xxxx_DFP Device Support 1.9.163 or newer
- MCC Melody Core 2.1.9
- Timer0 (TMR0) MCC Melody driver 4.0.8
- PIC16F15244 Curiosity Nano Evaluation Kit EV09Z19A
For demonstration PIC16F15245 Control board and Raspberry Pi 4 boards are used. Raspberry Pi board is programmed using python programming language and flash the program which is attached above the code example. Flash the firmware to the PIC16F15245 control board using MPLAB PICkit 4 programmer device. Connect keyboard externally to the Raspberry pi board through USB port, to enter power down command. The following points explains about functionality of the application.
- Enter the I2C command using keyboard connected to the Raspberry pi board. In this code example, command consists of an ASCII characters , for example: enter command “S007200’” , character ‘S’ is for cross platform support and 7200 represents seconds or two hours of power down mode.
- Raspberry pi board transmits the I2C command to the PIC16F15245 control board through I2C peripheral.
- After transmitting the command, raspberry pi enters software shut down mode.
- PIC16F15245 Control board waits for 30 secs before turning OFF the voltage regulator to the Raspberry pi board.
- Once the waiting period is completed, PIC16F15245 control board turns OFF the voltage regulator to the Raspberry pi board and enters the sleep mode.
- After power down period is completed, PIC16F15245 control board wakes up from the sleep and enables the voltage regulator to the raspberry pi board.
This code example presents developers with an overview of how an 8-bit microcontroller can be used to improve the power consumption of a process computer, such as an SBC. As a use case for system power supply control Raspberry Pi based reference application is demonstrated here.