- April 18th, 2016
- Write comment
One of the key features of my microwave is Panasonic’s Grideye thermal sensor. This is a (relatively) low cost thermal sensor that I have placed at the top of the microwave to measure the surface temperature of the food.
The sensor is an I2C device which requires a 5V or 3.3V supply. Wanting to keep everything relatively high level I am implementing it as a USB device.
For the demo I used a BusPirate as an I2C-USB bridge. This got me through the demo but the protocols combine very badly resulting in a maximum frame rate of about 1fps. The high latency of USB communications combines with the chattyness of I2C causing everything to be very slow. So a practical implementation can’t be a bridge, it must have some logic to control the device and present a processed USB data stream.
There is an existing one, Digikey has a breakout board that their Application Engineers developed. Sadly due to Panasonic’s limitations on distributing the GridEye sensor they only ship them within the US. The Application Engineers team runs in an open hardware manner, the project page for the breakout board includes the circuit diagram and firmware code. I got in contact with the author, Chris Baird, and while he didn’t have any blank PCBs he could ship he was happy to share the gerber files so I could make my own.
The story doesn’t end here though, because a solid dose of Not-Invented-Here hit, justified by the twin desire to evaluate KiCad and wanting to implement the USB Video protocol, driven in part by an absurd desire to shovel yet another driver into the Linux Kernel.
As a nice bonus I reduced the cost, significant components, excluding the GridEye, cost $9.81 AUD for the Digikey board compared to $2.60 AUD for mine. Though that it no way compensates for the time spent and comes with the disclaimer that the Digikey board actually works.
All files for the design being discussed are available at https://github.com/lod/grideye_usb_electronics.
My circuit design is below, I took a rather different approach to the Digikey board, wiring an Atmel AVR directly to the USB input. This will use V-USB, a software USB stack to communicate. The ATTiny AVR used is capable of running V-USB on it’s internal crystal, it should also have enough memory allowing me to do USB based reprogramming.
The AVR must run off 5V in order to be fast enough to handle the USB communications. USB communications however are a 3.3V signal and while driving it at 5V typically works it’s certainly not a nice thing to do. The weak zenner diodes are a bidirectional level conversion technique.
The power network actually allows for two different voltage levels into the GridEye. It isn’t clear from the datasheet what impact a dirty power supply has, so I have fitted an LDO to create a smooth 3.3V signal. There is also a 5V GridEye variant (which I don’t currently have) that could be run directly off the USB rail. To support both cases I have an LDO designed in as well as pads for a zero ohm resistor to bridge the rails, one or the other should be fitted.
The I2C bus uses an open-collector signal so nicely adapts to whatever voltage the GridEye is powered on. Running at 5V the AVR reads 2.5V as high, comfortably supporting 3.3V communication.
I would have liked to have a spare IO to be able to disable the LDO in low power mode. However the GridEye can be software configured into a low power state and the LDO does not consume much power when idle. I could repurpose the reset line for the job but that has significant downsides.
Single Sided PCB
My first attempt at a PCB was a two layered single sided PCB, it is functional but not optimized as I decided the approach was wrong and created a double sided PCB for manufacturing.
It is a fairly long, simple, PCB with a simple flow left to right of the USB port, AVR chip and GridEye sensor.
I created two ground planes, a shield plane around the outside which is connected to the USB shield and the screw holes, it is designed to be connected to the chassis. The center of the board has a standard digital ground connected to various components and the USB ground line. In my microwave system there should be a central (star) ground point, somewhere else, which connects these two grounds. To provide flexibility, mainly for applications without a metal chassis, there is an empty 0603 pad in each corner to bridge the two ground planes with either a capacitor or a 0 ohm resistor .
After doing this layout I felt a two layer design would be much better. It would allow the board to be much smaller and I wanted the sensor to be more central. Later I learnt that the prototype PCB manufacturers all up their rates for boards over 5cm, so my 6cm board was fairly expensive. I swapped the large six pin connector with a Tag-Connect connector to try and be less ugly, with mixed success.
Two Sided PCB
I started this board more professionally, defining a 3cm by 2cm board with M2 holes on each corner. It was a little bit of a struggle to get everything to fit nicely but that probably means it was the correct size.
My main concern with the new design is that one of the USB data lines is also used in the programming process. I tried to make it as short as possible but the programming connector wouldn’t fit anywhere but the far side of the board to the USB connector. So that line is a long stub during operation, not a nice thing to do to an RF signal. Anecdotal evidence from forums suggests that I will get away with this but having the programming cable connected will cause it to fail, I’m happy with that.
The Tag-Connect connector can be seen on the far side to the USB port. It is actually just a carefully arranged collection of pads with holes to guide the plug. I haven’t used the Tag-Connect system before, I am attracted to it for a number of reasons. The footprint is smaller, in board size, only consuming one layer and not having a high part permanently attached. Being a layout of pads it is cheap per board. And for manufacturing it is easy to design a pogo pin setup to hit the pads or use a bed of nails system. There is also a series of test points exposing the USB lines for manufacturing.
Several people have complained about the Tag-Connect routing meaning that you take up as much board space as the standard, larger, connector. I certainly found the routing was annoying, especially with the holes at either end requiring lines to go the long way around. I cheated somewhat by placing vias on the pads, effectively making some of the pins through holes, this made routing much easier for me. For a two layered board the Tag-Connect benefits are probably marginal, with more layers the benefits would be add up rapidly.
An order has been placed at OSHPark for both the Digikey board and mine, the process was remarkably good, lots of feedback as to what would be manufactured as you progressed. My board has an oval hole which OSHPark doesn’t support but I’ll fix that somehow after the board is delivered.
The Digikey board 20.35×22.91 mm (0.8×0.9 inches) and cost $1.20 USD per board.
My board is 30.02×20.02 mm (the 0.02mm is the cut line thickness) and cost $1.55 USD per board.
Within 24 hours both boards had been sent for fabrication, mine got a free upgrade to the special rush order stream.
I have ordered an 0603 resistor and an 0603 capacitor part book from Super Deal Technology with some empty pages. The Digikey board uses 0804 parts (designed for old folks with fading eyesight) but I’ll just put 0603s onto the larger pads. Part books are by far the best way to manage SMD components.
The remaining parts have been ordered from Element14, Digikey was cheaper on the parts but more expensive with shipping.