PowerPlay SSR Control

Updated 31 March 2023


The aim of PowerPlay is to provide an Arduino platform for managing downstream Solid State Relays (SSR) simply and safely.  PowerPlay consists of a custom Arduino Shield, and simple software to drive elements of the shield.

Why I Made It

I am interested in Solar Power initiatives. I find it upsetting that my electricity supplier charges me four or five times the rate for power I use from the grid compared to the feed-in rate that he pays for mine.

I think the developed use of solar power is going to bring changes in the way we distribute power within our homes, and smart usage will involve applications deciding on the state of environmental variables that it is opportune to make use of power within the home rather than export to the grid.

A particular interest is an immediate application to dual-element storage hot water systems. These systems typically run off-peak power to the lower element and normal supply to the upper. I can envisage substantial savings by canning the off-peak (provision and pro-rata energy costs) completely and using the SSR to switch power to the lower when opportune.

And there is a philosophical reason as well. Pope Francis wrote a letter to the World in 2015 titled Laudato Si. It is basically about caring for the Earth and countering Climate Change. If you enjoy my document, and even if you don’t, check out his at:


What is an Arduino Shield

An Arduino shield is typically a piece of electronic hardware which fits into a base Arduino UNO microprocessor. The UNO  board provides access to 32 logic pins via female header strips at its top and bottom edges, and the shield provides a male mating. Each UNO pin is thus exposed to the shield.  

Electronic stores carry Arduino shields for particular purposes such as robotics, and shield sub-assemblies also. The use of shields is  mature and developed.

What is the PowerPlay Shield

The PowerPlay Shield is a hardware development that provides actuators for driving solid-state relays (SSR), and sensor interfaces for the measurement of operating conditions controlling the SSRs.

For instance, a sensor such as a Light Dependent Resistor (LDR) might be connected to a PowerPlay input.  In turn, it connects to an Arduino Analog port in a Voltage divider configuration. The Arduino will convert this to an integer in the range 0-1023, upon which the Arduino program might decide to turn a light bank ON or suspend the use of solar, or whatever.

PowerPlay in detail consists of 4 SSR actuators, 1 digital input envisaged as interfacing to a digital output from a Solar Inverter,  4 analog inputs as voltage dividers, and 2 LED outputs available to signal operating status or settings.

It has a toolkit philosophy. It provides base facilities, and the role of the software is to read the analog and perhaps digital input and enable or disable the SSR actuators accordingly.

Arduino connects to a PC via USB at the top left, or to independent barrel-jack power at the bottom left. The female header strips at the top and bottom provide individual pin access or mass connection via a shield.

The PowerPlay shield is pictured below the Arduino. It plugs into the UNO via male header pins.

A set of 4 2-pin screw terminals at the right provide actuator output to drive SSRs. The top screw terminal pair at the left handles digital input and the 4 other analog inputs via sensors at the top and bottom. Test sensors for temperature and light measurement can be seen connected.

What Do I Need

1x Arduino UNO

1x Custom Arduino Shield as described above

Male Header Strip for Connection of Shield to UNO

The shield provides for:

4x SSR Interfaces each of which requires:

      1x 2-Wire PCB Screw Terminal 5mm Pitch

      1x KQAH616D intermediate SSR

      1x 220-ohm resistor

      1x 330-ohm resistor

4x Sensor Interfaces each of which requires:

      1x 2-Wire PCB Screw Terminal 5mm Pitch

      1x Resistor Appropriate to the Sensor

1x Sensor Interface to Digital Output from Solar Inverter which requires:

       1x 2-Wire PCB Screw Terminal 5mm Pitch

       1x 6N138 optocoupler

       1x 4.7K resistor

       1x 10K resistor

       1x 104 capacitors (0.1uF)

 2x LEDs for Indicators each requiring:

       1x LED

       1x 220-ohm resistor


Also required is a Solid State Relay for the actual project requirement and a power supply for operating the UNO isolated from a PC.

Note the toolkit nature of the supplies; if your application does not require instances of any of the particular interfaces, just leave them out.

More detail on parts is tabulated later.

Creating The Printed Circuit Board

The base PCB has been prepared using Eagle. The following link downloads a file zip that provides information for PCB fabricators, including Drill and Gerber detail.


The Eagle Schematic and Board Files

The Eagle Schematic (.sch) file describes the components to be employed and their interconnection at a design level.

The Eagle Board (.brd) file describes the PCB outline, the physical positioning of components within the PCB, the physical connection of components, and the drill holes required for their mounting. Board screen printing is also specified to aid assembly and subsequent external use.

These basic files are depicted in image files exported by Eagle.

The .brd file is presented as follows:

Similarly, the .sch file is depicted below.

The upper and lower header strips represent the connections to the Arduino UNO

The X1-X4 outputs to downstream SSRs are seen in the centre of the schematic.

The X5 input from a notional solar inverter is also seen at the upper centre. Note that this input is galvanically isolated from the PCB generally, sharing no earth or supply with its origin.

The X6-X9 analog inputs are seen at the lower centre.

The PCB is next populated with the parts determined necessary for its intended application. It is stressed that a subset of parts will probably be sufficient, consistent with the toolkit nature of the hardware and accompanying Arduino software.

Once the PCB blanks have been obtained, the first assembly task is soldering the male header strip of lengths 6, 8, 8 and 10 around the PCB periphery for connection to the matching female strip in the UNO itself. It is recommended that you insert the headers in the UNO, and use it as a template for getting everything nicely positioned before soldering.

Progress on to the 5mm terminal pairs. These have been chosen with screw sockets because they are useful for connecting light-stranded hookup wires, rather than for any current carrying capacity.

It is also recommended that you employ PCB sockets for the ICs. You can hardwire them, but re-use them in a more ambitious project then becomes less likely.

A fully populated PCB is pictured above.

The four terminal pairs driving downstream SSRs are seen at the bottom, and similar terminals accepting input from sensors such as Light- and Temperature-dependent resistors are seen at the left and right sides.

Parts List and Location on the PCB

Part  SKU  Located At  Description Purpose
 Male header strip  Pololu-965 (40-pin strip) Shield Periphery  0.1-inch spacing  Connection to Arduino 
 X1-X9 CE08311 Shield Periphery  PCB-mounted screw terminal pair; 5mm contact spacing; Connection of external actuators and sensors 
IC1-IC4    Adjacent to X1-X4 KQAH616D small SSR; 6-pin, dimple pin 1 to notch in label; Also termed PhotoMOS relay  Intermediate signal conditioning 
 C1-C4 CE05092 Straddles Top of IC1-IC4  Resistors 220 ohm  Feed from the digital port 
 R13-R16 CE05092  Behind IC1-IC4  Resistors 330 ohm Feed to SSRs 
 LED1-LED2 COM-12093 Shield Middle  The indicator LEDs Anode pin is adjacent to the resistor  General purpose 
 R11-R12 CE05092 Above LEDs 

Resistors 220 ohm
R12 series with LED1;
R11 series with LED2;
Current limiting to LEDs

Current Limiting to LEDs 
 R7-R10 CE05092 Adjacent X6-X9 

R7 680K
R8 56K
R9 22K
R10 10K

Voltage dividers for analog sensors;
Change as necessary but 5K realistic minimum

 OC1   Left Periphery 

Optocoupler for X5;
6N138 8-pin IC;
dimple pin 1 to notch in label

Optocoupler for external DC signal input
 C5 ADA753 Straddles OC1 

Capacitor 104;
(0.1uF 50V)

OC1 connection 
 R5 CE05092 Below X5 

Resistor 4.7K;
limits Voltage to OC1 input

OC1 Connection;
Adjust for different voltages as necessary

 R6 CE05092 Below R5  Resistor 10K  Digital Feed to Port 5 
 LDR  CE09439 External sensor    Light-Dependent resistor Light sensor 
 Photo Transistor  ADA2831 External sensor   Essentially LDR; 2 terminal connection  Light sensor
(Eco choice)
 SSR COM-13015 External actuator  Solid State Relay  Driving downstream AC loads 
  • CE05092 is a resistor pack of multiples of common values.  1 pack will supply you forever.
  • Similarly, ADA753 is a multiple 0.1uF capacitor pack.
  • COM-12093 a multiple-colour LED pack.

Actuator Outputs

The four actuator outputs driving SSRs are located on the right (irregular) edge of the shield, and screen-printed X1-X4. Each output consists of a terminal pair, labelled 1 and 2. ‘1’ is the positive terminal and ‘2’ negative. This polarity is important in connecting to the SSRs.

The particular SSR envisaged in the design is driven by 3-32V DC, a typical input impedance of 2K2 ohms and a maximum current of 25 mA. The SSR employs optical isolation techniques to keep its AC mains operation electrically separated from its low-voltage DC input.

A large range of SSR devices is available, and the intended load characteristics will determine your choice.

The device suggested is a Sparkfun SSR, manufactured by Fodek, referenced as COM-13015. It is rated at 40A, and should be mounted on a heatsink at higher current/duty cycle levels.

It has two heavy terminals labelled ‘1’ and ‘2’ handling the AC load, and two lesser input terminals labelled ‘3’ and ‘4’, with ‘3’ connecting to the positive input from the shield, and ‘4’ to the negative. Note that ‘4’ is to the LEFT of ‘3’, which is not intuitive, but consistent with ring labelling of IC devices. When active, a small red LED on the device illuminates.

The device was tested in a 10A setting with an unswitched Active AC connected to terminal 1, and terminal 2 carrying the switched Active AC to a 240V 10A GPO. The Neutral and Earth from the AC source were routed directly to the GPO, and a load was plugged into the GPO.  The above software then ran a ‘Blink’ test with a 10-second ON/OFF sequence.

Note that AC mains voltages are dangerous, and electrical professionals should be consulted during any implementation process.

Another convenient AC test mechanism is provided by irrigation controllers, which employ 24V AC, often supplied through an external transformer. So a few test wires from the transformer to the garden valve, and inserting the relay into one of the legs should produce a Blink water show.

The irrigation controller usually has a terminal block labelled C M 1 2 3… where C is Common, and is distributed to one side of all valves. M is for Master and the controller energizes this when any other station 1 2 3 etc is energized. The M 1 2 3 .. are connected to the other side of an individual valve. So you could also base test strategies around the terminal block.

Analog Sensor Inputs

Four sensor inputs are located on the shield labelled X6 to X9. Each has a board-mounted resistor which is matched to the normal resistance of the external sensor, which connects to the terminal pair. The polarity of variable resistors is unimportant. However, in some sensor situations such as a photo-electric array detecting light intensity, the array should be connected in a reverse-biased manner.  In all cases, terminal 1 of the pair is positive with respect to terminal 2.

Internally, 5V is applied to a series resistance consisting of the board resistor and the sensor, and the junction is connected to an Analog port.

Digital Input

This is located on the shield at X5. It is envisaged to operate in conjunction with Solar Inverters such as the Fronius Primo, which provides a 12V DC signal when configurable solar generation conditions are met.  For instance, if solar production exceeds say 3000 watts, or if a ‘should run’ time of day is reached. Terminal 1 is again positive.

Consistent with optical isolation techniques, the signal is routed through a voltage-dropping resistance and applied to an optocoupler, which then sets digital port 5 LOW if a signal is present.

Interfacing with other digital circuitry is similarly possible. Treat the optocoupler as an LED, choose a serial resistance accordingly and mount it at R5 immediately below X5 on the shield.

Indicator LEDs

Provision is made for two additional LEDS as general-purpose indicators at the shield middle.

Prototyping & Development

The hardware was prototyped in several stages before the fabrication of the PCB.

This prototype (shown front and obverse) worked well enough with 3 output SSRs, 1 LED, and various inputs. However, the rear wiring was pleading for Eagle intervention.

What else would be desirable? Plenty of central shield area remains for the addition of a Real Time Clock. Potentially this would make operational event logging very feasible.     

What does the Software Look Like?

The software is developed using the Arduino IDE, typically on a Windows or Mac PC. The C-source is stored on the PC. After successful compilation, it is uploaded to the Arduino, and can then run detached from the PC, or in conjunction with it via USB.

The software consists of a run-once ‘setup’ routine, and a ‘loop’ routine run repeatedly.

The Arduino program is termed a ‘sketch’,  has a filetype extension ‘ino’, and is C-text.

The PowerPlay prototype is presented as follows:-

// This code was written for the PowerPlay Arduino Shield.
// The PowerPlay Shield consists of :
//       4 outputs controlled by Digital Pins 8-11
//         Each output is intended to drive SSRs requiring 5V 20mA          
//         with the SSR switching downstream loads as required.
//       1 Digital output on D5
//         An external digital input from a Solar Inverter (Fronius)
//         is input at X5 to an optocoupler, and sets D5 to match.
//         Basically the Inverter sets this bit when the solar array
//         is generating above a specified threshold.
//       4 Analog inputs on A0-A3, input to terminal blocks mounted  
//         on the shield. A range of resistances forming voltage
//         dividers with each analog pin allows temperatures, and
//         light sensors to be incorporated. The table below includes //         the resistance for each input.  
//       2 LED outputs on Digital pins 6 and 7 are also provided to
//         signal operating conditions.
// In the table below X- indicates a shield mounted terminal pair,
// D- a digital pin, A- an analog pin, R- a resistance  
// X1 SSR1 turned ON when D8 set HIGH
// X2 SSR2 turned ON when D9 set HIGH
// X3 SSR3 turned ON when D10 set HIGH
// X4 SSR4 turned ON when D11 set HIGH
// X5 Input from Solar Inverter 12V DC expected; sets D5 LOW if so
// X6 Input from external photodiodes R7 680K divider on A3
// X7 Input from thermistor etc R8 56K divider on A0
// X8 Input from LDR etc R9 22K divider on A1
// X9 Input from variable temperature R10 10K divider on A2
int ssr_num = 4;
int ssr[] = {8, 9, 10, 11};    // SSR pin definitions

int anl_num = 4;
int anl[] = {A3, A0, A1, A2};
int anl_state[4];

int solar;                     // solar interface HIGH or LOW

int led_num = 2;
//         Red  Green  
int led[] = {6 , 7};           // LED pin definitions

int sol = 5;                   // solar inverter interface pin  
// note D5 normally HIGH goes LOW if 12V present from inverter.

void resetPins()
{ int i;
  int pin;
// pin setup
// start off with pins output and low
  for ( i = 0; i < ssr_num; i++)   // pins controlling SSRs
  {  pin = ssr[i];
     pinMode(pin, OUTPUT);

  for ( i = 0; i < led_num; i++)   // pins controlling LEDs
  {  pin = led[i];
     pinMode(pin, OUTPUT);

  pinMode(sol, INPUT);            // pin for solar inverter

void printState()
{ int i;
  Serial.print("Analog ");
  for (i=0; i 0) digitalWrite(led[1],HIGH);  // light a LED

// test the LEDs  
// testLeds();

// try to turn an SSR on
   pin = ssr[0];
   digitalWrite(pin,LOW);    // turn it OFF

Arduino software complements the PowerPlay Arduino shield hardware. The shield supports four distinct hardware functions, and the software interface to each is described:

Digital Outputs to Downstream Solid-State Relays


These outputs are controlled by setting Arduino pins D8, D9, D10 and D11 HIGH/LOW for SSR ON/OFF respectively.

The software abstracts these pins into an SSR array for convenient management, but it is as simple as this.

Analog Inputs from Sensors


Analog pins A0, A1, A2 and A3 are read with the analogRead function to yield a 10-bit integer.

In conjunction with on-shield resistors at shield locations R, a voltage divider is established between +5V, the on-shield resistor R, the sensor resistance S, and 0V (GND). The Analog pin is connected to the junction of the R and S resistances.

It is usual to employ a resistance equal to the usual value of the sensor but a wide margin is acceptable.

The reading is 0-1023 in the ratio S/(R+S), so a sensor consisting of a simple switch would yield 0 closed and close to 1023 open.

Sensors measuring temperature, light intensity, humidity, motion detection and the like are readily available. It is suggested that the analog reading is stored in an array, and used to decide the state of the SSR settings, such as if it is dark, or cold, let's have some lights or heating, run a sprinkler, or warm a 3-D printer.

Digital Input from Solar Inverter


Some solar inverters including the Fronius provide an output digital signal when conditions such as solar generation exceeding a threshold setting are met. This 12V signal can directly drive a relay.

In the shield, using an optocoupler, this signal is extracted onto an Arduino pin again for use in SSR decision-making.

The D7 pin is read with digitalRead(7) and is set LOW if such a signal is detected.

Digital Output to LED Indicators


Two LEDs may be wired onto the board and used through D5 and D6 in addition to the system provided by D13 for purposes of indicating operating conditions.

 For example, digitalWrite(5, HIGH) illuminates a LED.

So there is no special software requirement such as a library. The shield provides the links between the Arduino pins, and the basic software calls described. The software provides a framework for a head start on development for interested experimenters.

Have a question? Ask the Author of this guide today!

Please enter minimum 20 characters

Your comment will be posted (automatically) on our Support Forum which is publicly accessible. Don't enter private information, such as your phone number.

Expect a quick reply during business hours, many of us check-in over the weekend as well.



Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.