[Arduino] Analog Thumb Joystick

This is going to be a easy and fun one, analog joystick for Arduino. I got this one for around $6 from Adafruit. Awesome and easy to use. Essentially, this is what they use in all those consoles, PS1, PS2, PS3, PS4… Some stuffs you can make with this: robotic servo control, RC motor speed controller…

Continue reading


[Arduino] Ultrasonic Range Finder (XL-MaxSonar-EZ MB1240)

Last time I update this blog was almost a year ago… during this time, lots happened. I graduated from Lehigh University with a MechE degree, got 3 job offers. Got to choose 1, which is such a painful decision, but that will be for a later time. Long story short, I am back to Lehigh for a Master’s degree. For my thesis, I am building a “Guidance, Navigation and Control System for a Simulated Hopper Spacecraft”. Basically, building a tricopter / quadcopter to simulate the space hopper concept for space exploration. So I guess I will use this as my notebook again to document some work I’ve done, hopefully it will be easier when it’s time to write the paper.

So, ultrasonic sensor. A more expensive one, XL-MaxSonar.

Continue reading

[MATLAB] Real Time Serial Data Logger

Data acquisition is a very important part of test engineering. By plotting the data acquired in real time, we can analyze how the design behave and to determine whether it meet specs or not. Some examples of application are logging aircraft altitude and LiPo battery cells temperature. In my previous project of designing an aircraft altitude controller, the real  time data logger is a key part of the project in determining how the system perform. In that project, I used Java to program a real time data plotter and it was such a pain. The code became so messy that I do not want to look at it ever again. It took such a long time too.

So this time, I turned to MATLAB. As a 4th generation programming language, this is so much easier since it got a Serial interface and plotting function built in. In the end of this post, we should get sometime like this:

Serial Data Log Continue reading

[MATLAB] Dot Operation – No More For Loop!

MATLAB is a matrix based software that is widely used in engineering. Since the software is matrix based, it is actually a lot faster to do matrix operations rather than looping.

The following is an example of how to create a filter to eliminate all non-positive numbers from an array using the dot operation instead of a for loop.

function y = negative_filter( x )
% function y = negative_filter( x )
% plugging in a matrix will return only the positive numbers in a vector

%Create a zero matrix same size as the incoming matrix for comparison
z = zeros( size(x));

%Create a "filter" matrix that return 1 if the condition is true
%It will return 0 if the condition is false
filter = (x > z);

%This function multply the "filter matrix" with the incoming matrix
%elements by elements, note the '.' in front of '*'. This line will set all
%number less than 0, or false to the earlier stated condition to 0.
y = filter .* x;

%This remove all zero terms from the matrix
y(y==0) = [];





[Aerospace] The Standard Atmosphere

When doing calculations in engineering, many of the variables that we deal with are not constants. For example, if we were to calibrate a digital altimeter to collect accurate altitude position, we need the atmospheric pressure at sea level. It would be nice if pressure stay the same, then we could just hard code that number in. Unfortunately, that is not the case. Pressure changes constantly due to a number of factors.

Because of the continuously changing nature of some of the variable we deal with, this present us with a challenge in engineering. How are we supposed to design the aircraft if conditions are keep on changing?

Well, that’s when the Standard Atmosphere come into play. In simplest terms, the Standard Atmosphere is pretty much just a model that engineers and scientists came up with that generally describe what the average conditions are like.  Continue reading

[Arduino Project] Analog Digital Reader

This is a simple project that I did with the LCD Shield to learn how to use it. Basically, you can use the buttons to scroll through the different pins and control the lcd display back light. Basically, this is a mini voltmeter. Good for testing out raw sensor readings.

Source Code as Follow:

Continue reading

[Java] Download File from URL

In your program, you might want to acquire files from the internet for purposes such as update, additional resources, web image gallery… so here’s a modified version of the codes I found on stackoverflow.com that you can just copy and paste into your Java program. Just supply the URL for path and the file name in filename.

 public static String downloadFile(String path, String filename)

 try {
 URL website = new URL(path);
 ReadableByteChannel rbc = Channels.newChannel(website.openStream());
 FileOutputStream fos = new FileOutputStream(filename);
 fos.getChannel().transferFrom(rbc, 0, 1 << 24);
 } catch (IOException ex) {
 Logger.getLogger(main.class.getName()).log(Level.SEVERE, null, ex);

 return path + "............ COMPLETED!";