Yet another little corner of the web

Random thoughts and experience, committed to electrons

Pi2com: Serial and I2C Board for the Raspberry Pi

I finally succumbed and bought a Raspberry Pi. I’d been holding out for quite a while, I had a ARM based NAS box (NAS4220) that I had bought a few years back with the intention of learning a bit more about Linux on ARM and as that was the only real reason I could think of for buying it, I didn’t feel the need. A need did however finally present it’s self, I wanted a small device to use to do some simple temperature logging. The Pi with a custom expansion board seemed like a fun way to get there and I could have fun doing some hardware development along the way with my etch tank. The requirements would be (fairly) simple:

  • An I2C temperature sensor.
  • An I2C battery backed Real Time Clock (to make logging data worthwhile, the Pi lacks a proper RTC).
  • A transceiver for the serial port (not strictly needed for the scenario in mind, but would make the expansion board more useful).

I2C components were chosen as the Raspberry Pi exposes an I2C bus onto the expansion headers. As the pins from the Broadcom BCM2835 SoC on the Raspberry Pi are 3.3v, the component selection was limited to 3.3v parts for simplicity. As I would be manufacturing the board at home using my etch tank I also wanted to minimise the amount of drilling I needed to do, so I opted for SMT parts where possible. Parts selection provided the first surprise, the parts were chosen based primarily on their ability to meet my limited requirements, then cost. At this point I looked to see if they had Linux drivers (not that writing them would be a big issue for me, just would require more time) and discovered that both the temperature sensor and RTC that I had chosen already had drivers in the vanilla Linux kernel. This really goes to show just how large the pool of drivers provided in Linux has come. The parts that were chosen are:

  • Temperature sensor: Microchip TCN75A (compatible with the lm75 driver).
  • Real time clock: ST Microelectronics M41T81S (compatible with the rtc-m41t80 driver).
  • RS232 Transceiver: MAX3232EID (no driver required).

Layout proved a little interesting, as I have not used my etch tank a lot yet I wanted to keep to a single sided PCB. As the design was fairly simple I also hoped to not need any wire jumps, with a bit of fiddling with which power pins provided power to which components this proved possible.

PCB Etched

To etch the board I followed the process that I used in my initial tests. I decided to drill the boards prior to removing the etch mask, this turned out to be a very good plan. Some of the pads were quite small and only a little bigger than the 1mm drill that I needed to use. By just breaking the etch mask with the tip of the drill I was able to check that the hole was going to be central on the pads and if not I could make fine adjustments and try again. This allowed me to gain quite a high degree of accuracy.

PCB Drilled

One thing I had found when doing the initial testing was the cutting the PCB cleanly wasn’t simple with a hacksaw. I initially tried scoring and snapping the PCB (to get a piece approximately the right size) but I found that the board I am currently using doesn’t snap well. When trimming the PCB to size I needed a cleaner solution.

PCB Cutting with tile cutter

I was considering a band saw however research suggested that a tile cutter (the type with a spinning water lubricated diamond blade) could be used. An added advantage would be that the water would suppress the dust created by the cutting process. As these devices can be bought relatively cheaply (£30) I decided to give it a go. This proved to be a good (if quite noisy) method, the diamond cutter cutting through the board like a hot knife through butter.

PCB prior to removal of etch resist (along with a few SMT cleaned breakout boards)

With the boards cut and drilled I now needed to remove the etch resist. I had used an abrasive block to remove the press ’n peel etch resist on my test etches and this had proven to be quite a bit of work. This time I decided to investigate to see if any solvents would work. Research suggested that acetone would work, I didn’t have any pure acetone lying around, but my wife did have some nail varnish remover which has acetone as the primary ingredient so I gave that a try. It proved to be very effective at removing the etch resist. As my board has no need of a coating of pro vitamin a, I decided to buy a small bottle of pure acetone (it’s amazing the things that can be purchased on eBay).

Expansion board assembled

With the exception of remembering that I needed to drill holes for the location lugs on the DB9 connector at the last minute, assembly was fairly un eventful. The board fits as I’d expected, and tested by printing the design in paper and offering up to the Pi first (I also found this to be a good way to check that the footprints for all your components are right before etching, potential static issues aside).

Expansion board fitted

Attaching a serial cable to the serial port and booting the board proved that the serial port worked. Installing i2c-tools allowed me to quickly check that the i2c devices could be read on the bus. With the board fully functional, the next step is to build a custom Yocto image with the required drivers and scripts to do the required logging.

Output from initial Yocto build

Fortunately there is already a layer providing support for the Raspberry Pi in Yocto. This greatly reduces the effort needed to get a custom Yocto image booting on the Raspberry Pi.

30 Mar 2013 #electronics #linux