Thursday, November 3, 2011

Labview for Engineers

NI Labview's a great software package and in many respects considered better than its more established(among students specifically) rival MATLAB.But there seem to be fewer free resources to learn this and maybe thats why its lesser used.Or maybe I'm just wrong.

To get into this exciting world of Labview,I'm currently reading (& practicing) this book,titled 'Labview for Engineers',which is written in a nice and precise style giving you content at a good pace,minus the frilly words or the silly comics.So far,I'm about 2 chapters in,and its good.

More details about the book:
Title: LabVIEW For Engineers
Author: Ronald W. Larsen
ISBN: 0136094295
ISBN-13: 9780136094296,978-0136094296
Binding: Paperback
Publishing Date: Jan 2010
Publisher: Prentice Hall
Number of Pages: 391
Language: English
Dimensions: 9.8 x 7.9 x 0.6 inches
Weight: 726 grams

 (Details taken from its flipkart page)

I'm not saying that this is the best book to start with,there are tons out there,and if you know a few,feel free to leave details in the comments below.

Shape Recognition in MATLAB

This post is about something I contributed to a larger Neural Networks project.This isnt a proper tutorial on image processing,and the code discussed is also specific.And in my humble opinion,MATLAB isnt the best choice for Image Processing(OpenCV would be the way to go) anyway.Here it was the only choice since rest of the project was implemented in it.

The idea was to read an RGB Image which has the following characteristics:
-- 400x400px
-- RGB
-- has only one shape,any of a Triangle,Rectangle,Pentagon or a Hexagon,with a solid color fill.
-- has a colored background.

The project required my code to output:
-- The Identity of the shape
-- 2 Images,each of 400x400 px and each with a solid color fill,where one would be of the Shape's fill color and the other of the background color.

So heres my function .m file,all commented.It isnt very clean,and probably not very optimal too,processing wise.Its also not robust(then what use is it? :-/ ) so do tweak it for your specific application.If you spot any areas of improvement,do mention it in the comments below.

I'll briefly explain the shape characterization part,since the rest is pretty much straightforward and already commented.
I've used the Extrema property of the regionprops function and used the relative positions of the various extrem(a)e vertices to identify the shape.See the picture below for a better idea.

So,if we check for the equality(actually closeness of points.Since the left and right points detected will differ by a few pixels,even though the image is perfect.) of the extrema vertices ( whose co-ordinates are stored in the 8x2 Extrema matrix returned by regionprops) we can characterize a shape.

Heres the hexagon case:

Similarly,we can also see what extreme vertices are on the triangle,rectangle and other polygons.

Heres a link to the m-file (hosted on Google Docs)


Drop a line in the comments for any clarification or query.

PS:You can see the output of the different operations on the image using the imshow function.

PSoC3 Custom Board - PreFabrication

So I've finally gone ahead and frozen the PCB files for the prototype,after doing yet another batch of changes(placement,tracks and some more).I've also tried to improve the text and labels on the board.After running it through Sparkfun and SeeedStudio's Fusion DRU files,I'm convinced we're ready for running a prototype fab.
I've been posting updates over at the PSoCDeveloper forums and the DangerousPrototype forums.So you can view those threads too for tidbits and other people's take on it.
(click for a full size view)
Heres a link to the Pre-fab PCB files,linked over from the PSoC Developer forums.
(This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.)
 

Wednesday, October 26, 2011

PSoC3 Custom Board - Prototype soon

Phillip and I added few more changes,and looks like its finally ready for prototype.
Heres a shot of the board:
 click the image for a full size version

Drop a line in the comments if youre interested in the latest PCB files. 

PSoC3 Custom Board - Almost ready!

After my tests,I've finally got a chance to devote some more time to this project,so heres the result:
 click the image for a full size version

 I would like to thank Phillip Radner for his help and contribution to the design.

Changes:
-Added the top layer copper fill,connected to the GND net,
-Added test points for all the important voltage levels on the board,
-Fixed the silkscreen and added the OSHW logo :)
-Ran the ERC and DRC,and fixed all errors that came up.I used the sparkfun DRU for that.
-Minor placement shifts and such.

I should probably add extra vias between the 2 layers.

Drop a line in the comments if youre interested in the latest PCB files.

Thursday, October 6, 2011

PSoC3 Custom Board - More changes

 click the image for a full size version
Heres the latest view of the PCB.Many changes from the previous version,which I'll quickly list.
-Removed the external DC jack.
-Removed zero ohm resistors,and added solder jumpers(from SparkFun's eagle library).
-Added the ground plane,which is of the "GND" net.(GND net is the USB's ground,shorted with the VSSA and VDDA using a solder jumper.)
-Changed the type of USB connector,since I had a bad experience with a miniusb one.Too small to comfortably solder,with an thick iron like mine.

And yeah,I've decided on a name - "EzPSoC3".

I'm still waiting for confirmation from Cypress on the ground plane placement,but other than that,it seems ready :)

Drop a line in the comments if youre interested in the PCB files.

Wednesday, October 5, 2011

Part of the Day - Magnetic Reed Switch


A very simple and elegant non-contact switching mechanism,which can support currents upto 1.2A (but look into datasheets for part specific values).

The device consists of 2 ferromagnetic contacts,parallel and overhanging,encased in a glass case(much like diodes are.) They range in length from 2.0 inches long to as small as  0.025 inches long.When the device is in proximity of a magnet, the two ferrous contacts inside the switch pull together and the switch closes.So,not terribly great switching times(~1mS),but useful nonetheless.

Theres an app note and working description at Sparkfun,click here to read it.(PDF) They also have it in the catalog(here),and can be purchased for $1.50 a piece.

Common applications include sensors and alarms.They can also be used for checking orientation of various objects(which have some magnet attached,so proximity would turn on the switch) etc.

A very detailed writeup on them,at http://reed-switch-info.com/.