Monday, May 28, 2012

CHAOS GENERATOR - Electronic Circuit


Well, this time I’ll show you an electronic circuit that I thought was cool. It is called the CHAOS GENERATOR, why? Because when you see its output in the oscilloscope in the XY mode you get something like this:


So, it looks like an electromagnetic field attractor (if you remember some of you physics classes). And it is said to generate chaos because the circuit does not seem to set to into a stable mode for a reasonable period of time, that’s why the XY view looks like the signal moves without control.
The circuit that I show you here is a variation of the classic phase shift oscillator. And it is cheap and entertaining for a nothing-to-do afternoon.

Without the components inside the blue line, the circuit oscillates in a stable way, and there is a deformed sine wave at the T1 transistor collector. As show in the Bode diagrams of the classic phase shift oscillator below, the three stages of the RC ladder shift the phase 180 degrees.  So only at the frequency that produces this phase shift the circuit will oscillate, in this way the total shift around the loop will be o or 360 degrees (T1 also produces a 180° phase displacement).



For oscillations to be sustained, the gain K produced by the transistor should be inverse to the magnitude of the RC network transfer function at the frequency of oscillation.  This is to satisfy the unity-gain loop condition for oscillators.

Nevertheless, with the addition of the extra components in the blue line the output is completely different. When the amplitude increases during the booting of the oscillator, the transistor T2 will start to conduct at a certain point. This makes the resistor R5 to join the feedback loop and change the phase relation, which will force the circuit to find a new point of equilibrium.

To achieve CHAOS, the circuit should not find a stable situation, but a series of instable situations very close to each other. These situations are represented by “orbits” in the oscilloscope forming the so called “attractor.” Playing with the potentiometer P and the input voltage you can force the circuit to pass from one stable oscillation to chaos to another stable condition. Also, changing P1, R5 and C5 influence in the attractor’s shape.

The circuit contains 4 elements that store energy, for this reason the phase space has 4 dimensions. What we see in the oscilloscope is actually a 2D projection of an attractor in 4D. We can see other projections connecting the Y and Z instead of the X and Y points.

Here is a video compilation of the images I got. You can also see the video in my youtube account: http://www.youtube.com/watch?v=EvB6w3WwP_0&feature=youtu.be



Sunday, March 11, 2012

Labview Arduino - Control de Servomotor y Stepper Motor

Para mi el Arduino ya es lo suficientemente "amigable al usuario" para hacer muchas aplicaciones; y usarlo junto con Labview es como buscar más trabajo sólo porque nos gusta la mala vida. Pero si pensamos en ventajas de usarlo de esta forma, es que un Arduino es mucho más barato que una DAQ de National Instruments, por lo que podemos sensar y controlar ciertos dispositivos reemplazando uno por el otro. Claro la programación en Labview se vuelve más tediosa para usar el Arduino.

Entonces les muestro un programa sencillo para controlar un servo motor y un motor a pasos conjuntamente con el Arduino y Labview. El motivo es señalar los puntos a cuidar cuando se hacen las configuraciones y la lógica del programa par que realmente tengamos un control de los tiempos en los que se ejecuta.

1.- El control del toolkit de Arduino llamado "Init" se debe de cambiar. Se debe hacer doble click y buscar el contorl "Wait ms" que es el que dice cuanto tiempo debe de esperar Labview para comunicarse con el arduino, pongan un tiempo igual a 10000ms o más. Esto para permitir que el bootloader del arduino termine de de correr, si no Labview no reconocerá la dispositivo.

2.- Se debe de saber cuando el motor a pasos termina de ejecutar la secuencia correspondiente para moverse todos los pasos necesarios. De lo contrario, podemos empezar a ejecutar otros elementos en el programa antes de que el servomotor termine de moverse. Para esto se usa el control "Stepper To Go" en un ciclo while.

3.- Si hacemos uso del servomotor a lo largo de todo el programa, o usamos el control "Detach Servo" para que no se mande nada al servomotor, o nos aseguramos de que siempre se le esté mandando el pwm correspondiente. Si no el servomotor se moverá repentinamente o empezará a temblar.

Normalmente, no percibimos estos detalles cuando programamos en C, porque en seguida nosotros ponemos las instrucciones en un ciclo o le damos un tiempo de ejecución al PWM; y después ejecutamos las demás instrucciones, pero en Labview no es tan obvio porque los controles nos "dicen" que hacen el manejo directo de los actuadores, pero no es cierto.

Video tutorial en:  http://www.youtube.com/watch?v=9Md8ltHplc0
Carpeta zip programas: aqui

Diagrama de conexiones




Sunday, February 19, 2012

3D wheelchair simulator - XNA game Studio

Hi again! The purpose of this blog is also to comment in some projects I've done during my undergraduate studies. So this time I''ll show you a 3D wheelchair simulator I did using XNA game studio during my sophomore year. XNA game studio is a Visual Studio Plataform which uses C#  mainly for those who like videogames' programming.

This simulator was design based on an Intelligent Wheelchair which can be controlled through eye movements and voice commands. This wheelchair was developed by some graduate students at my college ITESM-CCM. The objective is for the users to get familiar with the wheelchair's controls, and to practice how to navigate through different type of scenarios (narrow spaces, hills, etc). In this way, the risk for them of having an accident when using the real wheelchair is reduces; as well as the time in which they adapt to the necessary commands to control it. The simulator also includes real life noises and animations. It offers different view perspectives (as in a video game like Call of Duty / Halo).

In my opinion there are a lot of easier game engines to program your own simulator or video game like Unity, and which offer better graphics too. But if you are old school and like programming almost from scratch and see for yourself algorithms for rendering graphics, XNA is a good choice to start.

I post some pictures of how does the 3d simulator looks like and videos of it from my youtube channel (suscribe!). If you want the code, ask for it in the comments. Thanks.

Video : Description fo the 3d environment
Video: Description of the voice commands for the 3d simulator



Thursday, January 12, 2012

Compute Resistors Standard Commercial Values

- Resistance is futile --/\/\/\--


I'll start with something not so complicated but I think useful.

Something I learned in my Electronic design course is that in some type of circuits, such as high order filters, we have to use component's values as precise as possible. Otherwise, the parameters of the circuit's response will not be optimal (not even close sometimes).

In most cases, we fix the value of the capacitors since their commercial values are not as varied as the resistors. The simplest way to solve the problem is to use potentiometers or other type of variable resistors; that's good if we are making tests in a protoboard, but if we want more like a permanent design (impressed circuit), fixed resistors are the way to go. And we also want to use these values to run our simulations.

From experience (mine and from  my professors), it is better if we use at most two resistors to approximate the desired value in order to avoid huge differences due to the resistors' tolerance. Since it can be tedious to figure out by yourself which two resistors are best (with or without a calculator); I decided to write a C++ program to find these values.

The input of the program is the desired resistor value. The output shows which two commercial resistors can be used (in series and in parallel) to approximate the input as well as their percentage error. It also shows two results for each combination, the first approximate value is less than the desired one and the other greater. The reason for this is because according to your application you may want to choose one or the other. For example, when connecting a LED you'll probably use a resistor with a higher value in order to prevent damaging your component; and when using a transistor you may use a resistor value with a smaller value to make sure it is activated.

Here is a example of the output when the input is 4350:


Well. here is the ComputeResistance.cpp code, I did not finish simplifying it all, but I tried to comment the most important parts and functions. I also left as comments the print functions and variables I used to debug the program in case you want to do it too.


Comments, improvements and questions are welcome. I'll also put a table with the resistors' commercial values for you to consult it.

Resistors' Commercial Values


Why Blogging??

Hi to everyone!!

My name is Arturo and I'm an Electronic Systems undergraduate. I just wanted to mention briefly why I decided to start a blog. I started thinking about it since I entered college... because every time (almost) I needed something for an assignment or project someone out there in the web has already done it, or at least something similar, and bothered to write/video about it. I think we all have been in this situation, and now it's my time to help.

Hence the purpose of this blog is to post about things I consider useful, specially for the ones studying engineering, and to discuss projects/ideas from which we all can benefit.

Best regards,
Arturo.