adding a RGB Power Switch to show Power State and D13 Pin status
HALRAD demonstrates adding a RGB Power Switch to show Power State and D13 Pin status
Purpose: This is a guide demonstrating how to add a Momentary RGB illuminated power switch to the Latte Panda Delta3 with the following objective:
1) Control Power state
2) Display Power Status (Off, Running, Sleeping)
3) Display D13 pin state
You might have noticed the Delta3 has some interesting onboard lights to show the current power (or ‘lower power’) sleeps state. A blue light for power and a green light for sleep.
Goal: The intent is to use a RGB (3 color) illuminated power switch to mimic the Power and Sleep light on the Delta3 PCB as follows:
1. Blue – Running
2. Green - Hibernate
3. No light – Off ~ S5
4. (bonus since we have 3 colors to use) RED will show the D13 pin status.
5. (bonus since we are using the Arduino Header we might as well wire D4 up to the SW to enable the MCU to reset the PC – see watchdog article references below)
Notes:
1) Sleep state references above use the LP headers to reference to designate ‘Sleep States’ ‘values’.
2) The following schematic and diagrams are illustrated using the Delta3 but is applicable to the Sigma (and other models with the CPU state headers).
3) For reference this is the related part of the Delta3 interface diagram.
GPIO Header Pins
We are going to be using the following pins: (highlighted in yellow and orange) more about the connections later for now let’s just orient ourselves to the pins we will use and what they are connected to.
1. D13 Pin – Connects to Red LED
2. SW – connects to sw1
3. S3 – connects to Blue LED
4. S0 pins – connects to Blue Led
5. Ground
6. Bonus/optional: RST connects to D4 to enable your Arduino to be able to reset the PC, while outside the scope of this topic you can learn more from these articles Using the Arduino Chip of LattePanda as a System Watchdog- Lattepanda Forum and a much deeper dive here, Programming the Watchdog Timer of LattePanda 3 Delta- Lattepanda Forum
RGB MC Power Switch Part
For this project a momentary pushbutton with RGB (3 lights) was selected as PV6FW4011-3R1was selected. Note the W in that part means PRE-WIRED, which saves some time and energy soldering or crimping and or shrinking but there are several great options in this line and from other vendors. I selected this one because it was pre-wired and has native LED voltage support. (R1 on the end designates) It is designed for something like a public Kiosk or perhaps even an ATM either way it’s so much overkill for our purposes here I love it easy to use, solid and looks great.
PV6FW4011-3R1 PV6FW4011-3R1 E-Switch | Mouser
As mentioned, this switch part came pre-wired so will reference the wire colors in the descriptions, but the schematic will help you map wire colors to the pins and will pair the connections by the wire colors as we go, again to help you map the connections out as you need for your specific parts and materials.
Figure 2- PV6FW4011-3R1 schematic
That shows the schematic of a single part assembly selected for this project but could be 3 separate LEDs and a NO momentary switch if you wanted separate parts or to do it more economically. This was selected more for its durability (it’s SOLID) in its function and pre-wired so works fine as a quick prototyping part all contained in one single assembly, albeit this at 18MM in diameter is ‘large’ depending on how you might use it.
Wiring Details
Solder or connect the lights and switch as follows:
White – SW1-1 One side of the switch connects to GPIO-SW |
Yellow – SW1-2 The other side of the switch connects to Ground |
Red – Red LED + connects to D13 |
Green – Green LED + connects to S3 |
Blue – Blue LED + connects to S0 |
Black – SW1 (-) Ground connects to Ground (one wire, if you used separate LEDs and switch , connect the Grounds to ground, all 4 wires rather than 1) |
Bonus: since you are right there you may choose to connect Arduino Header D4 pin to the Reset pin to enable the MCU to reset the PC. See ‘watchdog references’. Watchdog Timer - LattePanda Documentation Programming the Watchdog Timer of LattePanda 3 Delta- Lattepanda Forum |
Wrapping Up
This is how this came out, for now, it’s not exactly production ready but it works exactly as intended and needed for now...
Wait don’t stop; the tape how about a demo?
Why sure, look here: https://imgur.com/a/VutC6Wl
When the PC is on the Button glows solid Blue, when it’s sleeping it goes Green, and when its OFF there are no lights. And as bonus when the D13 light is turned on the switch will light Red. Did not demonstrate (wait long) or simulate (edit videos) to show the Green sleep but it all works as described try it out! This is as close as we have been able to get to simulate the Delta3 on-board power/state LEDs.
Hope this helps!
Regards-
-Halrad