Sunday, December 5, 2021

The Basel problem

 Here is a solution I found (for sure not original) to the classical calculus problem:

Series are so much fun :D


Thursday, June 4, 2020

Electrothermal patches and Nanohole calculations

For the work Nanoscale Horizons (2019) I did numerical calculations of the joule heating of a nanostructured gold film carrying an electrical current. The nanostructured films were obtained from the deposition of gold on self ordered polystyrene micro/nano-spheres layer, resulting in thin gold film with a nearly-periodic array of holes. The calculations follow 3 stages.
  • Calculating joule heating of a periodic film with holes, to obtain effective electrical and thermal conductivities.
  • With effective conductivities, perform 3D calculation, considering the gold film as a 2D surface satisfying the Laplace equation.
  • Obtain analytical steady state temperatures. 
Calculations were performed with the FEM software COMSOL. Surprisingly, a simple analytical model is very precise in fitting the Temperature-Voltage or Temperature-current at equilibrium, and allows the easy derivation of the heat transfer parameter.
It was fun also removing kapton from a kapton/copper laminate by laser ablation. The process leaves a dark oxide  on the copper layer that can be easily removed with a warm acetic acid solution in ultrasonic bath.

Wednesday, November 27, 2019

D-lines in superconductor with triangular defect

Steady currents in a superconductor film show a surprising phenomenon, the discontinuity lines. If there are cracks or indentations in the film border, perturbations appear in the current flow that span large areas, even of infinite extent in the case of a perfect superconductor in the critical state. The simple Bean model predicts that the perturbation corresponds to real discontinuities in the current direction, the d-line, and with parabolic shape starting from some distance of the indentation. Later, more detailed and accurate work by Gurevich showed that the d-line due to a planar indentation is actually parabolic in shape far from the indentation, but a slightly different factor of the one obtained with the Bean model. The Bean model also predicts that the d-lines produced by a triangular indentation of the same height as a planar indentation will produce also the same parabola at some point.
This is proved also with Gurevich's hodograph method in my work: Calculation of currents around a triangular indentation by the hodograph method, https://arxiv.org/abs/1812.10798v2.
A nice mathematical relationship I stumbled upon for the demonstration is the following expression for the Kronecker delta, obtained from Fourier series expansions of different parity: 
Here some of the current streamlines and magnetic field lines for a semi-infinite film:



Metal-Assisted Chemical Etching

Metal assisted chemical etching is a promissory technique for the fabrication of large scale cheap nanostructures. In a few words, a silicon substrate is covered by a patterned thin metal layer, and when submerged in a solution of alcohol, hydrogen peroxide and hydrofluoric acid, the metal layer etches the silicon leaving imprinted the pattern. Strangely, the thin layer of metal does not detach from the silicon, being able to etch several microns and keeping the pattern during the etching. This phenomenon is used to create long silicon nanowires. Another interesting feature is that the etching has some preferential directions, that seem to align with some crystallographic axes. Upon rinsing and alcohol and submerging the sample in the solution again, the so called quenching, the etching direction switches to another preferential direction, so zig-zag like nano wires can be obtained.
In the recent paper Nano Lett. 2019, 19, 11, 7681-7690 I contribute with numerical and analytical calculations to determine the etching rate of gold in silicon with good agreement with experimental data. Also, with a phenomenological model explaining the kinking by the preferential accumulation of alcohol in the acute corner of the nanowire near the etching area during the quenching, calculating the shape of nanodrops by the phase field method, all with the COMSOL package. The attraction of the metal layer and substrate during the etching is a more difficult topic. Several forces could be responsible, but I believe that is simple capillary force due to the presence of gas bubbles. 






GPS tracker with Arduino GSM MKR 1400

This is an old project that I have been able to finish only now that I am plenty of free time. I have a dog that never wanders too far, but anyways, I thought, a tracker is not that a bad idea, specially now that I live in the countryside. I could buy a commercial tracker, but, where is the fun then?
So here is the materials list:
Arduino MKR 1400, GSM module
Taoglas FXP40 antenna
Gps GP735T, with TTL UART
JST SH Jumper 6 Wire Assembly - 8", connector and cable for Gps
18650 single battery charger
18650 Li-Ion batteries (at least 1)
M2M sim card (in this case provided by SIMFRONTERAS)

So if you love your dog, there are several parameters you have to consider, the most important, it seems Li polymer batteries are not recommended for a wearable device of this kind, since the dog would not be able to detach the device if something goes wrong with the battery.  Moreover, the GSM module is hunger of current, and the low capacity batteries would drain too fast, so the option is the proven 18650 format, a 3.7V battery with a capacity of 6800mAh in this case, that can be directly connected to the battery input of the MKR 1400. Next issue is finding a case for the battery and electronics. I found that a 18650 single battery charger can contact the battery and also house all the electronics, namely the Arduino MKR board and the small GP735 gps.
Then I chose a https and private vpn connection to read the data through the cellular network provided by an excellent local company.
The wiring is very simple, the GP735 is connected to the serial1 port of the arduino board, with the V_BAT pin connected to the battery, and the PWR_CTRL pin connected to the digital pin 0 of the arduino.
The electronics of the of single battery charger is cut just leaving the battery leads attached. The headers of the arduino are removed also to give more room, and then everything is cut, glued and taped, leaving just an opening for the micro-usb port. And do not forget the sim card.






Then the code for the arduino is taken from the arduino example for a GSM server combined with the TinyGPS library:

 #include <MKRGSM.h>
#include <TinyGPS.h>
#define ss Serial1
#define P_C 0
const char PINNUMBER[]     = "XXXX"; //pin of SIM
const char GPRS_APN[]      = "XXXXXXXX";  //apn name
const char GPRS_LOGIN[]    = "XXXXXXXXXX"; //login
const char GPRS_PASSWORD[] = "XXXXX";  //password
TinyGPS gps;

// initialize the library instance
GPRS gprs;
GSM gsmAccess;     // include a 'true' parameter for debug enabled
GSMServer server(80); // port 80 (http default)
GSMClient client;
// timeout
const unsigned long __TIMEOUT__ = 10 * 1000;
 bool newData = false;
  unsigned long chars;
  unsigned short sentences, failed;
    long flat, flon;
  unsigned long age;
  int sensorValue;
  float voltage;
  unsigned long start;
   int year;
  byte month, day, hour, minute, second, hundredths;
      char sz[36];
  /////////////////////////////////////////////////////////////
  /////////////////////////////////////////////////////////////
  //////setup
void setup() {
  pinMode(P_C, OUTPUT);
  digitalWrite(P_C, HIGH);
  // initialize serial communications and wait for port to open:
  Serial.begin(9600);
  ss.begin(9600);
  while (!ss) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
  start=millis();
  delay(30000);  // Wait 30 second between transmits, could also 'sleep' here!
  // connection state
  bool connected = false;

  // Start GSM shield
  // If your SIM has PIN, pass it as a parameter of begin() in quotes
  while (!connected) {
    if (gsmAccess.begin(PINNUMBER) == GSM_READY)
    connected = true;
    Serial.println("Connected GSM");}
    connected = false;
  while (!connected) {
    if (gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD) == GPRS_READY) {
      connected = true;
    } else {
      Serial.println("Not connected GPRS");
      delay(1000);
    }
  
  }

  Serial.println("Connected to GPRS network");

  // start server
  server.begin();

  //Get IP.
  IPAddress LocalIP = gprs.getIPAddress();
  Serial.println("Server IP address=");
  Serial.println(LocalIP);
  //start=millis();

 
  for (start = millis(); millis() - start < 60000;)
  {
    while (ss.available())
    {
      char c = ss.read();
      // Serial.write(c); // uncomment this line if you want to see the GPS data flowing
      if (gps.encode(c)) // Did a new valid sentence come in?
        newData = true;
    }
 

  if (newData)
  {
  
    gps.get_position(&flat, &flon, &age);
    gps.crack_datetime(&year, &month, &day, &hour, &minute, &second, &hundredths, &age);
    Serial.print("LAT=");
    Serial.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
    Serial.print(" LON=");
    Serial.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
    Serial.print(" SAT=");
    Serial.print(gps.satellites() == TinyGPS::GPS_INVALID_SATELLITES ? 0 : gps.satellites());
    Serial.print(" PREC=");
    Serial.print(gps.hdop() == TinyGPS::GPS_INVALID_HDOP ? 0 : gps.hdop());
    sprintf(sz, "% 02d/%02d/%02d %02d:%02d:%02d ",
        month, day, year, hour, minute, second);
    Serial.print(sz);
    Serial.print(" \n");
  }
  delay(10000);
  }
  sensorValue = analogRead(ADC_BATTERY);
  // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 4.3V):
  voltage = sensorValue * (4.2 / 1023.0);
  // print out the value you read:
  Serial.print(voltage);
  Serial.println(" V");
}
//////////////////////////////////////////////////////////777
///////////////////////////////////////////////////////////////
///end set up

void loop() {

        newData=false;

 // delay(1000);  // Wait  60 second between transmits, could also 'sleep' here!
  for (unsigned long del = millis(); millis() - del < 1000;)
  {
    while (ss.available())
    {
      char c = ss.read();
      // Serial.write(c); // uncomment this line if you want to see the GPS data flowing
      if (gps.encode(c)) // Did a new valid sentence come in?
        newData = true;
    }
  }
 

  if (newData)
  {
  
    gps.get_position(&flat, &flon, &age);
    gps.crack_datetime(&year, &month, &day, &hour, &minute, &second, &hundredths, &age);
    Serial.print("LAT=");
    Serial.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
    Serial.print(" LON=");
    Serial.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
    Serial.print(" SAT=");
    Serial.print(gps.satellites() == TinyGPS::GPS_INVALID_SATELLITES ? 0 : gps.satellites());
    Serial.print(" PREC=");
    Serial.print(gps.hdop() == TinyGPS::GPS_INVALID_HDOP ? 0 : gps.hdop());
    sprintf(sz, " %02d/%02d/%02d %02d:%02d:%02d ",
        month, day, year, hour, minute, second);
    Serial.print(sz);
    Serial.print(" \n");
  }
  voltage = sensorValue * (4.2 / 1023.0);
  // print out the value you read:
  Serial.print(voltage);
  Serial.println(" V");
  digitalWrite(P_C, LOW);
 
  // listen for incoming clients
  for (start = millis(); millis() - start < 60000;){
  client = server.available();
  if(client){
  break;
  }
  }
  for (start = millis(); millis() - start < 60000;){
    digitalWrite(P_C, HIGH);
  client = server.available();
  if(client){
  break;
  }
  }
  if (client) {
    while (client.connected()) {
      if (client.available()) {
        Serial.println("Receiving request!");
        bool sendResponse = false;
        while (int c = client.read()) {
          if (c == -1) {
            break;
          } else if (c == '\n') {
            sendResponse = true;
          }
        }

        // if you've gotten to the end of the line (received a newline
        // character)
        if (sendResponse) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();
          client.println("<html>");
          client.print((float)flat/1.0E6,6);
          client.print(",");
          client.print((float)flon/1.0E6,6);
          client.print(" ,");
          client.print(sz);
          client.print(" UTC, Batt: ");
          client.print(voltage);
          client.print(" V");
          client.print(" \n");
          client.println("</html>");
          //necessary delay
          delay(1000);
          client.stop();
        }
      }
    }
  }
 //digitalWrite(P_C, HIGH);
 delay(1000);
}


So with this code the gps works 50% of the time, giving a battery life of about 24 hrs. By playing with the timings the battery life can be easily extended to 48 hrs. Then you have to play with the consumption of the MKR board to get longer life.
On the computer side I use open vpn in linux. The cellular company must send you the certificates, configuration files, gateway, subnet mask and IP address. Then, in a command window, I run the following:


sudo openvpn --config configuration_file.ovpn --cert certificate.pem --key personal_key.pem --ca ca_certificate.pem --route ip_address subnet_mask gateway


Check always that you are using TUN/TAP device tap0, otherwise close all openvpn precesses and start again.
And voilĂ , once you write the ip_address in a browser you get the gps coordinates and, UTC time and battery voltage. The coordinates can be pasted in the seach field of google maps and show you the position.

So I spent a lot of money and time but I learnt a lot about GSM and gps, and I can manage the privacy of the device. In principle, a simpler approach is using a MQTT connection, but that I leave it for a next project.

Saturday, June 10, 2017

Magnetic flux penetration in superconductors

Type II superconducting thin films can allow penetration of magnetic fields in the form of magnetic vortices, without loosing the overall superconducting state, rendering them this way technologically useful. Here a calculation:

Ref similar works: https://doi.org/10.1103/PhysRevB.93.054521

Concentric magnetic nanorings

This is an interesting systems, to my knowledge the only like this, where the magnetization of concentric nanorings can be aligned parallel or anti-parallel. This could be used as a memory state for spin injection devices.
Pause the video at the middle, the magnetization is parallel

 
Now antiparallel
Refs:Journal of Applied Physics 117, 103901 (2015); doi: http://dx.doi.org/10.1063/1.4914346