Need Advice on ESP Project

I’m not an electrical engineer so some stuff is still a learning curve as I tinker with Arduino’s, Pi’s breadboards and PCB’s to accomplish relatively rudimentary automation (i.e., simple plant watering devices and basic ESP32 sensor data).

What I want to do is have an ESP device powered by battery that can drive a small motor and survive the temperatures outdoors. It’s essentially a gate device that will have sensors to indicate if the gate is closed, sensors to read the temp and humidity (because why not, they are simple) and to control a motor capable of just lifting and lowering a lever on my gate latch (small lever, takes almost no effort to use, so the motor doesn’t have to be beefy) and a piezo style speaker to use as a “buzzer” (think apartments that buzz you in).

The concept is that I’ll have HA activate the motor to open the gate lever for 5 seconds and buzz the speaker to let the person know they can open the door before the motor lowers the lever again. I would like to one day geek it out with facial recognition and some other stuff, but just this basic capability via ESPHome would be sufficient.

What I’m not certain about is how to power it without having to change batteries frequently. I’m open to solar but don’t know anything about how to implement it, so I thought maybe some weather tough batteries that I could recharge from time to time (maybe 2-3 months?) would be OK too. Not sure if I need additional components to power the motor (step downs, resisters, etc). The use of this device would be infrequent (other than reporting on sensors occasionally), maybe a couple times per week.

I’m hoping my fellow nerds who are much more versed in this type of thing could give me some guidelines. Even broad strokes are cool because I can research a proposed concept to hopefully get to the finish line.

Thanks!

Driving a motor is going to consume anything smaller than an automotive battery with solar panel, especially if that motor is moving a load. If the gate lever has low resistance and low weight/mass, then it may be possible to use a servo instead of a simple motor. Servos also require some current/energy. It’s possible an SLA (sealed lead acid) battery with a small solar charge controller may work well. Everything would have to be placed into a plastic or metal water-tight box. How far would this ESP device be from your wifi access point?

Thanks for the reply! I’ve got a full mesh wireless network and I’ll be using this device on two gates, one will have a strong signal, the other has some obstacles between it and the network, so it has to go through a rock wall, garage, cars in the garage, and a couple more walls - it’ll be the tougher of the two.

I was thinking about the little servo motor that comes with the Arduino kits, I wouldn’t need more power than that. Is a sealed car/motorcycle battery the only way to incorporate solar? I was thinking sort of like those yard lights that use a panel connected to a 18650 style battery (or maybe two in sequence or parallel)?

18650 lithium oxide cells will provide a good power supply, but not when it comes to motion/servos. You’d have to use the deep sleep mode more than activity to conserve energy.

What type of gate are we talking about? I’ve installed gate operators and they require a lot of power. You’re essentially at the far end of a lever. Even perfectly balanced wind exerts a good amount of pressure that it overcome any small battery operated motor.

@FredTheFrog Even those little cheap servos huh? I figured deep sleep wouldn’t really be an option since I need the device to be on-demand for triggering the motor. The sensors can operate on just occasional wake-ups, but I figured the device would have to be “listening” during at least daytime hours for communication to run the motor.

@Mikefila The gate is not your standard gate lock, it’s actually a small latch and not the heavy steel latch, it’s polycarbonate with a super light up/down lever to release the gate latch (basically this: https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fimages.homedepot-static.com%2FproductImages%2F81945dc3-8629-4a42-a8d7-1e3313ae38fb%2Fsvn%2Flokk-latch-fence-gate-latches-slide-bolts-50560-64_1000.jpg&f=1&nofb=1). I’ve considered incorporating a solenoid to “knock the gate open” when the latch is released but figured that was a 2.0 upgrade :slight_smile:

As an example, this 55 gram RC servo draws 3 Amps at 5 volts DC. That will drain batteries pretty darned quickly. Now, as I mentioned earlier, when there is little resistance, that amount of current isn’t necessary. But the start-up current draw will still be greater than 1 ampere, which is why I suggested an SLA 5Ah battery above.

lol I read too fast. If you do ever go down the opener path, the screw drive type usually uses the least amount of power.

Your wifi, you can use esp’s as a cheap access point to extend your range.

@FredTheFrog Yea, you touched on something where I’m out of my depth and still trying to better understand, and that’s the power draw and how to properly manage it and prevent under or overload conditions. It’s easy to run a 5v power supply to an arduino, or even hook up a basic battery, but figuring out amperages needed and how that impacts a battery is definitely a weak spot for me. That and knowing if or when a resister is appropriate.

@Mikefila Thanks for the advice! Is it because that burst of energy to engage a solenoid is so much greater than the gradual draw of the screw drive? As for wifi, that’s easy, I can just add another extender to my mesh in the garage too (albeit a LOT more cost than an ESP32).

It all comes back to force. Pivot motors have to be very strong because it’s at the short end of a lever. The way a screw drive arm is situated, it’s a lot harder to spin a screw on a shaft by putting pressure on the gate leaf. If that makes sense.

To turn the drive nut it only needs a little bit of power. Trying to turn the nut by pushing the the screw arm requires a lot more force.

1 Like

Considering the prices:
$20 12V 5Ah SLA (AGM) battery
<$100 12V Solar panel with charge controller (need at least 10 watts, preferably 20 to 30 watts)
$15 Two-pack of 55g MG996R digital servo motors
$5 ESP8266 / Wemos D1 Mini clone
??? Miscellaneous hardware

So, you’d be getting into the just under $200 range for a single device.
Might be cheaper, simpler, and more reliable to run 120VAC out to the gate/post and use a wall-wart to power things.

1 Like

I’ve definitely considered running 120V but cost isn’t really an obstacle for me (unless it was thousands, then I would question my sanity in this project). A lot of my motivation is “because I can”, to see how I can really extend my home automation to useful, but probably unnecessary, gadgets. So this helps me to learn so I can take that knowledge and do other completely unnecessary things :joy:.

1 Like

I’m certainly going to go with your advice for the larger battery. I wasn’t initially understanding that you considered that part of a solar plan, so I was thinking “well, I have to disconnect that battery every so often, take it to a trickle charger and that seems like a lot of work”, but that battery in a solar setup makes sense (and is pretty small). Now I have to figure out how to process the energy from a small solar panel into the system and run the ESP from the battery without electrocuting myself :grimacing:.

This all depends on where you live and what type of regulations you face. In general gate operators run on 220V. You also need to bring a neutral out, as most accessories use 120V at least in the US.

Electrical I’m good on. I have done extensive household electrical work and could easily run a GFCI outlet within reach of the gate, but ask me about when resisters and capacitors need to be used and I’ll look at you like you are speaking Martian! But, it’s worth a few hundred to do this because it’s my feeder into putting together an entire HA system built totally on solar and batteries where there is no 120V available to it.

The good news is, converting 12VDC down to 5 VDC is simple and cheap.

Sorry, that’s a USB-C connection. I’ve used this device twice now and it’s been very reliable:
https://www.amazon.com/dp/B00CXKBJI2

And for the ‘quick and easy’ conversion:

1 Like

A ditch witch will run about 100 - 150/day grab a shovel and you could do 1000’+ feet it in a few hours. They also have a hydraulic ram that can be used to tunnel under a paved driveway for double leaf gates.

Lol adjusted

1 Like

@FredTheFrog So, power draw wise, I don’t need to split the power between the servo and the ESP, I could route directly to the ESP and use the same 5V to power the motor too?

@Mikefila I wouldn’t need one, each gate is only about 5’ from the house if I opted for a high voltage solution and I have shovels :muscle:.

LMAO @Mikefila, awesome edit!

1 Like

Well, most of those 12V-to-5V converters (and there are a LOT of different ones available) top out at 3 Amps total. I’d use one smaller 3A convertor to power the ESP and a second separate convertor to power the servo. Still inexpensive.

1 Like