These instructions aren't Python-specific, but they might help you get started with experimenting with GPIO. https://raspberrypi.stackexchange.com/a/350/668 has info about a library and usage specific for Python.
When you have booted your Raspberry Pi using the recommended Debian distro, GPIO is disabled. You have to enable each pin individually.
I had a similar problem with my Pi, when I connected it first time to my tv (a Samsung D5000): the tv did not understand an HDMI device was connected. I have raspbmc as the os.
There are a couple of instructions you can add to /boot/config.txt to tell your Pi to activate the hdmi output when you connect a cable, and to force hdmi output mode instead of dvi.
If you're using RPi.GPIO and run .cleanup() at the end of your script, it will return the channel(s) back to inputs with no pull up/down. Otherwise, they will remain in the state you left them.
See https://sourceforge.net/p/raspberry-gpio-python/wiki/BasicUsage/ for details.
Hackaday.com: USING CELL PHONE SCREENS WITH ANY HDMI INTERFACE
Has a video specifically using a raspi and iphone 4 screen.
I also ran into the same problem with my Raspberry Pi 2. I connected my Pi to my HD TV via an HDMI cable. My solution:
Set the audio output using the following command:
amixer cset numid=3 2
I tested the sound output using the following command, but no sound was heard:
speaker-test -c2 -t wav
To enable HDMI sound, I followed the directions found here
I think I have a way for solving your problem, try to type omxplayer -o local xxx.mp3(for mp3 file) or omxplayer -o local xxx.mp4(for mp4 file) to hear sound from raspi over your headphone. And you can also type omxplayer --help for more usage about omxplayer.
It is doubtful that the connections from a cell phone LCD screen would be optimal to use with your Raspberry Pi. That said, I'm positive it's possible.
But, why even go to the trouble? With multiple LCDs made specifically for the Raspberry Pi today (some of them touchscreens!), it is more practical to buy an LCD than to salvage one from a phone and use it....
Yes, that will work.
I suggest you have something like a 1 kΩ resistor in series. That will limit the maximum current to 3.3 mA.
That will save the day when by mistake you set both GPIOs as outputs, one as a 1 and the other as a 0. Without the resistor that would result in a damaging short circuit.
Yes, this is possible. You can achieve this by using a framebuffer driver from the fbtft project. According to the list of supported devices on the projects wiki, Nokia 5110/3310 displays are supported. These display modules are readily available on eBay.
If you know you won't be using the composite output, you can set up the pi to always use the hdmi output, even when no device has been detected. That way it will pick up the screen when it's attached, even if done at a later stage.
In your config.txt add/change the following line:
For more (screen and other) settings, see http://...
This seems to be a problem with the noob release - previous versions would default to the composite video if nothing was connected to the HDMI port.
To correct this do the following:
Connect your keyboard and TV to the Pi.
Insert your SD card.
Power on the TV.
Power up the Pi and hold down the SHIFT key, until the green LED stops flickering This will ...
This is a common bug. I think what's breaking ALSA is PulseAudio. If you want to use ALSA (Default, recommend by Tux) use sudo apt-get remove PulseAudio
For other fixes, try the wiki. It all depends. Try this first (as this is the most common)
I'm running OSMC, which runs Debian, and I got sound to play through my TV speakers, which is connected by HDMI. https://youtu.be/p2ljmTE67gs
If this is what you're trying to do, try adding dtparam=audio=on to /boot/config.txt
Original solution posted here:
The short answer is, no you can't do this with a Raspberry Pi.
The long answer is, perhaps with enough external hardware and a great deal of knowledge of how HDMI works you might be able to do something like you describe.
If you want to see and example of a hackable ARM device running linux that can do HDMI manipulation and pass through you can look at the ...
Per the elinux wiki, the GPIO pins are configurable to source or sink from 2mA to 16mA each, 3.3V (not 5V tolerant).
They also have GPIO tutorials, one of which demonstrates driving a low power LED directly from the output with no 3.3V or 5V connection used.
I am using the Audio jack prom a PI, with good result.
Be aware that the quality of your power supply have profound effect on the quality of the audio from the PI.
I the beginning I did not the this output as usable, as it was filled with noise, using a standard USB supply, for charging cell phones.
I then got a Goobay charger, as tested on this page and ...
What finally helped was the following:
I dumped the EDID-file with tvservice -d edid_dump.bin
I edited this file with LIGHTWARE-EDID-editor (part of a demo suite).
What I actually needed to change was little: In the CEA part of the file, I needed to specify that the device was HDMI-compliant (HDMI/HDMI options), and under CEA/Audio data, I needed to add ...
Edit the config.txt file
The config.txt file is located in /boot directory.
sudo nano /boot/config.txt
Go to following line, and place # at start, if already not there:
This will make the line like this:
Then save the file (Ctrl+o) and exit (Ctrl+x)
If the gpio is at logic 1 it is already at 3V3 so there will be no difference.
If the gpio is at logic 0 it is at ground and connecting 3V3 will in effect be a short-circuit. That can kill the gpio and or bank of gpios and or the Pi (unless an appropriate current limiting resistor is in place).
It is perfectly ok to do this. After all it does not matter whether two digitial pins (one input, one output) of different devices or the same device are connected to each other.
The one important thing is to consider that the maximum ratings of the GPIO pins are not exceeded - especially the current drawn from the pin. This holds true for any setup but ...
It depends on the module you are using and if you have changed the GPIO state using the module (rather than indirectly by calling a shell program to change the state).
My pigpio leaves the GPIO in the last set state.
I'm not sure about wiringPi (Python).
RPi.GPIO and RPIO.GPIO both have a cleanup function. If that is called then any GPIO you have changed ...
In general the reason electronic engineers prefer pull-ups to pull-downs is that in silicon N type (NPN bipolar or N-channel FET) transistors are better than P type transistors (PNP bipolar or P channel FET).
This meant that when ICs were built out of 1 type of transistor they were built out of N transistors and as a result they were much better at pulling ...
I don't have my Pi in reach right now, but you can do it like this: First, find out which playback devices you have. You can do this with aplay:
$ aplay -L
Discard all samples (playback) or generate zero samples (capture)
HDA Intel PCH, ALC892 Analog
Default Audio Device
HDA Intel PCH, ALC892 Analog
The Pi's GPIO are 3V3. There is no authoritative source for voltage levels. For the likely voltage levels see http://www.mosaic-industries.com/embedded-systems/microcontroller-projects/raspberry-pi/gpio-pin-electrical-specifications
A GPIO can output considerably more than 16mA. Whether it is safe to do so for any length of time I don't know. I think I ...
I expect that the issue is that your Raspberry Pi is using different resolution to your TV.
The resolution can be changed manually by editing the Raspberry Pi config file which is located at /boot/config.txt
You must enter an hdmi_group and hdmi_mode in that file in order to set the resolution. The values that correspond to the resolution you want can be ...
My current working hypothesis is that, for me at least, the audio depends somehow on the desktop environment. I have a Raspberry Pi 2, running Raspbian, installed from NOOBS. I've wiped it clean and reinstalled Raspbian dozens of times. The sound works when I first install Raspbian. The next thing I habitually do is remove the LXDE desktop environment ...
Yes it is safe to connect without a resistor. As for which is better a piezo disc or buzzer. There is not much difference (one may be louder than the other for the same voltage, and the may differ in tone), but only experimenting will tell you if there is enough difference to care.