I got the information below from here.
The GPIO.BOARD option specifies that you are referring to the pins by the number of the pin the the plug - i.e the numbers printed on the board (e.g. P1) and in the middle of the diagrams below.
The GPIO.BCM option means that you are referring to the pins by the "Broadcom SOC channel" number, these are the numbers ...
You can embed the Raspberry Pi in any end-product you want.
For mass production, the Compute Module may be a better choice. The Compute Module is a Raspberry Pi in a more flexible form factor, intended for industrial application.
You cannot use the words Raspberry Pi to promote your product without permission. Raspberry Pi is trademarked.
You will have ...
At powerup the GPIOs are pulled either high or low through the internal resistors. Whether the pull is high or low for a particular GPIO is detailed on page 102 of BCM2835 ARM Peripherals.
As the Linux kernel is started and if device tree is enabled (likely) then it will reconfigure the GPIOs according to the device tree settings. Modules loaded from /etc/...
Not sure if this is helpful, but under the latest copy of Raspbian I was able to install RPi.GPIO directly from the main repositories using apt-get as follows:
sudo apt-get update
sudo apt-get -y install python-rpi.gpio
If you're running Python 3 (idle3 on the command line) instead of Python 2 (python on the command line) you need to install the RPi.GPIO ...
and I quote from Raspberry Pi's blog
If, like Brian, you’re making a product which requires a Raspberry Pi to run, we don’t ask you to buy special permission or licences from us to use it. All we ask is that you include the words “Powered by Raspberry Pi” somewhere on your packaging. If your business is successful, we’d be very grateful if you could ...
It depends how you define "mass" in "mass production". If you're talking hundreds, the Pi is probably a good choice. If you're talking thousands, there might be "better" solutions available through OEM. "Better" as in price, availability, quantity, security and specific functionality.
Price - $30 dollar a pop might not be much for a couple of devices, ...
What you are looking for in that case is a LED matrix. You could control this matrix from the GPIO pins, but that still limits the amount of LEDs you can connect (the size of the matrix) and it might also start to draw too much current if you're not careful.
A better option is to connect a LED matrix to the I2C bus, using one or multiple I2C I/O extenders. ...
You can't read an output. Just store the state of the pin in a variable.
import RPi.GPIO as GPIO
LED = 17
ledState = False
ledState = not ledState
Another option would be to use a port expander to get additional I/O ports.
For example, the MCP23008 can connect via I²C (only uses two pins) and gives you eight I/O ports.
Since it uses I²C, up to eight of them can be connected to the same two I²C pins to give you up to 64 I/O pins.
Adafruit has a tutorial about how to use the MCP23008 (or MCP23016, the ...
If you are just looking to test the whole code and not worry about the actual pins (as windows machines don't have GPIO), then you can fake it.
First, in your main python source directory, create a directory named "RPi". In that folder, put an empty text file named __init__.py. This lets python know the folder "RPi" is a package. Also in that folder put a ...
The diagram does not show pin numbers. Neither can I find anything on the diagram labelled 1.
The diagram does appear to correctly label the ground and 5V pins.
You can power a 5V fan by connecting its power leads to a 5V pin and a ground pin.
It will be on all the time as you can't switch the 5V pins on or off.
Do not try powering the fans from a gpio. ...
The whole point of I2C is it is a bus. You can therefore connect multiple I2C devices to the same GPIO provided they have different I2C device addresses.
If the devices share an address which can't be changed you can use an I2C multiplexor chip to typically connect 8 devices to the same I2C bus. You send a command to the multiplexor to specify the device ...
The short answer
No, you (almost) don't. It's actually the other way around - you have to set them up not to be GPIO but to serve their special purpose. The only exception are UART pins. Also and I²C pins somehow special.
UART pins are used by the kernel for the console. You will have to configure the system not to use them if you want them to ...
The best solution to this is probably to go for a 'port expander'.
There is an expander kit available from HobbyTronics in the UK:
For a general briefing on port expanders, here's a page on Wikipedia:
Assuming you have pip, the python package index installer, which is installed on the latest versions of Raspbian by default
You can use:
sudo pip install RPi.GPIO for Python 2
sudo pip-3.2 install RPi.GPIO for Python 3
As an alternative to Infrared, you could use HDMI, if your TV has HDMI 2.0, it will support some kind of CEC (Consumer Electronics Control) implemenatation
Each TV brand calls this something else, like Panasonic Viera Link. But it all uses the same standard just some TV's implement more, some less but the basics should be there. Like turn TV on or off, ...
When the Raspberry Pi boots the GPIO lines are reset to the chip default, then the OS is loaded and resets them to the OS default. There is no way to "remember" the settings across a reboot. See also What is the power on state of the GPIOs? and GPIO state after boot.
Discovered the problem:
Some guides online instruct you do download version 0.1.0 of the GPIO library which does not have the setup function. You must use a more recent version of the library.
I have downloaded version 0.5.x and it works correctly.
Download from here https://pypi.python.org/pypi/RPi.GPIO
The component you are looking for to read the level of light is a light dependent resistor.
As you rightly stated in the question; the Raspberry Pi only has digital input. Therefore you can create an RC Charging Circuit. I advise reading this tutorial regarding RC charging circuits.
This blog post explains in detail how you can check light level using an ...
Although stated elsewhere, you CAN read an output by just inputting the same GPIO pin and get the value returned you just set out before:
GPIO.setup(LED_red, GPIO.OUT) #set Pin LED_red as aoutput
GPIO.output(LED_red, GPIO.HIGH) #set Pin LED_red = HIGH (ON)
GPIO.input(LED_red) returns 1
To answer your main question, no there is nothing syntactically wrong with writing:
import RPi.GPIO as g
However, I would seriously evaluate what you are trying to do if you think you will be typing gpio 7000 times. In my opinion the clarity of gpio is much more important than the 3 characters you are saving each time.
As for ...
You don't so much need root access as permission to access the gpio device. Raspbian has a user group 'gpio' to enable this. By default the 'pi' user is in the gpio group and can access GPIOs. If you add the apache user (www-data normally) to the gpio group then the web server will be able to access the GPIOs without requiring root access. You can do that ...
You need to set the pin as an output before you use it.
To do that add the following line:
below the matching lines for green and yellow:
GPIO.setup(yellow, GPIO.OUT) ## set output
Setting aside the ill-phrased part of the question (connecting multiple GPIO pins (which to my knowledge are 3 volts), to one ground pin) - which indeed short circuits the GPIO pins if they are set to output and thus most likely damages the Pi, there is nothing wrong with using one GND pin on the GPIO header for multiple GPIO pins. As you notice there are ...
After following the advice from okertanov, I discovered that you can't actually use RPi.GPIO in a python CGI script as it requires root access. I worked around the problem by calling out to the gpio command line app which is included as part of WiringPi, this can be called from a non-root account.
# Read the GPIO pin using the gpio application
You may try to add before 'import RPi.GPIO':
sys.stderr = sys.stdout
import RPi.GPIO as GPIO
except Exception as e:
It may help to diagnose an error.
And add these lines before your html output:
print "Content-Type: text/html" # HTML is following
print # blank line, end of headers
It is possible to expand up to 64 additional GPIO ports using some MCP23008 chips connected via I2C interface. Each adds 8 GPIOs and up to eight can be connected through I2C. As you need 75, I suppose you go with the big brother of MCP23008 the MCP23017 which has 16 GPIO ports. It's not possible to mix both and get over 128 as the limit of 8 on the I2C-Bus ...