Thanksgiving Break Update

I'm back home for Thanksgiving break so I can take pictures of all the things I've been working on.

I finally finished assembly the free pcb from Dangerous Prototypes, the Bus Pirate.  It took me awhile since I forgot to add the FT232 chip to my shopping cart and didn't want to place an order for just one chip.  Any way I burned the bootloader onto the PIC and them uploaded the latest firmware.  Everything checked out.  I'm looking forward to using it.

Another website that does free PCB Fridays is teholabs.  I had tried a couple times but was unsuccessful.  Two Fridays ago I tried and I got email the next saying I wasn't one the chosen but I could have one since they liked my blog.  Bonus points for having a blog!  The board that I got is called the Cygni and it is a dev board for the LM3S3N26, which is ARM Cortex M3. So I placed an order for the parts (and the FT232 chip since I finally had a reason to order parts) and about a week later I had the board and the parts.

I have become quite good at surface mount soldering after soldering the Bus Pirate and my Mechatronics board.  Surface mount chips go on in a flash with the drag soldering technique.  I still find 0603 components to be the most difficult.  I guess I just haven't found a good technique yet.

I haven't gotten a chance to program the Cygni yet since I don't have a JTAG programmer but I'm looking into using the Bus Pirate as a JTAG programmer.  I'll find a way to program it.





Soldered some QFNs, No Big

Use your imagination to transport yourself back in time to 3 weeks ago.  Have you done it yet?  Ok good.  Now you can read the post.

The board is all soldered up now.  The 28 pin QFN(Quad flat no-leads) gyros were a slight pain in the neck to solder but having a hot air rework tool helped tremendously.  The 16 ADXL335 went on easy and I think made me a little over confident when I started on the gyros.

Here's a little run through of how I soldered the chips on.  I first tinned the pads on the board.  I then applied some flux and placed the chip, lining it up as best I could.  I then started to apply heat with the hot air tool to preheat the board and have everything come up to an even temperature.  The tool was about 2-3in off the board at this point.    Then after roughly a minute of 'soaking,' I lowered the tool to ~0.5in to get the solder to flow.  Once the solder has flowed you can tap the chip very gently and it should snap into to place.  The accelerometer did this much better than the gyros.  I think it was because the center pad on the accelerometer.  I tried to only have the tool in this stage for a max of 30sec.  By doing it this way, it kind of follows the reflow temperature pattern from the chips datasheet.  After doing this a couple times, read another guys blog and he said that he doesn't do the preheat stage and just heats the area from ~0.5in until the solder melts.  I don't think that he has killed a chip doing it that way.  That way is certainly much faster and it is how I have done it since.

Once those sensors were on the board I wrote some A/D code for the PIC. That turned out to be a little more complicated than I was expecting. The A/D on the dsPIC is so versatile that it is hard to setup for basic operation.  Further down the road, I'll definitely take advantage of the more complex functions. I read good values from the accelerometer, however the gyros were outputting roughly .3 volts over their zero rate output.  I thought I had killed the chips or something but the they would still response to rotations.  It turns out that since I was powering the board through 3.3v from the PICKIT that I was only powering the digital side of my circuit and some how the analog voltage regulator was getting voltage.  I'm not sure on what was actually happening but the only way that the regulator could get power was if voltage went through the digital regulator backwards and then to the analog voltage regulator.  Once I realized this, I fed the board 5v at the correct input terminals and everything was now happy.

My group members are finishing up the hardware interfacing code and we are starting the design of the main control code.  We have roughly a month left in the quarter to finish this project.  That be plenty of time unless we have any major hiccups.

You can now come back to the present.  The board(s) are still working and the code is almost finished.  All that's left is some controller interface code.  I don't remember if I mentioned it or not but we are doing a ball copter now since we didn't want to try to get our stabilization code to working on the ornithopter.  We descoped the project.  The ornithopter is still coming in the future.

SNES to USB board revision

I finished another revision of the board.  I made it a little wider to allow for a slightly improved layout in my opinion.  Also that off center USB connector was bothering me.


I think it looks pretty good.  All that's left is adding the silkscreen.  

Here's a quick update on my mechatronics project.  I got the direction cosine matrix algorithm up running.  The DCM basically represents the orientation of one coordinate system to another.  This PDF was a great help in explaining what a DCM is and how to calculate it from gyro and accelerometer inputs.  Since we don't have a yaw reference like gps or a magnetometer,  the DCM drifts around the yaw axis.  That is fine for our project but if we were trying to do any sort of navigation then we would need a yaw reference.  We have roughly 2.5 weeks left to finish the project.  We have a little more coding to do and we have to build the platform.

SNES to USB PCB Design

So I went ahead designed a PCB for SNES to USB adapter I made last weekend.  This is a lot cleaner that the protoboard.  I broke out all the pins so that I can use the board for other purposes. 

First revision.  Still need to add the silkscreen and copper pour to the bottom.
I'm going to use the attiny4313 so that it will have a little more memory for projects that need.  I'm using Sparkfun's method of using blue LEDs to limit the D- and D+ lines to ~3.3 volts.  That works because blue LEDs have roughly a 3.1 voltage drop.  It may not be the best solution but it will be cool to see the LEDs light up when data is transferred.  If it turns out to be a bad idea then I can easily them out for the more standard solution of using 3.6v zener diodes.  This will get sent out at some point soon.  Most likely after another revision(s) of the layout.  I'm thinking about using iTead/Seeed Studio again since they have super cheap prices but I'll have to wait some time for the boards to arrive which is fine.

I'm still learning board design and would appreciate any design tips and suggestions that any of my readers can offer. 

Time to get back to coding my mechatronics term project.  I'll have an update post for it soon.

Back to the Beginning

I think the SNES to parallel port project was the first project that really got me into electronics.  It wasn't hard but it was still challenging since I didn't really know what I was doing.  Well I've come fully circle now since I finally got around to converting my SNES controller to USB.  I even used the same controller that I used before so now it has a parallel port and a USB port in addition to SNES port.  Talk about multipurpose! 

I tried doing this project a while back but I looked a project that used V-USB code and thought it was going to be too hard.  If I had actaully looked into a little further and read the actual driver files, I would have realized that it wasn't as hard as I thought.  Well I did just that this time.  I sat down and read through the driver source and header file and the examples.  That made everything so much clearer.  Shoulda done that in the first place.

Anyway I read up on the V-USB code and after I understood it better I looked at other projects.  I also looked at how to write HID descriptors since I was going to be implenmenting the SNES controller as a HID gamepad.  That way I didn't have to write/find a driver that would allow me to use the controller.  This is a great tutorial that helped me a lot.  Once I got the code to compile without any errors I moved onto the building the circuit.  Oh yeah I'm using a attiny2313 for this.  It's pretty awesome that the code is under 2k.  Right now my code size about 1650kb with my controller read function which isn't that big.  Supposedly the V-USB code size can be from 1200-1500kb.  That pretty neat that you can implement USB into these small micros.

I had to make a quick run to radio shack before I soldered the board since I didn't have any 68 ohm resistors.  The schematic I used is similar to the one on V-USB's website except it's sketchy and needs to be redone.  I managed to solder the board up without any shorts or bad connections.  Once I was confident that it was in working order I programmed it and plugged it into my computer.

Errrrrorrr.  It didn't recognized the device.  I went back to the code and tried to find where it was going wrong.  I tried a few things and got errors.  So I went got some example code for a HID mouse and loaded that.  This time it worked when I plugged it.  So I compared my config file with that config file to see if there were an drastic differences.  I couldn't find any.  So then I thought it might be the HID descriptor, so I made a simple one.  That didn't solve the problem.  This debugging went on for a while but I eventually solved the problem.  I think I narrowed it down to having a mismatch between the length of one the config strings and the #define of the length value. 

It works great for being a quick weekend project.  The next step is to design a nice PCB for it so that its not as janky.

TL;DR Converted SNES controller to USB. Gonna make a PCB next.

Recent Posts