All posts by EEadmin

Preventing (or at least reducing) SD corruption on Raspberry PI

From:
http://www.ideaheap.com/2013/07/stopping-sd-card-corruption-on-a-raspberry-pi/

Read for more info

The biggest offender for Filesystem writes on any linux system is logging. If you are like me, you don’t really look at /var/log after a recycle anyways. This area, and /var/run, a location where lock files, pid files and other “stuff” shows up, are the most common areas for mess-ups. Take a look at your blinking FS light on the board. Our goal is to make that light stay off as long as possible.

Set up tmpfs mounts for worst offenders.

The following two lines should be added to /etc/fstab:

none        /var/run        tmpfs   size=1M,noatime         00
none        /var/log        tmpfs   size=1M,noatime         00

There’s more, however. By default, linux also records when a file was last accessed.
That means that every time you read a file, the SD card is written to. That is no good! Luckily, you can specify the “noatime” option to disable this filesystem feature. I use this flag generously.

Also, for good measure, i set /boot to read-only. There’s really no need to regularly update this, and you can come back here and change it to “defaults” and reboot when you need to do something.

After this, /etc/fstab should look as follows:

proc            /proc               proc    defaults                    0   0
/dev/mmcblk0p1  /boot               vfat    ro,noatime                  0   2
/dev/mmcblk0p2  /                   ext4    defaults,noatime            0   1
none        /var/run        tmpfs   size=1M,noatime             0   0
none        /var/log        tmpfs   size=1M,noatime             0   0

Go ahead and reboot now to see things come up. Check the Filesystem light on your raspberry pi after it’s fully booted. You should see no blinking at all.

Disable swapping

One protection against SD card corruption is an optional, but potentially “I’m glad i did that” change to disable swapping.

The raspberry pi uses dphys-swapfile to control swapping. It dynamically creates a swap partition based on the available RAM. This tool needs to be used to turn off swap, and then needs to be removed from startup.

Run the following commands to disable swapping forever on your system:

sudo dphys-swapfile swapoff
sudo dphys-swapfile uninstall
sudo update-rc.d dphys-swapfile remove

After doing this, call free -m in order to see your memory usage:

pi@raspberrypi ~ $ free -m
             total       used       free     shared    buffers     cached
Mem:           438         59        378          0          9         27
-/+ buffers/cache:         22        416
Swap:            0          0          0

If you reboot, and run a free -m again, you should still see swap at 0. Now we don’t have to worry about tmpfs filesystems swapping out to hard disk!

From:
http://www.ideaheap.com/2013/07/stopping-sd-card-corruption-on-a-raspberry-pi/

Read for more info

The Story of Electricity Pt1

The Story of Electricity Part 1

Published on Nov 19, 2012

Shock and Awe – The Story of Electricity. Spark: Jim Al-Khalili tells how the first ‘natural philosophers’ began to unlock electricity’s mysteries, studying its curious link to life and building instruments to create it

Capacitance of a human body

by Paul E. Schoen of P S Technology, Inc.

There is some more information [regarding the resistance of a human body] at http://van.physics.uiuc.edu/qa/listing.php?id=6793 , where it states that the external human body resistance is about 1k to 100k Ohms, and the internal resistance is 300 to 1000 ohms. Only a thin layer of dry skin separates the internal resistance from an external object.

The human body capacitance to a far ground is 100-200 pF, which is really a minimum value. This correlates to an impedance of about 13 megohms at 60 Hz, which corresponds to a minimum of 9 uA at 120 VAC to ground. This is enough to be sensed and used for capacitively operated light dimmers.

Here is a way to measure your body capacitance: http://web.mit.edu/Edgerton/www/Capacitance.html

The inside of your body can be considered a conductor, and thus if you place your hand flat on a metal plate, you will form a capacitor with an area of perhaps 15 square inches, with a thin (maybe 0.005”) insulating layer of dry skin, which will form a capacitor much higher in value than the 200 pF stated above. According to a formula in http://www.sayedsaad.com/fundmental/11_Capacitance.htm , this would be C = 0.2249 * k * A / d = 1350 pF, (assuming k for skin is 2, about like dry paper). This will be an impedance of about 2 megohms , and current of 60 uA. This is still below the normal threshold of sensation, and still far below the usual safe current levels of 1 to 5 mA.

The actual thickness of the epidermis (per http://dermatology.about.com/cs/skinanatomy/a/anatomy.htm ) varies from 0.05 mm (0.002”) for eyelids to 1.5 mm (0.06”) for palms and soles, but the actual outer layer of the epidermis that is a good insulator is composed of flat, dead cells, which is much thinner. So the capacitance could be much higher than the quick estimate above.

Probably the main reason for electrical current to reach levels high enough for electrocution to occur (6 to 200 mA for 3 seconds, according to http://www.codecheck.com/ecution.htm ), is when skin becomes sweaty or otherwise loses its dry protective layer, which quickly exposes the underlying 1000 ohms or less, which will conduct 120 mA at 120 VAC.

There are safe ways to measure the body’s resistance and capacitance using realistic higher voltages, skin conditions, and contact surfaces, but I’m not going to suggest anyone try it. Suffice it to say that ohmmeter readings are misleading, and any carelessness around any kind of voltage source can be dangerous.

For very high voltages, there are standard minimum distances that must be maintained between a worker and an energized line: http://www.dir.ca.gov/oshsb/rubberglove.html . I found this on a search for rubber glove testing.

The field intensity near high voltage lines is so great that it might be fatal to touch them even if you were suspended in free air. You may notice that birds can sit on lower voltage transmission lines which are 5kV to 50 kV or so, but not on 200kV+ lines.