ebaierl
Posts: 35
Joined: Wed Jun 01, 2016 10:05 pm
Location: Wherever we happen to be
Contact: Website Facebook Twitter

GPIO Beginner Info Needed

Thu Jun 14, 2018 2:27 am

So its been a long time since I have messed with any electronics. I've built a few Pis, installed raspbian, all good on that front. Got them to do what I want. but I want to expand outward and start messing with things and make some smart home stuff.

My first project is gonna be lights through openHAB, pretty much got that figured out, just gotta get the hardware and assemble it. Its amazing how long it takes to ship something across an ocean.

But this about the second project. I live in an RV, we have four vents in the roof that we have to open manually with a turning crank. Not too difficult, but I want to automate it. I ordered a rain detector, so eventually I'll have a Pi setup with that to work as a weather center and display the outside and inside temperature, maybe some other stuff, I don't know yet what I'm all going to do with that one. But the main thing is the rain detection. I want to set it up so I have a Pi that can send a signal to motors and have them spin clockwise or counterclockwise, depending on if they need to open or close.

I think I found motors that will work and they only require .28amps. I assume I can connect them to a Pi through the GPIO pins and when they have power, they spin. If its possible, I'd like to do it all with one Pi since that's cheaper and I only have to set on up.

I read through a tutorial on the GPIO, and I'm still confused. Theres 2 5v pins and one 3.3v. The motors I'm looking at run at 1.5v to 12v. I assume they spin faster with more voltage, but the description page is a bit vague. I also assume that if the voltage is going one way it turns CW, the other way its CCW. I'm not positive though.

Is it possible to reverse the voltage over the pins to the motors? Or would I have to have one Pi that sends the power and have a second that is connected in reverse to spin them the other way? And is it possible to send that many amps to all four motors at once? Total amperage would be just a hair over 1amp. If I do need to use two Pis, on CW, one CCW, I'd have to figure out some way to prevent power from going back into the other Pi too, since the wires would be on the same contacts. I think a diode at the pins would this, but like I said, its been awhiel. And am I getting in over my head and trying to do something that isn't doable?

klricks
Posts: 5833
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: GPIO Beginner Info Needed

Thu Jun 14, 2018 3:19 am

The GPIO pins cannot be used to drive any kind of motor.
You need a motor driver board and suitable power supply for the motor(s).
Consult Google & YT for dozens of examples tutorials etc.

For the crank vents I would suggest that you replace them with off the shelf electric vents and then interface the RPi to control those.
The biggest problem with retrofiring manual vents/doors/windows is that you need to incorporate limit switches to signal when to stop the motors when at the fully closed and fully open positions. Off the shelf electric vents would have the limits built in.
Any retrofit solution would be bulky and likely unattractive if even possible.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Stretch w/ Desktop OS.

ebaierl
Posts: 35
Joined: Wed Jun 01, 2016 10:05 pm
Location: Wherever we happen to be
Contact: Website Facebook Twitter

Re: GPIO Beginner Info Needed

Thu Jun 14, 2018 3:06 pm

Well the reason I was trying to build a mechanism myself is because one of the electric fans costs over $100. We have four vents, so that would get really expensive. I could get the fans that have builtin rain sensors and close when it starts raining, but then those each cost nearly $100.

Figure if I could hack a way to make it myself, I'd be saving a ton of money and have more control over what I want it to do.

I do know it might not look great, but I think I can manage a way to get it to hide the motor and wiring with a small cover. To get them to close, I can either add a reed switch maybe, or have them all tied together so they are all either open or closed, since that's how we use them anyway. And that way, if the Pi knows if they are open or closed, I might be able to make it so it sends a command to turn on power for a set number of seconds to open them all and the reverse to close them all. If it was set up right, then they would always be closed or open the exact same amount.

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 35 guests