“Fail early and fail often”
In an effort to get something in the water as quickly as possible I decided to go back to the basics. A lot has happened since my last post – so this an effort to fill in the gaps.
This will talk about the first version of a new circuit board design. I’ve since completed a second version based on lessons learned.
——————————————————- FLASH BACK! ———————————————————–
I was having problems integrating the LoRa radio with the BLE nRF52 Feather. There seemed to be an issue with getting the RadioHead library to work with nRF52 hardware. According to Adafruit the nRF52 feather is under ongoing development. Here is the link to the customer forum post that is tracking this topic. The most recent updated says there is now a fix. Pushing firmware updates to the buoy wirelessly over BLE would be handy – but it is certainly not required at this stage of the project.
So, I decided to drop the BLE for now. Digging around in my electronics bin I found two Arduino UNOs, one MEGA 2560, and two 10,000 mAH lipo USB battery packs. These Arduino boards all require 5V input – one reason I wanted to use a 3.3V rated microcontroller like the BLE Feather. Not a big deal for now, I can ditch the solar panel and charging circuit and use the lipo battery packs for initial testing. Awesome, just removed two more components from the build!
The electronics layout and design was done in Eagle CAD using my own custom library components. Creating each component was TEDIOUS… but now I can reuse the components in the future. My first design aptly named “Wave Buoy – Arduino UNO – V1” had the UNO and the breakout boards mounted on the top surface of the board. This was done to minimize the overall height of the assembly since there was limited space inside the buoy.
Once the schematic is completed in Eagle you switch over to board layout mode and place all the components. This is where creating custom library components really helps because you can define the footprint and pinout for the actual hardware. In my case, most of the pieces being mounted to the circuit board are all breakout boards, not discrete surface mounted components. Placement of the components is KEY. A clever arrangement will help minimize the number of vias and keeping the trace paths as simple as possible.
The schematic for revision 1 (R1) to revision 3 (R3) of the board did not change much, but the layout was improved during each revision. R1 was full of mistakes, the UNO was mounted in the wrong orientation and the board was only powered through the UBS port. R2 was a huge improvement and my first fully working board; it added an ON/OFF switch to control the lipo battery power, but the assembly process was slow as I had lot of vias to transfer traces from the bottom to the top layer. R3 reduced the number of vias after moving the components around, and added ground planes to the top and bottom layers to minimize signal noise. I must have tried six unique layouts for before milling the first boards. Below shows R3 with *most* of the issues from R1 and R2 fixed.
I used an Othermill desktop CNC machine to fabricate all of the boards. This required a V-bit tool to engrave the traces and pads, and a 1/32″ flat end mill to droll the holes and cut out the board profile.
An image of the R2 board with the UNO and all the boards mounted. I didn’t want to solder the breakbout board directly to the copper board. Instead I soldered on headers to the copper board so that the breakout boards could be easily removed and reused. This was critical, since I went through three revisions of the board before fixing most of the errors. All of this could fit within the footprint of the lipo battery pack.
With the board fully assembled I tested each component individually to verify proper function. At this time I was only interested in verifying each part was working as a stand-alone unit to test that all solder points and traces were OK.
The battery and circuitboard were then mounted to a thin flat mounting plate using lots of yellow and white electrical tape. Not a long term solution, but it works. The mounting plate was superglued to the underside of the buoy lid so everything was hanging from the bottom and easy access and work on.
Finally, I pulled all the example programs for each of the components into a single Arduino sketch and hit UPLOAD to the Arduino UNO……
The sketch size exceeded the available program memory on the UNO – and not by a trivial amount. So rather than modifying all the code and library files to minimize the memory requirements I decided it was best to use a different microcontroller with more memory. By comparison, the MEGA 2560 has 8x more flash memory than the UNO. This would give me plenty of extra memory to work with so I could focus on the firmware functionality and worry less about optimizing code to save bits of memory.
So, many lessons learned. Most importantly, it would have been better to create a sample firmware program BEFORE I chose to design the circuit board around the UNO microcontroller. Even an rough draft of the code would have indicated that all the libraries needed to support the breakout-board would be pushing the limits of the UNO. But, at least I have another reason to design and fabricate a new circuit board!
Next post, I redesign the circuit board to be compatible with the Arduino MEGA 2560 and dive into the firmware.