onsdag 17 maj 2017

[Cubex] First corner balancing of Cubli based hardware

You shouldn't judge a book by a cover they say, and likewise you shouldn't judge a project by what just meets the eye. During our current master thesis work I had the chance to get better acquainted with some of the works of among others Leonhard  Euler and Joseph-Louis  Lagrange. These people spent thousands of hours on things that have been  beneficial to even the whole human race. Few people know this though.Why? Because the works consist of truckloads of books full of equations, and it is not as easy to see the use of this as for instance applying a band aid to a wound . That is, work that don't meet the eye easily.



This stands in contrast to Cubli. It makes use of abstract science in a way that is perceivable more easily. Although it is a great deal of fun to use the results of among others Euler and Lagrange for various things (optimization and rigid body dynamics for instance people) it is useful to also demonstrate the concrete use and validity of it for ourselves and others. Therefore we choose to do our master thesis around a Cubli based platform constructed by thesis workers last year. This variant of Cubli was coined Cubex by us, Cube for cube and the -ex for an acronym used for thesis work (examensarbete) in Swedish.  The thesis focuses on many more aspects than corner balancing. For instance a new approach for a solve for Model Predictive Control has been evaluated. Here we are trying an own algorithm for finding the actual location of the center of gravity.





fredag 21 oktober 2016

[RR] Automated rescue boat

We have a project course at our  master program System, Control and Mechatronics, were we could apply to one of around 30 projects available. I was really happy that I got my first choice, which is a project carried out as a joint effort between SSRS (Swedish Sea Rescue Society) and Chalmers. The goal is to develop  autonomous or/and semi-autonomous vehicles that can help out in rescue missions. The current vehicle, a large water scooter named Rescue Runner, is able to follow a larger leader boat.




However, the people involved want some better tracking capabilities and stability of the control system. We are currently a team of three persons hoping to achieve this. Stay tuned, more information will be posted when we finish. Or well, not if we sink though. Then I'll try to cover it up, and hope for dedicated readers to spam me with comments ;)

Here you can read some in Swedish about the project:
http://www.chalmers.se/sv/nyheter/Sidor/Autonomous-Rescue-Runner.aspx

Mars rover project

This summer I worked at a project for RUAG Space in Sweden where we constructed a robot arm from scratch more or less. First we were in a recruitment competition for a week where we proposed a draft solution and won. We were all master students from Chalmers University of Gothenburg. Then RUAG decided they wanted the arm, and launched it as a summer job. We built it from scratch in around 16 workdays. Everything from hardware design, to software development to laser-cutting of metal parts and all in between those was done.

 We got to show it at a major event in Sweden called Almedalsveckan where our foreign minister Margot Wallström and first Swedish astronaut Christer Fuglesang took a good look at it. Here is a video describing it all:





I took care of modeling, simulation, some of the electronics construction and most of the low-level programming in this project. Previous experience came in handy and I think we managed to avoid many time consuming traps. 

Funny thing, it's one of the projects presented on this this blog that I have put least time on but the first project where I've gotten paid. I think I personally spent more hours on the heating system presented in this blog, than this robot arm project. So seems that I can get paid for doing my hobby :) 

söndag 6 december 2015

Guide: Get more distortion from an HCM65R amp

I got my hands on an HCM65R guitar amplifier. It's an okay amp I guess, if anything it's loud enough to rise a mob against you even if you live off in a rural area. But, something that's been bothering me and many fellow reviewers it is that it lacks distortion. For me it's usually enough for blues but some palm muted metal, like Into the void with Black Sabbath, comes out a bit soft.


As both of the volumeknobs were broken I took the amplifier apart and started thinking about a way how to get this loudly purring kitty to growl like a beast. When taking it apart I saw that the PCB is really old school with large components placed with a lot of space between them. So, hack friendly! I found out what to change and how, tried and it worked. Check the video below to hear how different it got.

Demonstration

I play some random stuff with and without the modification and I think that the difference in tone is very clear.



How to do it

This is for you who knows how to solder and de-solder components on a printed circuitboard (PCB). You know these practical things but don't want go get into all details about how this amplifier works. This is not a guide for complete beginners. If you fail the job it's possible that you will leave your amplifier in an useful state. You've thus destroyed something of value and will have to play acoustically. And playing acoustically on an electric guitar, well, lame. I suggest you to only do this if you have to repair the amp anyway, say that some potentiometer is worn out or so.
Also, it may be that the overall tone of the amp get's changed with this mod even at moderate gains. After all, sound is something very subjective and I'm not sure. I got more distortion for sure though. 

Make sure that the power plug is always out and has been so for a while before touching any components.   

  1. The amplifier is attached to the cabinet with screws from the outside. Remove these screws and the net protecting the speaker element.
  2. Now, lift out the amplifier. It shouldn't require that much of force. If it doesn't come out too easily, chances are that you've forgotten a screw.
  3. Localise the preamp, it has the text preamp written on it. Take a photo of it so you remember how everything was (before it turned into a black cloud of smoke?) and de-attach the cables attached to the PCB.
  4.  The pre-amp should be de-attached from the chassis for this job. This is done by pulling off all the plastic knobs on the potentiometers and loosening the nuts on them and the nuts on the input- and output-jacks.
  5. Now you should have something that looks like this.
  6. What you do is that you simply localize the resistor name R55. The original value of R55 is 155kOhm. The lower the value of this resistor, the more gain and distortion. This gives you various options. You can replace R55 with a fix resistor of lower value, a piece of wire with basically zero resistance or a potentiometer enabling for adjustments.


     I put a potentiometer where R55 was, but ended ut turning it down to zero anyway after playing around with it. So, probably the best and easiest thing to do here is just replacing R55 with a piece of wire. I wouldn't try different fix resistors, as soldering and de-soldering many of these could destroy the connection points at the circuit boards.

    If you want to use a potentiometer, remember that a standard potentiometer has three connections, and the resistance doesn't vary between two of them. You have to connect some of the two pairs of connectors of the potentiometers were the resistance varies to the place where R55 was. Just ignore or cut off the third connector. Polarity doesn't matter. Play around with different settings on the potentiometer, with the power off, until you're happy.
  7. Put things back together, rock n' roll :) Remember the piece of sealing "fluff" that should be between the amplifier and the cabinet.

How it works

Distortion is interesting. It's basically the act of cutting the tops of the signal you feed into the amp from the guitar. Look at the diagram below for an explanation. 


A nice, smooth mathematically exact sinosoidal have it's peaks more or less brutally cut off. Seeing this diagram, a PhD in mathematics probably gives off a tear and sighs. What could previously be described by a simple formula, is now likely only best described by numerical fourier transforms on real life data. Hearing the destroyed waveform though, the very same professor might as well want to put the tie on his head, head bang and stage dive over the  book shelves in the reference library. What I'm trying to get at is that it's hard to predict what will sound well and not. This abuse of waveforms is called distortion, can be absolutely awsome, and is the reason why large portions of the popular music today exists! I mean, not even Rolling Stones would be Rolling Stones without these ill-treated signals.

In this example the clipping is done using diodes. As you may know, diodes don't conduct any current until there is a certain voltage drop over them. As the way this circuit is set up, the signal will "flatten out" when the voltage it's fed with is higher than the diodes voltage forward drop, see the figure below.



It should be noted though that this is a bit simplified, and assumes non-zero impedance in series with the diode. Also, most diodes don't clip this hard. But the principle remains the same.

No gain, no...

Most guitar amplifiers have at least two sections, one marked pre-amp something and one marked master volume something. The thing is that the pre-amp is usually in series with the circuit creating distortion, like the diode below. What the pre-amp does is that it amplifies the signal, making a larger proportion of the signal getting clipped. That is heard as more distortion. After studying the schematics for the HCM65R for a while, I couldn't find where this diode responsible for the rock n' roll would be located.

What the mastervolume does is that it just amplifies the already distorted signal, without adding more distortion itself (well, not before you play loud enough to you go deaf, anyway).

An analog circuit using digital components

It turns out, the HCM65R uses overdriven logical inverters to seal the deal! I found this great page that explains how it works:

Overdrive using hex-inverters

Logical inverters can be self-biased and used as linear amplifiers. When they are cranked up enough, they start to clip. The HCM65R uses various of these connected in series. See the excerpt from the HCM65R schematics below.



HCM65R Schematics

There are many ways in which this circuit could be modified to get more distortion. The key factor I was looking for was how to introduce more gain somehow. More gain should create more linear clipping, as previously explained. This could have been done before the node to the left marked LN1, but that would have affected the clean channel which I didn't want.

Some math behind it

In a datasheet from NXP I foundan expression for the gain of a HEX inverter when used as a linear amplifier, it can be seen below.



Link to an inverter data sheet

It can be seen that the gain Au is determined by a ration between R1 and R2, and for it to be as high as possible R1 should actually be zero. Bingo! If then any of the resisors R55, R35 etc in the amp were made smaller, there should be more gain and then more distortion. As the ratio between R55 and R24 is the one that can be changed the most changing only one component I choose to replace R55 with a variable resistance.

Also, I'm not sure how modifying the other three inverters would affect the tone, for one as the last one is hooked up as a low-pass filter. A model for how the the circuit would affect  signal can be derived quiet easily, but a model for how this signal would sound when cranking out a power chord is well let's say behind the scope of this article :) Changing R55 for a smaller value felt safer as that should be the same as just adding a possibly clipping pre-amp to the guitar. However, the drawback is that if this first inverter starts clipping, it's before the "distortion" knob on the pre-amp. That means that there is a risk that there will always be distortion in the tone when the amplifier is in overdrive mode, if not the volume knob on the guitar is turned down. This leads to a worse signal-to-noise-ration and well... The mod is a compromise.

onsdag 13 maj 2015

Visiting Itaipu


Itaipu dam has the second largest rated capacity of all hydropower plants in the world, next after Three Gorges Dam in China. However, as the Paraná river has a more even flow throughout the year, the Itaipu dam in the end is the hydropower plant in the world that supplies the most energy.
A normal year, this plant alone supplies more than 150% of the nuclear plants in Sweden together.

The dam was built and is operated within a binational co-operation between Paraguay and Brazil, that then divide the energy in between them, The ground where it stands has a somewhat international status.

Traveling in Brazil, I off course had to see this dam with my own eyes. Let's see some pictures I took. 

I photographed this overview picture of the dam for a start. 

The dam seen from the side. It doesn't look to vast here, but it's 7235 meters long in total. The turbines outlets are underneath the water surface and cannot be seen here.

 This is the outlet of cooling water from the generators. The cooling water leaves the generator at around 80°C before it's mixed with cool drainage water and is dispersed into the Paraná river.

   
These are channels for draining the dam, when there is a greater flow of water than the installed equipment can handle. 




The area that is flooded by the dam. As of what Itaipu claims it has one of the smaller flooded area per generated unit of energy  in the world though.

 The white towers sticking up are hydraulic pistons for operating shutter valves to the penstocks.

Another overview.

 Photo taken standing on the top of the dam. It's huge!

 Downstreams of the powerplant.


The  white penstocks for the turbines were just massive.

Penstocks again. 


Control room for the transformer stations. The policy is to have one operator from Paraguay and one from Brazil all the time.  The operation of the dam is complicated a bit as it supplies both Paraguay and Brazil, and these countries have different main frequencies on the power grid.




The control room for the turbines. As in many other places, it's a hybrid between old analogue supervising and a newer digital system. 


 A plate giving cred to the people who built the dam.


 The shaft transferring the mechanical power from one of the turbines to a generator. The shaft and the turbine is rotating at the rather modest speed of 90 RPM on the Brazilian side with the 60 Hz system. This should mean that the generator has 80 poles, am I right?


Underneath these circular areas in the floor the generators are located.




fredag 8 maj 2015

What "extremely hot" means in Sweden

Last summer in Sweden 2014 we had like five days straight with temperatures around 28 celsius (82 fahrenheit) during the day. Such temperature is considered more or less extreme and during such circumstances things go bad for some of us frozen swedes. Yeah, you read correctly, that is extreme for many of us. You're laughing right? Come here when it's -5 celsius instead and see who has the last laugh ;) Alright, I'm exaggerating a little. bit Most people like temperatures as such. But I believe I found an exception here.


Most housings in Sweden don't feature a cooling system, which is reasonable. I mean, it would be sort of the same thing as opening a sand shop in the desert of Sahara. However, sometimes maybe there is a need for sand even in Sahara. Some fellow engineering student (I guess), suffering in his rented student housing in Gothenburg, found a remedy to his hardships. Down at the yard there was a storage room for solid waste were disposed fridges ocassionally could be found. To shield himself from this burning inferno he mounted the fridge in the window of the apartment. That's right, when there was 28 celsius in Sweden some guy mount a fridge in his, or perhaps her, window. If the top part of the opening of the window was covered for the system to actually work is unknown.

This however reminds me of a deeper aspect. There is so much useful material that just goes to waste in Sweden, while it could sometimes be directly recycled, like here. Okey, this is not a great example, I don't expect people to mount old fridges in their windows. But a lot other stuff that is thrown away is fully usable.

onsdag 6 maj 2015

Improvement of Skype


Being abroad I'm using Skype regularly. During calls with some people, the call starts just fine but is drenched in low frequent noise after a while.

From some instrumental recordings I've done using my laptops internal mic, I knew that it has quiet a lot of background noise. What if that noise is transferred to the other persons speaker, amplified, fed back into my speaker, fed back into my mic again and added to the background noise it produces already, back to the other persons speaker and back again creating an unstable positive feed-back loop?



The theory was easily proved in practice. By using head phones, the feedback loop was broken and the high levels of noise disappeared.

The software engineers at Skype could probably have good use of the noble teachings of Nyquist to get rid of this. I bet though that a simple noise gate could do the trick. There is one such avaliable online as a plugin but Skype hasn't incorporated that in to their software yet as standard.