Saturday, August 11, 2012

Graduate school and xbee HOWTO

After many months applying for jobs and trying to figure out what I'm going to do next, Holley and I have both decided to go on to grad school!  I'll be posting about my ventures into the world of electronics design here starting with today. A part of my graduate project is going to deal with wireless communication and mesh networking.

That being said, I picked up a couple xbee modules and USB adapters to play with and get familiar with using them. Being a Linux nerd the majority of my time is spent trying to figure out how to make Windows solutions work in the Linux realm. Yesterday was no exception.




Here we have the xbee 900 pro digimesh something or other. It works on the 900 MHz band and claims a  range of up to 6 miles. Wow. That's way overkill for my needs but that is what was laying around the lab to play with. To my understanding all of the xbee products pretty much work the same with a few minor differences. I'll figure that out later down the road. First task is to get them talking.



I picked up two of the USB carrier boars along with the RF modules just so I could get them talking via USB and not have to worry about programming at first. After doing a little research I knew that getting them to work under Ubuntu wasnt going to be plug and play. The picture to the right shows the inhouse board the department made as well as an evaluation board from Digi.com. both work in Windows using X-CTU at a baud rate of 4800. X-CTU is the software utility that Digi uses to connect to and configure the xbee modules. Getting that up and running is a must if we want to do anything.



There is no Linux alternative to X-CTU so my first thought was WINE. Keep in mine I'm not particularly fond of WINE. It works sometimes and most of the time it doesn't. For this particular situation it does with a great deal of modification. I'm not going to pretend that I knew what to do to make U-CTU work but my googling skills are top notch. The following sites don't necessarily provide the working solution but go a long way to help piece together one that does. 


The problem with the wire.less link is that /dev/ttyUSB* is owned by root. So unless you run WINE as root all the time (dont do that) then you have to change the permissions of the device every time you plug on in. It possible and only requires one command but its a pain to remember all that. This is where the second link comes in. Its possible to set rules for specific devices. When they are plugged in you can mount them with a special name or in a special place or some other more complicated things. These are called udev rules. They reside in /etc/udev/rules.d/ . The hard thing is figuring out how to write these rules so that anytime you plug in an xbee it makes it readable and writable by users other than root.

Lets start with the easy stuff. First you want to install WINE if you don't already have it. The software manager of your distro will have it so go get it.

Nect go download the X-CTU installer from digi.com. Heres the link that I used.

Open up some terminal and from your home folder

cd /.wine/dosdevices

ln -s /dev/ttyUSB0 com5

ln -s /dev/ttyUSB1 com6

ln -s /dev/ttyUSB2 com7

ln -s /dev/ttyUSB3 com8

Those steps are literally cut and pasted from the wire.less link. What they do is link the COM ports windows normally uses to the /dev/ttyUSB ports we use in Linux. So when X-CTU goes looking for COM5 its directed to /dev/ttyUSB0 which is where it needs to be looking in Linux.

Now go find that .exe installer file we downloaded. Right click on it and set the permissions to executable. Then double click on it and let it install. It should do it automatically if you installed WINE correctly.

That was the easy part. Now we need to make it to where the user can go find and use /dev/ttyUSB whenever one of these devices is plugged in. I'm big on changing permissions as little as possible. Its easy to screw something up or create a security problem you don't even know about so I only want this to change permission when an xbee is plugged in. Otherwise leave it alone.

First thing you need to find an unique id to the ftdi chip that runs the USB converter.. This allows the computer to recognize the specific device the rule is for and not just blanket the rule over every device that's plugged in. I chose to use the vendor ID but you could just as well use the product or serial ID. I actually started with the serial ID but it would require an additional line be added to the rules for each different board. This is the most specific and secure but the least convenient. 

Open up a terminal and

udevadm info -a -p $(udevadm info -q path -n ttyUSB0) | egrep -i "ATTRS{serial}|ATTRS{idVendor}|ATTRS{idProduct}" -m 3

Write the values that come up. My idVendor was 0403. If yours is different youll need to change that in the rule.

So next we want to create the rule file. In the aeturnalus link they names their rule file 10-ftdi.rules. After doing some reading I saw it was recommended to name the rule file with a letter first so it is read last and overrides any previous rule. This makes sense due to the fact that the computer would read files starting with numbers first. So the next line is slightly different that what is seen in the aeturnalus link. 

Open up a terminal and

sudo touch /etc/udev/rules.d/ftdi.rules && sudo chmod 644 /etc/udev/rules.d/ftdi.rules

This is two commands in one line. it creates the file as well as modifies its permission. Next we want to add out rule to the file. Ubuntu uses vim and kubuntu uses kate to do text editing so pick your flavor. Im using kubuntu at the moment so

Open up some terminal and

sudo kate /etc/udev/rules.d/ftdi.rules 

This should open up a graphical text editor with a blank sheet in front of you. Don't panic. We just created this file. There shouldn't be anything in it.

cut and past this line in the file

KERNEL=="ttyUSB?", ATTRS{idVendor}=="0403", SYMLINK+="XBEE", MODE="0666" 

If you idVendor was different you'll need to change that here. 

Finished. Thats it. Now every time you plug into the usb port with a xbee through an ftdi chip it should set the permissions so that X-CTU can read from it. Here's a final shot of my Linux laptop communicating to my windows machine through a pair of xbees.


Friday, May 25, 2012

Found a couple spare moments!



Man, I uploaded these pictures from my phone to an unpublished blog post back in March.... Its now May if you haven't noticed. They need to hit the web though. This is a 3" interlocking cube that I designed with an interference fit. It worked and it also taught me that the Geko drive needs a cooling source or it will begin to skip steps. When I say cooling source I really mean a box fan that I put under it.






Ive forgotten what all Ive talked about on here but this is the newest purchase and build that Ive done to the CNC. Its a Porter router and DIY mount that works very well. I still have the mount for the smaller Rotozip router. I'm hoping to be able to use the smaller setup to make PCBs but I haven't been successful yet but that's mainly due to a couple of variables I will go into more detail in a later post.




In the upcoming weeks Ive got a new project I would like to start tossing around in CAD. I'm thinking about designing a boomerang. I used to make them by hand when I was young and this sounds fairly simple. I also have some pictures to throw up of a bio-reactor that I designed and cut out for work.. That design may have alternate uses in future projects. All in all, now that graduation is over, school it out, and my internship at ORNL just ended, I should have a nice amount of free time on my hands.

Ive also registered the CNC on www.HomeCut.org. Thats a cool site that allows you to register your CNC so others can contact you with project ideas. Pretty cool. That's it for now. Go build something.



Saturday, February 4, 2012

Stop the CLOCK!!!!!!!!


34:23:33:33
DayHrMinSec






That's it! I have met my goal. I am almost a full 34 days past due but I'm finally there. A lot has gone on in the last two weeks so let me hit the highlights of that real quick.
I got the new hardware in not last Friday but the Friday before. As you can see I took a shot of the new motor vs. the old one. Its almost twice as large. I got all the hardware hooked up and installed the latest version of Linux CNC ( formerly Linux EMC) and did what anyone would do in their right mind. I found some double sided tape and a Sharpie and hit play. It came out twice as large as it should and reversed in the X-axis. Both easy fixes in EMC. I kept the rev per inch on the rod at the default of 20 in order to keep things nice and big since I had a whole poster board to work with







I played with a couple other test files including a couple spiral patterns and a snow flake. It was the greatest feeling on earth to see this thing run.


I spent several hours just going through the software and getting acclimated to the controls and which direction was what on the screen as opposed to on the table. My dad hung the posters from the wall in the garage like I was in kindergarten. It awesome. My parents weren't my parents during that period of my life so its fair game now. That was all the excitement I could handle last weekend.


I spent the entirety of last week thinking about the CNC. It was so bad I had dreams about it. I kept looking at parts from my small engines class and thinking if I could draw them up in AutoCAD. I picked up a copy of MasterCAM and installed it. Sadly there is almost no information on how to use it. There are two or three books on Amazon, a couple online classes you can pay for, and a couple DVDs you can buy but nothing for the person that's not sure what sources of information are really good and which ones are garbage. I finally came across this site;


Those are free PDFs and are extremely well documented. They have window screen shots, button screen shots. Its simple to follow. I cant imagine how long it took to create them but man am I glad that I found them. I ran through a couple of the first CAM guides and waited for the weekend to roll around.



Once it did, we built a mount for a supercharged Dremel looking tool. Its made by Bosch but I didn't thing it was going to handle this job. I was glad to be wrong and another moment even better than what I mentioned came about. I crossed the line that I set for myself shortly after starting this blog. I cut a tangible object.  I cut an EMC logo in the double size and then recalibrated to cut a logo in a one-to-one scale. The one-to-one scale is sitting in front of me as I type. I may sleep with it under my pillow. The larger one stayed with my dad and I wouldn't be surprised to find it hanging on a wall somewhere the next time I go over to my parents place.

Here's a video just to show off. Enjoy the screaching sounds. I wanted to cut the sound and have it be a silent film but apparently that's not an option. YouTube should get one that but until then turn the volume down.

Where to now that I've met this goal? Well I'm going to take it all apart and sell it for scrap....Nope. Not even funny. Even as I look at the screen I'm not laughing. Well I've got some ideas. I'm thinking about making an enclosure to hold all my air ride equipment and sound equipment for the Blazer. Im also thinking about guitar bodies, and missing dashboard buttons, and signage, and random small engine parts.

Tuesday, January 24, 2012

Short Update!

 
23:14:07:13 passed the deadline

I'm now five hundred bucks poorer! Why am I sooo excited about that you ask? If you'll take a look at the nice picture on the right ----------------------------->

You will see that the money will soon be converted into a set of three high torque stepper motors, a Gecko g540 motor driver, and a matched power supply to get this party started! Hell yeah I'm excited. This should make getting up and running a lot easier. No more dealing with the Arduino and those tiny tiny stepper motors I was playing with. On a side note I will most likely be building a 3d printed or something smaller when I get the CNC up and running. So in the end those stepper motors will have a home....even if I end up selling the whole thing.

For those wondering, I got the job at ORNL and that's the main reason I have the excess financial funding needed to acquire these final pieces. There are upsides and downsides to this deal though. The upside is that I have a job and am being paid good money. The downside is that this is only a spring term internship with the possibility of extension. So the hunt is still on for a permanent job once I graduate. I've got some leads but nothing solid at this point. Fortunately my resume is getting full of all kinds of different and important acronyms that make me a strong candidate for many positions.

Tip for those looking for a job in the science/research field. Mention specific instruments you have worked with in your resume. HPLC, GC, NIR, Bioflo reactors, Fermentors,  Mills, etc, etc. It tells the reader what kinds of things you can already do and also says that someone trusted you with high dollar research equipment.

More to come when it unfolds.

23:14:20:37 passed the deadline