E-liquid nicotine strength calculator

Many people make their own liquids using ejuice Me Up calculator:

eJuice Me Up Calculator

I tried to run it in Linux but I was not able to install .NET in Wine so I found a simple calculator written in Python:

Python eJuice Calculator

Because this script is not too convenient and has some flaws I made its two new versions:

● with the version 1.0 you can use one nicotine base – you may choose between PG and VG;

● with the version 2.0 you can use two nicotine bases – PG and VG – both of the same strength.

With one nicotine base you can not make any possible blend – with two bases you can blend them in any proportion.

Both program versions display the messages about the errors, suggest the valid values of the variables, and allow to calculate the proportions of the ingredients using selected decimal precision.

I gave up to join both these scripts together because in such a case it would not be possible to pass the variables in an intuitive and logical way at the same time. As a result some users would be in a trouble.

Here are the sources of both these scripts:

ecig-1.0.zip

ecig-2.0.zip

***

The meaning of the particular variables is the following:

Code:
body   = 'PG'    # Body is for the ingredient of your base ('PG' or 'VG')
base   = 36      # Base is for the strength of your base in mg/ml
mix    = 70      # Mix is given in % of the body
flavor = 15.6    # Flavor means reserve of room for flavor in %
amount = 10      # Amount is for the desired liquid in ml
nic    = 18      # Nic is for the strength of the liquid in mg/ml
dec    = 1       # Dec is for the decimal precision of the calculations

You may set these variables before you run the script or you may remove some comments from the interactive section allowing the program to ask you about the particular values.

The body variable appears just in the first script.

Here are the outputs of both these scripts using the same values of the particular variables:

$ ./ecig-1.0.py
Code:
SOURCE:   PG
BASE:     36 mg/ml
BLEND:    70 : 30 PG:VG
FLAVOR:   15.6 %
AMOUNT:   10 ml
STRENGTH: 18 mg/ml

INFO:     Minimum PG solution is 50.0 % (for flavor 0 %)
          Maximum flavor amount is 50.0 % (for PG 100 %)

Use 5.0 ml of your 36.0 mg/ml PG liquid
Use 0.9 ml of your 0 mg/ml PG liquid
Use 2.5 ml of your 0 mg/ml VG liquid
This will make a 8.4 ml of a 70.0 % PG blend at 21.3 mg/ml of nicotine
When you add 15.6 % of flavors ( 1.6 ml )
You will get 10.0 ml of a liquid at 18.0 mg/ml of nicotine

$ ./ecig-2.0.py
Code:
SOURCE:   PG+VG
BASE:     36 mg/ml
BLEND:    70 : 30 PG:VG
FLAVOR:   15.6 %
AMOUNT:   10 ml
STRENGTH: 18 mg/ml

INFO:     Maximum flavor amount is 50.0 %

Use 3.5 ml of your 36.0 mg/ml PG liquid
Use 1.5 ml of your 36.0 mg/ml VG liquid
Use 2.41 ml of your 0 mg/ml PG liquid
Use 1.03 ml of your 0 mg/ml VG liquid
This will make a 8.44 ml of a 70.0 : 30.0 PG:VG blend at 21.33 mg/ml of nicotine
When you add 15.6 % of flavors ( 1.56 ml )
You will get 10.0 ml of a liquid at 18.0 mg/ml of nicotine

In both cases the result is the same but in the latter case you need two nicotine bases – PG and VG.

Here are the outputs of both scripts using the wrong values of the variables:

$ ./ecig-1.0.py
Code:
SOURCE:   PG
BASE:     72 mg/ml
BLEND:    50 : 50 PG:VG
FLAVOR:   55 %
AMOUNT:   10 ml
STRENGTH: 18 mg/ml

INFO:     Minimum PG solution is 25.0 % (for flavor 0 %)
          Maximum flavor amount is 75.0 % (for PG 100 %)

Use 2.5 ml of your 72.0 mg/ml PG liquid
Use 2.2 ml of your 0 mg/ml VG liquid
This will make a 4.8 ml of a 52.7 % PG blend at 37.9 mg/ml of nicotine
When you add 55.0 % of flavors ( 5.5 ml )
You will get 10.3 ml of a liquid at 17.6 mg/ml of nicotine

ERROR:    The liquid weaker than assumed ( 17.6 < 18.0 )
          * increase nicotine base strength to at least 80.0 mg/ml
          * increase PG mix proportion to at least 55.6 %
          * decrease flavor amount to at least 50.0 %

$ ./ecig-2.0.py
Code:
SOURCE:   PG+VG
BASE:     36 mg/ml
BLEND:    50 : 50 PG:VG
FLAVOR:   55 %
AMOUNT:   10 ml
STRENGTH: 18 mg/ml

INFO:     Maximum flavor amount is 50.0 %

ERROR:    Too weak base or too much flavor to make the blend
          * increase nicotine base strength to at least 40.0 mg/ml
          * decrease flavor amount to at least 50.0 %

The error messages suggest what to do in order to get the right blend.

***

The users of the most Linux systems can run these scripts out of the box. In the case of Mac OS and Windows you should install Python interpreter such as ActivePython:

ActivePython for Windows, Mac, and Linux

I tried the Community Edition because it is free and I decided to try 2.7.6.9 version because it should use less system resources than 3.3.4.1 one.

I started Windows XP in Linux Virtual Box and installed ActivePython using file ActivePython-2.7.6.9-win32-x86.msi.

Then I unpacked the ecig-1.0.zip file on the Desktop.

To try the script I used menu Start | All Programs | Accessories | Command Prompt.

The default directory in the terminal window is the user’s home directory – in my case it was "C:\Documents and Settings\cckk". The command dir shows that the Desktop folder is one level below.

In such a case to run the script it is enough to use the command:

python "Desktop\ecig-1.0.py"

Comments

There are no comments to display.

Blog entry information

Author
cckk
Views
1,527
Last update

More entries in ECF Blogs