Go Down

Topic: ESP8266, Uno and solar to control solenoid (Read 31 times) previous topic - next topic


Greetings all,
First, I'm of course, new. While I've been playing a lot with the Arduino (and rPi and others), I really don't have a lot (read: any) experience. I've spent a great deal of time trying to learn and have just about every book.
So here's my project: I'd like to take a ESP8266 module (I really would like to keep this wifi), an Uno (if need be, I understand the 8266 might be able to handle it all), and a solar panel/li-po battery combo to control a simple hose bib solenoid. Where I live in NorCal, you get fined for overwatering and I simply keep forgetting to shut off the water to my veggie boxes.
I've got the modules, the Uno, the solenoid (12v), and I'm getting (if I'm pointed that way) the SparkFun Sunny Buddy and one of their large solar panels. I've also got a couple 2000ma batteries.
What I DON'T have is any clue how this all goes together. Trust me, I've read what I can but so much of what is out there makes assumptions about the readers level of knowledge. Even the Sunny Buddy hook up tutorial glosses over how to hook up "the load" and whether the battery will power 'the load' when there's no sun. (This last part seems obvious to me, yes, it would. But the device is listed as a battery charger, so there's some question. Several commenters to the site have asked the same question, with no answers for months!)
My questions (right now) aren't around the programming, I think I can get through that. How to hook it all up. I'm imagining the Sunny Buddy (SB from now on) is going to have the solar panel coming in, the battery going out and the "load" being the Uno. I've seen the wiring there, so I think I can do that. (Never soldered, either. I learn fast.) But what about the solenoid? A motor controller board? How does that get powered?
If my suggestions for the power controller (the SB) is incorrect, I'm open to all suggestions.

Like I said, I'd really like to keep three aspects of the project - wifi cause I have other ideas I'd like to do with 8266, uno (or the wifi module itself, I'm not picky) and solar. BTW, I know there's simpler solutions - like a sprinkler controller, but I'll not learn anything there.

Thanks so much in advance.
Lots of Unos, couple Megas, some Makeblock boards. A few Pi3b's. No knowledge.


I understand the 8266 might be able to handle it all
Indeed, it can easily do that. Actually, it is a SOC (System On a Chip) with a faster processor and more memory than a regular Arduino, it can even run a web server, host a web page and images etc. You can program it like a normal Arduino if you use Ivan Grokhotkov's ESP8266 Arduino core. You can control its I/O using the familiar digitalRead/Write functions, for example.

As for power, I'd go with a 12V SLA (Sealed Lead Acid) battery (like a car battery). Why? 1. You've got your 12V for the solenoid, 2. They are much easier to charge from a solar panel than Li-Ion batteries.
Then just use a step-down converter to get 3.3V for the ESP8266.

How you drive the solenoid, depends on its current draw: if it's under 0.5A, you might get away with a simple NPN (power)transistor. If it's higher, I'd go for a MOSFET, you'll then probably also need 2 extra transistor, to drive the MOSFET with 12V (the 3.3V from the ESP8266 won't be enough to turn on the FET completely, unless you use a low gate voltage, logic level MOSFET). You could also use a relay. Make sure however, that you use a flyback diode, since the solenoid is an inductive load, and will produce high voltages when suddenly turned off, that may damage your transistor, or cause sparks in the relay.

Most MOSFET drivers you'll find online are badly designed, they're just simple emitter followers, that keep the voltage the same as the input, which is not what you want. Other designs invert the signal, meaning that they turn on when nothing is connected, and turn off when you apply 3.3V. This is absolutely not what you want, you want your valve closed if your ESP8266 crashes!
Take a look at my article on driving loads with Arduino.

Good luck!


Thanks for the quick - and complete - reply. I've been doing a lot of reading today and that's the best solution I've read.

I've seen plenty of 12v solar controllers, so I should be able to use one of those for the panel to battery connection, then go with the step down for the ESP8266.

The solenoid I'm using is from Sparkfun and is one of the 'normally closed' models. I've already left the water on twice this year in excess of a full day. $51 fine each time. So this is going to save me money!!

Thanks again for the suggestion.
Lots of Unos, couple Megas, some Makeblock boards. A few Pi3b's. No knowledge.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131