Need some help with an interesting project

I have an interesting project in mind that I need some help on.

We have a family farm that I would like to add some automation to. During harvest we fill the grain dryer with about 2 semi truckloads of corn, turn it on, and dry the corn. When the corn is done drying (2-ish hours) we crank a winch to open baffles and “drop the dryer”. We then close the baffles, fill again, and repeat. While the dryer is running we have a 110V light on the outside of a shed that turns on. When the dryer shuts off the power is cut to the light, turning it off.

My hope is to sense the power going to the light, when the 110V power is cut I’d like to trigger an automation that runs a 110V winch for x seconds. However, I’d prefer to wire in a 110V outlet on the same circuit as the light, then plug something into that outlet that can sense the power being cut. That way I don’t run the risk of a burnt lightbulb falsely triggering the event. Ideally, the automation would then wait for X minutes then run the winch in reverse. OR, the dryer runs on some serious power (like 480V, I think). Is there a good way to sense the power going to the dryer and run the trigger off that?

I know the winch has 4 wires going to it. My assumption is a neutral, a ground, and two hot, one hot wire to rotate the drum clockwise and one to reverse it. I plan to test that with regular light switches at some point. So, I think I could use two light switches in the automation. Although, momentary switches would be more ideal.

So, getting to my questions:

  1. Is there good hardware that I can use to sense the 110V current drop? Ideally, something that can be plugged into an outlet that wouldn’t falsely trigger an event if a light bulb burnt out? Or something to sense the 480V dryer current drop?
  2. Does anyone know of a momentary 110V switch that can be automated to be turned on for X seconds? If not, could I use a standard Z-wave light switch and trust HA to turn it on then turn it off X seconds later and be pretty accurate (like within 1 second)
  3. I’m also considering using a pin switch (like this) to make this more fail-proof. I’d use cable clamps on the winch cable to attach a metal plate. When the metal plate hit the pin switch it would cue an automation to turn off the winch. Does anyone know of a switch like that I could use? It would have to be weatherproof as it would be installed outside.

So, can anyone offer any advice? Am I way over my head on making this happen?

To detect whether there is power going to the light bulb you need to measure the voltage, not the current. The voltage will still be there if the bulb is blown or removed.

I think an optocoupler is probably what you want for that. Couple it with a raspberry pi or an esp8266 to communicate with HA over MQTT would be my methodology.

Switching could be done with a sonoff, a 4ch would give you two spare controls for something else, if you ever need them. You’d need to check the load your winch draws though, including in ‘failure’ states like getting jammed, or frozen stuck.

Oh, and are there safety checks needed? No doubt if someone is there to switch the winch on, they can see if there is a small child about to be covered in dried corn, a machine ain’t that clever without some more!

You also have the Sonoff Pow, with Tasmota, you can use as a switch and to mesure the voltage. an integrates very well onto HA.

1 Like

The sonoff pow does not measure voltage, it measures current.

I think it measures both, Voltage and current :wink:

{“Voltage”:228, “Current”:“0.054”, “Power”:3, “Today”:“0.079”, “Factor”:“0.30”}


However when the power from the light goes off, the sonoff will stop working.

1 Like

Thanks for the replies guys!

As far as the safety aspect goes, this is a pretty closed system. If someone were in the dryer when the corn dropped they would probably already be dead from the dryer running (which must be manually turned on). They would have also had to climb a 4 story ladder and crawled into a small door in the bin. The corn also drops slowly enough (takes about 10 minutes to drop 2,000 bushels) and evenly enough that someone in the bin would be safe around the dropping corn.

I like the Sonoff 4ch idea. Just to be clear, we aretalking about this, right? Presumably, this acts like 4 separate light switches? I can have the power going into this switch then out to each winch direction control? It looks like the 4 buttons on the unit can also manually run the winch too, correct?

As far as sensing the dryer turning off, I’m not great with Rasberry PI or Arduino and I’d like to keep this simple. Could I use a Z-Wave energy meterlike this and base a trigger on the energy consumption reducing?

My other thought would be to use a D1 Mini like this guy did. I could plug it into the power outlet that is connected to the light. When the power goes off it should lose connection with the router. My only concern with that is it might drop the dryer if the router loses power or just loses connection with the D1 Mini. I’d like to make the trigger near bulletproof so I’m not dropping 2K bushel of wet corn on top of 20K bushel of dry corn.

That was of course an example, just be aware that without eyes on, things that a human operator does instinctively don’t get done.

yes on all counts

energy consumption is not what you are measuring, because if the bulb is broken or removed, energy consumption drops, so it is a false (and devastating) positive.

Again I think you are measuring the wrong thing. If the network drops it could be due to numerous reasons, as you have pointed out. If you want to use the D1, do it like I suggested, and have it measure the voltage supplied to the light socket, and send a message to the home automation server when the bulb voltage goes off. If the network drops, the worse that happens is that the corn doesn’t drop and someone does it manually.

All good points! Thanks for the feedback!

One more thought. In an attempt to make this fail safe, I’d like to include some kind of emergency stop button. That way someone could halt the whole process if needed. My only thought so far would be to wire in a Zwave light switch that doesn’t turn anything on. I could have HA track the on/off state of the switch and trigger an automation to shut all the other automations off if the state changes. Will that work? Or do you have a better idea? If an automation has already started can another automation or trigger stop it immediately? Or does the automation always have to finish?

Another possible fail safe would be to monitor the temperature in the dryer. Is there a good temp sensor that would withstand pretty brutal conditions that would integrate well? It would need to read up to about 150 degrees (65 Celsius) and withstand outdoor Iowa weather as well as hot and humid conditions in the dryer.

I purchased the Sonoff 4ch to play with. If I can get it to operate the winch I think I’m in business!


I came across this tutorial for an optocoupler, it looks like it would work. I’m going to use a Rasberry Pi 3 to run HASSIO. This looks like I can just hook the optocoupler into the raspberry pi 3 that runs HASSIO. Is that the best way to do it? can HA read from GPIO pins on it’s own board? Or am I better off using a different board or a different solution like this one?

You could connect a flashed sonoff to the same supply as the light. It would be on when there is power to the light and you would be able to see the device in HA and use the fact it is on as a signal for power to the light. The sonoff could send an MQTT message or a device state on boot message of some kind to tell HA when the sonoff is on.

Personally I would flash ESPeasy onto 2 sonoffs which would be able to communicate with each other directly no need for home assistant in this case. You can use the inbuilt rules of ESPeasy to set timers and conditions on when to trigger. (Or you could use home assistant and ESPeasy)

I would use sonoff1 connected to light
Sonoff2 connected to the winch.

Sonoff1 would signal to sonoff2 when it boots up and also send regular pings saying I am turned on.
When sonoff1 was turned off (due to dryer off), sonoff2 would know power was cut to the lighting circuit because it doesn’t receive a signal from sonoff1 anymore and sonoff2 could activate the winch.

You would be able to add timers, temperature probe data and other conditions into the EASPeasy rules which together could make it quite a smart system on when to activate to prevent any false triggers. So for example, only activate winch if timer is within 10min of 2 hour expected time and if temperature is within 5deg of expected temperature. Something like that to prevent any false triggers. I suppose you could do that in home assistant as well, but you can do that with ESPeasy.

Total cost of parts $10. You could also add a temperature probe to either sonoff for a few $. Maybe a weatherproof box also for a few $.

How many Amps is the winch? The sonoff comes in a 10A and a 16A version, if it’s more than this then you won’t be able to control the winch with the sonoff directly.

You could wire an emergency stop button to the GPIO pins of the sonoff. Your rules inside ESPeasy would be able to stop any automation from running if the button was pressed.

What controls the timing for the dryer? Does it sense when the corn is dry or is it turned on and off manually? Whatever triggers the dryer may be a better trigger for your system instead of power to the light?
What action fills the hopper? Maybe you can automate the whole process; why just the winch?

I love projects like this, good luck!

Thanks for the ideas!

The dryer has a temp sensor in the dryer. It shuts off when the temp hits a certain point. I’d love to sense the temp in the dryer as another way to prevent false positives, but I’m not sure how to tap into the current temp sensor and I dont know of a HA compatible sensor that could survive in the dryer.

The long term goal is to automate the while thing. As well as have a tablet in the semi truck that can shut off augers. Then you could pull the semi under the load-out chute and load all without getting out of the truck.

As we harvest we first fill the dryer. As it runs we fill a “wet bin” with wet corn. We eventually need to get that wet corn in the dryer and dried. Step 2 of this is to automate the whole thing. So, when we quit at the end of the night with 10k bushel in the wet bin we can start an automation that cycles corn from the wet bin to the dryer, starts the dryer, then drops the dryer, closes it, and repeat. If I get the dryer drop figured out all I would need to do is figure out how to turn on the augers and start the dryer. I’m hoping i can also do this with the so off 4ch.

I ordered a so off 4ch pro and some stuff to make an optocoupler. I’m going to start with that this weekend. I’ll report back!

I just thought you can use a light detecting resistor (LDR) these are cheap and easy you can put it over the light and sense when it is on instead of an octothingamajig

The ds18b20 temperature probes connect to the sonoff devices (if they are flashed with tasmota or ESPeasy). They cost a few $s and I think you could test a few out and see if they last in there. I checked the datasheet and it says it measures upto 125C. You would probably connect it to a long length of Cat5 cable with a resistor and keep the sonoff out of the direct heat but the probe should be OK.

You can connect a load of them in serial and have a mesh of temperature probes all over the place.

My only concern with sensing the current lightbulb is if the bulb burnt out. It could drop a load of wet corn.

Thanks for the temp sensor idea. I’ll look at that as well.

Actually, I don’t know why I’m fixated on the light, it’s irrelevant. You can power literally any device in the world from that live line and use that as a signal.

Most straightforward I can think of is connect a 3.3V power supply to the line and connect the DC output to the input of a sonoff or nodeMCU or whatever device GPIO, it will directly detect voltage high and low and know whether there is power or not on that circuit. You can report this information to home assistant as a state or use it directly in a rule on the device to control something.

The more I think about this thread, the more it concerns me that you are trying to automate an industrial, major scale plant with software and hardware primarily designed for home automation. Personally I find HA pretty reliable, but then again it doesn’t cost me anything but a stubbed toe if my hallway light doesn’t go on when I stumble to the bathroom at 3.00 am.

Something my livelihood depended on, I might look at something more industrial strength.

Just my 2 cents worth.

I can understand the concern, that’s why I’m trying to put in some safety measures and do some incremental phases.

Our step 1 is just to drop the dryer. We will test that for awhile and see how it works. If we accidentally drop 2k bushel of wet corn it won’t cause an issue when mixed in among 400k bushel of corn. I’m also planning on sending an SMS for each step. If we get an alert that something happened when it shouldn’t have it will be easy to shut it down. It takes 10 minutes to drop the dryer. If we get an SMS that the dryer dropped and we catch it 2 minutes later we can shut the dryer and advert it any ussues. We also have an IP camera on the dryer controls at all times. We can always log in from anywhere and see the state of the dryer and the temp.

As it is now, if we see the light for the dryer is turned off we will manually drop the dryer. So, the automation won’t do anything that we wouldn’t have done ourselves.

My ideal scenario is to be able to measure the dryer temp. I can then use the temp as a condition plus send an SMS that says “the dryer turned off at 129 degrees”. “Dryer has dropped at 10:13pm.” Etc. That will give us plenty of opportunity to see if something isn’t right. I might also build some automations to send SMS with faults like “dryer shut off at 114 degrees. Dryer did NOT drop.”

LOL the other thing I have been meaning to say is that I love the quaint American units of measurement!

Yes sounds like you are moving forward incrementally, which is a good way to proceed IMHO.

Home assistant can do all sorts of notifications, not just SMS. Telegram seems a popular system, as does pushbullet.

A great project.

1 Like

On the notification end, I have come across this recently:

Seems like you can send actions as response to a notification - at least as long as you’re in the same network, but I guess it would work over a VPN as well.