Showing posts with label Science. Show all posts
Showing posts with label Science. Show all posts

Saturday, July 12, 2014

Modifying the Heat Equation for Multi Component and Layered Printed Circuit Boards

Introduction
PCB's are excellent for creating multi component electrical systems, especially when they involve IC's or larger components. In this post I will demonstrate a modification of the differential heat equation to allow for accurate modeling of these types of electrical systems, when they are supplied with power or when they are not.

Notation Overview
\ is a special form of and, it is not the same as the Boolean and or , rather it means that X\Y means that X is performed and Y is performed regardless of their condition
Semicolons denote the change from one statement to the next
$ is the length (Rows) of a given matrix: $X$ returns the length of X


The Equations


Suppose we have a single layer of circuit board with an arbitrary number of components, however it contains a particles. In such a circuit board:
 is the Hamiltonian and f represents force based interactions. Supposing that no uniform electricity is flowing in any amount worth mentioning for something the size of a PCB, then a blank pcb is represented by the generic Heat equation:
Note that a is a constant for a single material, such a presumption cannot be allowed to occur in a board with multiple components of multiple materials, note that a fiber glass substrate( the non-electrically conductive piece of the board) will not have the same thermal diffusivity as the copper components. Also, diffusivity can be temperature dependent, just as conductivity is. Therefore:
However before we can operate F* we must design the board in a mathematical context. Supposing that this methodology will be used in a practical application it will be more effective to define components as polygons,lines, and curves rather than defining each element a.
|Copper Line Element|
Creating a copper line element is simple:  ____________ would simply be y=c or x=c or z=c. However suppose we had a connected copper element which behaved as follows (the black line is of interest) which requires a third dimension:
Once cannot simply create a component function which states that the function changes depending upon conditions of x and y. Obviously the loop must be 3 dimensional; therefore we can create a system which auto routes this to the next level.
, in other words for every single value of x and y there cannot be a duplicate of these values on the same plane. Now for the 3-D auto route:

As for a description of P:


 Which is equivalent to:


 |Polygon Element|
|Component|
 Components could range from capacitors and diodes to antennas and heat sinks. Therefore I provide example equations to generate both. Note that the Capacitors and diodes are generally made of multiple materials and are thus shown through the diffusivity of their individual components. 

Heat Sinks



Capacitors and diodes

 The resistance for each region is computed and converted to thermal energy through:


This equation can be made more accurate through measurement of material properties.


Wednesday, July 2, 2014

The Mathematics of CERN Style Software for a Cloud Chamber

INTRODUCTION
A cloud chamber is an interesting device that allows a user to see charged particles. it consists of supersaturated alcohol and water vapor which is ionized by the charged particle and begins to precipitate. Alcohol is used because its low freezing point allows for us to quickly reach the critical temperature at which ionization will cause precipitation. In this blogpost I will outline the mathematics required for the system, the mathematics for a program to automate detection, and the mathematics of the particles themselves. In an upcoming blogpost I will demonstrate an implementation of the Cloud Chamber and the software.
OVERVIEW

We begin with a brief overview of the particles themselves, as computations from this section will allow for proper design of the chamber, as well as proper mathematics and design of the subsequent program.

    Suppose a particle P was launched at a velocity V towards Earth. It will be attracted to two plates mounted to the outside of the box following the coulomb equation. Also the degree of ionization is a function of the energy and ionization ability of the particle which adjusts the width of the ionized trail, therefore an algorithm can determine a particle type simply by analyzing trail width.

Program NOTATION
Custom Operator: $x$ returns the length of x
Turing Machine: <Machine|Function*|Tape>


Boolean Algebraic Program
The A* function applies the Y filter transform onto c










Tuesday, May 6, 2014

Distance and location using internet message time differentials for use in source tracking

Overview:
Messages sent over the internet take time to get to the sender, typically. D/C<D/S because the messages travel through routing stations and are not entirely photonic. Obviously these messages display where they came from for things such as email( but this is relative, an email from Russia may say from Moscow despite coming from Novosibirsk. However we can use Δt of the sent time stamp and the receive time stamp to create a circle around our location and the sender's location is on the circumference, then by searching for major population centers and or using routing information from the routing servers, the algorithms can determine the senders location very accurately:
PHP Server Side:
1. Let's get the current time for the observer:
Wow a monstrous four lines(sarcasm)
2. Now the time that the sender saw the file leave(by time line I mean the line containing the time):








3.Now let's subtract the times; we need to sift out all letters from the alphanumeric known as $stringcheese, so that we can get just the time:
This works because our timestamp will be 'time $militarytime'. Using military time eliminates the problem of searching the string for AM or PM.
/////////////////////////////////////////////////////
Determining Average Speed of the Signal:
Using a Mac just to mash things up a bit. We need the time it takes for the signal  to leave our computer and return from a location.The  methodology is the same as in the North Korea Server post but this time I will use a Mac, however the commands are the same:

User$ ping www.facebook.com
PING star.c10r.facebook.com (31.13.71.33): 56 data bytes
64 bytes from 31.13.71.33: icmp_seq=0 ttl=87 time=39.729 ms
64 bytes from 31.13.71.33: icmp_seq=1 ttl=87 time=39.523 ms
64 bytes from 31.13.71.33: icmp_seq=2 ttl=87 time=39.123 ms
64 bytes from 31.13.71.33: icmp_seq=3 ttl=87 time=38.707 ms
64 bytes from 31.13.71.33: icmp_seq=4 ttl=87 time=36.871 ms
64 bytes from 31.13.71.33: icmp_seq=5 ttl=87 time=39.909 ms
64 bytes from 31.13.71.33: icmp_seq=6 ttl=87 time=37.632 ms
64 bytes from 31.13.71.33: icmp_seq=7 ttl=87 time=40.425 ms
64 bytes from 31.13.71.33: icmp_seq=8 ttl=87 time=39.038 ms
64 bytes from 31.13.71.33: icmp_seq=9 ttl=87 time=41.607 ms

Speed:
We can easily find where 31.13.71.33 is with a web search:
The distance there is about:
4748 km and the average time is about 40 s, but the signals travel double the distance so d==9496km and d/x=40 therefore x==237.4km/sec. Thus -237.4*$dt==radius.Note the negative because we used observer time minus received time and for most applications the observer has to send a message before the receiver can receive it. Now for the city search algorithm.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Code Outline:
First we will use a Google maps api to easily display our location graphically and numerically through HTML
It is of the utmost importance that the degree of magnification or the distance from the earth's surface is a constant so, I will rewrite the HTML file to include this necessity at the end. Finally we will display a circle of radius r, save the radius as r.txt, and open an image of our file in java/processing so that the computer can calculate the most probable point of origin. The logical way to do this is to view the world by night and use light pollution as the indicator for the presence of human life. The more life, the more light and vice versa. However the API does not use this map, so we will search for the presence of a specific color, a grey~tan which is associated with the concrete of urban areas:



And the Grey is:

HTML:
Now for the HTML/Javascript code to find us and display us on a map:

<!DOCTYPE html>
<html>
  <head>
    <title>Location Location Location</title>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <style>
      html, body, #map-canvas {
        height: 100%;
        margin: 0px;
        padding: 0px
      }
    </style>

    <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=true"></script>

    <script>

var map;

function initialize() {
  var mapOptions = {
    zoom: 10
  };
  map = new google.maps.Map(document.getElementById('map-canvas'),
      mapOptions);

  // attempts HTML GEOLOCATE(MUST BE HTML 5)
  if(navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(function(position) {
      var pos = new google.maps.LatLng(position.coords.latitude,
                                       position.coords.longitude);
      alert(pos); //this displays our location
                                                       

      var infowindow = new google.maps.InfoWindow({
        map: map,
        position: pos,
        content: 'Found You'
      });

      map.setCenter(pos);
    }, function() {
      handleNoGeolocation(true);
    });
  } else {
    // Browser doesn't support Geolocation
    handleNoGeolocation(false);
  }
}

function handleNoGeolocation(errorFlag) {
  if (errorFlag) {
    var content = 'Error: The Geolocation service failed.';
  } else {
    var content = 'Error: Your browser doesn\'t support geolocation.';
  }

  var options = {
    map: map,
    position: new google.maps.LatLng(60, 105),
    content: content
  };

  var infowindow = new google.maps.InfoWindow(options);
  map.setCenter(options.position);
}

google.maps.event.addDomListener(window, 'load', initialize);

    </script>
  </head>
  <body>
    <div id="map-canvas"></div>
  </body>

</html>
Screenshot:
Awesome! Now we need to write a program to capture an image of our area and search for major population centers within the radius, which is defined in the preceding PHP scripts.

In Linux:
$ gnome-screenshot -w -B
This will Screenshot our HTML window. In order to do this we should get rid of the alert() function in the javascript so the HTML tracker reads:
<!DOCTYPE html>
<html>
  <head>
    <title>Location Location Location</title>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <style>
      html, body, #map-canvas {
        height: 100%;
        margin: 0px;
        padding: 0px
      }
    </style>

    <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=true"></script>

    <script>

var map;

function initialize() {
  var mapOptions = {
    zoom: 10
  };
  map = new google.maps.Map(document.getElementById('map-canvas'),
      mapOptions);

  // attempts HTML GEOLOCATE(MUST BE HTML 5)
  if(navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(function(position) {
      var pos = new google.maps.LatLng(position.coords.latitude,
                                       position.coords.longitude);
    
                                                       

      var infowindow = new google.maps.InfoWindow({
        map: map,
        position: pos,
        content: 'Found You'
      });

      map.setCenter(pos);
    }, function() {
      handleNoGeolocation(true);
    });
  } else {
    // Browser doesn't support Geolocation
    handleNoGeolocation(false);
  }
}

function handleNoGeolocation(errorFlag) {
  if (errorFlag) {
    var content = 'Error: The Geolocation service failed.';
  } else {
    var content = 'Error: Your browser doesn\'t support geolocation.';
  }

  var options = {
    map: map,
    position: new google.maps.LatLng(60, 105),
    content: content
  };

  var infowindow = new google.maps.InfoWindow(options);
  map.setCenter(options.position);
}

google.maps.event.addDomListener(window, 'load', initialize);

    </script>
  </head>
  <body>
    <div id="map-canvas"></div>
  </body>

</html>

By eliminating the alert(pos); line the command script can now be used to Start firefox and open the HTML file, and then screenshot it.
$ do firefox 'SourcePath of the HTML FILE',sleep(10),gnome-screenshot -w -B
Great!  Now you can set up the above line to save it to the location of you're choice.

Groovy. Now time for Processing/Java.
Java/Processing:












N=The number of sides of the polygon and R is the radius of the circumscribed circle which is equal to the radius of the php script, and A=-1.

This is a fair region for the computer to search, but it should be rather quick.

The Processing Side of things will be done with a similar method to that of my post on my novel Morley Pintururia Naturaleza Muerta Smoothing Algorithm post. In terms of the area to cover, if we were to add in a script which modified the circle to be a regular polygon to try to reduce some of the searching, then:


PImage img;
int a, b,r,u;

void setup() {
  size(1000, 900);
  img = loadImage("cat.jpg");
  a = 1;
  b = 1;
  r=img.width;
  u=0;
  imageMode(CENTER);
  noStroke();
  background(0);

}

void draw() { 

  float pixel = map(11, 0, width, a, b);
  int x = int((img.width)-r);
  int y = int(random(img.height));
  color pix = img.get(x, y);
  fill(pix, 128);
  rect(x-1, y, pixel, pixel);
  rect(x+1, y, pixel, pixel);
  rect(x, y-1, pixel, pixel);
  rect(x, y+1, pixel, pixel); 
   println(pix);
  if pix=(//this will be our city color){
  println("we have a city here");
}
if(r==500){
  r=img.width;
}
}

The above code will find cities but does not compare them in terms of size, in order to achieve this we write the following:
PImage img;
int a, b,r,u;

void setup() {
  size(1000, 900);
  img = loadImage("cat.jpg");
  a = 1;
  b = 1;
  r=img.width;
  u=0;
  imageMode(CENTER);
  noStroke();
  background(0);

}

void draw() { 

  float pixel = map(11, 0, width, a, b);
  int x = int((img.width)-r);
  int y = int(random(img.height));
  color pix = img.get(x, y);
  fill(pix, 128);
  rect(x-1, y, pixel, pixel);
  rect(x+1, y, pixel, pixel);
  rect(x, y-1, pixel, pixel);
  rect(x, y+1, pixel, pixel); 
   println(pix);
  if (pix=(//this will be our city color))
  println("1");
else{
println("0");
}
if(r==500){
  r=img.width;
}
}
Now we have an array map of where the sender is!

Thursday, May 1, 2014

Zener diode technique for Arduino signal control

Zener diodes are reverse biased, a trait which allows for current to flow in the opposite direction of the standard forward direction, whence the zener breakdown voltage had been reached. This useful effect, appropriately deemed the avalanche effect, allows for current to flow "backwards" at an increasing rate as more voltage is applied, as shown in figure. 1.
                         Figure 1
With an Arduino there is a large variety of uses. For example if we wire a battery into the arduino and diode as a circuit in the following way:
1. The negative end if the battery to a GND pin).
2. The positive end if the battery to a digital pin( depends on the board and application). This now goes to the anode(black side) of the zener diode.
3. The orange side(cathode) of the Zener diode is wired to the load usually =5V and =battery current+arduino current.

Now choosing the diode is critical. Arduino digital HIGH( which is traditionally the most produced out of an Arduino pin) reads out at 5V*(presuming you have the pin constantly on during measurement because Pulsing voltageay appear as lower voltage in a traditional multimeter). Therefore we want the zener voltage to be less than 5 volts, the exact choice depends mainly in how much current the load require. Now the arduino can power and control larger Amp devices!

Tuesday, April 29, 2014

Calc time

Ti timers are perfect for second level timing:
This can be used to measure computations permutation timr , as an actual timer etc.(the possibilities are endless).

MOSFETS and the Arduino for High Voltage PWM


A MOSFET(Metallic Oxide Semiconductor Field Effect Transistor) looks like this:

There are 3 pins, 1 for ground, drain, and source. Schematically the setup can be explained easily. Notice in the schematic that  the 1 pin looks as though it could press down and allow current to flow between 2 and 3. This is exactly how the MOSFET works. It is a lot like a thrysistor. Notice the little Zener diode at the bottom? For those not familiar with schematics it is the Triangle with a 3 line segments on one point.

A Zener Diode
The Zener allows flow of current( in this diagram to the right) constantly but only allows flow backwards if it is over a certain amount. This little addition to the mosfet, though it is small, is groovy for us, because our mosfet won't fail if things go South. So, you may be wondering where this is going, well today I will be covering High Power control circuits using Arduino, Mosfets, and the C language Family.
///////////////////////////////////////////////////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
The MOSFET uses a small input voltage(pin 1), not a full circuit, in order to allow a much larger voltage to pass through the Transistor(for this post transistor will mean MOSFET). This is useful for many reasons.

Currently for an ROV my team and I are working on, a large amount of "tether" seperates the Arduino controller from the Servos it controls. This is problematic for the following reasons:
  1. The Servos being used have chips inside them which can execute programs when no PWM is detected for a sufficient time span. However the robot is sent commands via a CS(Control System) using a USB to Arduino protocol which then sends pwm on the digital 9 pin(keep this in mind, only certain pins can handle pwm, there are actually only 8 on the Arduino Uno which is the board of choice).
  2. The voltage for power was too low but this was boosted with a simple parallel circuit solution, we will replace an op amp.
  3. The PWM is not reaching the Servos(it is only 5V and the current of the Arduino pins).
In order to fix this dilemma, the MOSFET will be utilized to use pulse width modulation with a "stronger" electrical source. In this case we will capture our energy from a 25 amp, 12-14.38 volt source.
Basic code outline:
Outline of program in C++

Wiring:
First wire the pwm (pin 9) into the gate of the MOSFET. This signal controls electrical flow through te MOSFET.

Next is the source, from the + of our  input power,( the source is where the electrons flow from. They have come from the p to make a bridge connecting the n material within the MOSFET, or the entire situation is reversed as is your mosfet's function.

Drain is to the load.