Sunday, 24 June 2012

It's not rocket science... Oh wait, yes it is..

In other news, a friend from uni has expressed interest in starting a small experimental rocket team to get a micro-satellite into low earth orbit, so far there around five students who expressed interest but just the two of us who actually want to get anything done. It seems that once again that the engineering students I know are all too interested in a well paid career than having any kind of affinity for engineering. Anyway a task of this magnitude would take many years, but who's to say it will never happen, all big projects had to start somewhere and other teams like Ausroc, Aspire, dutch Sub-Orbitals, Starchaser and SpaceX all started with a few interested people and big ideas. We have planned out initial project aims of building a small scale version of the liquid fuelled rocket engine, on the order of 1000N, and to have reached an altitude of 5km by December. The highest I have been before was about 1.5Km and that was with a commercial solid fuel motor and rocket this is going to be something else entirely. We have begun to put out some tentative feelers about who and how to start applying for funding or sponsorship. I have enough equipment, instrumentation and materials from previous projects to build and test a fairly large proportion of this initial stage, but there's no way we can afford the rest on our own budgets. Let alone the further stages of the project should we actually meet the objectives.

 
Talking of funds, well it looks like my bank account is going to take another hit because I need to buy another DAQ... Luckily with the European economies they way they are, I will be able to shave a bit off the the price. I need it because I have ten analogue signals I need to measure and thought I could use both the µChameleon and a DATAQ DAQs, but this has proved to be messy and it conflicts with my desire for everything to be symmetrical... This will also help in that I can monitor the gas and fuel solenoids, starting motor and glow plug operations easier, than trying to read these through the digital I/O channels.

Everything is coming together well now, I am starting to think about the physical test bench. I have some plans I sketched out a couple of years ago that involved the test bench mounted on a trolley with the engine operating inside a fully enclosed 'box' with the exhaust ducted out the rear. Fuel and instrumentation would be housed in separate compartments. This has the benefits of reducing noise, I know it won't be much, but even a few decibels would enough to help reduce the annoyance to the neighbours. I only wear ear defenders for the full throttle runs because I love engine noise, even high pitched rasping two-stroke engines! Another plus for this isolated engine layout, is the fact I can easily inject CO2 from a fire extinguisher should the need arise and it has on many occasions. I have set fire to the shed, my parents shrubbery, myself, in fact anything can be burned has been burned over the course of my life. The shrubbery is a particularly sore point with my mother who brings it up with anybody and everybody more than ten years after the incident. To be fair I really didn't think the exhaust from a small jet engine, without an exhaust nozzle, would be hot enough at ten feet to cook an entire bush. But I was wrong, and to top it off a bearing failure at 80,000 RPM then left pools of burning kerosene on the new block paving. I got the feeling I wasn't her favourite person that week.

Currently the dashboard in Labview looks like this. I'm still not happy with the layout, but it's getting there. Apologies for the mixture of metric and English units, That's if you noticed the temperature meters were in degrees Centigrade rather than Kelvin. I will be using this to monitor the engine in real time and my brain works best in Centigrade, especially at the higher combustion temperatures, because its the unit I use most in daily life. I only work with Kelvin when mathematics are involved. It's a bad habit I know, but I don't want to run the risk of missing something going wrong a moment before all hell breaks loose because I was confused with subtracting 273 degrees. Despite having just done a maths degree in disguise, it seems I am hopeless at simple arithmetic. I've also christened the project Ardor which is Latin for flame, burning, heat..... according to my seventeen year old, high school Latin dictionary. After my track record in testing gas turbines, I think the name is justified. There's still some things that need to be added to the dashboard, but these are simple indicators to notify me when the ECU is cycling through various start up systems. The next big job is figuring out how to export a PWM signal and adding a second vi to control another DAQ.

Judging by the amount of blog traffic I get just from people looking how to measure RPM in Labview, there must be some interesting projects out there. If you're doing something interesting let me know! I love reading about what other people are up to!

Friday, 15 June 2012

Signal Conditioning

I have been having some issues with noisy outputs from the µChameleon DAQ so when running the dashboard to see how well my sensors and their associated circuitry performed. The voltages I'd measure on a multimeter were fine, however Labview would show wildly fluctuating signals which had the needles on the gauges jumping over very large values. If you look at my previous Labview vi's you might notice that I had tried to lessen the effects of this unknown noise using a simple mathematical method where I limited the number of decimal places of the number string. I had tried to do some fault finding a few weeks ago and didn't really get anywhere as I didn't yet have an oscilloscope, but it now seems I have fallen victim to the dreaded aliasing...

Looking at the RPM voltage signal on the oscilloscope showed not the linear voltage I was expecting, but a triangular waveform that had a mean voltage that was the same what I was seeing on the multimeter. The maximum to minimum voltage was in the region of 1.8V!!! Which, after figuring out the scale I'd used, corresponded to the magnitudes of the needle fluctuations I was seeing in my Labview gauges.

That was one mystery solved, but why was the DAQ giving me a signal that looked like random noise. Now when I bought the DAQ I noticed it had a sample rate that was more than sufficient, at 50KHz. Even if it only ever realised 60% of that claim it would be more than fast enough, can you see where this is going? It does indeed seem that you get what you pay for, and in my case that would be a measured sample rate of around 50HZ on my analogue channels which is only 0.1% of the claimed sample rate. Some digging on the products help forum showed similar results from other people, although it seems like the moderators don't keep on top of the spam robots which seem to have flooded the site when I checked it a couple of days ago. Putting this into context, at 50Hz the time step between each sample is 0.02 seconds, as you can see in the graph of the waveform above, the period of that signal is 0.0005 seconds. This means that the DAQ cannot capture the waveform and the result is a signal that looked noisy. Incidentally, if I had a sample rate of twice the measured frequency, Nyquist theorem, then I'd need a sample rate of 10KHz.

Putting this together it seems like the low sample rate and the noisy waveform was the source of my frustrations. Even if the DAQ had a higher sample rate and aliasing wasn't a problem, the values would still oscillate and I'd still have data which would be unusable. I looked at commercial signal conditioning, but after a few seconds the cost and complexity had me running for coffee and an easier solution. Digging out some of my uni notes from a third year module, I found that I might solve the problem using a filter, specifically a 'Low Pass filter', this comprises of a capacitor and a resistor. Couldn't be simpler, so literally a few minutes later I had found that a 1MΩ resistor and a 220nF capacitor reduced the magnitude of the noise from 1.8V to 0.3mV and the noisy behaviour of the Labview gauges had stopped. Finally!!


Now that I have sorted the noisy signal issues I have also been able to implement Labviews built in Thermocouple vi  to interpret the temperature from the thermocouple. This saves me from creating a large lookup table to locate the temperature value based on the voltage. Previously I have been using a quick and dirty method to estimate the temperature based on the product of a simple conversion factor and the voltage. I did a test where I dunked a couple of digital thermometers into a cup with one of my thermocouples and monitored how it performed by watching the temperature drop of boiling water and observing the values. I'm happy to say that the temperature my thermocouple was giving values within 1°K of the food grade thermometer than the thermometer that I use to monitor one of my aquariums. Looks like I won't be using that one in my reef tank anymore.

Still have to sort out my load cell, pressure transducers and flowmeter, but things are coming together quite quickly now. Stay tuned!


Friday, 8 June 2012

RPM In Labview Part 2.

Remember a few months ago I mentioned how I was planning on using Labview to display the engine speed by splitting the signal between the Hall sensor and ECU. Now I had tried to simulate and convert a square wave in Labview to represent the engine speed, and didn't really have much success. I had an idea whereby I converted the frequency of the signal into a voltage and treated it the same way as the other signals. Now after looking at trying to do this in Labview, which lead me to almost scrapping the idea of using Labview and instead toyed with the idea of writing the whole thing using Python which I gave up. The madness continued and I looked at writing some code in Matlab and trying to get Labview to utilise the code to analyse the signal and spit out the RPM... This was starting to get complicated, so I wondered if I could solve this with an analogue solution. A quick Google and one coffee later I had found an IC from National Instruments that would do this, and that was as far as I got.
Fast forward a few months and I have just finished a prototype circuit, tested it and it seems to be stable and working fine. I have yet to test it with the DAQ and Labview, but that's a mere formality. I apologise for the messy picture showing the prototype circuit, I will transfer this to Veroboard shortly and tidy it up a bit. Just incase you can't match the circuit diagram with the circuit on the right I have numbered the important features that might need highlighting because there is a lot of crocodile clips in there. My new oscilloscope and function generator have been invaluable in this mini-project, so much that I think I would have abandoned it long ago if I didn't have them.


The corresponding circuit diagram which is based on the prototype circuit looks like this, not too bad for something I knocked up in Microsoft Paint!


You might have noticed the addition of an adjustable voltage regulator, this is to modify the pulsed DC signal given by the Hall sensor into an AC signal that can be read by the LM-2917 chip. After getting the circuit performing nicely giving a 0V to 4.5V output for 0 to 3KHz, which is 180,000 RPM I started playing with the input square wave to approximate the signal that I'd actually need to measure instead of a sinusoidal wave. At this point I found out that this chip doesn't like pulsed DC signals. Here is some data I took from the Hall sensor, at 88Hz showing the signal. As you can see, the signal is offset and doesn't cross the zero volt axis. Therefore I just simply added any voltage between -0.5V and -4V to the input signal to ensure that it crosses the zero volt axis and therefore can be read by the NI chip. In the end I used -1.5V, produced by a voltage regulator that I got from Maplins for £0.85. The polarity of the voltage regulator doesn't matter, if you want to shift the wave below the axis you can either add a positive voltage to the ground side of the waveform signal or add a negative voltage to the positive side of the signal.

I'm sure there is an easier way to read the RPM in Labview, I did think about hacking the ECU itself to read the voltage from its frequency-voltage converter chip, assuming it has one but I don't want to risk introducing noise into the ECU that could lead to it destroying a turbine. These engines will self destruct in a very, very short time especially at high RPM's. Besides, I don't know about you, but sitting in front of this isn't a bad way to spend a few hours! 

Just a quick note on the oscilloscope, It's an Atten ADS1102CAL 100MHz and I got it off EBay for about £190 and it is very good value for money and has more than enough capability for what I need to do. After using CRT style oscilloscopes in the past, this is super light and compact and very unobtrusive in my small room.

Update:
Here is the finished circuit, just need to add a gauge on my Labview Dashboard which is the easy bit because I now have a nice linear 0 to 5v voltage output from 0 to 200,000RPM. A conservative estimate of the total cost of the parts used would be in the region of £4.00, not bad.


Friday, 25 May 2012

And now for something completly different....

I should apologise for the lack of posts over the last few weeks, I am in the middle of my fourth year exams and the last few weeks before the semester finished I was run off my feet with a never ending list of coursework and reports. One of the modules had me doing some interesting programming of the vortex sheet produced by a wing to investigate the wing tip vortices's to see if the wake interfered with the tailplane. So while I have a few days between exams thought I'd write up a bit on this because having researched this topic, I know how tricky it was to model. The code is written in Matlab and a link to the scripts will be given at the bottom of the page. The mathematics behind computation of the vortical wake produced by a wing is too long for me to delve into for this mid-exam blog post, if there is enough interest I am more than happy to cover this in a future blog, but for now I will just gloss over the details and show the pretty pictures. After the last few weeks of non-stop revision digging out my notes and writing what would amount to another small report is the last thing on my mind. Besides, the UK is in the grip of a heatwave at the moment, it is nearly 28`C outside which reduces my desire to write up my derivations even more! For those of you who are reading this from sunnier climates it might sound like an average day for you, but for us it is almost unheard of on this rain drenched island.


Here is the classic NASA video of an experiment to show the vortex produced by the wing of an aircraft. These wing vortices's can interact with the empannage of the aircraft producing unpleasant effects as well as interfering with the behaviour of other aircraft. This is a well known phenomenon among large aircraft and most people know there are separation limits that govern take off and landings for commercial aircraft, but this video shows that the vortex sheet produced by an microlight aircraft is enough to interfere with a second microlight.


Here are a couple of screen shots from the my wake code that predicts the wake produced by a small aerobatic trainer type, aircraft which myself and several of my classmates designed for one of our uni modules. After finding the wake, the Matlab code will also plot the wing, fin and tailplane geometries to see if the wake produced any undesirable effects on the tail surfaces. 


The two files at the end of this post are the script 'wingwake.m' and function file 'vortex.m' for the wing vortex model. You'll need to download both into the same destination folder but only the 'wingwake.m' file needs to be run, and you will also of course, need a copy of Matlab. I will one day modify the code to add in the effects of flap deployment and tidy it up with a GUI, but I don't have the time yet. I never have the time for anything these days least of all the interesting projects. I haven't touched my gas turbine dashboard for a while and I'm itching to get back to it. 
Talking of interesting projects, fingers crossed I will start a PhD in a few weeks looking at CFD of ships with a view to improving the design process with respect to the handling qualities of a helicopter during deck operations.. I can't wait!

WingWake.m
Vortex.m

Wild goose chase.

It is Tuesday night, three days ago, the night before an exam... This happens, true story..
My four year old niece decides she wants to play with the quails. I had bought my mother a pair as part of her suburban dream of starting some kind of farm in her garden. Anyway my niece inadvertently releases a quail into the garden which then takes an instant dislike to any efforts to catch it, and hops the eight foot high wall into the neighbours garden. My brother, father of the now crying child jumps the over the wall, meanwhile the quail finds his new garden is not suitable for its taste, probably a lack of storage and decides to fly, magnificently for a quail, the twenty feet over the alleyway into another garden which is perfect quail habitat. Four foot high weeds, brambles, nettles, grass, bricks and an outdoor toilet that would look good in trainspotting. Que an hour later after much careful poking, swearing, scratching, shaking twigs and false alarms, where I stalked and caught a dried up plant that looked suspiciously like a quail. Dammit.
All hope had faded until my brother poked the quail up its bum and it took off again, clearing another eight foot high brick wall and into another garden. I started to sense a pattern developing here that quails can fly and they can fly better than I can climb walls in my bare feet. Within seconds we are perched on top of the wall trying to see where it went, at which point the neighbours two dogs appear. They are mental, they are angry. So angry that my bottom hole relaxes slightly. Oh fiddlesticks, that's going to be one tasty quail sized snack for a dog.. Then a woman appeared and visions of having to explain myself to the police flashed through my mind. Surprisingly the woman who lived there didn't appear to be alarmed by one guy stood on her wall brandishing a children's rock pool net and another waving a broom and gibbering nonsensically with what only can be described as a gingery-brown afro, (I had washed my hair earlier that day, but didn't condition it, and now I'm paying for that with a beautiful, but inexplicable hairstyle, but I digress)... Two minutes later and the quail found himself in the back of the net and back in the run, the niece was suitably shouted at and I'm left with an arm full of scratches, an afro full of twigs and one pissed off quail...

Thursday, 26 April 2012

That'll Learn Em... (Warning, contains extensive rantings)...

I've never been one to do things the easy way and I always get more enjoyment from finding my own solutions to problems than relying on what others have done. I once spent months trying to get somebody to machine parts for me with a lathe with no luck. So I made my own lathe. It wasn't the most accurate tool I have ever made, but it was more than adequate enough to build jet engine parts, after some practice. That's the trouble when something seems impossible, you only realise how hard it was when you have accomplished it. I still haven't had the sense of whats possible/impossible beaten out of me by the education system yet, I have known a few students who just give up or think something is too hard to do and never even make an attempt. There is a whole culture that has developed in academia where attempting something and failing is viewed as wrong especially with some of the tutors who will throw up their arms and roll their eyes should a student answer a question wrong in class. I can't count how many times I have tried a new approach and failed, but I'd pick up the bits and try again. When I say pick up the bits, a lot of the time this is literally what happens, usually accompanied with flames and some blood loss, but that's another story.

I may have said this before, but I was genuinely surprised when I started uni in that there seemed to be hardly anybody else who did any sort of engineering outside of the curriculum in their own time. I have naively thought that naturally everybody else would be like me and they were not. I have since found out over the next few years that I wasn't alone and there was a handful of other people, I never saw a degree as a simple stepping stone into a good career like a lot of students, I just wanted to learn and to use what I learned to improve my own projects, which in hindsight was also somewhat naive. How well you do in a degree in aerospace engineering seems to me to be how well you can remember vast chunks of information and jumping through the right hoops rather than any real understanding of the subjects.

As you may have noticed I have been messing about a lot with data acquisition devices, and for more years than I care to remember. Not just DAQ's but jet engines, rockets, model aircraft, pulsejets ect. I built my first large solid fuelled rocket motor when I was sixteen. A couple years later when I found out that I could measure thrust with a computer and not the Rube Goldberg type contraption I was using that consisted of a felt pen, a set of fishing scales, a Meccano motor and a few other things and I never looked back. So you can imagine more than ten years of using DAQ's later, how much I was looking forward to a module in year two of my degree called 'Instrumentation' which was to teach me about DAQ's, load cells, thermocouples, strain gauges, piezo-electric accelerometers and so on. That excitement soon faded due to a tutor who showed zero interest and would do nothing more than read from a book. His exam was based on a set of notes over 100 pages thick copied from an E book, with two pages of the book printed on each sheet, front and back. I scored 43% and almost failed the module. Others who have the capacity to remember vast chunks of information got higher marks, but not by much. Am I bitter, of course I am, it annoys me that I have feel as though I have an understanding of the subject but because I was unable to state a vague equation from one of the hundreds in the book or draw precisely one of the many DAQ logic circuits out of the many available, that I have to feel as though I have nearly failed.

I know I am moaning, but the education system in the UK is rubbish. The standardisation of the curriculum means that there is no capacity for children to show their full potential. Some will grasp subjects earlier than others but are then forced to carry on at the same boring pace. Others may not excel at academic subjects but might show flair for arts subjects, which are then usually ignored. How many arts teachers does the average high school have? How many music teachers? Mine had one of each, yet we had several French teachers, maths teachers, science teachers and three computer teachers, this was back in the day when we were still using BBC Microsoft computers with 5" floppy drives!. Why aren't we encouraging what children excel at, rather than making sure they all get the same education which just penalises the entire country. Churning out vast numbers of children who are either disillusioned with the system or have been ignored and do poorly in their exams, yet we wonder why there are many reports of school leavers having ever reducing standards of maths and literacy.

Every level of education from infant school, high school, A-level and degrees are treated in the same linear manner. Easy things are taught first and they progress in difficulty with each year. At first this seems a logical method of teaching, but looking at my experiences in maths and science education, then it starts to fall apart. I left school with a D in maths GCSE Now I have almost finished an aerospace engineering masters degree which is more or less a maths degree in disguise. Thinking back I was almost constantly bored, preferring to read anything I could get my hands on in the libraries to doing my homework on memorising Latin nouns. I could have easily handled more complex subjects but the copying of paragraphs from textbooks was what got you the marks not your knowledge on geology. So why can't you teach high school kids about calculus, why wait till they do A levels? Why at degree level do we still have to work through huge mathematical problems that give the same nice round answers as the tutors marking scheme in order to get the grades to go onto to potentially design aircraft? Real world problems never give nice round answers, nor would you be expected to work through a problem from first principles in the real world. If you truly understand a mathematical process then you should be able to write a program to solve it, computers do not remove an understanding of the theoretical methods despite what some people say. I think we are approaching a cross roads similar to what happened when calculators were introduced and those who held the slide rule and log tables as the only 'proper' methods also thought calculators took away the understanding. More and more kids are teaching themselves how to program, so hopefully the tide will turn and the long, tedious days of solving neat problems in the back of an exercise book will be over. Computers are great problem solving tools, let them do the hard work!

DAQ To Labview

I've noticed a lot of hits on my blog have been from a Google search trying to couple a DAQ with Labview. I have briefly alluded to how I did this a couple of weeks ago, so I thought I'd go over it again in a bit more depth. This vi should run for any DAQ that uses a serial port or runs through a virtual serial port, I'm not sure how many of the DAQ's out there that do it this way though. Of course the easy way to do this would be to buy a National Instruments DAQ, but this would require you to sell a kidney as they aren't cheap. There are several DAQ manufacturers who will provide Labview vi's for their equipment and it's always worth investigating prior to buying one.

I have actually downloaded a few beginners guides to programming in Python, I am quite proficient at Matlab scripts, so it wouldn't take long to learn the syntax. Depending on how I progress with Labview and whether it can actually do the things I want without dragging its heels, I may end up scrapping it all together and write a dashboard program from scratch in Python. Another student at uni is in the progress of building a flight simulator with several screens and a true to life aircraft cockpit, and has built several virtual aircraft gauges using C++, so that's another option. My first impressions of Labview were favourable, but the more I try to use it, the more 'clumsy' it seems. But we'll see, and I will persevre with it for now.

Anyway my vi for the µChameleon DAQ looks like this, it is very simple when compared to other DAQ vi's I have seen. I have no idea if that is a good thing or not. Since this particular DAQ has firmware which creates a virtual serial port, it is 'easy' work to get it to work with Labview. I'm sure there are much easier ways to do this, but I have had less than twenty hours time with Labview, so I will gradually improve things as I go. I have labelled the vi with as many comments as I can think of to help, rather than try to explain every last step because pictures really do say a thousand words! The vi is based on VISA, (virtual instrument software architecture), and will find any device connected to the serial port).

Within the vi you may notice a small block I have labelled as a sub vi. This was a small vi I 'borrowed' from somebody else's program, I forget who's because I have downloaded so many and picked each one apart to see how it worked, but whoever you were, thank you!! But I digress, here is what is contained within the sub vi. I will get around to putting up a download link for my vi when its done.