Retro programming Nostalgia IV: Acid/Base Equilibrium and Titration (Part I)

The motivation for this article stems from my interest in retro-computing connected, on the one hand, to the re-evaluation of my youthful explorations of scientific computing in the BASIC language and, on the other, to the popularity they are having in the amateur sector in recent years and of teaching, single-board microcomputers (single-board computers, such as, for example, the Raspberry Pi). These small computers have considerably more power at a much lower cost than the microcomputers of the 80s. This made it possible to emulate the operating systems of the legendary Commodore home computer models and the MSX extension on these computers.

Therefore, a renewed interest in the BASIC programming language is also occurring. This interest in retro-computing reflects the nostalgia for the great emotions that the development of consumer information technology brought to my generation in the 1970s and 1980s. I remember being so struck by the creativity in using and programming these microcomputers that it redirected my scientific interests and academic career. I have written in other articles about my first programming adventures with Commodore home computers and MSX systems in the late 80s and early 90s and my rediscoveries in computer archaeology. Among the exhibits, I found a small program I used to study acid/base titrations developed in MSX BASIC. Therefore, I took the opportunity to write notes on acid-base balance and titration and thus provide a restored and improved version of my program to students passionate about programming and grappling with this important concept of analytical chemistry.

Continue reading

Easter 2023: Superquadric and Squared-Eggs

First there was the Great Cosmic Egg.

Huai-nan Tzu, China 100 BCE 

Another Easter is arriving, and here I am for a new article on old friends: the Eggs. In my blog for Easter 2021, I mentioned squared eggs paraphrasing a sentence attributed to the extraordinary jeweler Peter Carl Fabergé:” This year, your Highness, we will be featuring square eggs.” A hen is unlikely to make a cubic-shaped egg, but we can still transform a cooked egg to get the cuboid shape. If you look for squared eggs on the internet, you will find a tool called the egg cuber that does the magic. Unfortunately, I could not yet try one, but it seems to be doing an excellent job from the reviews. The shape of the egg is not a perfect cube but a cuboid, namely a cube with rounded corners. In my previous article, I anticipated that this shape could be obtained using the superquadric function. Curiouser and curiouser! In this article, I will give a bit of mathematical background and even a source code to play with such a function as my Easter Bunny gift.

Continue reading

Numeric Solutions of the Schrödinger equation

For Schrödinger, the atom was an oscillating system — like the string of a musical instrument — for which there exist a number of modes of oscillation (fundamentals and overtones) which are interpreted as the atom’s energy states.

Armin Hermann. Werner Heisenberg 1901-1976.

This set of slides is from one of my courses in Computational Chemistry. It covers the one-dimensional solution of the Schrödinger equation using Numerov’s method. The material for this article was mainly taken from the excellent Levin textbook in the reference.
If you are interested in more details, please like it and subscribe to my website. This way, I will be motivated to add more of these contents.

Continue reading

A Practical Introduction to the C Language for Computational Chemistry. Part 4

Controlling complexity is the essence of computer programming.

Brian W. Kernighan. in Software Tools (with PJ Plauger), 1976.

THE FUNCTIONS

A C program is a collection of functions. A C function is equivalent to the subroutine in FORTRAN or BASIC and procedures in PASCAL, PERL, or PYTHON programming languages. A portion of the program cannot be executed independently but only as part of another program. The function contains a specific algorithm or a stand-alone procedure. You have already used several library functions in your previous programs. Output commands for printing or reading files (such as printf(), openf()), mathematical functions (sqrt(), cos() are a library or intrinsic functions as well. Other library functions, we can classify as follows

  • Input/output functions. Input/output on the computer devices (e.g. output to the terminal, printer, hard disk, input from keyboard). It is usually used with #include <stdio.h>;
  • String manipulation functions. This library contains common operations on strings (e.g., concatenation, length, search, and extraction of substrings). It is usually used with #include <string.h>;
  • Mathematical functions. Mathematical calculations (e.g. trigonometrics functions, exponentiation, square root extraction). It is usually used with #include <math.h>;
  • Graphical functions. Function for graphics operations (open a graphical window and canvas) and drawing graphical primitives (e.g. points, line, curves).
  • Operative system control functions. Operation requiriing allocation of the computer resources or devices (e.g. date and time, allocation of memory). It is usually used with, for example, #include <time.h>;
  • Data conversion functions. Operation for data conversion (e.g. change characters type, ascii to integer). It is usually used with #include <ctype.h>;

To use these function, you need to use the precompiler instruction #include at the beginning of the program. The compiler use by deafult the standard library #include <stdlib.h>;

You can write your functions, and it is called user-defined functions. The use of function allows the program to structure and makes its organization and reading easier. C language is structured around the use of functions. The main() function is a function that contains calls to other functions, both intrinsic and user-defined functions.

Continue reading

NATALE 2022: Il Trigesimo Anniversario della mia Tesi di Laurea

Mais à l’instant même où la gorgée mêlée des miettes du gâteau toucha mon palais, je tressaillis, attentif à ce qui se passait d’extraordinaire en moi. Un plaisir délicieux m’avait envahi, isolé, sans la notion de sa cause.

PROUST Marcel, Du côté de chez Swann.

Ci sono ricordi del passato che rievocano nostalgicamente piacevoli momenti nella nostra vita. Questi preziosi tesori sono, a volte, sepolti nella nostra mente o, come nel mio caso, in quella di dimenticati cristalli di ferrite. Come per dolcetti di Proust, il ritrovamento di queste vestigie ci fa rivivere le emozioni di un passato lontano. I ricordi di cui parlo sono quelle della mia tesi di Laurea in Chimica che dopo essere stata scritta e discussa fu poi dimenticata nella memoria artificiale di obsoleti supporti magnetici degli albori della rivoluzione digitale.

Discussi la mia tesi di laurea il 23 dicembre dell’anno 1992, era l’ultima sessione di laurea di quell’anno. A quell’epoca, non esisteva ancora la laurea triennale che fu introdotta in conformità con il processo di Bologna dall’anno scolastico 2001/2002. Il corso di laurea in chimica era quinquennale e si entrava in tesi nell’ultimo anno. La tesi sperimentale comportava un lavoro originale che doveva essere discusso di fronte a una commissione di laurea composta dai professori del dipartimento, i relatori e i controrelatori (coloro che dovevano leggere la tesi e valutare il lavoro di ricerca e la sua presentazione). Pertanto, la tesi di Laurea (come del resto l’equivalente tesi magistrale) era un’esperienza molto importante nel condizionare la scelta dello studente nell’avviarsi o meno in una carriera accademica. Nel mio caso, la tesi segnò la scelta di intraprendere la carriera dello scienziato e educatore.  Scelta che, come gli academici goliardici delle prime università europee, mi ha portato a peregrinare lontano dalla mia alma mater nelle lontane Università del nord Europa. Di fatti, questa prefazione è stata abbozzata a Brema in Germania e completata a Lincoln nel Regno Unito, a pochi chilometri dalla città che diede i natali a Isacco Newton.

Continue reading

Tre Nuovi Progetti per l’Automatizzazione della Microscopia Ottica Amatoriale e Didattica

Ho recentemente pubblicato nel mio sito su AUTODESK INSTRUCTABLES tre progetti per la microscopia ottica amatoriale e didattica. Sono nati come progetti didattici (STEM) ma possano essere anche utili per applicazioni amatoriali scientifiche. Mio figlio Leonardo (ma anche il resto della famiglia), mi ha aiutato nella creazione della documentazione per questi progetti. In questo articolo riassumo brevemente in italiano la natura edei tre progetti. Le istruzioni dettagliate in inglese per la realizzazione dei progetti possono essere lette sul sito Instructables seguendo i links.

Il Roto-Microscopio

Questo progetto mira a sviluppare un dispositivo che integrato con un microscopio USB economico consenta di scattare foto 3D di piccoli campioni. Il progetto nasce come un’attività educativa di tipo STEM per creare Arduino, la ricostruzione di immagini 3D e la stampa 3D un’attrezzatura utile per alcune entusiasmanti attività scientifiche. Come il mio progetto precedente, è anche l’occasione per condividere attività coinvolgenti ed educative con la mia famiglia e in particolare con mio figli Leonardo che mi ha aiutato a creare questa documentazione e a valutare il dispositivo nel ruolo di un entusiast studente. In questa occasione, anche la mia adorabile moglie ci ha aiutato a realizzare il video dell’assemblaggio dell’attrezzatura.
Il roto-microscopio consente di controllare la posizione di un semplice microscopio USB attorno al campione. Questo ci permette di scattare foto accurate da diverse angolazioni e non solo dall’alto lungo la verticale come nei tradizionali microscopi ma anche da direzioni diverse. Questa non è un’idea nuova, poiché esistono microscopi professionali che operano allo stesso modo. Tuttavia, la realizzazione di dispositivo richiede una spesa modesta alla portata di uno studente garantisce molto divertimento nel costruirlo e produce risultati di buona qualità.

Continue reading

ROMIO: a Remotely-Operated MIcrOscope

By love, that first did prompt me to enquire;
He lent me counsel, and I lent him eyes. 

William Shakespeare. Romeo and Juliet. Act II.

Another STEM project is avaialbel here on my AUTODESK Instructable site. We could not help but continue to explore our favourite hobby: microscopy. The interest received in our previous microscopy-related projects has encouraged us to propose other ideas and designs based on further elaborations of both the ROTAMI and the roto-microscope projects. For the latter, Arduino was the microcontroller of choice. In this new device, we decided to take a step further to venture into the use of the fabulous Raspberry PI computer. The results paid back all the e orts; the new ROMIO (I hope Shakespeare’s lover will forgive us for using the illustrious name assonance!) is an XY mobile platform for USB digital microscopes controlled remotely by a RaspPI zero 2 W. In addition to the translation movements, it is possible to adjust the focus of the digital microscope with an additional servo motor. We have developed a simple Python program (called RasPyliet) to control the microscope and automatically collect a series of images for stitching reconstruction.

Moreover, using an additional RaspCamera, you can monitor the device’s correct functioning. The project requires a 3D printer, an inexpensive USB microscope and a Raspberry PI zero W (or higher models) version 2. The project could be used as a STEM project or and affordable replacement for more expensive school equipment for biology projects.

The story of ROMIO and RasPyiet did not end up in a tragedy, but as with every prototype, it still has some known problems and limitations, and there is space for improvement. So we hope you like it, and constructive comments and suggestions are always welcome!

Physical Chemistry: The Simple Hückel Method (Part VI): PREVIEW

LIST OF PREVIOUS LESSONS

Continue reading

The ROTAforMI: a RObotic TAble for Microscopy

I have recently published another STEM oriented robotic project. It is the ROTAforMI device, a versatile robotic device for controlling the position and orientation of a microscope slide using four degrees of freedom. This prototype is a complementary development of the idea behind the Roto-microscope project. It was inspired by related projects of servo motors-controlled micromanipulators and 3D micro scanners.

The device is entirely 3D printed and is actioned by four small servos controlled by one Arduino Nano microcontroller. The device can be controlled manually using two micro joysticks (and possibly also automatically via a programmed sequence of movements). In addition, a Bluetooth remote can take snapshots with a smartphone’s camera.

The device is made modular to use for different purposes. For example, removing the Y-stage should be sufficient to fit it under a stereomicroscope. Although the electronic interface is quite bulky, the device is simple to assemble and use, and the controlling program is still in its early stages. The ultimate goal is to use it for automatic photo stacking or 3D image reconstruction. Still, we are sure there are other possible applications in which small motion in 3D dimensions and a rotation of the observation stage can be helpful.

This is a prototype, and there is a lot of space for improvements. So we hope you like it, and constructive comments and suggestions are always welcome!

If you want trying to build one, please follow to the link given above.

La Modellazione 3D della Forma delle Uova degli Uccelli per il Design di Oggetti Funzionali

La Pasqua di quest’anno è stata un’altra occasione per pubblicare il mio tradizionale articolo sulla matematica della forma delle uova degli uccelli. Quest’anno con l’aiuto dei miei figli, abbiamo creato il seguente Instructable educazionale:

https://www.instructables.com/Modelling-and-Designing-of-Bird-Eggs-for-3D-Printi/

Il progetto mira a mostrare come utilizzare un semplice modello matematico per generare la forma 3D di uova di uccelli reali aggiustandone i diversi parametri. I modelli di uova generati possono essere salvati come modello tridimensionale nel formato STL e poi stampati utilizzando una stampante ad estrusione di filamento plastico. L’uovo stampato può essere dipinto o modificato utilizzando un programma di modellistica 3D (per esempio MeshLab, sviluppato in Italy dal Visual Computing Lab of CNR-ISTI) per aggiungere funzionalità per gadget o giocattoli nella forma di uovo. Viene spiegato in dettaglio un esempio di come creare un uovo illuminato internamente con un LED multicolore.

Più recentemente, per divertimento, ho pubblicato sempre su sito Instrutables un altro esempio usando lo stesso approccio:

https://www.instructables.com/The-Eggyrint/

Inoltre, l’argomento della modellazione della forma delle uova è stato trattato in articoli precedenti e il lettore interessato può integrare le informazioni nel progetto Instructable con quelle fornite nei seguenti articoli:

https://wordpress.com/post/daniloroccatano.blog/3792

https://wordpress.com/post/daniloroccatano.blog/5171

https://wordpress.com/post/daniloroccatano.blog/6760

Nell’Instructable dviene fornito un programma in C++ che dà la possibilità di generare le forma 3D delle uova e salvarle in STL. Può essere utilizzato per la ricerca, l’insegnamento e il divertimento.

Spero che il nostro progetto vi piaccia e commenti e suggerimenti costruttivi sono sempre i benvenuti!