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.