Eliter
Posts: 37
Joined: Sat Dec 26, 2015 7:28 am

How is 3V GPIO usable?

Fri Apr 22, 2016 11:42 pm

So, I want to get started with projects that control things outside of the Raspberry Pi. I notice that if I hookup the motor a a small RC helicopter, it turns off the computer, since it drains power. I found out that I need a relay for the Raspberry Pi, so the Raspberry Pi can flip a connection on, and the thing being controlled is being powered by something else.

I have found lots of 5V relays, some saying its for arduino/Pi. So, there's only 4GPIO pins that produce 5V, and I want to be able to use all 8 GPIO pins. How would this work? Do I need different relays? Do I need to do fancy stuff?

I also have a $10 budget for relays. So, keep a price within reason.

rzusman
Posts: 347
Joined: Fri Jan 01, 2016 10:27 pm

Re: How is 3V GPIO usable?

Fri Apr 22, 2016 11:49 pm

You need to use a transistor or a FET to drive the relay from the port pin.
There are a million posts on this subject - search for it.

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

Re: How is 3V GPIO usable?

Sat Apr 23, 2016 1:45 am

Eliter wrote:So, I want to get started with projects that control things outside of the Raspberry Pi. I notice that if I hookup the motor a a small RC helicopter, it turns off the computer, since it drains power. I found out that I need a relay for the Raspberry Pi, so the Raspberry Pi can flip a connection on, and the thing being controlled is being powered by something else.

I have found lots of 5V relays, some saying its for arduino/Pi. So, there's only 4GPIO pins that produce 5V, and I want to be able to use all 8 GPIO pins. How would this work? Do I need different relays? Do I need to do fancy stuff?

I also have a $10 budget for relays. So, keep a price within reason.
You are a bit confused on the GPIO.
In the 40 pin header there are 17 programmable pins which are the 'real' GPIO's.
There are also several other special purpose pins which can be used as GPIO when needed.
In the 40 pin header, there are also 8 GROUND pins, 2 full time 3.3V POWER pins and 2 full time 5V POWER pins. The GROUND and POWER pins are not really GPIO but many call them that.

Regarding the relay. I would suggest to get a relay board and not try to use a 'raw' relay. The relay boards have the control transistors and protection diode built in and have screw terminals to easily wire things up. They usually have an indicator LED to show when the relay is on or off.
You can get relay boards with 1, 2, 4, 8, or more relays on one board. Often referred to as channels For example: 4 channel relay board etc. http://www.sainsmart.com/sainsmart-rela ... ry-pi.html

Don't confuse the coil voltage with the relay input controls.......
When they say 5V relay they mean the electromagnetic coil voltage. Relays coils come in several voltages.... 5V, 12V, 24V are the most common.
You can use the 5V POWER pin on the RPi to power the coils as long as there are not too many. It would be best to use a separate power supply. You have to use a different power supply of course if using anything other than a 5V relay.

The relay board has 1 control terminal for each relay which is what you connect the GPIO to. (1 GPIO per relay).
Google will provide all the information you need. There are hundreds of Raspberry Pi relay tutorials etc.
Last edited by klricks on Sat Apr 23, 2016 2:51 am, edited 1 time in total.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

Eliter
Posts: 37
Joined: Sat Dec 26, 2015 7:28 am

Re: How is 3V GPIO usable?

Sat Apr 23, 2016 2:51 am

I do want to power some motors, sensors and stuff, and would like to not be bound by 3V or 5V. I already ordered the 8 channel relay board from sainsmart. Is this a bad investment? I'm interested in using whatever works, the cheapest and the most power efficient. Also, I'd like things to last a decent amount of time. Also, you say there's so much out there, when there is nothing that I see as halfway useful.

Thanks!

What I bought:
http://www.sainsmart.com/sainsmart-rela ... ry-pi.html

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

Re: How is 3V GPIO usable?

Sat Apr 23, 2016 3:15 am

Eliter wrote:I do want to power some motors, sensors and stuff, and would like to not be bound by 3V or 5V. I already ordered the 8 channel relay board from sainsmart. Is this a bad investment? I'm interested in using whatever works, the cheapest and the most power efficient. Also, I'd like things to last a decent amount of time. Also, you say there's so much out there, when there is nothing that I see as halfway useful.

Thanks!

What I bought:
http://www.sainsmart.com/sainsmart-rela ... ry-pi.html
Not sure what you mean "bound by 3V or 5V?"
The output terminals of the relay you bought are: AC250V 10A ; DC30V 10A. which means if you want to control Mains AC equipment then you can use up to 250VAC and you must limit the current to no more than 10A per relay. Do not use mains AC unless you know what you are doing or get help from someone who knows how to safely handle the wiring.
If you are using DC then 0-30VDC and no more than 10A. Of course you would have to apply the voltages needed to the common terminal on the relay output.

For motors, if you want to run a simple motor to just turn on and off only then a relay will work.
If you want to do forward & reverse or control the speed or if you have the more complex stepper motor then you would need a motor control board instead of a relay board.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

Eliter
Posts: 37
Joined: Sat Dec 26, 2015 7:28 am

Re: How is 3V GPIO usable?

Sun Apr 24, 2016 8:22 pm

I was reading that there a millions to billions of transistors in a computer. If they can put that much into a computer with a somewhat reasonable price, can I get transistors at a dirt cheap price? If yes, I could build something that could take the combinations of GPIO pin outputs, and build a circuit for switching around the motor's power.

For example(be flexible about my names for the GPIO pins, as they're wrong, but gives a picture): pin 1 on and pin 2 off means forward for motor; pin 1 and pin 2 on means backward; pin 1 off and pin 2 off means the motor isn't powered.

User avatar
joan
Posts: 15256
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: How is 3V GPIO usable?

Sun Apr 24, 2016 8:31 pm

Have a look through past issues (download pdf) of the MagPi magazine.

https://www.raspberrypi.org/magpi/issues/

rzusman
Posts: 347
Joined: Fri Jan 01, 2016 10:27 pm

Re: How is 3V GPIO usable?

Tue Apr 26, 2016 1:46 am

Eliter wrote:I was reading that there a millions to billions of transistors in a computer. If they can put that much into a computer with a somewhat reasonable price, can I get transistors at a dirt cheap price? If yes, I could build something that could take the combinations of GPIO pin outputs, and build a circuit for switching around the motor's power.

For example(be flexible about my names for the GPIO pins, as they're wrong, but gives a picture): pin 1 on and pin 2 off means forward for motor; pin 1 and pin 2 on means backward; pin 1 off and pin 2 off means the motor isn't powered.
Yes, it’s called an Integrated Circuit.

Just figure out the combinations you want, and then find the correct logic IC.

skspurling
Posts: 196
Joined: Fri Jul 27, 2012 1:44 pm
Location: US. Right in the middle...

Re: How is 3V GPIO usable?

Tue Apr 26, 2016 2:29 am

Eliter wrote:I was reading that there a millions to billions of transistors in a computer. If they can put that much into a computer with a somewhat reasonable price, can I get transistors at a dirt cheap price? If yes, I could build something that could take the combinations of GPIO pin outputs, and build a circuit for switching around the motor's power.

For example(be flexible about my names for the GPIO pins, as they're wrong, but gives a picture): pin 1 on and pin 2 off means forward for motor; pin 1 and pin 2 on means backward; pin 1 off and pin 2 off means the motor isn't powered.
That last one is called an h-bridge. You can build it with transistors, mos-fets, use.an integrated circuit, or connect up relays. The integrated circuit route is the simplest, as many of the difficult issues are already addressed. MOS-FETs are the most efficent, but trickiest and most expensive.

The voltage limitation comes from this all being digital in nature. Digital circuits come in 1.7v (iirc, ultra low power?), 3.3v(low power ttl), 5v (standard ttl), and 12v (older CMOS logic). For every logic family there is an on/off threshold. That's what makes it digital so that's what limits you to 3 or 5 volts. If you want analog, there are other tricks you have to use to read and create those types of siginals/voltages.

skspurling
Posts: 196
Joined: Fri Jul 27, 2012 1:44 pm
Location: US. Right in the middle...

Re: How is 3V GPIO usable?

Tue Apr 26, 2016 2:56 am

Eliter wrote:I do want to power some motors, sensors and stuff, and would like to not be bound by 3V or 5V. I already ordered the 8 channel relay board from sainsmart. Is this a bad investment? I'm interested in using whatever works, the cheapest and the most power efficient. Also, I'd like things to last a decent amount of time. Also, you say there's so much out there, when there is nothing that I see as halfway useful.

Thanks!

What I bought:
http://www.sainsmart.com/sainsmart-rela ... ry-pi.html
okay, I get it. You have misunderstood. You seldom "drive" the devices with the GPIO output pins. Those are signals. They provide a digital signal to a switch( transistor or mechanical), that controls the high current supply for the load. You should only pull a few milliamps of power from each.

moistpie
Posts: 7
Joined: Tue Apr 12, 2016 5:07 pm
Location: UK

Re: How is 3V GPIO usable?

Tue Apr 26, 2016 9:18 pm

Hi I'm still a beginner myself but I thought I'd weigh in as I have just found and implemented a solution to my, very similar, problem.

The problem being to supply a separate and variable power supply to motors controlled by the pi and be able to control the direction of the motors.
For the separate power supply I used a Darlington Array chip http://www.hobbytronics.co.uk/uln2003a- ... on%20array at 36p its a handy piece of equipment. It's basically a transistor block that works by using inputs from your GPIO to enable outputs that are linked to a common rail that you can supply whatever voltage you desire (obviously check the chip rating, it's not invincible). I also read that because of it's built in diodes it provides adequate protection to your pi from the higher power sources you may use. You can only have a one power supply per chip but you can use as many as you have GPIO pins for to supply different power supplies.
With regards to driving your motors in both directions you can use a H-Bridge chip http://www.hobbytronics.co.uk/h-bridge- ... h%20bridge at £1.80 it is also cheap enough to play with. The H-Bridge allows for two separate inputs to control 1 motor (forward input and reverse input). It is also important to note that the chip will work fine with PWM, sorry if I'm teaching you to suck eggs but PWM is required to vary the speed of the motors rather than just stopped and full speed. Again you can use a few of these chips to control more motors, this one will run 2 in both directions or 1 stepper motor in both directions (as they require extra control).

There are several ways to integrate the two chips, I have some diagrams if needed.

As a side note I found a variable transformer that plugs straight into the mains very handy for testing, no point burning through batteries while your developing your project.

User avatar
davidcoton
Posts: 5667
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK
Contact: Website

Re: How is 3V GPIO usable?

Tue Apr 26, 2016 9:51 pm

moistpie wrote:As a side note I found a variable transformer that plugs straight into the mains very handy for testing, no point burning through batteries while your developing your project.
Just for clarity, and not to knock your answer in any way, I think you mean a variable power supply (producing a DC voltage with (probably) an adjustable current limit). A variable transformer would leave you with an AC voltage, needing at least a rectifier and capacitor to make it usable.
Location: 345th cell on the right of the 210th row of L2 cache

User avatar
MarkHaysHarris777
Posts: 1820
Joined: Mon Mar 23, 2015 7:39 am
Location: Rochester, MN
Contact: Website

Re: How is 3V GPIO usable?

Tue Apr 26, 2016 10:05 pm

Eliter wrote:I do want to power some motors, sensors and stuff, and would like to not be bound by 3V or 5V. I already ordered the 8 channel relay board from sainsmart. Is this a bad investment?
We all thought that CMOS (5v complimentary Metal Oxide Silicon ) gates were the way things were going to be; and CMOS was it for awhile with 5v high on, and 0v low off. Trouble is, that when those gates got to moving very fast they conducted more and more current and then they got very hot and melted. So, we lowered the voltage; the lower the voltage the less the power for the same speed and current P = E x I
Well, to make things even worse, other boards like the Intel Edison run at 1.8v (think about that for a minute).

The bottom line is that these little boards are pieces of hardware engineering. Children play with them, but they are not really toys (even though they are) they're not.... :shock:
You really do need to know a little bit about electronics and hardware engineering to fully implement and enjoy your RPi. This little truth should not upset you... just learn it... the soon the better.

If you don't learn about ohms law, and something about resistance & capacitance sooner or later you will make a mistake and burn out something valuable. On the other hand, error is a great teacher. On the other hand, measure twice cut once is a lot cheaper (easier on the pocket book).

If you put more that 3v3 on any GPIO pin on the RPi, you will permanently damage the PI irreparably; and you'll have to recycle it and buy a new onc; I've seen that happen on this board twice this week, don't let it happen to you.

(whether you like it or not, you are bound to 3v3 volts on the RPi)
marcus
:ugeek:

masa-aud
Posts: 141
Joined: Fri Feb 26, 2016 9:20 am

Re: How is 3V GPIO usable?

Wed Apr 27, 2016 1:49 am

reply to Eliter on GPIO and relay
I think firstly that relay often seems to be used easily but practically needs much knowledges and experiences as this members also refer. The second is shortcomings as size, weigh, energy consuming, noise and chattering etc..
I recommend to use FET arrays e.g. for driving motors etc..

Return to “Advanced users”