Page 1 of 1
Using adapter
Posted: Tue Apr 01, 2014 10:08 pm
by IvanAK
Hi all,
I like to make some test project, but im not sure how to connect this type of situation. For example i have led streak that takes 12V from adapter. So i like to control this from my raspberry pi. Like the led streak to get power from adapter but to be controlled from raspberry pi. For now i have all the equipment ( rele, resistors, adapter, etc.. ). Yes breadboard too. So how to connect all this to make it work ?
Re: Using adapter
Posted: Wed Apr 02, 2014 3:25 pm
by Tarcas
You're going to have to better explain what you're trying to do. If anybody knew what you were asking, you would have several responses by now. I, for one, have never heard of an LED streak. Maybe start by describing what that is, including what controlling it means, and what inputs it takes.
...not trying to be rude, just asking you to help us help you.
Re: Using adapter
Posted: Wed Apr 02, 2014 3:31 pm
by DougieLawson
Hi Ivan,
it's clear that your first language isn't English.
Perhaps you could give us some web links to the equipment you're trying to use.
Perhaps you could tell us your nationality, we may be able to find someone who writes in your mother tongue (without using Google Translate).
Perhaps you should restate your problem in your first language.
Re: Using adapter
Posted: Wed Apr 02, 2014 7:58 pm
by IvanAK
Hi,
First i want to apologize for the bed English ! And yes it is not my first language. Here's what iv got:
1. Led strip / LED streak
https://www.google.com/search?q=led+str ... 20&bih=952
This is my Led strip
http://s29.postimg.org/irhwz6w53/IMG_41 ... 598172.jpg
http://s30.postimg.org/bcfoh01up/20140402_214536.jpg
2. Adapter, Rele, Resistor etc.
http://s21.postimg.org/wulehbs6v/20140401_235808.jpg
What im trying to do is to control this Led Strip with my Raspberry Pi ( turning on and off ). But this Led Strip get power from the Adapter 12V. And i don't know how to connect all this equipment so i can make this work
I think im clear now ?

I hope so

... if not pleas let me know. And sorry for bad English !
Re: Using adapter
Posted: Wed Apr 02, 2014 8:16 pm
by DougieLawson
Re: Using adapter
Posted: Wed Apr 02, 2014 8:29 pm
by FLYFISH TECHNOLOGIES
Hi,
IvanAK wrote:This is my Led strip
This your LED strip can be just turned on and off (completely). Some other LED strips (not your, but ones from Dougie's links) have each LED addressable and you can change their color and brightness individually.
(There is an option to change brightness of your strip. It can be done when controlling it with PWM, but a relay is not suitable element for this - it is not fast enough).
For turning your LED strip on and off with existing components, the suitable circuit can be (despite the fact that it is mentioning motor):
http://electronics.stackexchange.com/qu ... -with-rasp
12V adapter must be used. You should NOT connect the LED strip directly to the RasPi.
With a circuit from the link above, the relay connects/disconnects 12V adapter to the LED strip, what turns LEDs on and off.
Best wishes, Ivan Zilic.
Re: Using adapter
Posted: Fri Apr 04, 2014 6:24 pm
by IvanAK
Ok i have this now ...
http://s28.postimg.org/5us6ds4ul/untitled223123.jpg
So tell me if im wrong here
GPIO (Y) should go to one of GND (ether 6,9,14,20 or 25) Pins of Raspberry Pi, GPIO(X) should go to 3v3 (Ping 17), GPIO (Z) i dont know but i thing i should put on pin 2, am i right ???
Re: Using adapter
Posted: Fri Apr 04, 2014 7:13 pm
by Tarcas
It looks right to me, not that I'm an electrical engineer or anything.
GPIO Z is +5v, header pin 2
GPIO Y is GND, so pin 6. (There are some DNC pins which are also connected to GND, but I don't know those off the top of my head.)
GPIO X can go to any of the 17 controllable GPIO pins on the Pi, as long as the code and the hardware match up. If it's the only thing you're using the GPIO header for, it doesn't really matter which one you choose.
If you plan on turning it on and off a few times a day, this will work great. If you're planning on turning it on and off a few times per minute, the relay will only last a few months. For this sort of use, or for PWM dimming, you'll need to upgrade your relay to solid state if you want it to last.
Re: Using adapter
Posted: Sat Apr 05, 2014 12:47 am
by IvanAK
If you plan on turning it on and off a few times a day, this will work great. If you're planning on turning it on and off a few times per minute, the relay will only last a few months.
Yes i'm planing to turning it on and off a few times.
For this sort of use, or for PWM dimming, you'll need to upgrade your relay to solid state if you want it to last.
I have this two types of relay ( im going to use the big one

)
http://s28.postimg.org/nj6qo46x9/20140405_023026.jpg
I hope it will last ...
Re: Using adapter
Posted: Sat Apr 05, 2014 2:16 am
by Tarcas
IvanAK wrote:If you plan on turning it on and off a few times a day, this will work great. If you're planning on turning it on and off a few times per minute, the relay will only last a few months.
Yes i'm planing to turning it on and off a few times.
For this sort of use, or for PWM dimming, you'll need to upgrade your relay to solid state if you want it to last.
I have this two types of relay ( im going to use the big one

)
http://s28.postimg.org/nj6qo46x9/20140405_023026.jpg
I hope it will last ...
Most electromagnetic relays are rated to about 100,000 cycles. You can check the datasheet for yours and your estimated frequency of use to find out how many days it will last. (100,000 sounds like a lot, but like I said, if you're switching several times per minute for 8 hours/day, you'll only get a few months out of it. On the other hand, if you're switching on average 4 times per day, you get 25,000 days, or over 68 years, so no problem there.)

Re: Using adapter
Posted: Sat Apr 05, 2014 2:17 pm
by IvanAK
I put the (from the picture) GPIO (Y) to pin 6, GPIO (X) to pin 11 and i try pin 12 , and for GPIO(Z) pin 2 and i execute the following commands:
This is history from raspberry pi commands
Code: Select all
485 gpio -g mode 17 out
486 gpio -g write 17 1
487 gpio -g write 17 0
488 gpio readall
489 gpio mode 0 in
490 gpio readall
491 gpio mode 6 out
492 gpio readall
493 gpio mode 17 out
494 gpio readall
495 gpio mode 17 in
496 gpio mode 17 out
497 gpio -g write 17 1
498 gpio -g write 17 1
499 gpio readall
502 gpio mode 17 in
511 gpio -g write 17 1
512 gpio -g write 17 0
513 gpio mode 0 out
514 gpio write 0 1
515 gpio write 0 0
516 gpio write 17 1
517 gpio write 17 0
518 gpio write 11 0
519* gpio write 11
520 gpio write 11 0
521 gpio readall
522 gpio -g mode 17 out
523 gpio -g write 17 1
524 gpio write 17 1
528 gpio write 17 0
529 history | grep gpio
and nothing iv got ... and also this is the output of gpio readall command
Code: Select all
root@raspberrypi:/home/skripti# gpio readall
+----------+-Rev2-+------+--------+------+-------+
| wiringPi | GPIO | Phys | Name | Mode | Value |
+----------+------+------+--------+------+-------+
| 0 | 17 | 11 | GPIO 0 | OUT | Low |
| 1 | 18 | 12 | GPIO 1 | IN | Low |
| 2 | 27 | 13 | GPIO 2 | IN | Low |
| 3 | 22 | 15 | GPIO 3 | IN | Low |
| 4 | 23 | 16 | GPIO 4 | IN | Low |
| 5 | 24 | 18 | GPIO 5 | IN | Low |
| 6 | 25 | 22 | GPIO 6 | IN | Low |
| 7 | 4 | 7 | GPIO 7 | IN | Low |
| 8 | 2 | 3 | SDA | IN | High |
| 9 | 3 | 5 | SCL | IN | High |
| 10 | 8 | 24 | CE0 | IN | Low |
| 11 | 7 | 26 | CE1 | IN | Low |
| 12 | 10 | 19 | MOSI | IN | Low |
| 13 | 9 | 21 | MISO | IN | Low |
| 14 | 11 | 23 | SCLK | IN | Low |
| 15 | 14 | 8 | TxD | ALT0 | High |
| 16 | 15 | 10 | RxD | ALT0 | High |
| 17 | 28 | 3 | GPIO 8 | IN | Low |
| 18 | 29 | 4 | GPIO 9 | ALT2 | Low |
| 19 | 30 | 5 | GPIO10 | ALT2 | Low |
| 20 | 31 | 6 | GPIO11 | ALT2 | Low |
+----------+------+------+--------+------+-------+
Re: Using adapter
Posted: Sun Apr 06, 2014 10:27 am
by IvanAK
Tarcas wrote:It looks right to me, not that I'm an electrical engineer or anything.
GPIO Z is +5v, header pin 2
GPIO Y is GND, so pin 6. (There are some DNC pins which are also connected to GND, but I don't know those off the top of my head.)
GPIO X can go to any of the 17 controllable GPIO pins on the Pi, as long as the code and the hardware match up. If it's the only thing you're using the GPIO header for, it doesn't really matter which one you choose.
If you plan on turning it on and off a few times a day, this will work great. If you're planning on turning it on and off a few times per minute, the relay will only last a few months. For this sort of use, or for PWM dimming, you'll need to upgrade your relay to solid state if you want it to last.
How do i control this situation, just typical gpio 17 1 / gpio 17 0 or do i have to make more of this ?
Re: Using adapter
Posted: Sun Apr 06, 2014 2:34 pm
by Tarcas
IvanAK wrote:Tarcas wrote:It looks right to me, not that I'm an electrical engineer or anything.
GPIO Z is +5v, header pin 2
GPIO Y is GND, so pin 6. (There are some DNC pins which are also connected to GND, but I don't know those off the top of my head.)
GPIO X can go to any of the 17 controllable GPIO pins on the Pi, as long as the code and the hardware match up. If it's the only thing you're using the GPIO header for, it doesn't really matter which one you choose.
If you plan on turning it on and off a few times a day, this will work great. If you're planning on turning it on and off a few times per minute, the relay will only last a few months. For this sort of use, or for PWM dimming, you'll need to upgrade your relay to solid state if you want it to last.
How do i control this situation, just typical gpio 17 1 / gpio 17 0 or do i have to make more of this ?
Yes, the GPIO command is one option, but I think the command you've given specifically is invalid. Without the -g flag, the main header only uses gpio 0-16
Make sure you're using consistent numbering. The GPIO header is sometimes numbered in at least 3 conflicting (and often confusing, especially if you're not aware) ways:
One is pin number on the header.
One is WiringPi GPIO number, which the gpio command uses by default, and I find convenient.
One is Broadcom pin number, which you can use with the gpio command with the -g flag. (note that one of these changed between rev1 and rev2, pin 21 became 27.)
The chart on
this page shows all three.
Once you determine which of the latter two numbering schemes you want to use, use it consistently in both your code and wiring.
Re: Using adapter
Posted: Sun Apr 06, 2014 4:25 pm
by IvanAK
To be honest im total lost. I am beginner and i have start reading some books, im still learning.
This is how i connect all iv got ( i hope you can see what is what )
http://postimg.org/gallery/1tu3pdu6/
As you can see the violet wire is Pin 11 ( physical pin 11 ) and as i know it is control/controlling pin. White wire is pin 2 +5v pin and grey wire is pin 6 GND. So because Pin 11 is pin that can be control i guess i have to play with him on and off.
From the table that iv got listed with gpio readall i have the following
root@raspberrypi:~# gpio readall
+----------+-Rev2-+------+--------+------+-------+
| wiringPi | GPIO | Phys | Name | Mode | Value |
+----------+------+------+--------+------+-------+
| 0 | 17 | 11 | GPIO 0 | IN | Low |
| 1 | 18 | 12 | GPIO 1 | IN | Low |
| 2 | 27 | 13 | GPIO 2 | IN | Low |
| 3 | 22 | 15 | GPIO 3 | IN | Low |
| 4 | 23 | 16 | GPIO 4 | IN | Low |
| 5 | 24 | 18 | GPIO 5 | IN | Low |
| 6 | 25 | 22 | GPIO 6 | IN | Low |
| 7 | 4 | 7 | GPIO 7 | IN | Low |
| 8 | 2 | 3 | SDA | IN | High |
| 9 | 3 | 5 | SCL | IN | High |
| 10 | 8 | 24 | CE0 | IN | Low |
| 11 | 7 | 26 | CE1 | IN | Low |
| 12 | 10 | 19 | MOSI | IN | Low |
| 13 | 9 | 21 | MISO | IN | Low |
| 14 | 11 | 23 | SCLK | IN | Low |
| 15 | 14 | 8 | TxD | ALT0 | High |
| 16 | 15 | 10 | RxD | ALT0 | High |
| 17 | 28 | 3 | GPIO 8 | OUT | Low |
| 18 | 29 | 4 | GPIO 9 | ALT2 | Low |
| 19 | 30 | 5 | GPIO10 | ALT2 | Low |
| 20 | 31 | 6 | GPIO11 | ALT2 | Low |
+----------+------+------+--------+------+-------+
Using this table and the table you send me from the page wiringPi 0 GPIO 17 Phys 11 ( physical pin number 11 ) i put the mode of this pin to OUT so he can send signal to.... and i put 0 or 1 ( off and on ). Do i miss something here or i miss connecting something ? And the code that im using is :
gpio mode 0 out # mode for wiringPi 0 (pin 11 ) out
gpio write 0 0 or gpio write 0 1
Re: Using adapter
Posted: Sun Apr 06, 2014 6:49 pm
by Tarcas
gpio mode 0 out
gpio write 0 0 or gpio write 0 1
This code looks correct.
You can test your hardware by pulling the purple plug from the Pi GPIO and plugging it alternately into +3.3v and GND. When connected to 3.3 it should simulate a high, and GND a low. If that activates your relay, but the GPIO pin doesn't, either for some reason the gpio command isn't working correctly on your Pi (don't know why that would be) or you've connected to the wrong pin (double check that you're on header pin 11. You don't seem to have a closeup of the Pi, so I can't tell what you're connected to.
If it doesn't work connected directly to 3.3v and Gnd, re-check your hardware, because without that working, you'll never get your code to activate it.
Finally, just to verify, your relay is a 5v relay, and not a 12v relay, correct? If it's 12v, you'll have to source 12v from someplace besides the Pi (instead of the 5v that you have running now) and connect the two grounds together.
Re: Using adapter
Posted: Sun Apr 06, 2014 7:24 pm
by IvanAK
I have two kind of relay, im using the big one
http://postimg.org/gallery/23zt7ptm/
Re: Using adapter
Posted: Sun Apr 06, 2014 7:41 pm
by Tarcas
Well, it seems to say 5V on the housing. Does it click when you apply 5v directly across the coils (just bypass the transistor on your circuit. You want to leave the diode in place.)
Re: Using adapter
Posted: Sun Apr 06, 2014 8:12 pm
by IvanAK
Yes it clicks when i move green wire up to the other free part ( i dont know how to say it

) of the relay.
http://postimg.org/image/jiiemt1el/
And i run the pin test it seems fine
Please make sure everything is removed and press the ENTER key to continue,
or Control-C to abort...
The main 8 GPIO pins 0: 7: OK
The 4 pins on the P5 connector 17:20: OK
The 5 SPI pins 10:14: OK
The serial pins 15:16: OK
The I2C pins 8: 9: OK
But after i run test i notes some changes looking at the table from the command gpio readall
this is the new look of the table and changes that iv notes is about the mode on the last 3-4 pins, now they all on mode "IN" but still no success
root@raspberrypi:/# gpio readall
+----------+-Rev2-+------+--------+------+-------+
| wiringPi | GPIO | Phys | Name | Mode | Value |
+----------+------+------+--------+------+-------+
| 0 | 17 | 11 | GPIO 0 | OUT | High |
| 1 | 18 | 12 | GPIO 1 | IN | Low |
| 2 | 27 | 13 | GPIO 2 | IN | Low |
| 3 | 22 | 15 | GPIO 3 | IN | Low |
| 4 | 23 | 16 | GPIO 4 | IN | Low |
| 5 | 24 | 18 | GPIO 5 | IN | Low |
| 6 | 25 | 22 | GPIO 6 | IN | Low |
| 7 | 4 | 7 | GPIO 7 | IN | Low |
| 8 | 2 | 3 | SDA | IN | High |
| 9 | 3 | 5 | SCL | IN | High |
| 10 | 8 | 24 | CE0 | IN | Low |
| 11 | 7 | 26 | CE1 | IN | Low |
| 12 | 10 | 19 | MOSI | IN | Low |
| 13 | 9 | 21 | MISO | IN | Low |
| 14 | 11 | 23 | SCLK | IN | Low |
| 15 | 14 | 8 | TxD | IN | Low |
| 16 | 15 | 10 | RxD | IN | Low |
| 17 | 28 | 3 | GPIO 8 | IN | Low |
| 18 | 29 | 4 | GPIO 9 | IN | Low |
| 19 | 30 | 5 | GPIO10 | IN | Low |
| 20 | 31 | 6 | GPIO11 | IN | Low |
+----------+------+------+--------+------+-------+
Re: Using adapter
Posted: Sun Apr 06, 2014 8:36 pm
by IvanAK
I try to connect again with more space between so this is how it looks now ...
http://postimg.org/gallery/bgna4phq/
Re: Using adapter
Posted: Sun Apr 06, 2014 9:20 pm
by Tarcas
I don't think this will stop it from working, but I think you have both ends of the resistor in the same rail of the breadboard. If so, move one end across to the other side of the divider, along with the purple wire.
Have you tried connecting the base of the transistor to GND and 3.3v, and if so, does the relay click when you connect it to one of those?
EDIT: I looked at the pictures again, and your diode appears to be in backwards. I think. I'm not an electronics expert, but if it's wired the way I think it is, you need to turn the diode around. To double-check, it should be reverse-biased against the flow of current, so that it does not pass current in normal operation, but only comes into play to dissipate the collapsing inductive load from the relay's coil when it is turned off.
Re: Using adapter
Posted: Mon Apr 07, 2014 7:04 pm
by IvanAK
EDIT: I looked at the pictures again, and your diode appears to be in backwards. I think. I'm not an electronics expert, but if it's wired the way I think it is, you need to turn the diode around. To double-check, it should be reverse-biased against the flow of current, so that it does not pass current in normal operation, but only comes into play to dissipate the collapsing inductive load from the relay's coil when it is turned off.
I change i put new one and try every combination whit it, but nothing.
Have you tried connecting the base of the transistor to GND and 3.3v, and if so, does the relay click when you connect it to one of those?
I did this too ( from physical pin 11 to pin 17 nothing happen nothing change ) i put the base far from the other ones still nothing and still trying to get this work

Re: Using adapter
Posted: Mon Apr 07, 2014 8:23 pm
by Tarcas
IvanAK wrote:
Have you tried connecting the base of the transistor to GND and 3.3v, and if so, does the relay click when you connect it to one of those?
I did this too ( from physical pin 11 to pin 17 nothing happen nothing change ) i put the base far from the other ones still nothing and still trying to get this work

I mean to physical pin 1 and 6 (not at the same time, of course.) If one of those doesn't trigger the relay, you definitely have a hardware problem.
Re: Using adapter
Posted: Mon Apr 07, 2014 9:46 pm
by IvanAK
Tarcas wrote:IvanAK wrote:
Have you tried connecting the base of the transistor to GND and 3.3v, and if so, does the relay click when you connect it to one of those?
I did this too ( from physical pin 11 to pin 17 nothing happen nothing change ) i put the base far from the other ones still nothing and still trying to get this work

I mean to physical pin 1 and 6 (not at the same time, of course.) If one of those doesn't trigger the relay, you definitely have a hardware problem.
I put pin 11 ( physical pin ) to pin 1 and nothing ... i put same wire ( i move away a wire that was on pin 6 and put the wire from pin 1 to pin 6 and nothing. Also after that i put the wire that i move ( pin 6 before ) to some other pin that is GND and still nothing ... and what do you thing when you say about hardware problem ? Hardware problem from Raspberry Pi or something from the breadboard/protoboard ?
Re: Using adapter
Posted: Tue Apr 08, 2014 1:08 am
by Tarcas
I think your Pi is fine. It's the wiring on the breadboard that's suspect.
Is there an option to move this thread to the Automation, Sensing, and Robotics forum? This qualifies as automation (of turning your LED strip on and off) and some of the people there will be more familiar with electronics, I think.
Re: Using adapter
Posted: Tue Apr 08, 2014 9:15 am
by IvanAK
Tarcas wrote:I think your Pi is fine. It's the wiring on the breadboard that's suspect.
Is there an option to move this thread to the Automation, Sensing, and Robotics forum? This qualifies as automation (of turning your LED strip on and off) and some of the people there will be more familiar with electronics, I think.
Tarcas thank You so much ! You done too much ! Im relay thankful, you got 100 beers from me

when i find solution about this i will tell you ! Thanks again !!!!