arduino, IOT, Making, PCB Manufacture

Upload a sketch to an Arduino UNO with bluetooth using the Adafruit Bluefruit EZ-Link breakout

I’m working on ways to make my Arduino UNO communicate with my Raspberry Pi 3 over a serial connection, and I’ve used a USB cable to connect the two devices together.

But because the Type-B USB connector on the Arduino is being used, I don’t have a convenient way to upload sketches to the Arduino UNO from my development machine.

I can obviously disconnect the USB connector from the Arduino UNO and connect it to my development machine, but this gets kind of old after a while, and I’d like an easier way to upload sketches.

So I dug deep into my box of electronic bits and pieces, and fortunately found I’ve got another way to do this – I can add bluetooth capability to my Arduino UNO with the Adafruit Bluefruit EZ-link breakout board.

First connect the board to the Arduino UNO

I could have done this with wires and a breadboard, but I decided to make a custom shields with some copper clad PCB board and my Shapeoko.

WP_20170803_11_23_20_Pro

Fortunately there was very little soldering to be done on my custom PCB as my soldering could be better!

WP_20170803_11_23_35_Pro

 

I designed the PCB according the pinout recommended by Adafruit, which is:

EZ-Link Arduino UNO
GND GND
DSR Not connected
V-IN 5V
Tx Digital Pin 0 (Rx)
Rx Digital Pin 1 (Tx)
DTR 1uF in series with Reset

Attaching the breakout board to a custom made PCB makes the whole device more self contained and I can also add other Arduino shields on top.

I found out afterwards that Adafruit actually sells something similar to this already – a Bluefruit EZ-Link Shield.

Now pair the Bluefruit board with a development machine

Adafruit provide some really good documentation for pairing the Bluefruit module with a Windows 7 machine – but I’ve written my own notes before for the Windows 10 operating system.

My Arduino is powered by the USB connection to my Raspberry Pi, so once I attached the shield to the Arduino the blue power light came on immediately. The next step was to pair the Bluefruit device with my development machine.

My machine has bluetooth v4.0 on board, but I could have used an after-market bluetooth dongle like this one – it’s important to get one that supports bluetooth v4.0, some of the cheaper dongles do not support v4.0.

From Windows 10, I typed “Bluetooth” into the search box on the taskbar, and the results gave me the option to select “Bluetooth and other devices settings”.

screenshot.1501708578

I clicked on the “+” button beside the text “Add Bluetooth or other device”, which opened the screen below.

screenshot.1501679214

I clicked on the Bluetooth option, which opened the screen below, and this shows the Adafruit EZ-Link device.

screenshot.1501679192

I selected the Adafruit device for pairing, and received the success message below.

screenshot.1501679253

So at this point, it’s possible to upload sketches to the Arduino through the Bluetooth COM port – and in the image below, you can see that even though my Arduino isn’t connected by USB cable to my development machine, the serial port COM6 is available to me.

screenshot.1501710670

I talked about how to use VSCode to develop and deploy to the Arduino last time, and it works exactly the same way in VSCode.

And as far as the Arduino is concerned, this is just another COM port, as if the Arduino was directly connected to the PC using a USB cable. I don’t need to do any further set up, and I can verify and upload my sketch to the Arduino UNO wirelessly through COM6 (it’ll probably be different on another machine). It’s a little bit slower to transfer a sketch over the air, but at least it’s wireless.

Wrapping up

This was a short post about how to wirelessly deploy sketches to the Arduino using the Adafruit Bluefruit EZ-Link breakout. When I can’t use the Arduino’s on board USB port, this device makes my Arduino development much more convenient. If you have this device in your toolkit, hopefully you find this post useful!


About me: I regularly post about .NET – if you’re interested, please follow me on Twitter, or have a look at my previous posts here. Thanks!

PCB Manufacture

Shapeoko 2 – PCB Manufacture Review

The Shapeoko 2 from Inventables was my second milling machine (after the Roland iModela, which I blogged about before).

I don’t intend this post to be an extended comparison of the iModela and the Shapeoko 2- they’re different machines aimed at different markets. So I’ll limit my comparison to the two points below:

  • Whereas the iModela is pretty much ready to go out of the box, the Shapeoko 2 arrives unassembled;
  • The iModela has a very small area that can be milled, but the Shapeoko 2 default configuration has a much larger area, about 400x400mm – which can be upgraded to as large as you want by acquiring longer lengths of MakerSlide.

You can swap out bits of the Shapeoko 2- the pack shipped to me had a white-label Dremel clone, which I swapped out for my actual Dremel. This has an imperial collet, which allowed me to use the 3.175mm engraving bits – a huge advantage for me (and my wallet). But the Dremel is loud, and this pretty much limits me to using this in the garage – definitely not something I could have on in the house. It’s possible to purchase a motor which runs much more quietly, but I don’t want to buy this yet.

Assembling the Shapeoko 2 was fairly straight forward, and I spread it over a couple of nights. I had watched a video on YouTube from Inventables a few times, which was helpful (even though the version shipped to me was slightly different from the version used the video). There are also excellent instructions online, which I kept open beside me as i put the kit together.  The package even included the tools necessary for assembly – wrenches, Allen keys, and a tap kit to thread the holes in the MakerSlide.

Initial Tests

I ran through an initial test using a Sharpie and the G-code for writing “Shapeoko 2” on a piece of paper. During this process I went through a bit of confusion over the direction of the Z-axis (leading to a broken pen) – but it’s better to do this with a pen than a Dremel with a very sharp engraving bit at 35,000 revs/min.

I made a jig to hold my copper clad PCB, so a piece of sacrificial wood could sit below the the PCB – I intend to drill holes into the PCB, so I didn’t want my base board to be damaged (although it’s not that big a deal if it is – it’s just a piece of MDF which I could replace).

shapeoko 1

On feeding the first g-code file with a PCB design, I had some pretty positive results. I had been very conservative about how deep I was going to cut into the copper, which is only a few microns deep. MY first cut started showing some of the same signs as the issues I’d had with the iModela – uneven cutting depth. This time I had a few more options – I was able to use a program which measured the height variation across the board, and then used this data to adjust the G-code file. This solved the height variation issue.

shapeoko etching

My initial successes turned out to be…beginner’s luck. The next few attempts were a lot less good, so I’ll share some of the issues I had, and the solutions which helped things start getting better again.

Issue 1 – Engraving bit oscillation

My Z-axis was pretty badly squared up which was obvious because I could see the tip of the engraving bit oscillating from side to side when it should have been only moving vertically. I was able to correct this by doing 3 things:

  • Using a speed-square and adjusting the T-nuts in the vertical MakerSlide to improve the Z-axis alignment.
  • I had to go off-piste a bit and modify the manufacturer’s design – I found that the M8 nuts on either side of the Z-axis bearing didn’t have perfectly parallel faces, so when I tightened them up it caused the threaded rod to no longer be perfectly parallel to the shaft of the Z-axis motor.
  • I used my own M8 die kit on the threaded rod, and added plenty of WD40 oil to the rod. After that, I inserted the rod into a drill and threaded the Delrin nut up and down the rod a few times to eliminate as many causes of friction as I could.

After this, I found the vertical movement of the Dremel to be much more consistent with no discernable side-to-side oscillation, and co-incidentally a lot quieter.

Issue 2 – Stepper motors missing steps

Even after fixing the height variation issue, I found a massively worse height issue – the z-axis cut deeper and deeper into the copper, until eventually on one board it cut the whole way through the plastic and into the wooden board underneath. This was the most disturbing issue for me – the Dremel is a very powerful tool and the sudden and unexpected deep cuts made some very unpleasant noises.

Initially I thought it was that the engraving bit wasn’t being gripped tightly enough and was slipping out of the collet. But actually, the issue was that the Z-axis NEMA motor wasn’t getting enough current from the GRBL. I only discovered this when I did an “air-print”, and heard a lot of clicks coming from the Z-axis, which meant that the motor was being asked to travel faster than it actually could. So when the Z-axis was being lifted between moves, the GRBL asked it to lift 5mm – the software thought it was actually being lifted 5mm – but actually it actually only lifting 3-4mm. However, it was much better at lowering because gravity was helping out, leading to the cuts being much deeper than expected.

The fix was simply turning the variable resistor on the GRBL for the Z-axis, and increasing the current supplied. The problem went away immediately.

Issue 3 – Different start and end positions

I sometimes found that the engraved lines didn’t align perfectly – meaning that the engraving bit didn’t form a closed loop (so it didn’t start and finish in the same place). There wasn’t a single cause for this, I had to change a couple of things to fix this:

  • One problem was backlash – the rubber stepped cable on my machine wasn’t tight enough. I’ve found they need to nearly be as tight as guitar strings. This helped a lot.
  • The other problem was completely of my own making – the engraving process makes quite a lot of dust, and I had been switching on my shop-vacuum every now and again to clean up the dust. When I didn’t switch the vacuum cleaner on, I didn’t experience the problem. I can only guess that switching on the cleaner caused some kind of variation in the current getting to the motors.

Issue 4 – Universal G-code sender crashing

Finally, a really frustrating problem was catastrophic JVM errors – I don’t have words for how gutting it is when you’re almost through a perfect print, and then your computer alerts you that Java has encountered a critical error and has to close – which means that the job aborts and you have to start again on a new board.

I am not 100% sure how to fix this – but I eventually did notice a correlation between me switching on my vacuum cleaner (to hoover up all the dust being generated) and this error occurring shortly afterwards. This didn’t happen every time I put the vacuum cleaner on, and I don’t even want to guess at the science behind what would cause this because it would sound very implausible! But I’d recommend to anyone else encountering this problem that they try to avoid turning on other heavy current machines at the same time as the CNC machine.

Conclusions

The Shapeoko is the best tool I’ve used so far for isolation milling PCBs. There were a bunch of problems starting off – but these were solvable problems, and really just part of finding out how to use the machine.

I wish I could take better photos of the results – I’ve included a couple below. My first attempt is on the left of the photo below – you can see how the copper wasn’t cut uniformly because the bed wasn’t level. After applying the auto-levelling software, the effort on the right is much more uniform.

early attempts 2

I’m able to create PCBs repeatedly using the Shapeoko now – the photo below shows the most recent PCB I’ve milled and drilled.

shapeoko finished PCB

PCB Manufacture

Roland iModela desktop CNC machine – review for PCB manufacture

I purchased the iModela in 2014 with the intention of using it to create small Arduino-sized circuit boards, using the isolation milling technique. Some UK based resellers market this device specfically mentioning its capability as a PCB manufacturing tool.

iModela milling machine

This type of “ready to use” consumer electronic device still requires some effort before creating your first milled piece. I think of this a bit like the difference between starting to use a drill and a router (this kind of router, not this kind). For example, I’ve never read the instruction manual for a drill in my life – basically you just insert the bit, squeeze the trigger and start drilling holes (Ok – it’s maybe a bit more complex than that but not much). But a router is a more specialised tool, which is can be pretty dangerous if you don’t know how to use it properly. Sometimes if you don’t get the result you want, that doesn’t mean the tool is wrong – you might not be using the tool right. You need to invest some time to get good results.

Fortunately the iModela gives a really good set of instructions to get you started. Roland creates a workflow which has all software you need to start making things. This is supplied on a disk which comes with the machine, and you can download this software too. My kit was also supplied with a milling bit, some acrylic material and double sided tape, which meant I was able start making an example shape on the same day I received the device.

CNC machines grind material away from around the shape you want to keep, and this usually leads to a lot of dust and particles. The clear plastic shields to the front and rear of the device really help keep this dust in the machine. It’s not 100% dust proof obviously, but the plastic shields help a lot and it does make this device more suitable for using in living areas (rather than in a workshop or garage).

The process of designing PCBs is well documented on the web, and exporting this PCB design to G-code is easy (using PCB-Gcode). The iModela is able to accept G-code, which I’ve blogged about here. To make PCBs, I needed some copper clad board, which is widely available. I also needed a special PCB engraving bit – with a metric diameter of 2.35mm to match the iModela’s collet size.

Using for PCB manufacture

Buying replacement consumables

Finding metric consumables, like bits, is probably my biggest problem with the device, and ultimately the reason why I stopped using the iModela. I found it incredibly difficult to acquire metric bits at a reasonable price. I eventually found metric milling bits that fit the machine available at Farnell here, but these aren’t PCB engraving bits and are not suitable for PCB milling. The only 2.35mm bit I could locate for PCB milling was nearly £27 for one bit. I’ve worn out a couple of these now – the cut through the copper nicely for the first few cuts, but my experience was that they became blunt very quickly, and £27 is way too much for a bit that lasts for only a few boards.

For comparison – I can buy 10 PCB imperial sized engraving bits for just over £4 on ebay (in metric, the shank diameter is 3.175mm). I have not been able to identify an aftermarket collet for the iModela with this size (but United States customers might have be able to acquire this).

Base rigidity

The other problem I found was that the plastic bed (which moves in the Y-axis directions) is not level and is not rigid enough. When the PCB bit was lowered onto the circuit board, it would cut the copper layer fine when the bit was brand new. But after a few cuts, I found bit wasn’t sharp enough to puncture the copper. Instead the plastic bed deformed – this meant that the bit scored the top of the copper, but didn’t break through. I compensated by increasing the cutting depth – this punctured the copper when I hit the limit where the bed wouldn’t deform any further. But it doesn’t solve the problem. The plastic below the copper is much softer than the copper surface, which means that as soon as the copper is broken, the bed springs back and you get an unexpectedly wide cut in the top layer.

Some of this unevenness might be because of how the board is secured to the bed – I was using double sided sticky tape, which is the only option as there are no mounting points on the machine. If even a small grain of material gets trapped under the tape, it will distort the board. Securing material to a CNC machine using tape is very common, but it doesn’t really work for very precise work like PCB milling.

The photo below shows an example of some of the problems with the machine. The engraving process started on the right hand side, and started well. However, as the job progressed, the bit started to get blunt, and it’s possible to see how it hasn’t managed to puncture the copper at times. The width of the cut also varies, and some tracks are completely engraved away. This was unfortunately typical of how most of my boards finished.

WP_20151127_18_21_38_Pro

However, you can see on the right hand side that it is possible to get decent results – other makers have had more positive results.

Summary

I created a few boards, but the experience wasn’t plain sailing, and have stopped using the iModela for isolation milling PCBs. This wasn’t because it was too difficult to use – investing time in understanding how to use a machine goes with the territory (and it’s actually part of the fun) – I’ve put it away because the consumables are just too expensive. If I found a source for metric engraving bits, I’d probably invest more time in trying to make it work.

Advantages:

  • Quick setup time;
  • Shipped with CAD software;
  • Relatively un-messy.

Disadvantages – specifically for PCB isolation milling:

  • Consumables are hard to acquire and very very expensive;
  • Milling surface is not rigid enough;
  • Milling surface isn’t level.

I’ve tried other isolation milling machines more successfully, which I’ll blog about soon.

Making, PCB Manufacture

Sending G-Code to the iModela CNC

I’m using the Eagle PCB design tool from CadSoft to lay out my PCBs.  There’s a great library for this tool which will convert your PCB design into G-Code, which allows you to send this to a CNC milling machine.

I’m interested in using this G-Code with my iModela device, so I’ve been investigating how to do this.

It turns out that this is pretty simple, but you may need to tweak your G-Code slightly to make sure the iModela is able to recognise it. I’ll present a simple example below.

Note: This post doesn’t explain how to move your milling bit to the zero position on the machine – if you have the iModela, that is all covered in the instructions which ship with the machine.

Step 1: Open iModela Controller

I use this software application to send G-Code. I needed to change a few settings in here.

I found that by default, the “User Coordinate System” setting was selected in the dropdowns at the top of the main dashboard, as shown below.

imodela controller

Step 2: Change the setup from expecting custom Roland commands to standard G-Code

Click on the “Setup” button, which is shown in the above screenshot at the bottom right of the dashboard.

When you click on this, you’ll see a screen like the one below.iModela controller setup

The RML-1 is probably selected by default. Make sure that the option “NC Code” is selected, and click OK.

Step 3: Select the G-Code to be processed

I created a simple G-Code file for this post – I’ve pasted it below.
%
G90
G21
G00 Z1000
G00 X1000Y3000
G00 X0Y0Z0
%

  • The opening and closing % signs are necessary for the iModela software to recognise the code as G-Code.
  • G90 signifies absolute positioning.
  • G21 signifies we’re using metric convention.
  • This program moves the bit up 1mm in the Z-axis, then across 1mm in the X-axis and 3mm in the Y-axis, and finally returns to the zero position.
  • I saved this to a file names test.nc and saved on my desktop.

To load this into the Controller software, click on “Cut” (which is located in the bottom right corner of the Controller dashboard). This will open the screen below:

imodela controller cut gcodeTo add the G-Code file that you want to send to the iModela, click on the “Add” button, browse to the file you want to add, and then select it. You can see in the “Cut” screenshot above that I’ve already done this. The contents of the file are previewed in the right hand side of the screen.

Step 4: Send the G-Code

You can test the G-Code one line at a time if you like – click on the “Test…” button to open a debugging screen. I’ve stepped through the first 5 lines of code already in the “Test Cut” screenshot below, and you can see how the Controller dashboard in the background is reporting that the bit is presently positioned where I expect it to be (1mm up, 1mm across, and 3mm forward).imodela controller test cutYou can send the complete file by clicking “Close” on this screen, and then clicking on “Output” on the “Cut” screen.