Weekly Update

I attended a 3 day “Excellence at Supervision” course at MAA Kelana Jaya as part of my training program. It’s a leadership course that teaches us how to manage people and deal with situations at work. I find it more like a team building exercise because we need to work together to solve problems and come up with solutions. It’s a very hands on course and it’s a lot of fun.

There’s a big difference between dealing with people and dealing with machines. With machines it’s simple. You just need to give it exactly what it needs. The machine is build to a certain specification and it will never run away from that. Humans are different. We are all different and we all have different personalities. So if you have 20 people that you need to lead, you will have 20 different ways of interacting with each of them. And you’ll need to figure out their styles, preferably when you first meet them.

We also learn of the different ways of dealing with situations. Instead of the blame-culture that we are all so familiar with, we were taught the “proactive” way of approaching a situation. In the proactive approach, we ask these 3 questions:

  1. What went well?
  2. What can be improved?
  3. What did I/we learn?

As you can see, the proactive way is a very positive way of approaching a situation. The opposite of proactive is reactive, which is to start blaming people.

Although the concept is good, implementing it in real life may be difficult. It’s difficult but not impossible. But it’s definitely easier to blame others for any thing that goes wrong.

demotivational posters
see more Very Demotivational

We also learned how to be better leaders. And the difference between leaders and managers. There’s a fine line between them but leaders are the ones who will always put their team first because nobody can run a one man show. Leaders will also need to have integrity and be ready to admit their mistakes.

I truly believe that if we all follow the teachings of the course, the world will be a better place. One way or the other, we are all leaders. Setting a good example to those following you will have a profound impact on your team and people around you.

DSLR Mirror and Shutter Mechanism

This is what happens when a photo is taken on a Nikon D3.

A series of events happen:

  1. The mirror is raised, and at the same time the aperture of the lens is adjusted according to the camera’s settings (f/16).
  2. The shutter moves across the image sensor. At 1/4000, you can see that the shutter moves to expose a small slit of light to the sensor only. A slit is produced because at such high speeds (1/4000), the rear curtain must start moving before the front curtain completely exposes the image sensor. This is why normal flash sync will not work. If you use normal flash sync at such speeds, you will get photos like these.
  3. After the rear curtain has traveled across the image sensor, the mirror starts to go down, and at the same time the aperture of the lens is opened up to maximum (f/1.4 in this case).
  4. The camera is now ready for another shot.

At normal speeds the mirror and shutter action is almost impossible to study. Also because of the high speed operation, the shutter and mirror mechanism must be well engineered to last long. A high end camera’s shutter can usually last for about 100,000-150,000 actuations.

Cheap Analog Signal Acquisition for PCs

There are times when you’ll need to read analog signals and pass them to a computer to process or display. Analog signal acquisition cards are usually expensive and not suitable for hobbyist on a budget. So if you’re not running mission critical systems requiring ultra fast and accurate updates, here’s a very cheap and easy solution to getting your analog signals into your computer.

This idea came to me when I was looking for a USB interface card for my CarPC. Unfortunately for me I have a very old car that doesn’t support the current OBDII system so I have to hardwire everything to get their status. I needed the status of the fans, coolant temperature, compressor clutch, and a host of other parameters to feed my obsession for information that I don’t need and to distract me from the road ahead. While looking for a cheap and easy way to get all these information (PICs, etc.) I stumbled upon cheap China made USB controllers. And since USB is pretty much standard with every computer, I was sold.

First off, you will need an analog USB joystick. You can probably see where this is heading. The reason is because USB joysticks are so cheap that it makes sense to experiment with them. Besides analog inputs, you get discrete inputs too with these joysticks. You can grab some of these joysticks from the links below:

Note: I would recommend the gamepad type because there are 4 analog inputs as compared to only 3 for the joystick. Get the cheapest analog controller you can possibly find. Warranty is not an issue for obvious reasons.

DSC_0004 copy

This controller from a local computer store cost me RM23 ($8) only. It has about 20 discrete inputs (buttons) and 4 analog inputs and also a vibration unit inside.

First thing you’ll want to do when you get your controller is to plug it into the computer and check if it works. If not you still have the option to return it to get a replacement. Once you are satisfied with the condition of the controller, it’s time to have some fun. Take out your screwdriver set and tear it open.

DSC_0006 copy

Here you’re looking at the analog  joystick board (green). All the connections that you need can be tapped from here. If they are 4 axis of analog control, you will have 4 inputs from here.


The  red squares show where the 4 potentiometers are. The red circle shows the input connections. The 5V and ground reference is there also.

DSC_0009 copy

Measuring the supply voltage to the potentiometers. As expected, it was 5v (USB powered)

So basically the controller works as follows:


Looking at the diagram on the left, with a supply of 5v and ground, the potentiometer divides this and gives an output that varies between 0-5v. So depending on where the potentiometer is positioned, the output voltage to the joystick’s controller input can be anywhere from 0v to 5v. The joystick controller then reads this voltage and gives a reading to the computer.

DSC_0015 copy

An externally connected potentiometer is used for testing. The purple wire supplies the 5v, blue wire supplies the ground and green wire is the input. A capacitor is connected between the input and ground because the readings were “jumpy”, probably due to external interference.

So if the potentiometer is turned all the way down, the input to the joystick controller will be 0v. The joystick will then send a “full left” (or “full right” depending on the design) to the computer. If we turn the potentiometer all the way up, the input to the joystick controller will be 5v. The joystick will then send an opposite signal to the computer, telling it that they joystick has now been moved all the way to the other direction.

If the potentiometer is turned somewhere in between, it might give a signal of 3v. The joystick controller will then interpret this and tell the computer where the joystick location is.

If you have managed to follow the explanation above, you’ll see why we can use this to measure analog voltages. We can theoretically apply a voltage to the analog input of the joystick controller and the joystick will send that signal to the computer. I say theoretically because that is not exactly the case in real life, as you will see below:


This is the software that reads the joystick input. It’s written in C# and it can be downloaded from codeproject.com along with the source code. I’m not an expert in C# so please direct your C# questions to someone else. But a little reverse engineering and trial and error should help you modify the source sufficiently for your own use.

I disconnected the potentiometer and instead connected the input to 2 different batteries, one at a time:


When I connected it to the Li-ion battery of 3.86v (measured with a voltmeter), it gave me a reading of 62154.


When I connected it to a AAA battery of 1.5v, I got 8191. If we assumed that 0v will show zero on the computer and 5v will show 65535 then the readings will not make sense. For example:

Input Voltage = (Axis Value / 65535) x 5v

In the case above, we got 8191 for the 1.5v battery. So if we substitute that into the formula above, we’ll get:

Input Voltage = (8191/65535) x 5v = 0.6249v (which is obviously not the voltage of the 1.5v battery)

So it seems that the joystick controller only reads a certain range of voltage, with dead zones at both the upper limit and lower limit. Hence, we need to calculate those values. We have 2 variables to figure out: the lower limit and the range. Upper limit is not required to get the correct voltage reading. We already have 2 samples to work with from above (the li-ion battery and 1.5v AAA battery). By using simple high school maths, we can then calculate for the 2 unknowns:


Note: the AAA battery was at 1.49v.

From here, we know that the lower limit is 1.1431v. So anything below this, the joystick reads as zero. Also, we now know that the joystick only reads a range of 2.8647v. That’s not a lot to play with. But it’s sufficient.

So now with the unknowns calculate, we can write our equation for this joystick:

Input Voltage = 1.1431 + (Axis Value / 65536) x 2.8647v

To test the equation, we use the example of the 1.5v battery again:

Input Voltage = 1.1431 + (8191 / 65535) x 2.8647v = 1.5011v

Now the value of 1.5011v looks more convincing.

DSC_0012 copy

From here, you can tap the other analog inputs. And using the values acquired from the equations, you can write your program to display the values in voltages instead of unintelligible numbers like 8191.

If you need to read more range or higher voltages, just use a voltage divider network.

Of course, if you require better resolution, you can always go for the commercial devices, like the one shown below:

That’s about all that you need to know on how to make a cheap and easy analog signal acquisition device for a computer. If you have questions, comments or suggestions feel free to leave them in the comments section below or send me an email.


I just realized that I listen to many oldies while I was still in secondary school. These brought back many old memories.

Ash – Burn Baby Burn

Ash – Girl from Mars

And apparently Amazon still carries them! Wonder if I can get the CDs here in Malaysia.