New product idea: controller to switch and monitor high current DC & AC

Hello All,

I created mostly for my own use a PCB to switch high power with an Arduino on the same board. You can for example build your own UPS controller, 12/24V dimmer pack, heat-pump controller…
The main intended use is to enable low cost solar power for everyone.
It has an ATmega2560 with 6-pin ISP for programming and the proto-shield connector. I also made a simple library, that provides the basic functions (listed further down). The board has six MOSFETs in parallel to switch (PWM) 30VDC/50A continuously, a DPDT relay to switch 120AC/10A, and an array of sensors to measure volts, amps, and temperature and a few other things. I also added the proto-shield connectors to make is expandable to any other module.

I put countless hours into it and spent $$$ on equipment for testing and I would like to get some feedback. If there is enough interest in this custom PCB I could apply for funding on Kickstarter/Indiegogo. Here is a link to a page I made with more info/ also I have attached a pic of the board at the end.

Any suggestions or thoughts?

This is a board that is very similar to the Arduino Mega 2560, specifications:

  • Operating voltage: 5V
  • External Input Voltage: 7 - 30V
  • DC Supply: On board 120V transformer for 24V (max. 20W), 5Vcc (0.5A), and USB port 5V (1A)
  • Bootloader: Arduino
  • Compatible with the Arduino Uno pin mapping
  • Digital I/O pins: 14 , ports 3,5,6,9,10,11 can be used for PWM output
  • Analog input pin: 6
  • Each I/O DC output capacity : 40 mA
  • 1200Watt Relay 120VAC/10A cont.
  • 1500Watt Power MOSTEFs 30VDC/50A cont.
  • 18 Pin connector for LCD panel
  • 2 bidirectional Hall sensors

The library function names pretty much tell the ability of the board:

void	setBackgroundRGB(0-255, 0-255, 0-255);
void	setBuzzer(LOW/HIGH);
void	setCharger(0-255);
void	setDimmer(0-255);
void	setDisplayText(Str,Str);
void	setRelay(LOW/HIGH);

bool	isButton1();
bool	isButton2();
int	getSlideSwitch();
float	getTemperature();

float	getVs();
float	getVb();
float	getAs();
float	getAb();
float	getMainAmplitude();
float	getInverterAmplitude();

you should use a relay capable of 240V 10A and you will triple your market :slight_smile:

The relay is actually capable of 240V but the transformer would need a split primary coil, but this is doable :slight_smile:

void setDisplayText(Str,Str);

I hope you mean

void setDisplayText(char *line1, char *line2)

Can you post the library for review?

Hi Rob,

here is the code, for now it’s only an “.ino” file - the full lib will follow.
It demonstrates the use of the I/O options of the board.


 *  solarUSBControllerLib v1
 *  --- To compile set the board type to Arduino MEGA 2560 ---
 *  Utilities for solarUSBController board - based on ATmega2560
 *  Original code by Markus E. Loeffler June 2014
 *  This is free software. You can redistribute it and/or modify it under
 *  the terms of Creative Commons Attribution 3.0 United States License. 
 *  To view a copy of this license, visit 
 *  or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.

#include <LiquidCrystal.h>
#include <OneWire.h>

#define V_ARDUINO       4.98  // real measured board voltage

#define REDLITE 46
#define GREENLITE 45
#define BLUELITE 44
#define mainPin 35
#define inverterPin 2
#define buzzerPin 36
#define DS18S20_Pin 37
#define ChargerPin 3
#define nextPin 18  //int.3
#define enterPin 19 //int.2
#define slidePin1 34
#define slidePin2 33

LiquidCrystal lcd(27, 26, 22, 23, 24, 25);
OneWire ds(DS18S20_Pin);

void setBackgroundRGB(uint8_t r, uint8_t g, uint8_t b)
  analogWrite(REDLITE, r);
  analogWrite(GREENLITE, g);
  analogWrite(BLUELITE, b);

void setBuzzer(uint8_t value)
  digitalWrite(buzzerPin, value);

void setCharger(uint8_t value)
  analogWrite(ChargerPin, value);

void setDimmer(uint8_t value)
  analogWrite(inverterPin, value);

void setDisplayText(char* line1,char* line2)
  lcd.setCursor(0, 1);

void setDisplayText(int line1,int line2)
  lcd.setCursor(0, 1);

void setRelay(uint8_t state)
  digitalWrite(mainPin, state);

bool isButton1()
  return digitalRead(nextPin) == HIGH;

bool isButton2()
  return digitalRead(enterPin) == HIGH;

int getSlideSwitch()
  return digitalRead(slidePin1) == HIGH ? 1 : 0 +
    digitalRead(slidePin2) == HIGH ? 2 : 0;

float getVs()
  return V_ARDUINO*(analogRead(A11))/1023.*(29200./2200.);

float	getVb()
  return V_ARDUINO*(analogRead(A9))/1023.*(14200./2200.);

float	getAs()
  return ((V_ARDUINO*(analogRead(A10) -511.5)/1023.)/ -.04);

float	getAb()
  return ((V_ARDUINO*(analogRead(A8) -511.5)/1023.)/ -.04);

int getMainAmplitude()
  return analogRead(A14);

int getInverterAmplitude()
  return  analogRead(A12);

float getTemp(){
  //returns the temperature from one DS18S20 in DEG Celsius

  byte data[12];
  byte addr[8];

  if ( ! {
    //no more sensors on chain, reset search
    Serial.print("no more sensors on chain, reset search");
    return -1000;

  if ( OneWire::crc8( addr, 7) != addr[7]) {
    Serial.print("CRC is not valid!");
    return -1000;

  if ( addr[0] != 0x10 && addr[0] != 0x28) {
    Serial.print("Device is not recognized");
    return -1000;

  ds.write(0x44,1); // start conversion, with parasite power on at the end

  byte present = ds.reset();;
  ds.write(0xBE); // Read Scratchpad

  for (int i = 0; i < 9; i++) { // we need 9 bytes
    data[i] =;


  byte MSB = data[1];
  byte LSB = data[0];

  float tempRead = ((MSB << 8) | LSB); //using two's compliment
  float Sum = tempRead / 16;

  return Sum;

void setup()
  lcd.begin(16, 2);

  pinMode(inverterPin, OUTPUT);
  pinMode(mainPin, OUTPUT);
  pinMode(buzzerPin, OUTPUT);
  pinMode(nextPin, INPUT_PULLUP);
  pinMode(enterPin, INPUT_PULLUP);
  pinMode(slidePin1, INPUT_PULLUP);
  pinMode(slidePin2, INPUT_PULLUP);
  pinMode(ChargerPin, OUTPUT);

  setDisplayText("solarUSBControllerLib","SOLAR-TRAP 2014");

void loop()



solarUSBControllerLib.ino (4.56 KB)

pretty decent code, good variable names, well done!

Thanks for the feedback Rob.
My main question is if anyone would use the controller to build anything else than the original UPS controller?

Any thoughts?