May 192017

So, what is Bash?

The terminal (or ‘command-line’) on a computer allows a user a great deal of control over their system. All of these tools allow a user to directly manipulate their system through the use of commands. These commands can be chained together and/or combined together into complex scripts (see the linux usage page on scripting) that can potentially complete tasks more efficiently than much larger traditional software packages.

Bash is a Unix shell and command language written by Brian Fox for the GNU Project that powers the text interface of your Raspberry Pi. Every time you type a command into the terminal, you’re speaking Bash. First released in 1989, it has been distributed widely as the default login shell for Linux distributions and Apple Mac OSX. A version is also available for Windows 10. Before computers had graphical interfaces it was the only way you could interact with them. It’s necessarily very powerful and flexible. 

Raspberry Pi shell

On the Raspberry Pi (running Raspbian), the default terminal application is LXTerminal.

A shell is a command processor which lets you manipulate your computer by typing in commands. Commands are typed after the “prompt” which is a brief snippet of text informing you who and where you are on the system:

You can download as PDF here:

Here is my list of useful Rasbian bash terminal commands:

General commands
apt-get update
apt-get upgrade
chmod +x filename
find / -name example.txt
nano example.txt
shutdown -h now
shutdown -h 14:30
File and directory
cat example.txt
cd /abc/xyz
cp XXX
ls -l
mkdir example_directory
mv XXX
rm example.txt
rmdir example_directory
scp user@
touch example.txt
Network and web commands
hostname -I
iwlist wlan0 scan
iwlist wlan0 scan | grep ESSID
wget http://www.somewebsite.com/example.txt
System info
cat /proc/meminfo
cat /proc/partitions
cat /proc/version
df -h
df /
dpkg – –get–selections | grep XXX
dpkg – –get–selections
UP key
vcgencmd measure_temp
vcgencmd get_mem arm && vcgencmd get_mem gpu
May 152017

What is Claws mail?

Claws mail logo

Claws Mail is an email client aiming at being fast, easy-to-use and powerful. It is mostly desktop-independent, but tries to integrate with your desktop as best as possible. The Claws Mail developers try hard to keep it lightweight, so that it should be usable on low-end computers without much memory or CPU power, which is great when running it on a Raspberry Pi embedded SOC computer.

What is Claws mail not?

Claws Mail is not a full-featured Personal Information Manager like Evolution or Outlook, although external plugins provide these functionalities. Claws Mail will not let you write and send HTML emails or other kind of annoyances, hence it may not be the software you need in some business environments.

Google mail icon

Gmail Configuration

The first thing you have to do is set up Google Mail to allow IMAP connections.

Step 1: Check that IMAP is turned on in your g-mail account:

  1. On your computer, open Gmail.
  2. In the top right, click Settings Settings.
  3. Click Settings.
  4. Click the Forwarding and POP/IMAP tab.
  5. In the “IMAP Access” section, select Enable IMAP.
  6. Click Save Changes.
Gmail denies access to desktop email clients such as Claws Mail by default. Any sign-in attempt fails as if you had used an incorrect password for smtp authentication. To allow access, you need to modify an option in your account’s security settings.

1. Log in to the Google Accounts homepage.
2. Under Signing in, click Access for less secure apps
3. Select Turn on


Step 2: Configure Claws Mail on the Raspberry Pi:

Start the Claw mail application on your Raspberry Pi and go to the Configuration menu and select Create New Account. Use the table below to update your client with the correct information.

Incoming Mail (IMAP4 protocol) Server imap.gmail.com
Requires SSL: Yes
Port: 993
Outgoing Mail (SMTP) Server smtp.gmail.com
Requires SSL: Yes
Requires TLS: Yes (if available)
Requires Authentication: Yes
Port for SSL: 465
Port for TLS/STARTTLS: 587
Full Name or Display Name Your name
Account Name, User name, or Email address Your full email address
Password Your Gmail password

Step 3: The final step

Go back to the main Claws Mail window. If you right click on the Gmail main folder you will see an entry for Subscriptions. Under that entry there are three sub entries. Click the Subscribe entry to subscribe to your Gmail mail. Once you have done that, you can click Get Mail to download all of your Gmail mail. You are ready to go.


Step by step…..

For reference, your Raspberry Pi Claw Mail Account preferences should be setup like below when configured for your Gmail imap account:

  1. Select Configurations – “Create new account”

Select Claw configurations

2.Basic Claw mail settings:

Claw mail basic settings


3. Receive configuration:

Claw mail receive configuration

4. Send configuration:

Claw mail send configuration


5. Compose configuration:

Claw mail compose settings

6. Privacy configuration:

Claw mail privacy settings

7. SSL configuration:

Claw mail SSL configuration

8. Advanced settings:

Claw mail advanced settings

May 142017

InfluxDB is an easy to use open-source time series database developed by InfluxData. It is written in Go and optimized for fast, high-availability storage and retrieval of time series data in fields such as operations monitoring, application metrics, Internet of Things sensor data, and real-time analytics. It also has support for processing data from Graphite. A time series database have the series records always associated with a timestamp. You can provide the timestamp with the measurement data or the Influx database will generate it itself.

Grafana is an open source, feature rich metrics dashboard and graph editor for Graphite, Elasticsearch, OpenTSDB, Prometheus and InfluxDB.

Combining Influxdb+Grafana makes an easy to use database and a very flexible and good-looking dashboard for your next Raspberry Pi datalogger project.

TCP port 8086 is used for client-server communication over InfluxDB’s HTTP API.
TCP port 8088 is used for the RPC service for backup and restore.
In addition to the ports above, InfluxDB also offers multiple plugins that may require custom ports. All port mappings can be modified through the configuration file, which is located at /etc/influxdb/influxdb.conf for default installations.

InfluxDB installation instructions on Raspberry Pi:

#1. Add the InfluxData repository configuration by using the following commands:

Note: After hitting enter on some commands, a new prompt appears and nothing else is displayed. In the Command Line Interface, CLI, this means the statement was executed and there were no errors to display. There will always be an error displayed if something went wrong. No news is good news!

curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -source /etc/os-release

test $VERSION_ID = "7" && echo "deb https://repos.influxdata.com/debian wheezy stable" | sudo tee /etc/apt/sources.list.d/influxdb.list

test $VERSION_ID = "8" && echo "deb https://repos.influxdata.com/debian jessie stable" | sudo tee /etc/apt/sources.list.d/influxdb.list

#2.Install InfluxDB from the repository prevuously added in /etc/apt/sources.list.d/influxdb.list
sudo apt-get update && sudo apt-get install influxdb
#3. Start the InfluxDB service:
sudo service influxdb start
InfluxDB configuration

The system has internal defaults for every configuration file setting. View the default configuration settings with the influxd config command. Most of the settings in the local configuration file (/etc/influxdb/influxdb.conf) are commented out. All commented-out settings will be determined by the internal defaults. Any uncommented settings in the local configuration file override the internal defaults. Note that the local configuration file does not need to include every configuration setting. There are two ways to launch InfluxDB with your configuration file:
Point the process to the correct configuration file by using the -config option:

influxd -config /etc/influxdb/influxdb.conf
Set the environment variable INFLUXDB_CONFIG_PATH to the path of your configuration file and start the process.
For example:
echo $INFLUXDB_CONFIG_PATH /etc/influxdb/influxdb.conf


InfluxDB first checks for the -config option and then for the environment variable. See the Configuration documentation for more information.

To configure the InfluxDB first open the config file in the text editor nano:

sudo nano /etc/influxdb/influxdb.conf

I did the following configuration in the /etc/influxdb/influxdb.conf file:

#1. Configure the web-based Admin user interface, if admin through http web interface is desired:
 Please note that the Influxdb web-based admin interface will be deprecated as of version 1.1.0 and will be removed in a future release.  (Edit the following rows by removing the “#” tag.)
InfluxDB config admin access

#2.Configure the HTTP endpoint to get data in and out of InfluxDB:
(Edit the following rows by removing the “#” tag.)

InfluxDB http configuration file edit

Restart InfluxDB after modifying the file: ​sudo service influxdb restart

Test the InfluxDB installation

Open the Raspberry web browser and type:

Instead of writing “localhost” in the address field you could enter the real IP address of your raspberry Pi: Example: If you don’t know the IP address you, can easily find if by using the bash command sudo hostname -I
If it works,you should see the following html page:
404 page not found
Yes, that’s right, on port 8086 you will see a 404 page. The browser will complain: “This site could not be reached” if the database is not found.

You could also try to run the Influxdb command shell by typing influx in the terminal.
When you see this response you know that it is working:
influxdb shell

Type exit to get out of the Influx shell.

You can login to the web-based admin interface if you have enabled it in the config file:

Before you dive into InfluxDB it’s good to get acquainted with some of the key concepts of the database. This document provides a gentle introduction to those concepts and common InfluxDB terminology. With InfluxDB installed, you’re ready to start doing some awesome things. Getting started guide here.

Grafana installation instructions on RaspberryPi:

I have decided to install using apt From Bintray Debian Repository at Github.

#1. Install some packages and add the bintray pubkey to the apt keyring:
sudo apt-get install apt-transport-https curl
curl https://bintray.com/user/downloadSubjectPublicKey?username=bintray | sudo apt-key add -
#2. Update your apt source

For Raspberry pi 1, and Raspberry Pi Zero W, use:

echo "deb https://dl.bintray.com/fg2it/deb-rpi-1b jessie main" | sudo tee -a /etc/apt/sources.list.d/grafana.list

For Raspberry pi 2, and Raspberry Pi 3, use:

echo "deb https://dl.bintray.com/fg2it/deb jessie main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
#3. Install
sudo apt-get update
sudo apt-get install grafana
Test the Grafana installation

Open the Raspberry Chromium web browser and type:

You will then see the Grafana login page:
Grafana login html image

You made it!

You’ve sucessfully installed Influxdb and Grafana on your Raspberry Pi supercomputer. If you’re just starting out, we recommend taking a look at Grafana well made documentation for Basic Concept and Getting Started guides.

Feb 022015

Tire size calculator

The results of this wheel and tire size calculator are based on the mathematical equations of the sizes
entered, not the actual tire specs provided by the tire manufacturers. Please refer to the guides
supplied by manufacturers for exact specifications.Results within +3% of stock are considered acceptable.


Please enter actual Tread width – Aspect Ratio and Wheel / Rim diameter
(e.g. 205/65-R16)

Original Alternate
 /  –   /  – 

Graph: Actual speed vs. speedometer reading (km/h)

More about tires

Tire sizes are expressed by the manufacturers with three sets of numbers:

Tread width – Aspect Ratio – Wheel diameter (e.g. 215 55 R16)
Automobile tires are described by an alphanumeric tire code (in American English)
or tyre code (in British English, Australian English and others), which is
generally molded into the sidewall of the tire. This code specifies the
dimensions of the tire, and some of its key limitations,
such as load-bearing ability, and maximum speed.
Sometimes the inner sidewall contains information not
included on the outer sidewall, and vice versa.
For more in dept information about tire size and tyre codes see Wikipedia


1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)

Jan 312015

infoSuper capacitor discharge time calculator.

This calculator determines timekeeping operation using a supercapacitor (ultracap) based upon starting and ending capacitor voltages, discharge current, and capacitor size.

Formulas used:
Bt(seconds) = [C(Vcapmax – Vcapmin)/Imax]  This formula is valid for constant current only.
Bt(seconds) = -log(Vcapmin/Vcapmax)(RC) = t  This formula is valid for linear current only (simple resistive load).

  • Imax is the discharge current in amperes (A)
  • Vcapmin is the ending voltage in volts (V)
  • Vcapmax is the initial voltage in volts (V)
  • R is the equivalent resistive load in ohms(Ω) based on : R=Vcapmax/Imax
  • C is the capacitor value in farads 1F=1000 000μF=1000 000 000nF=1000 000 000 000pF
  • t is the time in seconds(s)

Edit the input fields and then click [Calculate]    
Vcapmax: V  
Vcapmin: V  
Capacitor Value: Farads  
Capacitor ESR: Ohms  
Imax uA  
R (calculated) Ohms  
Linear current discharge time: (simple resistor load) seconds  
Constant current discharge time: seconds  




More about this calculation

  • Vcapmax is the VCC maximum value that the capacitor is charged to.
  • Vcapmin is the minimum operating voltage you can tolerate before your circuit or component, which is backed up by the capacitor, stops working.
  • Imax is the maximum current that your circuit will discharge the capacitor.
    This can be a constant current or the initial linear current at Vcapmax.The Imax and Vcap values are used to calculate the equivalent resistance of the circuit, which is used in the
    equation to calculate the backup time.

RC Capacitor discgarge circuit
Figure 1.

From basic electronics, the formula to determine the voltage across a capacitor at any given time (for the
discharge circuit in Figure 1) is: V(t) = E(e-t/RC)

Rearranging this formula for time gives us: t = – log(V/E)(RC)
V is the ending voltage in volts (V)
E is the initial voltage in volts (V)
R is the resistive load in ohms(Ω)
C is the capacitor value in farads 1F=1000 000μF=1000 000 000nF=1000 000 000 000pF
t is the time in seconds


More about super capacitors
A supercapacitor, supercondenser, pseudocapacitor, electrochemical double layer capacitor (EDLC), or ultracapacitor,
is an electrochemical capacitor with relatively high energy density, typically on the order of thousands
of times greater than an electrolytic capacitor. For instance, a typical D-cell sized electrolytic capacitor
may have capacitance in the range of tens of millifarads. The same size electric double-layer capacitor
might reach several farads, an improvement of two orders of magnitude. Supercapacitors usually
yield a lower working voltage in the range 2,5 – 20V.
As of 2010 larger double-layer capacitors have capacities
up to 5,000 farads.[1] Also in 2010, the highest available supercapacitor energy density
is 30 Wh/kg,[2] lower than rapid-charging lithium-titanate batteries.

EDLCs have a variety of commercial applications, notably in “energy smoothing” and momentary-load devices.
They have applications as energy-storage devices used in vehicles, and for smaller applications like
home solar energy systems where extremely fast charging is a valuable feature.

Super capacitors are widely used as a backup power source for realtime clock circuits and memory in microcontroller applications for years.
More information in Wikipedia here.

Please rate this article: 1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 4.00 out of 5)

Apr 202012


The formula used in this
calculation is from the famous Wheelers approximations
which is accurate to <1% if the cross section is near
square shaped.

L (uH) =31.6*N^2* r1^2 / 6*r1+ 9*L + 10*(r2-r1)


  • L(uH)= Inductance in microHenries
  • N = Total Number of turns
  • r1 = Radius of the inside of the coil in meters
  • r2 = Radius of the outside of the coil in meters
  • L = Length of the coil in meters
Multilayer air cor inductors

NOTEThis formula applies at ‘low’ frequencies (<3MHz) using
enameled copper wire tightly wound.

Multilayer air coils Please note that the diameter is measured from center of wire trough
center of the coil and to center of the wire on the opposite side.

Inductance (L):
Coil Inner Diameter (d=2*r1):
Coil Length (l):
Wire Gauge: AWG
Number of Turns (N): turns
Turns per Layer: turns/layer
Number of Layers: layers
Coil Outer Diameter (D):
Wire Diameter:
Wire Length:
DC Resistance (R): Ω (at 20°C)


If it may happen that you find this multilayer aircoil calculator interesting for others, please consider sharing it.
Please rate this article: 1 Star2 Stars3 Stars4 Stars5 Stars (6 votes, average: 3.33 out of 5)

Apr 192012

info Winding the wire in a single layer produces an inductor with minimal parasitic capacitance, and hence gives the highest possible self-resonant frequency (SRF). Striving to obtain a high SRF and low losses is the key to producing coils which have radio-frequency properties bearing some useful resemblance to pure inductance.

The calculation is based on Wheeler’s 1928 formula for a single-layer solenoid which is given in its original form as:
L = a² N² / (9a + 10b) [microHenries] , b > 0.8a
Where b is the coil length in inches, and a is the radius in inches.

To convert this formula to SI units, we will use the symbols r = radius, D = 2r = diameter, l = solenoid length.
Factoring b from the denominator gives:
L = 10-6 a² N² / [ b (10 + 9a/b)] [Henrys] The quantity a/b is dimensionless, and so we can immediately substitute in the denominator:
L = 10-6 a² N² / [ b (10 + 9r/l)] = 10-6 a² N² / [ b (10 + 4.5 D/l)] Factoring 10 from the denominator gives:
L = 10-7 N² ( a² / b ) / (1 + 0.45 D/l) [Henrys]


  • L is the inductance in Henry
  • D is the coil diameter in meters
  • r is the radius in meters (or D/2)
  • l is the lenght of the coil in meters
  • N is the number of turns
Please note that the accuracy of this formula is ±0.33% if the ratio of D/l>0.4. so this formula fits best for long solenoids.

noteThis formula applies at ‘low’ frequencies (<3MHz) using enameled copper wire (magnet wire) close wound.

Tip 1Small reductions in the inductance obtained can be achieved by pulling the turns apart slightly. This will also reduce self-resonance. Other combinations of wire and coil diameter may be tried but best results are usually obtained when the length of the coil is the same as its diameter.

Tip 2 If you need good induction stability in the presence of vibration then wind the coil on a support made from a suitable non magnetic plastic or ceramic former and lock the windings using epoxy glue or other suitable adhesive.

Please note that the diameter is measured from center of wire trough
center of the coil and to center of the wire on the opposite side.


Required Inductance (L):
Coil Diameter (D):
Wire Diameter (d):
Coil Length (l):
Number of Turns (N):


Apr 182012

Info This is an popular coil geometri used in todays wireless charger circuits.
The formula used in this calculation is based on the
Harold A. Wheeler approximations
for air core flat spiral coil inductor.


  • L = inductance in μH
  • Di = inner diameter in inches.
  • s = distance between windings in inches
  • w = wire diameter in inches
  • N = number of turns

1 inch = 0,0254m=2,54cm = 25,4mm.
This formula applies at ‘low’ frequencies (<30MHz)
using enameled copper wire. Some people call it “magnet

Click on image to enlargeFlat spiral coil inductor example

Please note that the outer and inner diameter is measured from the center of the wire.

Flat spiral coil dimensions drawing


Coil inner diameter (Di):
Number of turns (N):
Wire Diameter (w):
Spacing between turns (s):
Inductance (L):
Outer diameter (Do):
Wire lenght (Wl):


More about flat spiral coils

A flat spiral coil is a type of an air core inductor
usually incorporated in the primary of a tesla generator,
RFID tag, and proximity detectors. In the same category
as the flat spiral coils we have planar spiral coils,
planar square spiral coils, planar rectangular spiral
coils, planar hexagonal spiral coils and octagonal spiral
coil. Planar coils are mostly used in high frequency
applications and designed as tracks on a circuit board.

A flat spiral coil belongs to the category of air core inductors

An “air core inductor” is an inductor that does not depend upon a ferromagnetic material to achieve its specified inductance. Some inductors are wound without a bobbin and just air as the core. Some others are wound on a bobbin made of bakelite, platsic, ceramic etc.

Advantages of an air core coil:

Its inductance is unaffected by the current it carries.
This contrasts with the situation with coils using ferromagnetic cores whose inductance tends to reach a peak at moderate field strengths before dropping towards zero as saturation approaches. Sometimes non-linearity in the magnetization curve can be tolerated; for example in switching power supplies and in some switching topologies this is an advantage.
In circuits such as audio cross over filters in hi-fi speaker systems you must avoid distortion; then an air coil is a good choice. Most radio transmitters rely on air coils to prevent the production of harmonics.
Air coils are also free of the “iron losses” which a problem with ferromagnetic cores. As frequency is increased this advantage becomes progressively more important. You obtain better Q-factor, greater efficiency, greater power handling, and less distortion.
Lastly, air coils can be designed to perform at frequencies as high as 1 Ghz. Most ferromagnetic cores tend to be rather lossy above 100 MHz.

And the “downside”:

Without a high permeability core you must have more and/or larger turns to achieve a given inductance value. More turns means larger coils, lower self-resonance dur to higher interwinding capacitance and higher copper loss. At higher frequencies you generally don’t need high inductance, so this is then less of a problem.
Greater stray field radiation and pickup:
With the closed magnetic paths used in cored inductors radiation is much less serious. As the diameter increases towards a wavelength (lambda = c / f), loss due to electromagnetic radiation will become significant. You may be able to reduce this problem by enclosing the coil in a screen, or by mounting it at right angles to other coils it may be coupling with.
You may be using an air cored coil not because you require a circuit element with a specific inductance per se but because your coil is used as a proximity sensor, loop antenna, induction heater, Tesla coil, electromagnet, magnetometer head, or deflection yoke etc. Then an external radiated field may be what you want.

Please consider sharing this page if you find it useful
Please rate this article: 1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 4.00 out of 5)

Apr 172012

Push image to enlarge
Square planar spiral coil Hexagon spiral coil inductor Octagon spiral coil inductor Sircular spiral coil inductor
InfoThe first approximation is based on a modification of an expression developed by Wheeler; the second is derived from electromagnetic principles by approximating the sides of the spirals as current-sheets; and the third is a monomial expression derived from fitting to a large database of inductors (and the exact inductance values).
All three expressions are accurate, with typical errors of 2 – 3%, and very simple, and are therefore excellent candidates for use in design and synthesis. The thickness of the inductor has only a very small effect on inductance and will therefore be ignored.
Fill in appropriate values in the white fields.Then push “calculate”.
1μm =0.001mm
1μm =0.00003937007874015748 inch
Number of turns (n): turns
Spacing between turns (s): μm
Turn width (w): μm
Outer Diameter (dout): μm
Calculated Inner diameter (Din) μm
Fill factor p=(Dout-Din)/(Dout+Din)
  Square Hexagonal Octagonal Circular
Modified Wheeler nH nH nH nH
Current Sheet nH nH nH nH
Monomial Fit nH nH nH nH


S.S. Mohan, M. Hershenson, S.P. Boyd and T.H. Lee
Simple Accurate Expressions for Planar Spiral Inductances
IEEE Journal of Solid-State Circuits, Oct. 1999, pp. 1419-24.
For multilayer spiral pcb coils see here:
A new calculation for designing multilayer planar spiral inductors

If you find this page useful for others, please consider sharing it.

Please rate this article: 1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)

Apr 152012

With the emphasis today on the need for more efficient and cost-effective power solutions, EE-Times created this column to provide helpful tips on a variety of power management topics. This column is geared towards design engineers at all levels. Whether you’ve been in the power business a long time or just coming on the power scene, you’ll find some nuggets of information that just might help you with your next design challenge.

 If you liked this page of powersupply tips, please consider sharing it:
Please rate this article: 1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)