New domain and blog

New domain and blog
Please head over to my new domain to view my blog and current projects

Thursday 24 May 2012

LabVIEW: Creating custom buttons

It's been something that I have been thinking about for a while but never really got round to trying. Creating custom buttons have a number of different applications and they are really easy to make.

To start off, you either need to decide if you want a button with an emblem (same image for true and false) or if you want a button that has a different image for true and false. You also need to find the images that you want displayed on the buttons. A good place to start is a clipart website like this one.


Download the images and then resize them. I use an image size of about 60px x 60px.
  • Open the LabVIEW start up window and under New, select More
  • Under Other Files, select Custom Control
  • We now need to place a button so we can change what it looks like
  • Place a button control onto the front panel
  • Select your first image by navigating to Edit >> Import Picture to Clipboard
  • Right click on the button and select Import Picture from Clipboard >> True/False/Decal
  • True will display the picture when the button is in a true state. False will display the picture when the button is in a false state. Decal will embed the picture for all states.
  • Do the same process to attach the next image for the other state
  • Save the control and then use it in a normal VI
That's about it. Pretty simple to create custom controls.

To download the example control, use this link.

Greg

Friday 11 May 2012

LabVIEW: Simple event structure

I searched everywhere to get an example or some help of a simple event structure and a state machine working together. I have used state machines extensively and really like the way they work but never tried implementing an event structure into it.

Here is a very simple state machine which runs through an initialising state and then sits in a running state. The event structure is in the running state and monitors the two button for a state change and also the close window button. 

Initialise button: Takes the program back into the Initialising state.
Stop button: Takes the program into the Stop state and then stops the program.
Close Window: Show a message that the program must first be stopped before it can be closed. Then takes the program into the CloseWindow state and then back to the Running state.


I am sure there are much better ways to perform this task so if you have any tips please leave me a comment. As soon as I find a more efficient process, I will be sure to update this post and program.

To download the example VI, use this link.

Greg

Tuesday 8 May 2012

The best thing to do for our health

Watch the video and find out how easy it is to get healthy and live a longer, happier life.



Go for a walk today and see how it feels. 

Greg

Thursday 3 May 2012

Specsavers Ironman South Africa

One day I will be back on the start line getting ready to run onto the ocean for what is called an IRONMAN triathlon. Until then I will just watch the race day video and get inspired by all those survivors.



Greg

LabVIEW: Sending an email to a gmail account

Logging to a database in a LabVIEW application has its uses, however sending test results as an email can also be very useful. Sending an email to a Google (gmail) account is relatively simple using .NET constructors.


By using the various constructors, an email can be sent using an existing gmail account. (Click here to get a gmail account.) The email can be sent to a recipient, carbon copied to a recipient and even have an attachment added. 

By using the VI as part of an application, any string can be written and sent as an email. I used this VI to email results for an automated test so that I could monitor its progress after each test was completed. Logging to a database is also very effective but sometimes it's easier to access an email account over accessing a results database.

To download the example VI, use this link.

Greg

LabVIEW: Reinitialise all indicators

There are times in a LabVIEW program that where you need to reinitialise all the front panel indicators and controls to their respective default values. I like to do this as the first step before the VI is run so that I know that everything is in a default state.

This can be done by using a property node for each indicator or control. With large programs this can become very tedious and add a significant amount of unwanted clutter.

There is another, easy way to accomplish this and that is to use a reference to the current vi and an invoke node. 


By adding this VI at the start of your program, all the indicators and controls are initialised to their default values. 

To download the example VI, use this link.

Greg


Chainring BCD sizing


I have wondered for a while how chainrings are sized. Even though I have been riding for years, I have never needed to replace one so I never realised how many different sizes and shapes there are.
 The number of teeth on the chainring and the number of bolts (4 or 5) is pretty easy to choose. This depends on what type of riding you doing and what type of cranks you have. The measurement that isn’t so easy is the Bolt Circle Diameter, otherwise known as the BCD, of the chainring.
The size that you need depends on the groupset and is sometimes written on the face of the chainring. If it is not, then the table below will help you determine what size chainring you need.


 Using a tape measure, measure the distance between the center of 2 adjacent holes. (See the picture) Then use that measurement to determine what size chainring you need depending on if you have a 4 or 5 hole crank.


 I hope this helps prevent multiple trips to the bikeshop with the incorrect chainring size.

Greg

Recipe: Tomato Bredie


One of my favourite meals is tomato bredie (stew). My mom used to make this from time-to-time and I used to love it. When I left home and moved overseas I longed to have a good tomato bredie so got my mom to show me what to do when she came for a visit. This is a perfect dish for any time of the year, but especially in winter to keep warm.

What you will need:

1kg lamb knuckles, stewing lamb, mutton (try not to get too small pieces as they will cook away)

2 onions
1 garlic clove
500ml beef stock
2 x 400g tins of chopped tomatoes
60ml tomato paste
4-5 large potatoes peeled and cut into cubes
½ teaspoon chilli powder
Salt and pepper to taste (I add lots of ground black pepper)

What to do:

In a large pot, brown the meat in some more olive oil. Then remove the meat from the pot and set aside.
Chop the onions and garlic and sauté in the same pot until cooked.
Add the tomato paste, chilli, salt and pepper to the stock and stir well.
Peel potatoes and cut into cubes
To the onions, add the meat, stock, chopped tinned tomatoes and potatoes.
Cover and once boiling, turn the heat down low and allow to simmer for about 90min or until the potatoes are soft.

Thicken with some corn floor if you prefer a thicker sauce. (I mix 2 teaspoons of corn floor with some water and add after about 45min)
Serve with white rice or couscous.


Tomato bredie freezes well and normally tastes better the next day once all the flavours have been absorbed into the meat and potatoes.
I hope you enjoy this meal as much as I do.
Greg