12 Feb

Programming the SaBLE-x (CC2640)

This guide will walk you through programming the CC2640 (SimpleLink ultra-low power wireless MCU for Bluetooth Low Energy) from Texas Instruments. This will also work for any module that is based on this MCU, such as the SaBLE-x from LS Research. For the example provided in this post, the inexpensive SimpleLink SensorTag Debugger DevPack ($15) will program our SaBLE-x breakout board.

The SensorTag Debugger DevPack (the programmer) has the standard smaller pitch ARM JTAG connector, as does the SaBLE-x breakout board. We must now correctly determine the orientation of the programmer, since pin 1 is not marked on the programmer.

Programming Connector Orientation

In this situation, one naturally looks towards the documentation. As is often the case, the documentation can be very difficult to navigate and the information you need is not readily available. The correct documentation can almost always be found with a bit of tenacity and experience. In this case, the following documents from TI were helpful (or not so helpful) in determining the correct orientation of the programmer:

  • DevPack User Guide – This was not particularly helpful, however it does clearly indicate what programming software is needed to flash the firmware.
  • DevPack Product Page (Technical Documents) – A list of relevant technical documents that may be able to answer our question.
  • DevPack Schematic – This does not answer our question on orientation. However it does confirm that the signals on the programming header (J2) match the SaBLE-x breakout board.
  • DevPack Design Files (zip) – The design files often contain useful information. In this case, the assembly document should contain the orientation of the connector we are interested in (J2), but it does not. Digging deeper under the “PCB” folder, the Layout pdf has what we need.

The programming connector schematic and pinout for the SaBLE-x breakout board is shown on the left, and the programming connector for the DevPack is shown on the right. The connectors are mirrored, which makes sense given that the DevPack connector is mounted on the bottom of the board rather than the top.

The layout pdf in the design files does not contain a label for pin 1, but it does show where the ground connections are (red box). This is enough for us to ascertain the correct orientation of the programming header.

Programming the SaBLE-x

Download and install the SmartRF Flash Programmer v2 from the TI website.

Connect the DevPack to the SaBLE-x breakout board as shown below. External power is needed since the programmer does not provide power to the breakout board (as you can see from the schematic). I use a 3V source from an old LaunchPad programmer. I also make sure to power the breakout board before plugging in the programmer with the USB cable.

Upon opening the programmer software, the DevPack should be automatically recognized. A firmware update may be required to use the DevPack. For me, it actually took two tries to get this to work. I simply had to unplug and replug the device in. This was also true for the software recognizing the CC2640. The first time I connected to the DevPack, I was unable to see the SaBLE-x module. Removing the power and unplugging the system seemed to do the trick.

You can now choose your firmware image from your disk (created through Code Composer Studio or IAR) and program away!

11 Dec

Hardware Breakout 2.0

I am very excited to release the new Hardware Breakout store and blog! The new website combines our store and blog into a single site that improves the layout, while increasing security for our customers.

By encrypting the new site with HTTPS, our entire checkout process is secure. This has enabled us to offer new payment gateways during checkout. You can now pay with Stripe and Amazon Payments in addition to PayPal.

Keep an eye out for new products over the coming weeks and be sure to check out the new services that we offer. If you have any questions about the website change or our services, please feel free to contact us.

Thank you for choosing Hardware Breakout!

07 Sep

Organize Components the Easy Way

Sooner or later, everyone struggles with organizing their components. Creating a single system for surface mount devices, through hole components, larger components, and everything inbetween can be a daunting task. This post describes how I organize my system and gives you all the tools needed to organize yours in a similar fashion.

I have tried countless different ways of organizing my components and still have remnants of these systems cluttering up my home lab. Old through hole storage cabinets like this one and this one, do not work well with surface mount devices. Even when using small component storage boxes, I seem to always have trouble remembering the less common properties of my components (such as capacitor voltage ratings). I never remember what voltage or wattage my components can be used at. Furthermore, when I run out of a part, I have to spend a lot of time finding what to replace it with (because of course I didn’t write down the part number somewhere easily accessible).

After reading about a system on Hackaday which uses small envelopes to store SMD, I decided to make my own system for labeled envelopes. Over time, I will be converting all of my components to this new system which uses envelopes and labels with QR codes to organize everything. As you can see in the picture below, it is super easy to expand and find all the parts you need.

system

Coming up with and sticking to an organizational system for your electronic parts can be very difficult. Plus, I am always ordering new parts or I cannot find a specific part that I already have to order more. This system is simple to use and stick with.

Rather than convert all of my parts to this system in one go, I found it easier to start with a large order from Mouser. The key to this system is a spreadsheet which has all of the information for the parts you ordered. It takes a few minutes add each component to the spreadsheet when a new order comes in. Using Excel and Word, labels are automatically created and can be printed out with almost no additional effort. Continue reading for a quick overview each file.

Features:

  • Requires only Excel and Word
  • Automatically creates a QR code for every printed out label
  • Stores part numbers and specificiations
  • Links to the suppliers website
  • Requires very little storage space!
This system allows you to keep track of everything. Rather than trying to look through your order history when you run out of a part, simply scan the QR code and it will automatically bring you to either Mouser, DigiKey, or a Google search where you can find and order the same part.

The smaller parts are stored in small envelopes which can be stored in an envelop box (or really anywhere). Larger components, and components which require ant-static protection go into a larger folder (the the picture above). This makes finding the chip you need infinitely easier and more manageable.

The Word and Excel files (see the end of the post) are all that you need to create your own custom QR code labeling system. Use them and modify them however you see fit!

It can be quite daunting figuring out a way to automatically embed a QR code for each label, but hopefully you will find my example useful. The information for the QR code is combined in Excel into a single URL. This URL interfaces with Google’s QR code API to create the QR image in Word (see the image below). Google’s API is quite easy to use once you figure out how to format the URL and information. Hopefully you will find my example files useful.

The magic happens in the Word document. Using mail-merge, the labels can automatically be generated from the Excel spreadsheet.

Once everything is ready, the trick for generating the final labels is to click on “Finish & Merge”, then click “Edit Individual Documents…”. This will create a new document for your labels. Be sure to update the QR fields in this document by pressing “F9”. You can now fix any layout issues, such as reducing the font size on lines which overflow and mess up the rest of the labels.

How do you organize your parts? This project could easily be expanded using Python to create a full fledged parts management system if need be. Enjoy!

Files:

29 Mar

DIY Laser Cutter for PCB Stencils

Introduction

Are you sick and tired of using a tooth pick to apply solder paste? Are you still using through hole components because you don’t want to deal with soldering surface mount devices (SMD)? If so, this post provides you with guidelines for building your very own laser cutter for cutting PCB stencils. With a total cost of approximately $200 (it can be significantly less if you already have parts laying around), this project can pay for itself very quickly. While you can get “low cost” stencils for your PCBs, they still can be quite expensive if you are only creating one or two boards.

The laser cutter can cut very accurate stencils from adhesive backed black vinyl sheets (on Amazon) for ICs with a pitch of 0.5mm (SON-10) and 0402 resistors (and possibly even smaller parts). These stencils are disposable and so cheap that you do not have to worry about using your stencils on one or two PCBs.

laser-cutter

It gets better. You can use your RepRap as a laser cutter. All you need is a laser, a laser driver circuit board, and updated firmware (see below). While I built my laser cutter to be a laser cutter and not a 3D printer, I still used the RAMPS for the electronics even though it was built for the RepRap.

Before going onto how I built the laser cutter, I want to give you a quick overview of the design flow once everything is up and running:

  • First, I create a circuit board and order it from either Seeedstudio or OSHPark.
  • Next I make sure I have all the components I need. I personally prefer ordering from Mouser.
  • Once the boards arrive, I export the gerber files for the stencils from Eagle CAD using a simple CAM processor.
  • I then run a custom Python script which reads a gerber file and outputs a G-code file that the RAMPS electronics can understand.
  • Using pronterface (a RepRap interface software), I control the laser via G-code creating the stencil
  • A few minutes later, a perfect stencil has been created!
  • Using a credit card or razor blade I apply solder paste to the board.
  • I then manually place the parts using tweezers (sadly I do not have a pick and place machine…. yet).
  • Finally, I carefully place the populated board in my toaster oven reflow oven.
  • Approximately 5 minutes later, a perfectly soldered surface mount PCB is ready to be tested!

It has literally never been easier to build a custom circuit board. One of the best parts of this project is that most of the software needed was already written. This makes it VERY easy get going once the build is complete. Never reinvent the wheel if you can help it! That being said, you can buy a cutter/plotter for $200 on Amazon and make stencils that way. I believe that I will be able to achieve significantly higher accuracy with no software magic using my custom laser cutter. This is a much “simpler” alternative that may not provide as good results for approximately the same price.

Parts

The Build

While I can give you a full parts list, I do not believe that it is necessary. I built my frame out of birch. In hindsight, I should have used a different material such as plexiglass or metal. After I was finished, Adafruit started releasing parts which would have made the whole processes so much easier. Check out their CNC category and use them to build a two axis device. That is what I recommend if you are starting from scratch.

rails

Where do you buy parts? Lowes, Home Depot, McMaster. It does not really matter, just make sure everything fits together nicely. For my device, I used 8mm smooth rods and 1/4″ threaded rods for both axis. I learned a lot from when I built a RepRap a few years ago (sadly, I sold it, otherwise it would have been the base for my laser cutter), which made the whole process a lot easier.

One trick which I will share with you, is what to use for the drive nut. Sure, you can spend tons of $$ for ACME rods and anti-backlash nuts, but I do not think that it is necessary. In Lowes (and I assume Home Depot), they have whats called a “Tee Nut”. I used the pronged version since I just hammered it into a piece of wood which was glued to each carriage. Get the longest one they have in stock that fits your threaded rod. The longer the nut is, the less backlash there will be. Spending less than $5 at Lowes sure beats spending over $50 on something you really don’t need.

drive-nut

I highly recommend buying your smooth and threaded rods from McMaster Carr and spending a bit extra money to get higher quality ones. While you do not need the best of the best, having high quality smooth rods can make all the difference.

As for the bearing and motor couplers, eBay is your best friend. See the list above for which ones I used. Make sure you buy linear bearings and flexible motor couplers. Also, make sure that your smooth rods are perfectly aligned in your frame, otherwise you will have problems. At the end of the build, you should have something with at least two axis. While you can use pulley driven carriages, they will not provide as much accuracy as threaded rod driven carriages.

The best source (in my opinion) for motors and motor drivers is Pololu. You really can’t go wrong with them. See the links above for which steppers and stepper drivers I used. An additional way to save money, is to buy NEMA-14 motors rather than NEMA-17 motors. As we are not building a large 3D printer, the extra power is not necessary.

Laser and the Laser Driver

The biggest difference between this and a RepRap is the laser (obviously).  As such, you will need a laser and a circuit to drive the laser. The laser I used was the LPC-826, which can run up to 400-500mA and is widely available on eBay. I have found that you only need about 300mA (or even less) to make the perfect cut in black vinyl. This laser is available on eBay for about $10. If you have extra money in your budget, I highly recommend getting a blue laser or even a green laser rather than a red one. Why? Lasers with smaller wavelengths are better at cutting.

WARNING: IT IS VERY IMPORTANT THAT YOU ALSO BUY LASER SAFETY GOGGLES IF YOU USE A LASER IN ANY WAY SHAPE OR FORM. Looking at this laser can cause you to go BLIND. They don’t call it irreversible eye damage for no reason. Please, be safe. Do not attempt this project unless you know what you are doing, it can be very dangerous if you are not careful.

Once you have purchased your laser, be sure to pick up a focusable Aixiz module and glass lens. The glass lens will let you focus your laser better, creating thinner cuts. I have found that my stencil’s accuracy is not limited by the mechanical system or the electronics, but rather by the optics. My lens does not focus as well as it should which limits how thin my cut can be.

Laser Driver Schematic

Laser Driver Schematic

This schematic is based off the LM317 and is in essence, a constant current source. The current output is controlled via a 100 ohm trimmer which has a 2.7 ohm resistor in series to limit the maximum current that can be sent to the laser diode. Additionally, the current source can be turned on and off via a MOSFET controlled by the Arduino. You really want to be careful with powering your laser diode as they can be blown very easily. The final circuit board is shown below. If there is enough interest, I will start selling the blank laser driver boards in the Hardware Breakout Store.

Electronics (RAMPS) and Firmware

As I previously mentioned, I use the RAMPS electronics which was originally created as an Arduino shield for the RepRap. Instead of using all three axis, I simply used the first two. Be sure to also hookup the endstops, I highly recommend that you use the mechanical ones rather than optical ones. I also did not populate any of the MOSFET drivers or thermistor parts. All in all, it was an easy and cheap build.

Partially assembled RAMPS electronics. This is all that is needed for the laser cutter.

Partially assembled RAMPS electronics. This is all that is needed for the laser cutter.

To hook up the laser board, all that is needed is the AUX-2 header. This has the necessary connections needed to control the laser, an extra digital output (D42) and GND. Modifying the firmware proved to be just as simple as everything else. I simply needed to add a few lines of code for the laser to be supported via custom G-codes. I decided to use the code M52 to turn on the laser and M53 to turn off the laser. Place this code in the Sprinter.pde file at line 725:

// M52 Turn on LASER
case 52:
    WRITE(LASER_EN, HIGH);
    break;
// M53 Turn off LASER
case 53:
    WRITE(LASER_EN, LOW);
    break;

Be sure to calibrate your firmware as well by inputting the correct steps/cm into the configuration file. Please note, there are a few other changes that need to be made to the project. See the files list at the bottom of this post to download the Arduino project (RAMPS Laser Firmware). One final tip, use Arduino 0022. For some reason I had trouble with the newer versions when using the RAMPS firmware.

Software – Eagle Output and G-code

Here comes the most interesting part of the whole project. The goal is to make it as easy as possible to print stencils, in essence, I wanted only one step between Eagle CAD and usable G-code. First I use a CAM process to create a gerber file from the cream layers directly in Eagle CAD, this is fairly standard. The top layer must be mirrored for it it to work correctly.

To create the G-code I found some Python code which can convert gerber files to G-code, pygerber2gcode. While attempting to modify this code to convert gcode which the RepRap firmware would understand, I decided to gut the whole code and rewrite some of it. All the difficult parts were already completed in pygerber2gcode; all the credit for reading the gerber files goes to author of this project.

The modified code will read in a gerber file and output gcode to the specified file, which the laser cutter can directly understand. I am not a Python expert, so the code leaves a lot to be desired. It works just fine for me though, and I believe that it is structured in a way that allows it to be easily modified. In the future, it would be interesting to calculate the optimal size of the shapes to account for the material and laser used.

My code has been uploaded to github. Please feel free to modify it as needed!

Calibrating

The most difficult part of this project was getting the laser cutter calibrated. This was difficult because you need to get the perfect balance between focus, power to the laser, and cutting speed to get the ideal cut. At first, I had the power turned up too high, this resulted in poor cuts due to the vinyl melting around the cut.

It turns out that the lens for my laser does not focus as well as I had hoped. This causes the laser to be wider than it is long, resulting in the cut being thicker in one direction than the other. Reducing the lasers power also helped minimize this issue. I ran quite a few tests to determine the best speed and laser current.

By taking the stencils and putting them on a white piece of paper, it is easy to see how well each cut was made. Be sure to keep track of your settings!

By taking the stencils and putting them on a white piece of paper, it is easy to see how well each cut was made. Be sure to keep track of your settings!

Results

Here are some of my results. I am VERY happy with how everything came out.

This figure depicts the steps needed to fully assemble a board. No touch ups were needed. The board was soldered in my reflow oven toaster oven. Be sure to click on this picture and zoom in so that you can see everything clearly.

This figure depicts the steps needed to fully assemble a board. No touch ups were needed. The board was soldered in my reflow oven toaster oven. Be sure to click on this picture and zoom in so that you can see everything clearly.

This is another board that used the laser cutter. It is a CC430 access point which uses the SON package from TI.

This is another board that used the laser cutter. It is a CC430 access point which uses the SON package from TI.

This is another example PCB that I soldered using a vinyl stencil from this laser cutter.

This is another example PCB that I soldered using a vinyl stencil from this laser cutter.

Concluding Remarks

I believe this to be a wildly successful project. While there is room for improvement, it works more than fine for my purposes. The most difficult part of the whole process is aligning the stencil on the circuit board. Check out github for all the files needed