ARDUINO Solar Activated Switch using element ID HTML


I am trying to build a simple network attached Arduino that will read a value from my solar systems local web page and turn a relay on or off depending on the value.

The web page is on my local network with a ip of 192.168.1.x and I have found the element ID of the data I wish to inspect which is labelled “currentGridPower”.

In essence I want to read currentGridPower and throw a if < else statement after it to turn on a relay.

This way if my solar system is pumping out a surplus I can turn on things like battery chargers around the house and take advantage of my system without investing in a battery bank (yet).

Any help would be appreciated. I have never worked with arduinos using network shields so this is a bit of uncharted territory for me.

I would advice to have some “toleration level” so the relay does not go “machine gun mode” when the levels are fluctuating arround the value you want.

Something like this:


Good advice ,
I will proably go for a delay so that the if statment must be true for 30 seconds consecutively before it actions the relay. That part is easy and I can fine tune it once I have the brass nuts of this projecto working.

Something like that. Only, I don’t want to host a new web page and I believe the data I want to pull is embeded in the element ID “currentPowerGrid”. I have already spent considerable time searching other forums via google on this one with mild success. Cheers for the link!

I haven’t messed around with arduino in so long. I do remember reading someone was using it to track the sun with panels and do (x) or (y) at certain points like with LDRs and such via an interface, but to also use a web(page) for certain tasks with switches (relays).

Although I can’t find it. If I can locate it I will post.

You may not even need an Arduino for what you are doing or not have to scrape HTML. What value are you trying to read?

I am trying to read an element ID “currentGridPower” from a web page my solar panels inverter publishes on my local network(192.168.1.?).

The variable is displayed as follows “3.0 KW” where the number will change depending on the current output of the panels.

If I inspect the webpage I can see that the varible I want to capture is embeded with the following code:


I just want to read that value and if it is above a preset limit I want to set a pin to high and if it isn’t I want to set that pin to low.

Wouldn’t it be easier to measure voltage? Use the voltage of the panel/array as your indicator.

How would I measure voltage? Would I need to add a piece of equipment to my setup to tap into the panels output?

Using my method I can deploy this switch anywhere either using a wifi sheild or a LAN shield. If I was to pull the voltage data from the panels web page then my problem would be the same, how?

It would just be an analog input.

You can have your solar charger charge directly to the batteries and have them discharge to the rest of the system negating almost everything you are doing. I.E. trickle charging. Are you using deep cycle batteries?

A normal solar setup need pretty much need no digital components for it to work. I would have to see your setup , components, and wiring to give you a more in depth answer. Also would have to know your electrical load. But it looks like your system is way more complicated than it needs to be.

I’m an automation person by trade and I am sure there is an electrician or electrical engineer who could chime in as well.

Yes. This is called Hysteresis and ignoring it will burn out the relay.

1 Like

I think there has been some confusion. I don’t have any batteries connected to my solar system, it is a simple grid tie in system. I have 2x BOSCH BPT-S series inverters connected to 6.2 KW worth of solar panels. This feeds into my house to power anythying that is on when the sun is out and any excess goes back into the grid for which I am given input credits to the value of 0.08c per KWH. Problem is I am charged about 0.34c per KWH I use so I am better of putting that power to good use rather than exporting it back to the grid.

Programming an ARDUINO to turn on a relay when the panels are producing an excess and to turn off when they are dormant will let me keep all non-essential appliances off until I am producing a surplus… Hopefully saving me a boat load of cash…

In the future I plan on installing a battery bank to store my excess power but that is a bit of a stretch for my budget right now… So I am trying to work with what I have and make it work for me!

Could not remember the specific term, but that is what I meant.