### About & Hints

Exploring the Raspberry Pi, explore the official home page ( http://www.raspberrypi.org ).
The Raspberry Pi Magazine is also a great resource ( http://www.themagpi.com ).
WiFi Power Save OFF
Option 1 create a script called wlan0 in /etc/network/if-up.d
#!/bin/bash
sudo BRANCH=next rpi-update
iwconfig wlan0 power off
Option 2 add statement to /etc/rc.local
iwconfig wlan0 power off
PIXEL
Change screen resolution using PIXEL:
Open terminal and enter lxrandr.
HDMI Monitor switch off when Screen Saver active
Modify, as user root, the file /boot/config.txt.
Add at file end, the line:
hdmi_blanking=1
Then save and reboot.
Disable Power Management
Read the power management flag:
cat /sys/module/8192cu/parameters/rtw_power_mgnt
This reports value "1".
Set to Zero:
sudo nano /etc/modprobe.d/8192cu.conf
Add line:
options 8192cu rtw_power_mgnt=0 rtw_enusbss=0
Save and Reboot sudo reboot
Power LED On Off
On the Raspberry Pi Model 2B the Device Power LED can be turned OFF and ON by:
Set GPIO Mode first
echo gpio | sudo tee /sys/class/leds/led1/trigger
Output:
gpio
Turn LED OFF
echo 0 | sudo tee /sys/class/leds/led1/brightness
Output:
0
Turn LED ON
echo 1 | sudo tee /sys/class/leds/led1/brightness
Output:
1
IMPORTANT
Be careful using this feature as it might impact applications using GPIO.
Example:
After the Raspberry Power LED has been turned off, a TinkerForge LCD20x4 bricklet connected via a TinkerForge Master brick, turns its display off after 5 min.
Status 20150818: Root Cause not identified.
Update Firmware
An easy way to upgrade the firmware is using rpi-update
Reference: https://github.com/Hexxeh/rpi-update/
Install:
sudo apt-get install rpi-update
Command Update Firmware:
sudo rpi-update
Always reboot thereafter.
Setting up autostart of an App on the Raspberry Pi.
Lets assume the non-ui app is called myapp.
Solution using Bash Script and Crontab
• The myapp.jar file is created on the development device in folder Objects of the B4J Project.
• Logon the Raspberry Pi as User Pi.
• Create a folder /home/pi/myapp.
• Copy myapp.jar (and any additional files required) from the development device Objects folder to the Raspberry Pi folder /home/pi/myapp.
Note: One way is by using WinSCP. Ensure all files are copied to the RPi.
• Goto folder /home/pi/myapp (cd /home/pi/myapp).
• Create a file myapp.sh with content below (sudo nano myapp.sh):
#!/bin/bash
cd /home/pi/myapp
sudo java -jar myapp.jar&
• Save the file. Note: do not forget the ampersand & to start myapp.jar
• Make the file executable: sudo chmod 755 myapp.sh
• Add myapp.sh to crontab: sudo crontab -e
• Add the line to crontab: @reboot sudo /home/pi/myapp/myapp.sh
• Save
• Reboot the Pi
• Check if the process myapp.jar is running (ps -ef | grep myapp)
Additional References
Run a script on start up
http://raspberrywebserver.com/serveradmin/run-a-script-on-start-up.html
Setup I2C on the Raspberry Pi.
Set Configuration
sudo raspi-config
Advanced Options > I2C > Enable
Update the Modules
Go to /etc/modules and add
i2c-bcm2708
i2c-dev
Install i2c-tools
Not required, but hand to test.
sudo apt-get install python-smbus
sudo apt-get install i2c-tools
Modify Blacklist
sudo nano /etc/modprobe.d/raspi-blacklist.conf and comment out
blacklist spi-bcm2708
blacklist i2c-bcm2708
Test I2C
Detect device connected to Bus 0 or 1
For Bus 0:
sudo i2cdetect -y 0
For Bus 1:
sudo i2cdetect -y 1
If a device is found, then an entry like
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- 77
A device with address 0x77 is connected (in this case a BMP180 Sensor).
Read data from the device
i2cget -y 1 0x77
Write data to the device
sudo i2cset -y 1 0x77 0x00

Changed: 2018-03-26 13:04, Category: Raspberry Pi, File: T6C234M1705.htm, ID: 1705