Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Hot answers tagged

62

I believe the following is correct for the B+. Red PWR LED on if power OK flashes (or goes out) if the power drops below about 4.63V Green ACT LED steady on if no SD card during boot irregular flashes for SD card access Ethernet Socket Left LED (yellow) on 100-Mbps connection off 10-Mbps connection Ethernet Socket Right LED (green) on if link ...


57

The OK LED can be controlled from user space software. Details here: Re: Can we control the on-board leds Summarised from the above (all credit to BrianW): The OK LED is available as /sys/class/leds/led0/. The kernel LED driver has "triggers" which let some other part of the kernel control the LED. The default trigger for the LED is 'mmc0', which makes it ...


25

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/...


23

According to http://elinux.org/RPi_Hardware Rev. 1.9 Boards D5(Green) - OK - SDCard Access (via GPIO16) D6(Red) - PWR - 3.3 V Power D7(Green) - FDX - Full Duplex (LAN) (Model B) D8(Green) - LNK - Link/Activity (LAN) (Model B) D9(Yellow) - 10M - 10/100Mbit (LAN) (Model B) Rev.2.0 Boards label the LEDS as ACT PWR FDX LNK 100


20

None of the on board LEDs can be controlled in software - they are all used for other things. OK - indicates SD card access PWR - indicates power to the micro USB connection FDX - Full Duplex LAN LNK - LAN Activity 10M - 10M/100M connection speed - if it is lit, the RPi is connected at 100M. Now, that's the official answer... Let's study the schematic. ...


13

You need (as minimum): Red/orange/green LEDs ~470 ohm resistor (1 per LED) - note that this resistance is approximate, but should work for most all standard 5mm LEDs Wire A breadboard Pi-breadboard connector (hacked 26-pin floppy drive cable, Pi breakout kit, etc). Your circuit will look like the following (image taken from the excellent book Raspberry Pi: ...


13

I know this may sound silly, but a piece of electricians tape over the top would work. Alternatively, put it in a case or box.


13

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. ...


12

You can connect directly to the IO pins. The GPIO pins on the RasPi processor (BCM2835) supply 3.3v @8ma of drive by default but are programmable as far as pull-up, current, slew rate, etc. see http://www.scribd.com/doc/101830961/GPIO-Pads-Control2 for a summary. Having said that, unless you're adept at programming those pin parameters, you probably want ...


11

The Pi does not have any onboard speaker, so there are no power on/off sounds. The main indicators are the lights on the front corner of the board. These are: OK (green): The board is active (blinks off when accessing the SD card) PWR (red): The board is successfully powered from USB FDX (green): Network is full-duplex LNK (green): The network cable is ...


11

Arduino: is a microcontroller based physical computing platform,programmed using a Wiring-based language (syntax and libraries), similar to C++ with some slight simplifications and modifications, and a Processing-based integrated development environment. With the Arduino Uno you would need to create a sketch in the Arduino language. This is not hard - it ...


10

Current RPi models have some of the following LEDs: PWR (red) Indicates that power has been provided to the board. On A+ and later models it will flash if the voltage drops below 4.63V ACT (green) Indicates SD card activity: flashes when read or write is in progress, otherwise steady ON (on Pi Zero) or OFF. Should flash intensively during boot. This is ...


10

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.


9

You can do this with the PWM pin on the Pi. Here's a link to a blog post dealing with this that uses the C WiringPi library to do it: http://lifebydesignuk.wordpress.com/2013/02/20/how-to-breathing-led-in-python-for-raspberrypi/ I would paste the code in here but the editor isn't co-operating.


9

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. RPi.GPIO-0.1.0.tar.gz I have downloaded version 0.5.x and it works correctly. RPi.GPIO-0.5.3a.tar.gz Download from here https://pypi.python.org/pypi/RPi.GPIO ...


9

LEDs have different characteristics depending on their color. Of significance is the so called forward voltage. Blue LEDs have a typical forward voltage of 3.3V to 3.4V which is higher than the voltage output of the GPIO pin. So the current through the LED will be minuscule. No current, no light. Red LEDs on the other hand have a forward voltage of less ...


9

You need to consider that the forward voltage of a white LED is likely in the range of 3.0 V to 3.2 V (according to the linked article). Assuming the best case of 3.0 V and a resistor of 330 Ohms and using Ohm's law R = U / I we find that the current is about 1 mA and thus the brightness of the LED is rather low. Decreasing the resistor will help to some ...


8

I few differences I have noticed. Raspberry Pi: Doesn't support Analog IO Not as many pins for IO as the Arduino Much more difficult to access IO pins (imo) Writing to the pins for time essential applications in Python can lead to inaccuracies Runs a full fledged Linux OS Features Ethernet (and WiFi and Bluetooth on newer models) Two USB 2.0 Can display to ...


8

The shell interprets and handles redirection before the command is executed. So the redirection (>/sys/class/leds/led0/trigger) is attempted with the user's permissions, thus fails. The generally recognized solution is to use the tee command: (man page and wikipedia) echo heartbeat | sudo tee /sys/class/leds/led0/trigger >/dev/null The tee command ...


8

You need to set the pin as an output before you use it. To do that add the following line: GPIO.setup(red, GPIO.OUT) below the matching lines for green and yellow: GPIO.setup(yellow, GPIO.OUT) ## set output GPIO.setup(green, GPIO.OUT)


7

There is a simpler way to control the LAN LEDs from userland. Source code is available from http://www.raspberrypi.org/forums/viewtopic.php?f=63&t=72070 The program needs to be run with sudo.


7

You can control all leds (except PWR in older Pi models, as said in other answers). But for ethernet leds you will need to patch the driver and recompile the kernel. Information of how recompile can get here: http://elinux.org/RPi_Kernel_Compilation Patch and more information here(google translate if need): http://everpi.tsar.in/2013/11/patch-para-...


7

You can connect an LED directly to the GPIO pins (it will provide enough current). However, you probably shouldn't do this for a couple of reasons, You can fry the Pi as you state, and without a current limiting resistor you will signifcantly reduce the life of the LED. This does not mean you need to buy a breakout board to run a single LED. You can use a ...


7

Looking at your picture, why not make use of the extra 10 unused rows on your breadboard? I am going to assume that you've figured out that "row 1, holes a-e" are all interconnected, "row 1, holes f-j" are interconnected, "row 2, holes a-e" are interconnected, etc. Your unused rows 21-30 aren't used, so, for example, the anode of the left-hand blue LED is ...


7

Actually, with 17 GPIOs you can drive 72 LEDs using time multiplex (8 groups of 9 LEDs are driven one after another for such a short time that our eyes believes they are on at the same time, just less bright). Do you can have 24 RGB LEDs this way. And if that's not enough, you can cascade I2C LED drivers resulting in hundreds of LEDs if you want.


6

No Unfortunately not. The PWR LED, for example, is directly wired to the 5V rail and other LEDs are controlled by closed-binaries.


6

Yes. You would use the GPIO pins in PWM mode to control each brightness scale. An example of the wiring from wiring.org.co. The GPIO utility & guides from Gordons Project is another place to start Edit As Alex Chamberlain pointed out, only one GPIO pin supports PWM. You can use software to achieve PWM on other GPIO pins. Info & examples for C &...


6

I can confirm that with the Raspberry Pi 2 it's possible to control the PWD LED as well! The power LED is controlled by the files in: /sys/class/leds/led1 You can turn it off just like the Status LED using: echo 0 > /sys/class/leds/led1/brightness # Power LED echo 0 > /sys/class/leds/led0/brightness # Status LED See Guy's answer for more ways to ...


6

I wrote a userspace program which let you control the Ethernet LEDs. The program requires the more recent libusb-1.0 (NOT the older 0.1). It works with LAN9512 (e.g. on the older Raspberry B) as well as LAN9514 chips (e.g. on Raspberry B+ or Raspberry 2) Details can be found here: LAN951x LED control


6

Depending on the LEDs you are using, It may be possible to use a multiplexing scheme to reduce the number of drivers you need. It's probably simpler to use a bunch of 4094 shift registers daisy chained. You can bitbang the clock/data or use the SPI hardware to drive them Each 4094 can control 8 LEDs. You'll most likely need a small driver (eg transistor) ...


Only top voted, non community-wiki answers of a minimum length are eligible