Main

Automating a Greenhouse with LoRa! (Part 2) || Motorized Window Opener

$2 for 2Layer, 5pcs & $5 for 4Layer, 5pcs: https://jlcpcb.com Previous video: https://youtu.be/EzJsKWW-cDU Part 1: https://youtu.be/2YJHcGQnpAk Facebook: https://www.facebook.com/greatscottlab Twitter: https://twitter.com/GreatScottLab Support me for more videos: https://www.patreon.com/GreatScott?ty=h More project information (schematic, code,......) on Instructables: https://www.instructables.com/id/Automating-a-Greenhouse-With-LoRa-Part-2-Motorized/ Parts list (affiliate links): 1x LoRa Radio Node: http://s.click.aliexpress.com/e/_dYpwqA6 1x LM7805 Voltage Regulator: http://s.click.aliexpress.com/e/_dS0705s 1x LG02 LoRa Gateway: http://s.click.aliexpress.com/e/_d8jEIAK 1x L293D Motor Driver IC: https://s.click.aliexpress.com/e/_dWFVvdc 1x 12V 100RPM DC Motor: https://s.click.aliexpress.com/e/_dYY7aWa In this project I will be showing you how I created a motorized window opener for my greenhouse. That means I will show you what motor I used, how I designed the actual mechanical system, how I drive the motor and finally how I used an Arduino LoRa board in order to control the motor from anywhere in the world. Let's get started! Thanks to JLCPCB for sponsoring this video Visit https://jlcpcb.com to get professional PCBs for low prices. Music: 2011 Lookalike by Bartlebeats

GreatScott!

3 years ago

Hi there, in case you have not realized it yet then let me tell you that this is Part 2 of my automated greenhouse project. So make sure to watch part 1 before watching this part because otherwise you will get confused pretty quickly. With that out of the way let start off with me telling you what I learned in the two months of using my automated greenhouse and what problems I fixed. The first thing I noticed was that the moisture sensors are pretty useless because they never output any kind of
accurate measurements which is why I simply got rid of them. Next I added cable lead-throughs because I actually read all of your comments and admit if I missed something. I also 3D printed a new housing in white for my Temperature sensor because using a black enclosure in direct sunlight kind of distorted the measurements. Last but not least I added a better antenna to the LoRa board which I positioned on top of the greenhouse to achieve a more stable connection to my router. And those were bas
ically all the changes if I exclude that I also added a small script which translates the hex values to decimal and I have to say that I am pretty happy receiving the temperature and humidity data without any problems because it lets me easily know when I have to open the window or door to ventilate the greenhouse. And it even seems like all my tomatoes, sugar melons and one water melon agree with me on that. But wouldn’t it be awesome to have an automated motorized window opener which like the
name implies open and closes the window whenever I tell it to do so through the Things Network site. Well in this video I will show you how to do just that, so let’s not waste any more time and let’s get started! This video is sponsored by JLCPCB! Feel free to visit their website JLCPCB.com to not only find out what awesome PCB and Assembly services they offer but also to easily upload your Gerber files and thus order affordable and high quality PCBs. First off I have to say that my initial plan
was to also incorporate an automated watering system but I quickly realized that I need to visit my greenhouse almost every day and thus automating this process would have been kind of pointless and thus I scratched it. With that out of the way let’s think about the motorized window opener which consists of a mechanical part where we have to decide on a motor type and create a suitable mechanical system consisting of motor holder, gear and gear rack and an electronics part in which we have to f
igure out how to drive the motor and how to control it through LoRa and the Things Network. Let’s begin with the mechanical side by choosing between these three motor types: a BLDC Motor, a Stepper Motor or a DC Motor. Now the biggest challenge for the motor will be the required holding torque which is required to hold the window in the opened position and not let it roll back down. That means the BLDC Motor is out because common ESCs which are necessary to power them, do usually not come with a
holding torque option. Stepper Motor drivers however do come with such an option and therefore feature suitable holding torque. But the catch is obviously that powering the stepper motor would require quite a bit of energy and since we are working with solar power and a battery we should definitely avoid that which means that the stepper motor is out as well. And that brings us to the DC motor which at first sight does not come with decent holding torque. But if we take a DC motor whose RPM of
5000 gets reduced to just 100 through a gear system then you can see that it suddenly features quite a lot of holding toque which I even cannot overcome with my hands. And due to this gear system and later powering it with only 5V, I will not even have to alter is RPM electrically which makes it perfect for our window opener. So next I measured all the dimensions of the motor as well as the space between the available mounting holes next to the window and through this knowledge created this moto
r holder in which the motor will later fit snugly and can be locked in place with two M3 bolts and nuts. Next it was time for the gear system for which I used the McMaster-Car component library where I chose a fitting plastic gear and gear rack. After then extending the gears mounting hole a bit according to the dimensions of the motors rotor, I also added a 3mm hole to it to later hold it in place with a grub screw and then continued by shorting the gear rack a bit. As you can see those two par
ts can later be used to slide the rack forwards and backwards and thus opening and closing the window but as you might already have guessed this rack cannot float in midair which is why I also designed this case for it. And with that being done, all the mechanical components were pretty much done and thus I 3D printed them all with my Prusa 3D printers which took around 4 hours in total. As soon as that was done I assembled the gear system for testing purposes and as you can see by alternatingly
powering the motor, the rack slides forwards and backwards without a problem which brings me to the electrical section. To turn the motors rotor left and right we need to be able to change the current flow through it which is why we need such an H Bridge circuit and at least two digital pins of our microcontroller. If the left side is high and the right side is low, current will flow from right to left and if the left side is low and the right side high, current will flow the other way which ba
sically means this circuit should do the trick. But while searching for suitable MOSFETs, I noticed that I didn’t have any logic level P Channel MOSFETs lying around which are definitely mandatory when working with such a 3.3V system. But instead I found this L293D IC which actually includes an H-Bridge and can be controlled by 2.3V logic levels, perfect. To test it, I soldered a fitting IC socket to a piece of perfboard, created some solder connections and finally hooked up the motor according
to this little schematic. After then inserting the IC and connecting the power lines to 5V which is a voltage that is also available in my greenhouse, we basically got two input pins to work with. Depending on which one gets connected to 5V or later 3.3V, the motor rotates one way or the other way and as you can see everything seems to work just fine. So next I got myself the same Arduino LoRa board from part 1 of this video series and connected the input pins of the motor controller to pin 3 an
d 4 in addition with 300kohm pull down resistors but you can just follow the finalized wiring diagram of this projects if you are interested in creating something similar. After then adding this new LoRa board to the things network site, I adjusted the code of this test device a bit so that it always uploads the same temperature and humidity data. And after hooking an FTDI breakout board up to it and uploading this new code you can see that the things network gets the data successfully and here
we can actually send over data through a downlink but all the Arduino code registers is how big the received data was in bytes. So I simply edited the code in a way that it rotates the motor one way if it receives one byte and it rotates the other way if it receives two bytes. Of course I also implemented a delay so that the motor only moves for a short time and the motor can also not rotate the same way twice in a row and the Arduino will also from now on send over the status of the window with
99.9 standing for being open and 00.0 for being closed. After uploading this finished test code and powering everything up, I sent over 1 byte which promptly let the motor spin one way and afterwards I sent over 2 bytes which lets it spin the other way, perfect. That means it was time to head into my garden to firstly secure the motor mount with motor and gear system next to the window and then soldering a wire to the motor which I guided into my electronics chest through the help of wire pedes
tals and zip ties in which I then connected the motor wires to the motor driver IC which I then obviously hooked up to the LoRa board. After then using adhesive tape to mount the window opener to the window, I uploaded the finalized code and as you can see the system still sends over the correct greenhouse data but now we can also remotely control the window through LoRa and the internet, brilliant. With that being said, I hope you enjoyed this video series and learned a thing or two. If so don’
t forget to like, share, subscribe and hit the notification bell. Stay creative and I will see you next time.

Comments