Friday, October 17, 2025
Plateau-Rayleigh instabilities with openfoam
Water falling from 1 cm diameter inlet, height is 40 cm. Made with incompressible VoF and dynamic meshing.
Thursday, July 3, 2025
CFD calculations with openFoam
Openfoam is a great package for computational fluid dynamics (cfd). Here are some examples of simulations of fluid flow with multiphase, heat exchange and particles.
| Duct with incoming air at 5 m/s from left to right, and 3 water drops injectors, also injecting at 5 m/s. Performed with MPPICFoam for the particle treatment, and LES for the fluid turbulence. |
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 :DThursday, 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.
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.
- 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.
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:
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.
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:
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.
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
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.
Now antiparallel
Refs:Journal of Applied Physics 117, 103901 (2015); doi: http://dx.doi.org/10.1063/1.4914346
Pause the video at the middle, the magnetization is parallel
Refs:Journal of Applied Physics 117, 103901 (2015); doi: http://dx.doi.org/10.1063/1.4914346
Friday, November 22, 2013
Communicating with Agilent 34970A Data Acquisition unit through RS232 with arduino
This is part of an electropolishing project where the 34970A is used to make precision low resistance measurements. Here I post the part of communicating with the daq unit in monitor mode. This is the mode that the unit usually uses when the continuous readings of 1 channel are shown on the display. The connections here are with an LCD display and MAX232 driver.
Here is arduino sketch:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
//LiquidCrystal(rs, enable, d4, d5, d6, d7)
LiquidCrystal lcd(A0, A1, A2, A3, A4, A5);
char inString[20];
float number=0;
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
lcd.setCursor(0, 1);
// Print a message to the LCD.
lcd.print("V const ");
Serial.begin(9600);
// Enable Monitor mode. Note the terminating character \n
Serial.print("ROUT:MON:STAT ON\n");
delay(100);
}
void loop() {
// loops the function reading() that reads the serial and displays the numbers on the LCD
reading();
}
float reading(){
// set the cursor to column 0, line 1
lcd.setCursor(0, 1);
//Ask for data in daq
Serial.print("ROUT:MON:DATA?\n");
int i=0;
while(Serial.available()){
inString[i] = (char)Serial.read();
i++;}
//transform the char array in a float
number = atof(inString);
lcd.print(number,4);
lcd.print(" units ");
delay(100);
//return number for data handling
return number;
}
In the experiment, depending on the resistance readings, voltage width pulses applied to the samples are modified.
Here is arduino sketch:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
//LiquidCrystal(rs, enable, d4, d5, d6, d7)
LiquidCrystal lcd(A0, A1, A2, A3, A4, A5);
char inString[20];
float number=0;
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
lcd.setCursor(0, 1);
// Print a message to the LCD.
lcd.print("V const ");
Serial.begin(9600);
// Enable Monitor mode. Note the terminating character \n
Serial.print("ROUT:MON:STAT ON\n");
delay(100);
}
void loop() {
// loops the function reading() that reads the serial and displays the numbers on the LCD
reading();
}
float reading(){
// set the cursor to column 0, line 1
lcd.setCursor(0, 1);
//Ask for data in daq
Serial.print("ROUT:MON:DATA?\n");
int i=0;
while(Serial.available()){
inString[i] = (char)Serial.read();
i++;}
//transform the char array in a float
number = atof(inString);
lcd.print(number,4);
lcd.print(" units ");
delay(100);
//return number for data handling
return number;
}
In the experiment, depending on the resistance readings, voltage width pulses applied to the samples are modified.
Arduino based display for HPT100 pressure gauge
The DPG101 controller of our HPT100 UHV gauge from Pfeiffer suddenly broke down, and buying a new one should take some money and time, so I decided to build one. The controller supplies 24V to the HPT100, and comunnicates with it by RS232 or RS485. Those are just interfacing standards between UARTS, the real serial peripherals of microcontrollers or PCs and devices. After struggling for weeks with my first PIC micro based display (with the XC8 compiler) for a Baratron, I moved to the popular arduino. The arduino project have made available a lot of useful libraries that make programming a microcontroller real easy, making possible finishing a prototype in a matter of hours. Here are the connections in the fritzing breadboard view:
The power supply used was a universal laptop power supply with 24 V and USB 5V outputs. Connect to the HPT 100 with a straight through serial cable.
And here is the arduino sketch:
#include <LiquidCrystal.h>
LiquidCrystal lcd(3,4,5,6,7,8,9,10,11,12,13);
String inputString = ""; // a string to hold incoming data
boolean stringComplete = false; // whether the string is complete
String expo = "20";
void setup() {
Serial.begin(9600);
lcd.begin(16, 2);
// reserve 200 bytes for the inputString:
inputString.reserve(200);
lcd.print("Pressure");
}
void loop() {
lcd.setCursor(0, 1);
Serial.print("0010074002=?106\r");
if (stringComplete) {
// clear the string:
expo = inputString.substring(14,16);
int exponente=expo.toInt()-20;
lcd.print(inputString.charAt(10));
lcd.print(".");
lcd.print(inputString.substring(11,14));
lcd.print(" e");
lcd.print(exponente);
lcd.print(" mbar");
delay(1000);
inputString = "";
stringComplete = false;
}
}
void serialEvent() {
while (Serial.available()) {
// get the new byte:
char inChar = (char)Serial.read();
// add it to the inputString:
inputString += inChar;
// if the incoming character is a Cr, set a flag
// so the main loop can do something about it:
if (inChar == '\r') {
stringComplete = true;
}
}
}
The setpoints can also be easily implemented with relays, which is typically necessary to control vacuum systems.
Here is the picture of the final display:
The power supply used was a universal laptop power supply with 24 V and USB 5V outputs. Connect to the HPT 100 with a straight through serial cable.
And here is the arduino sketch:
#include <LiquidCrystal.h>
LiquidCrystal lcd(3,4,5,6,7,8,9,10,11,12,13);
String inputString = ""; // a string to hold incoming data
boolean stringComplete = false; // whether the string is complete
String expo = "20";
void setup() {
Serial.begin(9600);
lcd.begin(16, 2);
// reserve 200 bytes for the inputString:
inputString.reserve(200);
lcd.print("Pressure");
}
void loop() {
lcd.setCursor(0, 1);
Serial.print("0010074002=?106\r");
if (stringComplete) {
// clear the string:
expo = inputString.substring(14,16);
int exponente=expo.toInt()-20;
lcd.print(inputString.charAt(10));
lcd.print(".");
lcd.print(inputString.substring(11,14));
lcd.print(" e");
lcd.print(exponente);
lcd.print(" mbar");
delay(1000);
inputString = "";
stringComplete = false;
}
}
void serialEvent() {
while (Serial.available()) {
// get the new byte:
char inChar = (char)Serial.read();
// add it to the inputString:
inputString += inChar;
// if the incoming character is a Cr, set a flag
// so the main loop can do something about it:
if (inChar == '\r') {
stringComplete = true;
}
}
}
The setpoints can also be easily implemented with relays, which is typically necessary to control vacuum systems.
Here is the picture of the final display:
Thursday, November 21, 2013
microwave oven plasma asher
This is a project I devised with my colleagues M. Flores, M. Tumelero, A. Pasa and A. D. C. Viegas at LFFS, UFSC, Brasil, and inspired by other projects (see links). It consists of a plasma asher, a device that generates a very reactive oxygen plasma to clean organic contaminants on samples.
This project requires knowledge of high voltage, electromagnetic waves, and high vacuum science. A commercial microwave oven is internally modified, so be conscious of the risks associated to it. A microwave oven is composed by a closed chamber were stationary microwaves generated by a magnetron are used to heat food. Very high power can be delivered to materials that absorb microwaves. The microwaves heat can be sensed by the body, but some parts like the eyes crystalline can be damaged without notice, so never allow microwave radiation to escape the oven by, for example, using a broken window. The magnetron is powered by a high power high voltage transformer. The AC voltage of the transformer is doubled and rectified with a diode and a high voltage capacitor, getting around 4-5KV DC, so be aware that lethal voltages and currents are possible if this capacitor is discharged, or any electrical component touched while turned on. A schematic of the system is shown in the picture.
With A) Microwave oven B) Pyrex baking tray C) Seal D) Aluminum base E) Copper hoses and conections F) Baratron (0-100 torr range) G) Flux controller H) To rotatory vaccum pump J) To gas regulator in tank The metallic case of the oven was disassembled to allow better machining. Holes were drilled, some parts cut with a dremmel. Copper pipes and brass parts soldered with tin were used for the vacuum connections, rubber and vacuum grease for the seals. For the vacuum chamber a pyrex baking tray was used. The border of the tray was flattened with the dremmel and a diamond disc. To measure the pressure, a baratron gauge was used. To save costs, the controller of the baratron was also home made. The vacuum chamber is composed by the pyrex tray and an aluminum plate. The vacuum is made with an old rotatory pump. The oxygen flux is controlled with a flux meter, and the tank pressure regulator. Sparks are possible so avoid sharp surfaces. The microwave is designed such that dimensions are more or less multiples of half the wavelength of the microwaves, and to focus the waves in the center of the oven. The aluminum plate distorts the fields of the original design and gets hot. The concave left wall was covered with an aluminum foil to avoid sparks in the plate (just an experimental fact). The pyrex seems to get hot because of the plasma itself, so no continuous operation is desirable for more than 1 minute. The best results for cleaning are obtained at the highest possible flux, typically 4 lit/min with a pressure gradient of about half bar, and pressure in the vacuum chamber of about 1 torr or less.
Refs:
- http://www.helgiskuli.com
- Guvench, M.G., “Design and Fabrication of Impact (Acceleration) Sensors as Class Projects in a MEMS Course," Proc. A.S.E.E, AC 2009-2191, 2009.
This project requires knowledge of high voltage, electromagnetic waves, and high vacuum science. A commercial microwave oven is internally modified, so be conscious of the risks associated to it. A microwave oven is composed by a closed chamber were stationary microwaves generated by a magnetron are used to heat food. Very high power can be delivered to materials that absorb microwaves. The microwaves heat can be sensed by the body, but some parts like the eyes crystalline can be damaged without notice, so never allow microwave radiation to escape the oven by, for example, using a broken window. The magnetron is powered by a high power high voltage transformer. The AC voltage of the transformer is doubled and rectified with a diode and a high voltage capacitor, getting around 4-5KV DC, so be aware that lethal voltages and currents are possible if this capacitor is discharged, or any electrical component touched while turned on. A schematic of the system is shown in the picture.
With A) Microwave oven B) Pyrex baking tray C) Seal D) Aluminum base E) Copper hoses and conections F) Baratron (0-100 torr range) G) Flux controller H) To rotatory vaccum pump J) To gas regulator in tank The metallic case of the oven was disassembled to allow better machining. Holes were drilled, some parts cut with a dremmel. Copper pipes and brass parts soldered with tin were used for the vacuum connections, rubber and vacuum grease for the seals. For the vacuum chamber a pyrex baking tray was used. The border of the tray was flattened with the dremmel and a diamond disc. To measure the pressure, a baratron gauge was used. To save costs, the controller of the baratron was also home made. The vacuum chamber is composed by the pyrex tray and an aluminum plate. The vacuum is made with an old rotatory pump. The oxygen flux is controlled with a flux meter, and the tank pressure regulator. Sparks are possible so avoid sharp surfaces. The microwave is designed such that dimensions are more or less multiples of half the wavelength of the microwaves, and to focus the waves in the center of the oven. The aluminum plate distorts the fields of the original design and gets hot. The concave left wall was covered with an aluminum foil to avoid sparks in the plate (just an experimental fact). The pyrex seems to get hot because of the plasma itself, so no continuous operation is desirable for more than 1 minute. The best results for cleaning are obtained at the highest possible flux, typically 4 lit/min with a pressure gradient of about half bar, and pressure in the vacuum chamber of about 1 torr or less.
Refs:
- http://www.helgiskuli.com
- Guvench, M.G., “Design and Fabrication of Impact (Acceleration) Sensors as Class Projects in a MEMS Course," Proc. A.S.E.E, AC 2009-2191, 2009.
Welcome
This is a blog dedicated to describe several hardware and software prototypes I make in my work as a physics researcher. Please leave a comment. All questions will be eventually answered, just be patient.
Subscribe to:
Posts (Atom)












