jazzler
Posts: 31
Joined: Mon Nov 04, 2013 7:43 am

Re: Control Relay Switches via Android using a Raspberry Pi

Mon Oct 05, 2015 7:45 am

Did your Pi Boot up with the new SD Image? is it connected to your network? and is the phone connected to your wifi? If so, try restarting your phone to clear any DNS caching in case its picked up an old IP address.

if its still not working open your web browser on your phone and go to http://raspberrypi/gpio.php you should see the relays listed and their current status (0=off 1=on).

Please let me know the results..
PiRelay Project : http://bit.ly/pirelay
PiRelay Play Store App : http://bit.ly/PiRelayApp

jazzler
Posts: 31
Joined: Mon Nov 04, 2013 7:43 am

Re: Control Relay Switches via Android using a Raspberry Pi

Mon Oct 05, 2015 7:53 am

For those interested in an iOS version of the app, i've started developing it in Xcode, and i've got it switching on my iPhone 6 running ios9.

It's early days in the development process, so could be a way off completion yet, and I may run into issues which may take time to resolve, or may even not be resolvable on ios, but I'm working on it, and the basic switching is working so it look promising.

Depending on the interest in this I may then post it to the Apple App store, although I would need to buy a developer account annually to do this, so it really depends on the level of interest there is in an ios app.
Attachments
IMG_1594.jpg
IMG_1594.jpg (41.1 KiB) Viewed 3190 times
PiRelay Project : http://bit.ly/pirelay
PiRelay Play Store App : http://bit.ly/PiRelayApp

pocepi
Posts: 3
Joined: Mon Oct 05, 2015 1:05 pm

Re: Control Relay Switches via Android using a Raspberry Pi

Mon Oct 05, 2015 1:32 pm

Hi jazzler,
In the description of your project you declare:

"I am using the 8 channel relay version which is great value (Currently under £6 delivered). It consists of 8x 250v 10Amp Relays, perfectly capable of running directly from the Pi. (Note that if all 8 relays are engaged at the same time, you will be drawing around 600mA of power from the Pi, so a 2 amp or above power supply is recommended if powering it directly from the Pi, alternately you might want to provide power to the board with an additional 5v power source".

I have purchased the same (or a very similar) 8 relay module to control 5 or 6 small DC motors, so your system should work fine. In fact, I was developing one that uses a web server on the Pi and any browser on the client to activate/deactivate the relays.
I have a doubt on the number of Relays that I can activate at any time, though, because looking at Raspberry Pi FAQ it looks like each GPIO can provide max 16mA and a max of about 50mA can be drawn from all the GPIO combined at any time:

"The GPIO pins can draw 50mA safely (that is 50mA distributed across all the pins! An individual GPIO pin can only safely draw 16mA)".

The relay module I bought states that each relay draws 15 to 20mA, which makes me think that I can control a max of 2 or 3 of them at the same time. Am I missing something?
I'm a just starting playing with the Pi, so I apologise if the question is dumb.
Many thanks in advance!

jazzler
Posts: 31
Joined: Mon Nov 04, 2013 7:43 am

Re: Control Relay Switches via Android using a Raspberry Pi

Mon Oct 05, 2015 2:12 pm

Hello, The 5v pin as I understand it passes straight through from the usb power supply, that's what I use. If you have a 3.3v relay board and want to power it from the Pi you should make sure it does not exceed 50mA as i am lead to believe that is its limitation, in reality I would stay well away from the 3.3v pin, as I am also lead to believe that it is that which supplies power to the GPIO pins when they are enabled. You should not be powering your board from the switched gpio pins (which max out at 16mA/50mA Total), as that would draw way too much current from them. I simply use power from the 5v pin, then use GPIO's 0 to 7 as the switched line from my Pi. I don't know what the draw is on the individual GPIO pins when using them as the switched line for my relay board, but i've had 16 relays connected like this in the past (2x 8relay boards powering one of the boards from a seperate 5v power supply) and it worked without issue.

With my setup I have run 8 relays, energized for days on end without issue running directly from the 5v pin on the Pi. My recommendation if you are concerned or unsure would be to power the relay board separately from the Pi (Perhaps using a secondary USB 5v power lead). But ultimately with so many different setups out there, you will need to do your own calculations for hardware you have to be sure.
PiRelay Project : http://bit.ly/pirelay
PiRelay Play Store App : http://bit.ly/PiRelayApp

pocepi
Posts: 3
Joined: Mon Oct 05, 2015 1:05 pm

Re: Control Relay Switches via Android using a Raspberry Pi

Mon Oct 05, 2015 2:46 pm

Hi,
thanks a lot for the quick reply.
Ok, so if understand correctly what you are saying, if I power the relay module from the 5v pin on the Pi (pin no. 2 or pin no. 4), it should be more than capable of handling all 8 of them because the 5v pin is actually getting the power directly from the power supply, right?
This is actually what I did. I used pin 2 to supply 5v to the relay module, pin 9 for the ground, and GPIO4 (pin 7) to activate one of the relays. According to the setup that you described, I can safely connect other GPIO pins to the other relays and it should all work smoothly.
Please let me know if I misinterpreted your answer.
Thanks and regards.

jazzler
Posts: 31
Joined: Mon Nov 04, 2013 7:43 am

Re: Control Relay Switches via Android using a Raspberry Pi

Mon Oct 05, 2015 3:07 pm

I think you have understood correctly. But keep in mind that the Pi will also be using the power from the usb cable to power up the Pi itself. So it has more to do with the supply to the Pi really via your 5v usb power supply and the cable. If you are using a 1A power supply, just keep in mind that the Pi could be using circa 700mA itself, so adding to that could be pushing the psu to or near its limit. I use a decent 2A power supply and have no issues. Whether this will work "safely" for you or not, really depends on all the factors, i.e. PSU , power cables, how much draw your relay board& Pi takes etc. I can't say with absolute certainty as I do not know the full spec of your hardware and requirements, I can only pass on my own experience and the experience I have learned from others who have contacted me telling me how they set theirs up working with my app. If you are concerned then definitely go down the route of separately powering the relay board.
PiRelay Project : http://bit.ly/pirelay
PiRelay Play Store App : http://bit.ly/PiRelayApp

pocepi
Posts: 3
Joined: Mon Oct 05, 2015 1:05 pm

Re: Control Relay Switches via Android using a Raspberry Pi

Mon Oct 05, 2015 3:17 pm

Ok, many thanks again.
By the way, I'm using a 2A power supply as well, on a Pi model B+, but I will disconnect the Pi-camera while using the relay module, as I don't need it for this project and it uses some power too.
Best regards.

Realitymark1
Posts: 11
Joined: Wed Sep 30, 2015 10:13 pm

Re: Control Relay Switches via Android using a Raspberry Pi

Mon Oct 05, 2015 3:37 pm

jazzler wrote:Did your Pi Boot up with the new SD Image? is it connected to your network? and is the phone connected to your wifi? If so, try restarting your phone to clear any DNS caching in case its picked up an old IP address.

if its still not working open your web browser on your phone and go to http://raspberrypi/gpio.php you should see the relays listed and their current status (0=off 1=on).

Please let me know the results..

hello so i check my wiring everyrhing is connected properly, when i go to the raspberrypi/gpio.php
i get :
relay1: 0
relay 2:1
relay3:1
relay4;0
relay 5;0
relay 6;0
relay7;1
relay8;1

jazzler
Posts: 31
Joined: Mon Nov 04, 2013 7:43 am

Re: Control Relay Switches via Android using a Raspberry Pi

Mon Oct 05, 2015 4:03 pm

Realitymark1 wrote: hello so i check my wiring everyrhing is connected properly, when i go to the raspberrypi/gpio.php
i get :
relay1: 0
relay 2:1
relay3:1
relay4;0
relay 5;0
relay 6;0
relay7;1
relay8;1
Hi - Okay, so it looks like the Pi side of things is working, it also looks like you have turned on relays 2,3,7 and 8 looking at your output.

Also, i really need to know if you followed the manual install, or the SD card image. If you did the manual install then try the SD card image as this has been confirmed as working to me on 5 Pi's already.

If you did the install manually, did you type out the php file contents manually or copy and paste from my site? it needs to be exact for the app to read the settings, i.e. : instead of ; and the spacing needs to match my example exactly, which it doesn't in the above you posted.

I'm leaving on business now until the end of the week, so may not be able to reply again until then if you are still having trouble. But I am be keen to know and help you get it working
Last edited by jazzler on Mon Oct 05, 2015 4:06 pm, edited 1 time in total.
PiRelay Project : http://bit.ly/pirelay
PiRelay Play Store App : http://bit.ly/PiRelayApp

jazzler
Posts: 31
Joined: Mon Nov 04, 2013 7:43 am

Re: Control Relay Switches via Android using a Raspberry Pi

Mon Oct 05, 2015 4:04 pm

pocepi wrote:Ok, many thanks again.
By the way, I'm using a 2A power supply as well, on a Pi model B+, but I will disconnect the Pi-camera while using the relay module, as I don't need it for this project and it uses some power too.
Best regards.
No problem, let us know how you get on...
PiRelay Project : http://bit.ly/pirelay
PiRelay Play Store App : http://bit.ly/PiRelayApp

Realitymark1
Posts: 11
Joined: Wed Sep 30, 2015 10:13 pm

Re: Control Relay Switches via Android using a Raspberry Pi

Mon Oct 05, 2015 4:31 pm

jazzler wrote:
Realitymark1 wrote: hello so i check my wiring everyrhing is connected properly, when i go to the raspberrypi/gpio.php
i get :
relay1: 0
relay 2:1
relay3:1
relay4;0
relay 5;0
relay 6;0
relay7;1
relay8;1
Hi - Okay, so it looks like the Pi side of things is working, it also looks like you have turned on relays 2,3,7 and 8 looking at your output.

Also, i really need to know if you followed the manual install, or the SD card image. If you did the manual install then try the SD card image as this has been confirmed as working to me on 5 Pi's already.

If you did the install manually, did you type out the php file contents manually or copy and paste from my site? it needs to be exact for the app to read the settings, i.e. : instead of ; and the spacing needs to match my example exactly, which it doesn't in the above you posted.

I'm leaving on business now until the end of the week, so may not be able to reply again until then if you are still having trouble. But I am be keen to know and help you get it working

i used your disk image.... so i gues now its only to connect the right jumper wire to the right gpio on the pi and everything should be working

jazzler
Posts: 31
Joined: Mon Nov 04, 2013 7:43 am

Re: Control Relay Switches via Android using a Raspberry Pi

Tue Oct 06, 2015 6:40 am

Realitymark1 wrote: i used your disk image.... so i gues now its only to connect the right jumper wire to the right gpio on the pi and everything should be working
Ok sounds like you are all set to go then.
PiRelay Project : http://bit.ly/pirelay
PiRelay Play Store App : http://bit.ly/PiRelayApp

Realitymark1
Posts: 11
Joined: Wed Sep 30, 2015 10:13 pm

Re: Control Relay Switches via Android using a Raspberry Pi

Sat Oct 10, 2015 6:15 pm

im a big pain in the but i totally agree... but im having a hard time with the gpio pins, i think im at the point where i need instructions like... cable 1: second pin on the right....


other wise i dont see my project getting built here !

pplease anyone ! :) and thank you

jazzler
Posts: 31
Joined: Mon Nov 04, 2013 7:43 am

Re: Control Relay Switches via Android using a Raspberry Pi

Fri Oct 16, 2015 6:18 am

Realitymark1 wrote:im a big pain in the but i totally agree... but im having a hard time with the gpio pins, i think im at the point where i need instructions like... cable 1: second pin on the right....


other wise i dont see my project getting built here !

pplease anyone ! :) and thank you
Hello again, have you seen this Pin diagram? It shows you what pin does what on the Pi2 Model B

http://pi4j.com/pins/model-2b-rev1.html
PiRelay Project : http://bit.ly/pirelay
PiRelay Play Store App : http://bit.ly/PiRelayApp

Realitymark1
Posts: 11
Joined: Wed Sep 30, 2015 10:13 pm

Re: Control Relay Switches via Android using a Raspberry Pi

Tue Oct 20, 2015 6:26 am

i add it working, everything was working at some point and then bahm....today again, unable to detect relay status

andrewbarry
Posts: 2
Joined: Sat Oct 17, 2015 9:03 am

Re: Control Relay Switches via Android using a Raspberry Pi

Sun Oct 25, 2015 3:56 am

I could not not get this working over the internet. Im using a ZTE MF90 Modem

andrewbarry
Posts: 2
Joined: Sat Oct 17, 2015 9:03 am

Re: Control Relay Switches via Android using a Raspberry Pi

Sat Oct 31, 2015 5:07 am

When I want to control this remotely do i use the modem ip address then port 80 or the raspberry pi ip address then port 80?

User avatar
DougieLawson
Posts: 33835
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Control Relay Switches via Android using a Raspberry Pi

Sat Oct 31, 2015 10:06 am

You have a LAN address that is completely private to your home network and a WAN address that is on the public internet.

On your system at home head to http://ip4.me and it will give you your WAN address.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

Realitymark1
Posts: 11
Joined: Wed Sep 30, 2015 10:13 pm

Re: Control Relay Switches via Android using a Raspberry Pi

Fri Nov 13, 2015 12:37 am

hey guys so i got an older version of the pi, because the newer version i had worked for a while but became unstable for no reason, so my aquarium pumps, skimmer, reactor went crazy and almost floded my appartment.

i got an older pi version, plus a new relay board. everything seems to be working except i cant seem to get the clicking sound to go on the relay board...

matej2212
Posts: 2
Joined: Sat Dec 12, 2015 10:35 pm

Re: Control Relay Switches via Android using a Raspberry Pi

Sat Dec 12, 2015 10:37 pm

Hi! I want to know if pi relay works with raspberry pi 2 and how to wire everything up. Thanks

david-framboise
Posts: 1
Joined: Sun Dec 27, 2015 12:38 pm

Re: Control Relay Switches via Android using a Raspberry Pi

Sun Dec 27, 2015 12:48 pm

hi Jazzler,
thanks a lot for this app, it's very plugandplay !!
I'd like to modify a code : how to add a timer on the output ?
For example : an output become on, during 30s, and at the end this output will be off.

thanks for your answer.

David

matej2212
Posts: 2
Joined: Sat Dec 12, 2015 10:35 pm

Re: Control Relay Switches via Android using a Raspberry Pi

Wed Jan 13, 2016 4:46 pm

david-framboise wrote:hi Jazzler,
thanks a lot for this app, it's very plugandplay !!
I'd like to modify a code : how to add a timer on the output ?
For example : an output become on, during 30s, and at the end this output will be off.

thanks for your answer.

David
Hi David, can you tell me exactly how to wire everything up, because i dont understand. Thanks

jeandino
Posts: 1
Joined: Sun Jan 17, 2016 3:01 pm

Re: Control Relay Switches via Android using a Raspberry Pi

Sun Jan 17, 2016 3:11 pm

Hi all,
I am new starting with a Raspberry and some relay boards, i am good with the hardware like electronics but not that good with software, how to start to let it work, i all ready find out to make the GPIO pins to be high or low but i need to make a program and to connect with the app on my mobile. Is there some one to help me to start with this or a little program so i can try to learn to program the raspberry. thankx a lot. greetings

TheBudderNinja
Posts: 1
Joined: Sun Mar 06, 2016 3:06 am

Re: Control Relay Switches via Android using a Raspberry Pi

Sun Mar 06, 2016 3:11 am

Is there any way to install this on an existing raspbian? I want to install this on a raspberry pi with octopi so my 3D printer is not on until I'm ready for it.

Andrew Bostaph
Posts: 1
Joined: Mon Mar 14, 2016 3:59 am

Re: Control Relay Switches via Android using a Raspberry Pi

Mon Mar 14, 2016 4:04 am

Hi
Can this be used remotely with my dyndns address since I dont have a static IP address?

Andrew

Return to “Automation, sensing and robotics”

Who is online

Users browsing this forum: No registered users and 6 guests