Shared thoughts, experiments, simulations and simple ideas with Python, R and other languages
Monday, 23 December 2019
Electromagnetic forces between busbars
Saturday, 19 October 2019
Shaded pole motor magnetic field simulation in FEMM
Shaded pole motors are a variety of induction motors. They are quite the cheap type of motors: you can usually find them in old washing machines (powering the water pump for example) or even in new white goods where they may be used for periodic (but not frequent) tasks, for instance every 30s for turning a wheel. It is extremely rare to find a shaded pole motor that runs continuously. In the picture below (from Wikipedia) you can find an example of such motors.
Thursday, 16 August 2018
Automate your garden lights DIY style: getting practical!
This post is a follow up of this project.
After a lot of fiddling around, I finally built up the circuit for automating the turn on and off of my garden lights. It was about time wasn’it? Yeah, I know, it took me some time, but it was worth it since I think the end result is particularly nice and I enjoyed the process of building the circuit.
Goals of this project
The objectives of this DIY project are the following:
- Automate the turn on and off of garden lights: 4 LED lights powered from a battery which is recharged every day through an appropriately sized solar panel. The lights should turn on in the evening and turn off in the morning. Ideally turn on and turn off should be adjustable with ambient light.
- Improve my basic knowledge on how to design a proper circuit, a PCB, source components and debug analog circuitry.
- Keep the project relatively cheap.
The circuit in LTSpice
Below you can find a picture of the circuit simulated in LTSpice with all my notes following testing and a close up of the circuit.
Sunday, 4 March 2018
Calculating the DFT in C++
When you learn about the Fourier transform and what it can show you about a signal, you immediately start thinking about its possible applications. The Fourier transform, however, deals with continuous time signals while, in practice, computers deal with discrete time signals (i.e. a sampled version of the original continuous time signal). When it comes to discrete time signal, you can calculate a discrete Fourier transform to get the frequency content of the signal.
Saturday, 2 September 2017
How would you make a very simple and rotating magnetic field starting from a three phase power supply?
Recently I had a brilliant idea :D why not make a rotating magnetic field that can rotate a needle of a compass? (or any other magnetic needle for that matter).
Ok but the design must be very basic. One possible option would be the following:
Simulation of the electric field of a three phase cable using FEMM
If you think of a simple cable, with a copper core and a PVC insulation, calculating the electric field generated in the insulation layer using pen and paper may still be feasible, however, using FEMM greatly improves your life when doing calculations as an engineer, student, or “just” curious person.
This simple cable can be modelled using FEMM as follows
The cable has a total diameter of 7 cm, with a first PVC insulation with a radius of 2.6 cm, a 0.05cm air gap and another PVC insulation layer.
Thursday, 18 May 2017
Lighting your garden with LED lights and the sun: a DIY project, part 2.
Some time ago I wrote a short article on a small circuit I made to power on and off my garden lights using only a handful of components and some patience. Since then, however, I’ve dug deeper and found out some other good solutions to the problem.
A quick recap of the problem: At dusk and dawn I’d like my garden lights (powered by 12V DC batteries) to switch themselves on and off without me doing anything: a first step towards total automation ;)
My first try at accomplishing this task was using a simple BJT with a voltage divider specifically design to allow a certain bias current when it gets dark. See here for more information on this first raw trial.
Tuesday, 2 May 2017
Current sink: one of my first experiences with Eagle
I’ve learnt a few things the hard way while messing around with electronic circuits, here is a basic summary:
Wednesday, 23 November 2016
Solving electrical radial lines with Python
Electrical transmission systems are something we all take for granted. They work in a reliable manner ensuring high quality of service and as few minutes lost per year as possible.
Low voltage lines and most of medium voltage lines are radial lines, that is they are like a branch of a tree with a unique power supply location. Radial lines are relatively easy to work with, you can solve a radial line problem (ie you can get currents and voltages) by applying Boucherot’s theorem to each section of the line. This is a good news for a Python enthusiast as myself, since repetitive tasks lends themselves to be automated with programming.
Since Boucherot’s theorem uses the absolute values of electrical quantities, it is useful when you are working with AC lines and you would like to know the magnitude (rms) of currents and voltages while at the same time you do not really care about the phase differences. The rms values are used, for instance, when you need to choose the protection systems to install and what kind of electrical wires to use.
Suppose you are given the following three phase balanced radial line:
You can think of C1, C2 and C3 as industrial motors or any other kind of three phased balanced loads.
Sunday, 14 February 2016
Solving a circuit with a mutual inductor using LTspice
This is one of the first excercises we were taught in our circuit class. As you can probably see, the circuit is composed by two current sources with different frequency, some resistors and a mutual inductor. The aim of the analysis is to find out the total power consumed by the resistors. Let's analyse each problem carefully before proceeding.
Tuesday, 22 December 2015
Step response of a RLC series circuit
Today I am going to make a brief description of the step response of a RLC series circuit. This is the schematic made with LTspice
As you can see the components used are a resistor, an inductor and a capacitor connected in series. By applying Kirchhoff voltage law we obtain the following equation
$$u(t) = R x(t) + L\frac{dx(t)}{dt} + \frac{1}{C} \int x(t)dt $$
Monday, 21 December 2015
Three-phase symmetric perfectly balanced system LTspice simulation
Tuesday, 8 December 2015
How to simulate a simple high pass filters on LTspice
Here I am again after a long break!
During my last engineering class I learnt about the frequency response of a system and how this thing can be applied to solve simple problems. But the crucial question from most of us was the following: how would you build such filters, and perhaps more importantly, how would you tune them?
In principle, you could build a simple filter using nothing more than a resistor and a capacitor and, as you might have guessed, LTspice once again comes at rescuing us from our wandering around.
Let’s say we would like to build a simple high pass filter. Then we could try building the following circuit
Thursday, 20 August 2015
Using Arduino to measure friction coefficient
As a sideproject I decided to design a simple experiment and use Arduino to measure the friction coefficient of an object sliding on a given material.
Ideally we would like our first object to slide (not roll) on a sheet of a given material as below:
If we know the angle (we can easily set it) and the mass of the wooden block, then the only unknown variable is the friction coefficient and we can easily estimate it by measuring how long it took for the block to go over a certain distance x.
Controlling lights according to sunlight using only few electronic components
At the beginning of this summer, I was asked to provide a simple (and possibly cost-effective) solution to a simple problem: how can I do in order for my garden LED lights to turn themselves on and off according to the sunlight?
There are plenty of ready to use circuits and tools that one can use to answer this question, however I decided to try and design something “new” empowered by what I recently learned about NPN transistors, relays and LT-Spice IV. Let me talk you through my workflow:
The problem and the setting:
The LED lights which provide illumination in the garden are powered by a solar panel which during the day charges the battery. At night, the stored energy is used to power the lamp. The solar charge controller ensures that the charging process is smooth and that everything is going as it should during the charge and discharge processes. Since the solar charge controller is very minimal, it does not have a timer or a switch to turn on and off the lights. A manual switch is therefore used instead (not shown in the picture and to be replaced by this project). The lamp is a 12V 4.5W LED lamp.
The solution

