## How to Figure Out Relative Humidity with PHP

Today, I had to calculate relative humidity using PHP and I have documented my findings below:

First, let’s just use an example situation where we have a temperature of 60.1 and a dew point of 42.7, both in Fahrenheit, so…:

dew point in Fahrenheit: 42.7

temperature in Fahrenheit: 60.1

1) The first step is to convert to Celsius using the following formulas
Tc=5.0/9.0*(Tf-32.0)

Tdc=5.0/9.0*(Tdf-32.0)

Formulas explained:
Tc=air temperature in degrees Celsius, Tf=air temperature in degrees Fahrenheit

Tdc=dewpoint temperature in degrees Celsius

Tdf=dewpoint temperature in degrees Fahrenheit

Notice: If your temperature and dewpoint are in degrees Celsius, you can skip step 1 and proceed to step 2.

answer for equations:
Temp in Celsius: 15.61

Tc=5.0/9.0*(Tf-32.0)
5.0/9.0*(60.1-32.0)
5.0/9.0*28.1
0.5555555555555556 * 28.1 = 15.61111111111111

dewpoint in Celsius: 5.94
5.0/9.0*(Tdf-32.0)
5.0/9.0*10.7
0.5555555555555556 *  10.7 = 5.944444444444444

2) calculate saturation vapor pressure(Es) and actual vapor pressure(E) in millibars:
NOTE: first line is the equation and the subsequent lines represent one step solved at a time:
Es=6.11*10.0**(7.5*Tc/(237.7+Tc))
Es=6.11*10.0**(7.5*15.61/(237.7+15.61))
Es=61.1 ** (7.5*15.61/(237.7+15.61))
Es=61.1 ** (117.075/253.31)
Es = 61.1**0.4621807271722395
Es = 6.6907349413770067935260257174923

E=6.11*10.0**(7.5*Tdc/(237.7+Tdc))
E=6.11*10.0**(7.5*5.94/(237.7+5.94))
E=61.1 ** (7.5*5.94/(237.7+5.94))
E=61.1 ** (44.55/243.64)
E=61.1 ** 0.1828517484813659497619438515843
E = 2.1211957981192776150462474985589

3)  Once you have the saturation vapor pressure and actual vapor pressure, relative humidity(RH) can be computed by dividing the actual vapor pressure by the saturation vapor pressure and then multiplying by 100 to convert the quantity to a percent:
RH =(E/Es)*100
RH =(2.1211957981192776150462474985589/6.6907349413770067935260257174923)*100
RH = 0.31703479762758596814611114744566 * 100
RH = 31.703479762758596814611114744566%
SO… Humidity is 31.7%

And note here that ** means to the power of. I figured I’de clue anyone in that is as ignorant is I was when I had to figure it out.

## How to Share Your Internet Connection in Windows 10

So I’ve used a couple different methods to share internet connections on several different computers. What’s a real pain is that some methods only work on some PCs and some PCs don’t have all the components or programs needed to run ICS(Internet Connection Sharing) properly. So, I finally may have found a great, easy to use solution. It does require installing a simple app in Windows, but it doesn’t seem to have any adware or nonsense in it. I will update this post if I do find any malicious content from the app later on though.

## Using an App for Internet Connection Sharing

Some peope are against using an app for this, but let me tell you, it is easier if you have to deal with this issue regularly. The app is called Virtual Router and can be downloaded from: https://virtualrouter.codeplex.com/downloads/get/621827.

## How to Connect to Ad Hoc Network from Windows 8.1

Microsoft seems to have dropped the ball on this one folks. For some unknown-to-me reason, Windows 8 computers cannot detect an ad hoc network. This means that when I set up an ad hoc internet sharing network on my Windows 7 laptop so that I could share the laptop’s internet connection with a different laptop running Windows 8.1, it couldn’t be done. The main reason it wouldn’t work is because the ad hoc network I created does not show up under WiFi connections on the Windows 8.1 machine. I tried all sorts of things and only one finally worked, so I’ll share it with you below. For anyone following my series on developing a Smart Home, This is the method I used to network my smart home PC to other PCs in the house. The laptop used as a controller for the house was connected directly to the cable modem using an Ethernet cable. Then I created an ad hoc network on the same laptop that broadcasts the internet signal(shares its internet connection) to any other computer in the house that has wireless capability.

## Instructions for using ad hoc with Windows 8.1

1.  First create your ad hoc connection from a computer that has a working internet connection that you want to share. FYI, Windows 7 starter does not have the ability to create ad hoc networks and won’t allow you to share internet connections in any way without doing some serious mods to your OS. It’s easier to use a PC that doesn’t have Windows 7 starter.
2. Next, on the machine that you want to share with that’s running Windows 8.1 or similar, open the Control Panel and click on “Network and Sharing Center”.
3. Click on “Set up a new connection or network”.
4. Select “Manually connect to a wireless network” and click “Next”.
5. In the “Network Name” field, enter the ssid name for the network you created on the other computer exactly how you entered the name when you created the ad hoc network.
6. Select he appropriate security type and enter a security key if needed.
7. Be sure that the box that reads “Start this connection automatically” is NOT CHECKED. I normally leave the other box unchecked as well.
8. Click the “Next” button.
9. Close that window and open a command prompt window which you can do by hitting the windows key then clicking on the search icon(magnifying glass) in the upper right corner of the screen then typing “cmd” and searching. Click on the command prompt option from the search results to open a new command prompt window.
10. At the command prompt, type(without quotes):”netsh wlan connect [ssid]” replacing [ssid] with the ssid name of the ad hoc network you created on the other PC.
11. Now your Windows 8.1 PC is all set up to use that single ad hoc network. Unfortunately you’ll have to repeat the above process for any other ad hoc networks you might want to use in the future. You’ll not have to do it again for the same network though. Finally, to connect, all you do it type this at the command prompt: “netsh connect [ssid]” without quotes and replacing [ssid] with the ad hoc network name.
12. Now you are connected, so use it til done and when you want to disconnect, you can use “netsh wlan disconnect ” without quotes.
13. If you ever wish to delete the ad hoc network from your Windows 8.1 computer, use this command from a command prompt: “netsh wlan delete profile [ssid] ” without quotes and replacing the ssid name and brackets with actual network name.

There you go! Now you can connect your Windows 8.1 machine to an ad hoc network. It’s really only about ten easy steps so don’t be intimidated by my long explanation. Simple do the above one step at a time and you’ll get it in no time at all. Good Luck!

## Why Would You Use an Ad Hoc Network?

The reason I did this instead of using a WiFi wireless router was to save electricity. I was getting a heavy bill despite using the best possible economy 7 tariffs. Since I had to have the main computer that controls the house running all the time anyway, I figured why not use it for a router too. I have effectively eliminated one small appliance which means saving about 10 watts of power continuously in my case.

Another reason could be that you simply do not have a wireless router. In my particular case, I fried mine last night by accidentally hooking 24 volts to the router instead of the required 12 volts. So this turned out to be a blessing in disguise because now I am able to save power on my Smart Home system and cut down on the number of wires as well.

## Home Made Battery

This is intended to be the beginning of a series of posts about making batteries from home. It is going to include a series of test in order to determine the best types of home made batteries to use to power my home. The basic objective is to make a battery bank large enough to power several 12 volt lights and appliances throughout my home. I don’t intend to power any large appliances yet, however that may be a goal for the future. For now, my intention is to be able to power at least  enough lights for up to 5 rooms, two internet routers (a cable modem and a wireless router), a 12 volt cooler for food, a PC and a TV. For me, those are the bare necessities and I can live quite comfortably with just those things. Others may require more, but this is my house, not theirs lol. Stands for grow lights as well as fixtures should be considered as well.

## General experiments

I have already performed some general experiments with different sized containers, different types of container materials, different metals and various electrolytes. Below are my basic discoveries to get us started.

How to make a basic home made battery

To make a general purpose home made battery you generally need to make several cells. For this demonstration, we will use one 12 oz pop cans for each cell in our battery and we will probably use 6-8 cells depending on how much power is needed.

Materials

1. 6-8 12 oz pop cans(preferably generic and not Coke cans) I find that generic soda cans are less likely to have a coating on the inside that prevents effective corrosion which is needed for the battery to work. If you have to use cans with this coating, you’ll need to remove the coating with sandpaper somehow first. I’ve heard of using hydrochloric acid, but I cannot safely recommend that here, so don’t do that unless you know what you’re doing and understand that it is strictly at your own risk!
2. roughly a 6 feed length of 1/2 to 1 inch in diameter copper tubing or another equally substantial amount of copper with similar or greater surface area.
3. approximately 4 feet of medium gauge wire that is between 10 and 20 gauge.
4. Either solder or aligator clips can be used to fasten your wires to the battery’s electrodes
5. A decent pair of wire cutters and strippers.
6. Water. Good old H2O or Plain tap water works fine.
7. Bleach. Any kind will work, but I use the concentrated type for better results. I’ve heard using Clorox brand works better too, but I refused to buy a name brand bleach for testing.
8. Salt. Regular table salt. You’ll need several tablespoons or about 2 tablespoons for each cell at the most.

Those are the things I”ll be using for my first experiments and these items were selected based on my preliminary testing.

## Putting it all together:

It’s not really hard to build home made batteries, but it is time consuming because you have to produce several cells and run some parallel and some in a series until you get the voltage and amps required. Here are the basic steps:

1. Take 1 of your 12 oz soda cans(you could use larger or smaller ones too) and clean it out.
2. Measure your can from top to bottom and cut a lengh of copper tubing(or other copper material) to approximately 1 inch longer than the can.
3. Wrap one end of the copper tubing with electrical tape so that when you stick it down in the pop can, it doesn’t ground out to the bottom of the can(or make sure it just doesn’t touch the bottom if you don’t want to take it. Then place a mark on the copper tube where it meets with the top of the pop can.
4. Fill the can with plain tap water from your sink.
5. Using the mark you made on the copper tube from step 3, wrap enough electrical tape around the copper so that you can fit it firmly in the mouth of the pop can. It should be a little snug at least with the tape around the mark keeping the copper from touching the can at any point. It is important the the two metals never touch or your battery will never work!
6. After inserting the copper tube into the can, solder or clip a 2 inch length of wire to the portion of the copper tubing that sticks out above the top of the can.
7. Solder or clip another length of wire 2 inches or longer to the rim of the alluminum can. This will be your negative lead and the one on the copper will be positive.
8. Hook your leads to a multimeter and record the voltage and amperage from the single cell bettery you have just completet. You should get about 1/2 volt and very little amperage.
9. Continue to make a total of at least 6 cells by repeating all the above steps. Label each cell you have made from 1 to 6 or 1 to 8 etc., depending on how many you made.
10. Connect the positive lead(from the copper tube) of cell one to the negative lead of cell 2. Then the pos lead from cell 2 to neg lead on cell 3……continue until all cells are wired together in a series.
11. Measure the voltage from the negative terminal on cell one and the positive terminal of the last cell and you should have between 6 and 16 volts so far.

That’s basically all there is to it, but now you will know if you need more cells in series or in parallel depending on if you need more voltage or amperage. Add more cells in series to increase voltage and in parallel to increase amps. Also increase the amount of bleach and/or salt in each cell to increase voltage, but remember that the stronger the solution is, the faster the battery terminals will corrode and eventually need maintenance and/or cleaning to keep them producing the optimal voltage and amperage needed.

## Size of container

I’ve tried everything from Popsicle trays(like larger ice cube trays), aluminum cans and 5 gallon buckets. What is the difference in the size of the battery you ask? Surprisingly very little. Whether using a 5 gallon bucket with large electrodes and 5 gallons of electrolyte or using a pop can, both batteries produced roughly the same amount of voltage ranging from 0.4 to 1 volt depending on the strength of the electrolyte solution.

## Increasing Voltage

Electrolytes is the key to more volts within a single cell I discovered. While other factors can alter the amount of voltage only slightly, the strength of the electrolyte was the main factor that effected the amount of voltage the batteries Ive made so far produced.

To increase the overall voltage produced by your home made batteries, you need to increase the number of cells in the battery. A battery is often a series of several cells unless it is a single cell battery, but usually when I refer to “battery”, I am speaking of the entire group of cells making up a single batter. A home made battery will often consist of 6 or more pop cans or other containers wired in a series or in parallel. To increase voltage we would run them in a series which means to attache the positive lead from the first cell to the negative lead of the second cell then continue until you reach the last cell. At that point the negative lead on cell one and the positive lead on the last cell will be open and those will be the two terminals used to power your device.

## Increasing Amperage

The key to more amps seems to be in the general size of the battery. I was able to product significant;y more amps using a five gallon bucket as opposed to a 12 oz soda can.

To increase overall amperage a battery produces, several cells are required just as with increasing voltage. To increase amperage however, we have to wire the cells in parallel instead of in a series because batteries wired in parallel will cause the amperage to increase and the voltage to remain the same. Often times batters consist of a combination of cells ran in a series and cells ran in parallel to product the desired volts and amps. The general idea we are using will be to wire enough cells in a series to get 12 volts  in a single battery and after that we will increase the amperage by making several of these multi-cell/12 volt batteries and connecting them in parallel.

My First Battery

After testing large & small containers, a few different metals and several combinations of electrolytes, I ended up making my first batter with a series of 8 cells to product 12 volts at