Tag Archives: cnc

CNC board and USB microscope

While in China I picked up a USB microscope for $25 USD. It’s an “2MP HD microscope with 600x magnification” according to the box and has 6 LEDs around the camera. I plugged it in and it was found right away by Linux as a video4linux device and works with VLC and Cheese. It’s been sitting next to my computer for about 2 weeks since I got back from China and I’ve been itching for some reason to use it. Tonight I made a small board on my CNC to test some new footprints and I thought it would be the perfect time to use the microscope to check out the cuts made by the bit. Using Cheese I was able to get some good shots of the PCB traces. The pictures are only 640×480, so I’m not too sure where the 2MP claim comes from.

I used my gcode_03 ULP script for Eagle (from my older site) to export the PCB to G-code. When I started working with the CNC for PCB routing I was using a 0.8mm end mill carbide bit, however I’ve noticed I get pretty clean cuts with a 30 degree “V” etching bit run at the max speed of my manually controlled spindle (Yes I know I need to find out the RPMs of that thing). The cuts made by the CNC are impressively clean and without burs. Each cut goes down 0.16 inches and the feed rate is 300mm/minute. The footprint is SOIC-8, the pads are 1.27mm x 0.635mm and the traces are 20mil. The cut is close to 0.5mm. The microscope did show what looks like copper particles in the track which was interesting to see. I’ve made a bunch of breakout boards and switch boards without shorting issues so I don’t know if these particles are big enough to cause a problem. Here are some pictures of the board using the microscope.

microscope image of board compared to a dime microscope image of the board microscope image zoomed in on traces

microscope image of cnc cut - two traces microscope image of cnc corner cut microscope image of cnc particles microscope view of SOIC-8 chip on pad

Reference PCB Business Card on a CNC

I’ve found myself in the situation a few times where I was trying to explain that PCBs can be routed using a low cost CNC, like the 3040 CNC I purchased on Ebay a while back.  Since I have routed dozens of PCBs this sounds obvious to me, however it is not very obvious to some of the engineers I have explained it to, it seems as if they can’t visualize what can be accomplished.  In those moments I wish I had an example PCB to show them.  Not to mention  a few times I was stuck without a quick way to measure small lengths, or I wanted to know the SMD footprint used for a resistor to see if I had one, or when I needed to compare the pin spacing of a cable to see if it is 0.1″.  A few days ago I found a post about TinkerRule, a reference PCB that could be used to solve pretty much all the engineering scenarios I just mentioned. I really liked what they did and it inspired me to see if I could make a reference PCB on my CNC in the form factor of a business card to fit in a wallet, that way not only would I have a useful tool, but I would have a demo of the capabilities of my CNC PCB router too!

It turns out that my small 3040 CNC is quite capable of making a 2.125 x 3.25″ PCB business card with a number of useful features, including an inch ruler, centimeter ruler, some reference traces, reference vias, reference holes, and  0.1″ grid.  The board also has 150 mil letters so it is easy to read.  Plus, since the single sided copper board I used is only about 50 mils thick, it’s only 50% thicker than a credit card, so it isn’t a noticeable addition to my wallet. This was the first pass and there are 2 missed sections, this was due to my setting of the router bit a little too shallow…things to fix on Rev 2.

20150103_153638 20150103_153645 20150103_223014

I have uploaded the Eagle PCB and GCode so anyone can download it and try and make their own: biz_pcb.brd & biz_pcb.ngc

I already have identified some things I want to change on Rev 2, any ideas or suggestions?

Serial LCD python code

A while ago I purchased a CFA533 TTL level serial LCD board from Crystalfontz for use with a project. The board has a 16×2 character LCD and 6 buttons with plastic pads arranged in a Dpad pattern. The unit talks serial at 19200 baud. I am ramping up for a new project so I decided to see what this little unit could do and how easy the command set is. The first order of business was to connect to the unit. I am not a fan of stripping tiny wires and soldering to headers, so I thought I would turn to the trusty CNC and make an adapter board. The LCD has a 5×2 header, takes 3.3v-5v, and since it is TTL it needs to interface with some serial adapter. I have a 5v FTDI 232R USB cable that would fit the bill for this, I also dug out some 10 pin ribbon cable, as well as numerous 5v wall transformers with 2.1mm barrel jacks. The board I came up with it pretty simple, 5V, GND, RX, TX all on a 2cmx3cm board.

The next step was to get it chatting with some software. I had some python code that was used a few weeks ago to talk to a PIC via serial so I thought I would modify that to talk the LCD protocol. The protocol is pretty simple, 1 byte for type/command, 1 byte for length, variable data payload and a 2 byte CRC16. The stumbling block came when I tried to compute the CRC16 for some commands. Python has always been a language where you could “import xxxx” and it just works, not so much with CRCs. The datasheet for the LCD says the polynominal used is 0x8408, I tried to use crcmod to define a generator however I kept getting errors about it being too short. Long story short, it appears that Crystalfontz is using a CRC that isn’t very common, so I took the example C in the LCD datasheet and made a simple python function which did the trick. I wanted to write this post so anyone else looking for this CRC could use it.

The final result is a quick command utility that allows python to control almost anything on the LCD.I also got the python running on a Raspberry Pi with pyserial installed. Here are some pictures of the effort as well as the Python code. py_basic_term.py

serial_lcd_pic serial_lcd_testing serial_lcd_interface raspberry pi serial lcd output